Пример #1
0
 public static void sendDenied(String[] args) {
   CommandSender sender = CommandManager.getSender();
   String title = Language.getString("general.title");
   String message = Language.getString("general.access-denied");
   String command = "";
   for (int i = 0; i < args.length; i++) command = command + " " + args[i];
   log(sender.getName() + " was denied to use a command (/" + command + ")");
 }
Пример #2
0
  /**
   * Checks if the command sender has a permission.
   *
   * @param node The permissions node.
   * @return true is the sender has a permission, false if not.
   */
  public static boolean senderHasPermission(String node) {
    CommandSender sender = CommandManager.getSender();
    boolean usePermissions = Configuration.getBoolean("configuration.use-permissions");

    // Console always has the permissions
    Player player;
    if (isPlayer()) player = (Player) sender;
    else return true;

    // If permissions are not used, check for op
    if (!usePermissions) {
      if (player.isOp()) return true;
      else return false;
    }

    if (player.hasPermission("ecm." + node)) return true;
    return false;
  }
Пример #3
0
 public static void sendSuccess(String string) {
   CommandSender sender = CommandManager.getSender();
   String title = Language.getString("general.title");
   sender.sendMessage(ChatColor.GREEN + "[" + title + "]" + ChatColor.WHITE + message);
 }
Пример #4
0
 public static void sendMessage(String message) {
   CommandSender sender = CommandManager.getSender();
   sender.sendMessage(message);
 }
Пример #5
0
  public static boolean isPlayer() {
    CommandSender sender = CommandManager.getSender();

    if (sender instanceof Player) return true;
    else return false;
  }