Exemplo n.º 1
0
 @SuppressWarnings("unused")
 private boolean isNotPlayer(CommandSender sender) {
   if (!(sender instanceof Player)) {
     Messenger messenger = api.getMessenger();
     messenger.tell(sender, messenger.get("command.player-only"));
     return true;
   }
   return false;
 }
Exemplo n.º 2
0
  @Override
  protected boolean onPerformed(CommandSender sender, String[] args) {
    Messenger messenger = api.getMessenger();

    // Commands with 1 argument
    if (args.length < 1) {
      messenger.tell(sender, Message.SPECIFY_TEST);
      messenger.tell(sender, messenger.get("command.usage"), getUsage());
      return false;
    }

    // Commands with 2 arguments
    if (args.length < 2) {
      messenger.tell(sender, Message.INCORRECT_USAGE);
      return false;
    }

    messenger.tell(sender, Message.INVALID_COMMAND);
    return false;
  }