mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-26 22:06:07 +00:00
@@ -19,79 +19,84 @@ import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
public class CommandRemove extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandRemove(Residence plugin) {
|
||||
public CommandRemove(final Residence plugin) {
|
||||
super("remove", "delete");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String label, String[] args) throws CommandException {
|
||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||
Player player = null;
|
||||
boolean resadmin = (command != null);
|
||||
ResidenceManager rmanager = Residence.getResidenceManager();
|
||||
Map<String, String> deleteConfirm = plugin.deleteConfirm;
|
||||
Language language = Residence.getLanguage();
|
||||
final boolean resadmin = (command != null);
|
||||
final ResidenceManager rmanager = plugin.getResidenceManager();
|
||||
final Map<String, String> deleteConfirm = plugin.getDeleteConfirm();
|
||||
final Language language = plugin.getLanguage();
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
String area = rmanager.getNameByLoc(player.getLocation());
|
||||
if (area != null) {
|
||||
ClaimedResidence res = rmanager.getByName(area);
|
||||
if (res.getParent() != null) {
|
||||
String[] split = area.split("\\.");
|
||||
String words = split[split.length - 1];
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));
|
||||
deleteConfirm.put(player.getName(), area);
|
||||
} else
|
||||
rmanager.removeResidence(player, area, resadmin);
|
||||
return;
|
||||
final String area = rmanager.getNameByLoc(player.getLocation());
|
||||
if (area != null) {
|
||||
final ClaimedResidence res = rmanager.getByName(area);
|
||||
if (res.getParent() != null) {
|
||||
final String[] split = area.split("\\.");
|
||||
final String words = split[split.length - 1];
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));
|
||||
deleteConfirm.put(player.getName(), area);
|
||||
} else {
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + area + ChatColor.RED));
|
||||
deleteConfirm.put(player.getName(), area);
|
||||
} else
|
||||
rmanager.removeResidence(player, area, resadmin);
|
||||
return;
|
||||
rmanager.removeResidence(player, area, resadmin);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + area + ChatColor.RED));
|
||||
deleteConfirm.put(player.getName(), area);
|
||||
} else {
|
||||
rmanager.removeResidence(player, area, resadmin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.length != 2)
|
||||
if (args.length != 1) {
|
||||
return;
|
||||
}
|
||||
if (player != null) {
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !args[0].equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
String words = null;
|
||||
if (rmanager.getByName(args[1]) != null) {
|
||||
ClaimedResidence res = rmanager.getByName(args[1]);
|
||||
if (rmanager.getByName(args[0]) != null) {
|
||||
final ClaimedResidence res = rmanager.getByName(args[0]);
|
||||
if (res.getParent() != null) {
|
||||
String[] split = args[1].split("\\.");
|
||||
final String[] split = args[0].split("\\.");
|
||||
words = split[split.length - 1];
|
||||
}
|
||||
}
|
||||
if (words == null)
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED));
|
||||
else
|
||||
if (words == null) {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[0] + ChatColor.RED));
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));
|
||||
deleteConfirm.put(player.getName(), args[1]);
|
||||
} else
|
||||
rmanager.removeResidence(player, args[1], resadmin);
|
||||
} else if (!deleteConfirm.containsKey("Console") || !args[1].equalsIgnoreCase(deleteConfirm.get("Console"))) {
|
||||
}
|
||||
deleteConfirm.put(player.getName(), args[0]);
|
||||
} else {
|
||||
rmanager.removeResidence(player, args[0], resadmin);
|
||||
}
|
||||
} else if (!deleteConfirm.containsKey("Console") || !args[0].equalsIgnoreCase(deleteConfirm.get("Console"))) {
|
||||
String words = null;
|
||||
if (rmanager.getByName(args[1]) != null) {
|
||||
ClaimedResidence res = rmanager.getByName(args[1]);
|
||||
if (rmanager.getByName(args[0]) != null) {
|
||||
final ClaimedResidence res = rmanager.getByName(args[1]);
|
||||
if (res.getParent() != null) {
|
||||
String[] split = args[1].split("\\.");
|
||||
final String[] split = args[0].split("\\.");
|
||||
words = split[split.length - 1];
|
||||
}
|
||||
}
|
||||
if (words == null)
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + ChatColor.RED));
|
||||
else
|
||||
if (words == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[0] + ChatColor.RED));
|
||||
} else {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteSubzoneConfirm", ChatColor.YELLOW + words + ChatColor.RED));
|
||||
deleteConfirm.put("Console", args[1]);
|
||||
} else
|
||||
rmanager.removeResidence(args[1]);
|
||||
}
|
||||
deleteConfirm.put("Console", args[0]);
|
||||
} else {
|
||||
rmanager.removeResidence(args[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user