@Override public void processCommandPlayer(EntityPlayer sender, String[] args) { if (args.length == 0) { String msg = ""; for (String warp : CommandDataManager.warps.keySet()) { msg = warp + ", " + msg; } sender.sendChatToPlayer(msg); } else if (args.length == 1) { if (CommandDataManager.warps.containsKey(args[0].toLowerCase())) { if (PermissionsAPI.checkPermAllowed( new PermQueryPlayer(sender, getCommandPerm() + "." + args[0].toLowerCase()))) { Warp warp = CommandDataManager.warps.get(args[0].toLowerCase()); PlayerInfo playerInfo = PlayerInfo.getPlayerInfo(sender.username); playerInfo.back = new WarpPoint(sender); TeleportCenter.addToTpQue(warp.getPoint(), sender); } else { OutputHandler.chatError(sender, Localization.get(Localization.ERROR_PERMDENIED)); } } else { OutputHandler.chatError(sender, Localization.get("command.warp.notfound")); } } else if (args.length == 2) { if (PermissionsAPI.checkPermAllowed( new PermQueryPlayer(sender, getCommandPerm() + ".admin"))) { if (args[0].equalsIgnoreCase("set")) { if (CommandDataManager.warps.containsKey(args[1].toLowerCase())) { OutputHandler.chatError(sender, Localization.get("command.warp.alreadyexists")); } else { CommandDataManager.addWarp(new Warp(args[1].toLowerCase(), new WarpPoint(sender))); OutputHandler.chatConfirmation(sender, Localization.get(Localization.DONE)); } } else if (args[0].equalsIgnoreCase("del")) { if (CommandDataManager.warps.containsKey(args[1].toLowerCase())) { CommandDataManager.removeWarp(CommandDataManager.warps.get(args[1])); OutputHandler.chatConfirmation(sender, Localization.get(Localization.DONE)); } else { OutputHandler.chatError(sender, Localization.get("command.warp.notfound")); } } else { OutputHandler.chatError( sender, Localization.get(Localization.ERROR_BADSYNTAX) + getSyntaxPlayer(sender)); } } else { OutputHandler.chatError(sender, Localization.get(Localization.ERROR_PERMDENIED)); } } }
@Override public void processCommandConsole(ICommandSender sender, String[] args) { if (args.length == 2) { if (CommandDataManager.warps.containsKey(args[1].toLowerCase())) { EntityPlayerMP player = FunctionHelper.getPlayerForName(sender, args[0]); if (player != null) { Warp warp = CommandDataManager.warps.get(args[1].toLowerCase()); PlayerInfo.getPlayerInfo(player.username).back = new WarpPoint(player); TeleportCenter.addToTpQue(warp.getPoint(), player); } else { OutputHandler.chatError( sender, Localization.format(Localization.ERROR_NOPLAYER, args[0])); } } else { OutputHandler.info("CommandBlock Error: " + Localization.get("command.warp.notfound")); } } }