public boolean onCommand( CommandSender sender, Command command, String commandLabel, String[] args) { YamlConfiguration config = (YamlConfiguration) plugin.getConfig(); boolean auth = false; Player player = null; String admin = config.getString("defAdminName", "server"); if (sender instanceof Player) { player = (Player) sender; if (player.hasPermission(permission) || player.isOp()) auth = true; admin = player.getName(); } else { auth = true; // if sender is not a player - Console } if (!auth) { sender.sendMessage(ChatColor.RED + "You do not have the required permissions."); return true; } if (args.length < 1) return false; String jaile = args[0]; if (plugin.autoComplete) jaile = plugin.util.expandName(jaile); plugin.jailed.remove(jaile.toLowerCase()); Player jailee = plugin.getServer().getPlayer(jaile); if (jailee == null) { jailee = plugin.getServer().getOfflinePlayer(jaile).getPlayer(); if (jailee == null) { sender.sendMessage(ChatColor.RED + "Unable to find Jailed Player"); return true; } } plugin.db.removeFromJaillist(jailee.getName()); plugin.db.addPlayer(jailee.getName(), "Released From Jail", admin, 0, 8); Location stlp = plugin.jail.getJail("release"); if (stlp != null) { jailee.teleport(stlp); } else { jailee.teleport(jailee.getWorld().getSpawnLocation()); } if (plugin.tempJail.containsKey(jaile.toLowerCase())) { plugin.tempJail.remove(jaile.toLowerCase()); } String jailMsgRelease = config.getString("messages.jailMsgRelease"); if (jailMsgRelease.contains(plugin.regexAdmin)) jailMsgRelease = jailMsgRelease.replaceAll(plugin.regexAdmin, admin); if (jailMsgRelease.contains(plugin.regexVictim)) jailMsgRelease = jailMsgRelease.replaceAll(plugin.regexVictim, jaile); if (jailMsgRelease != null) { jailee.sendMessage(plugin.util.formatMessage(jailMsgRelease)); sender.sendMessage(plugin.util.formatMessage(jailMsgRelease)); } return true; }
public boolean onCommand( CommandSender sender, Command command, String commandLabel, String[] args) { YamlConfiguration config = (YamlConfiguration) plugin.getConfig(); boolean auth = false; Player player = null; String admin = config.getString("defAdminName", "server"); if (sender instanceof Player) { player = (Player) sender; if (player.hasPermission(permission) || player.isOp()) auth = true; admin = player.getName(); } else { auth = true; // if sender is not a player - Console } if (auth) { if (args.length < 1) return false; String p = args[0]; // type name correct or if (plugin.autoComplete) p = plugin.util.expandName(p); Player victim = plugin.getServer().getPlayer(p); String idoit = null; if (victim != null) { idoit = victim.getName(); } else { sender.sendMessage(ChatColor.GRAY + "Player must be online!"); return true; } String fspawnMsgVictim = config.getString("messages.fspawnMsgVictim"); if (fspawnMsgVictim.contains(plugin.regexAdmin)) fspawnMsgVictim = fspawnMsgVictim.replaceAll(plugin.regexAdmin, admin); if (fspawnMsgVictim.contains(plugin.regexVictim)) fspawnMsgVictim = fspawnMsgVictim.replaceAll(plugin.regexVictim, idoit); if (fspawnMsgVictim != null) victim.sendMessage(plugin.util.formatMessage(fspawnMsgVictim)); String fspawnMsgBroadcast = config.getString("messages.fspawnMsgBroadcast", "%victim% is now at spawn!"); if (fspawnMsgBroadcast.contains(plugin.regexAdmin)) fspawnMsgBroadcast = fspawnMsgBroadcast.replaceAll(plugin.regexAdmin, admin); if (fspawnMsgBroadcast.contains(plugin.regexVictim)) fspawnMsgBroadcast = fspawnMsgBroadcast.replaceAll(plugin.regexVictim, idoit); if (fspawnMsgBroadcast != null) sender.sendMessage(plugin.util.formatMessage(fspawnMsgBroadcast)); // Further Research World wtlp = victim.getWorld(); Location tlp = wtlp.getSpawnLocation(); victim.teleport(tlp); } return true; }
public boolean onCommand( CommandSender sender, Command command, String commandLabel, String[] args) { boolean auth = false; Player player = null; if (sender instanceof Player) { player = (Player) sender; if (plugin.setupPermissions()) { if (plugin.permission.has(player, "ultraban.check")) auth = true; } else { if (player.isOp()) auth = true; } } else { auth = true; // if sender is not a player - Console } if (!auth) { sender.sendMessage(ChatColor.RED + "You do not have the required permissions."); return true; } else { if (args.length < 1) return false; String p = args[0]; List<EditBan> bans = plugin.db.listRecords(p, sender); if (bans.isEmpty()) { sender.sendMessage(ChatColor.GREEN + "No records"); return true; } String ip = plugin.db.getAddress(p); sender.sendMessage( ChatColor.BLUE + "Found " + bans.size() + " records for user " + bans.get(0).name + " on IP " + ip + " :"); for (EditBan ban : bans) { sender.sendMessage( ChatColor.RED + banType(ban.type) + ChatColor.GRAY + ban.id + ": " + ChatColor.GREEN + ban.reason + ChatColor.AQUA + " by " + ban.admin); } return true; } }