private void deleteRouteCommand( final CommandSender sender, final Player player, final String routeName) throws ExplorersException { synchronized (routes) { Route r = getExistingRoute(routeName); if (player != null && !r.isOwner(player) && !player.hasPermission(DELETE_PERMISSION)) { throw new ExplorersPermissionException(); } routes.remove(routeName); sender.sendMessage(ChatColor.GREEN + "Success"); } }
public void addExplorationSign(Player player, CommandSign sign, Location location) throws ExplorersException { final String token = sign.getRouteName(); final String name = player.getName(); Route r = getOrCreateRoute(token, name); if (!r.isOwner(player) && !player.hasPermission(CREATE_PERMISSION)) { throw new ExplorersPermissionException(); } signs.add(locationToArray(location)); player.sendMessage(SIGN_CREATED_MSG); saveState(); }
private void revokeRouteCommand( final CommandSender sender, final Player player, final String routeName, final String playerName) throws ExplorersException { Route r = getExistingRoute(routeName); if (player != null && !r.isOwner(player) && !player.hasPermission(REVOKE_PERMISSION)) { throw new ExplorersPermissionException(); } r.removeWinner(playerName); sender.sendMessage(ChatColor.GREEN + "Success"); }
private void routeGiveCommand( CommandSender sender, Player player, String routeName, String targetName) throws ExplorersException { Route r = getExistingRoute(routeName); Player targetPlayer = getServer().getPlayer(targetName); if (targetPlayer == null) { sender.sendMessage(NO_PLAYER_MSG); return; } if (player != null && !r.isOwner(player) && !player.hasPermission(GIVE_PERMISSION)) { throw new ExplorersPermissionException(); } r.setOwner(targetPlayer.getName()); sender.sendMessage(ChatColor.GREEN + "Gave " + routeName + " to " + targetPlayer.getName()); }