mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
@@ -0,0 +1,50 @@
|
||||
package com.bekvon.bukkit.residence.commandsub;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.protection.ResidenceManager;
|
||||
import com.bekvon.bukkit.residence.text.Language;
|
||||
|
||||
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
|
||||
public class CommandConfirm extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandConfirm(Residence plugin) {
|
||||
super("?", "help");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String label, 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();
|
||||
String name = "Console";
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
name = player.getName();
|
||||
}
|
||||
if (args.length == 1) {
|
||||
String area = deleteConfirm.get(name);
|
||||
if (area == null)
|
||||
sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence"));
|
||||
else {
|
||||
rmanager.removeResidence(player, area, resadmin);
|
||||
deleteConfirm.remove(name);
|
||||
if (player == null)
|
||||
sender.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("ResidenceRemove", ChatColor.YELLOW + name + ChatColor.GREEN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.bekvon.bukkit.residence.commandsub;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import com.bekvon.bukkit.residence.protection.ResidenceManager;
|
||||
import com.bekvon.bukkit.residence.text.Language;
|
||||
|
||||
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
|
||||
public class CommandRemove extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandRemove(Residence plugin) {
|
||||
super("remove", "delete");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String label, 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();
|
||||
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;
|
||||
} 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)
|
||||
return;
|
||||
if (player != null) {
|
||||
if (!deleteConfirm.containsKey(player.getName()) || !args[1].equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
|
||||
String words = null;
|
||||
if (rmanager.getByName(args[1]) != null) {
|
||||
ClaimedResidence res = rmanager.getByName(args[1]);
|
||||
if (res.getParent() != null) {
|
||||
String[] split = args[1].split("\\.");
|
||||
words = split[split.length - 1];
|
||||
}
|
||||
}
|
||||
if (words == null)
|
||||
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + 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"))) {
|
||||
String words = null;
|
||||
if (rmanager.getByName(args[1]) != null) {
|
||||
ClaimedResidence res = rmanager.getByName(args[1]);
|
||||
if (res.getParent() != null) {
|
||||
String[] split = args[1].split("\\.");
|
||||
words = split[split.length - 1];
|
||||
}
|
||||
}
|
||||
if (words == null)
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + args[1] + 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]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.bekvon.bukkit.residence.commandsub;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import com.bekvon.bukkit.residence.protection.ResidenceManager;
|
||||
import com.bekvon.bukkit.residence.text.Language;
|
||||
|
||||
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
|
||||
public class CommandSetOwner extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandSetOwner(Residence plugin) {
|
||||
super("setowner");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String label, String[] args) throws CommandException {
|
||||
boolean resadmin = (command != null);
|
||||
ResidenceManager rmanager = Residence.getResidenceManager();
|
||||
Language language = Residence.getLanguage();
|
||||
|
||||
if (!resadmin)
|
||||
sender.sendMessage(ChatColor.RED + language.getPhrase("NoPermission"));
|
||||
ClaimedResidence area = rmanager.getByName(args[1]);
|
||||
if (area != null) {
|
||||
area.getPermissions().setOwner(args[2], true);
|
||||
if (area.getParent() == null)
|
||||
sender.sendMessage(
|
||||
ChatColor.GREEN + language.getPhrase("ResidenceOwnerChange", ChatColor.YELLOW + " " + args[1] + " " + ChatColor.GREEN + "." + ChatColor.YELLOW + args[2] + ChatColor.GREEN));
|
||||
else
|
||||
sender.sendMessage(ChatColor.GREEN + language.getPhrase("SubzoneOwnerChange",
|
||||
ChatColor.YELLOW + " " + args[1].split("\\.")[args[1].split("\\.").length - 1] + " " + ChatColor.GREEN + "." + ChatColor.YELLOW + args[2] + ChatColor.GREEN));
|
||||
} else
|
||||
sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.bekvon.bukkit.residence.commandsub;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
|
||||
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
|
||||
public class CommandVersion extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandVersion(Residence plugin) {
|
||||
super("version");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String label, String[] args) throws CommandException {
|
||||
sender.sendMessage(ChatColor.GRAY + "------------------------------------");
|
||||
sender.sendMessage(ChatColor.RED + "当前服务器运行的 " + ChatColor.GOLD + "Residence" + ChatColor.RED + " 版本: " + ChatColor.BLUE + plugin.getDescription().getVersion());
|
||||
sender.sendMessage(ChatColor.GREEN + "创建者: " + ChatColor.YELLOW + "bekvon");
|
||||
sender.sendMessage(ChatColor.GREEN + "升级到 1.8 by: " + ChatColor.YELLOW + "DartCZ");
|
||||
sender.sendMessage(ChatColor.RED + "升级到最新无UUID版本 by: " + ChatColor.YELLOW + "喵♂呜");
|
||||
String names = null;
|
||||
List<String> authlist = plugin.getDescription().getAuthors();
|
||||
for (String auth : authlist)
|
||||
if (names == null)
|
||||
names = auth;
|
||||
else
|
||||
names = names + ", " + auth;
|
||||
sender.sendMessage(ChatColor.GREEN + "作者: " + ChatColor.YELLOW + names);
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "插件命令列表,帮助, 请查看wiki:");
|
||||
sender.sendMessage(ChatColor.GREEN + "http://residencebukkitmod.wikispaces.com/");
|
||||
sender.sendMessage(ChatColor.AQUA + "重制版本请查看Jenkins:");
|
||||
sender.sendMessage(ChatColor.BLUE + plugin.getDescription().getWebsite());
|
||||
sender.sendMessage(ChatColor.GRAY + "------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user