mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-26 22:06:07 +00:00
@@ -15,30 +15,34 @@ import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||
public class CommandSetOwner extends BaseCommand {
|
||||
Residence plugin;
|
||||
|
||||
public CommandSetOwner(Residence plugin) {
|
||||
public CommandSetOwner(final Residence plugin) {
|
||||
super("setowner");
|
||||
this.plugin = plugin;
|
||||
setMinimumArguments(2);
|
||||
setPossibleArguments("[领地名] [玩家]");
|
||||
}
|
||||
|
||||
@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)
|
||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||
final boolean resadmin = (command != null);
|
||||
final ResidenceManager rmanager = plugin.getResidenceManager();
|
||||
final Language language = plugin.getLanguage();
|
||||
if (!resadmin) {
|
||||
sender.sendMessage(ChatColor.RED + language.getPhrase("NoPermission"));
|
||||
ClaimedResidence area = rmanager.getByName(args[1]);
|
||||
}
|
||||
final ClaimedResidence area = rmanager.getByName(args[0]);
|
||||
if (area != null) {
|
||||
area.getPermissions().setOwner(args[2], true);
|
||||
if (area.getParent() == null)
|
||||
area.getPermissions().setOwner(args[1], 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
|
||||
ChatColor.GREEN + language.getPhrase("ResidenceOwnerChange", ChatColor.YELLOW + " " + args[0] + " " + ChatColor.GREEN + "." + ChatColor.YELLOW + args[1] + 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
|
||||
ChatColor.YELLOW + " " + args[0].split("\\.")[args[1].split("\\.").length - 1] + " " + ChatColor.GREEN + "." + ChatColor.YELLOW + args[1] + ChatColor.GREEN));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + language.getPhrase("InvalidResidence"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user