public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { Gamer gamer = pm.getGamer(sender.getName()); if (!gamer.isAlive()) { if (args.length > 0) { if (Bukkit.getPlayer(args[0]) != null) { gamer.getPlayer().eject(); gamer .getPlayer() .teleport(sender.getServer().getPlayer(args[0]).getLocation().add(0, 0.1, 0)); return true; } else if (args[0].equalsIgnoreCase(cm.getCommandGotoNameOfFeast())) { Location feastLoc = LibsFeastManager.getFeastManager().getFeastLocation(); if (feastLoc.getBlockY() > 0) { gamer.getPlayer().eject(); gamer .getPlayer() .teleport( feastLoc .getWorld() .getHighestBlockAt(feastLoc) .getLocation() .clone() .add(0.5, 1, 0.5)); } else sender.sendMessage(cm.getCommandGotoFeastFailed()); return true; } else sender.sendMessage(cm.getCommandGotoPlayerDoesntExist()); } else sender.sendMessage(cm.getCommandGotoNotEnoughArgs()); } else sender.sendMessage(cm.getCommandGotoNotSpectator()); return true; }
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (sender.hasPermission("hungergames.invis")) { Gamer gamer = pm.getGamer(sender.getName()); Player p = gamer.getPlayer(); if (args.length > 0) { if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfShow())) { p.sendMessage(cm.getCommandInvisShow()); gamer.seeInvis(true); gamer.updateOthersToSelf(); } else if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfHide())) { gamer.seeInvis(false); gamer.updateOthersToSelf(); p.sendMessage(cm.getCommandInvisHide()); } else if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfShowAll())) { for (Gamer game : pm.getGamers()) { game.seeInvis(true); game.updateSelfToOthers(); } p.sendMessage(cm.getCommandInvisShowAll()); } else if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfHideAll())) { for (Gamer game : pm.getGamers()) { game.seeInvis(false); game.updateSelfToOthers(); } p.sendMessage(cm.getCommandInvisHideAll()); } else if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfHidePlayer())) { if (args.length > 1) { if (Bukkit.getPlayer(args[1]) != null) { pm.getGamer(Bukkit.getPlayer(args[1])).hide(); p.sendMessage( String.format( cm.getCommandInvisHidePlayerSuccess(), Bukkit.getPlayer(args[1]).getName())); } else p.sendMessage(String.format(cm.getCommandInvisHidePlayerFail(), args[1])); } else p.sendMessage(cm.getCommandInvisHidePlayerNoArgs()); } else if (args[0].toLowerCase().equals(cm.getCommandInvisNameOfShowPlayer())) { if (args.length > 1) { Player player = Bukkit.getPlayer(args[1]); if (player != null) { pm.getGamer(player).show(); p.sendMessage(String.format(cm.getCommandInvisShowPlayerSuccess(), player.getName())); } else p.sendMessage(String.format(cm.getCommandInvisShowPlayerFail(), args[1])); } else p.sendMessage(cm.getCommandInvisShowPlayerNoArgs()); } else p.sendMessage(cm.getCommandInvisNotEnoughArguments()); } else p.sendMessage(cm.getCommandInvisNotEnoughArguments()); } else sender.sendMessage(cm.getCommandInvisNoPermission()); return true; }
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { Gamer gamer = pm.getGamer(sender.getName()); if (!gamer.isAlive()) { pm.sendToSpawn(gamer); return true; } else { ((Player) sender).setCompassTarget(HungergamesApi.getHungergames().world.getSpawnLocation()); gamer.getPlayer().sendMessage(cm.getCommandSpawnPointingToSpawn()); } return true; }