Ejemplo n.º 1
0
 private void showUsage(CommandSender sender, String arg) {
   String cmdName = arg.toLowerCase();
   Command cmd = aliasMap.get(cmdName);
   if (cmd != null && hasAccess(cmd, sender)) {
     String msg = I18nUtil.tr("\u00a77Usage: {0}", name) + " \u00a7e";
     msg += getShortDescription(sender, cmd);
     if (cmd.getUsage() != null && !cmd.getUsage().isEmpty()) {
       msg += "\u00a77" + cmd.getUsage();
     }
     sender.sendMessage(msg.split("\n"));
   } else if (cmdName.matches("[0-9]+")) {
     showUsage(sender, Integer.parseInt(cmdName));
   } else {
     List<String> cmds = filter(aliasMap.keySet(), cmdName);
     if (cmds.isEmpty()) {
       showUsage(sender, 1);
     } else {
       String msg = I18nUtil.tr("\u00a77Usage: {0}", getShortDescription(sender, this));
       Collections.sort(cmds);
       for (String key : cmds) {
         Command scmd = commandMap.get(key);
         if (scmd != null) {
           msg += "  " + getShortDescription(sender, scmd);
         }
       }
       sender.sendMessage(msg.split("\n"));
     }
   }
 }
Ejemplo n.º 2
0
 public SpawnCommand(uSkyBlock plugin) {
   super("spawn", "usb.island.spawn", I18nUtil.tr("teleports you to the skyblock spawn"));
   this.plugin = plugin;
 }