|
|
|
|
@@ -26,7 +26,9 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
public CommandSelect(final Residence plugin) {
|
|
|
|
|
super("select");
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
setMinimumArguments(1);
|
|
|
|
|
setOnlyPlayerExecutable(true);
|
|
|
|
|
setPossibleArguments("请使用/res select ? 查看帮助");
|
|
|
|
|
setPermission("residence.select");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -48,8 +50,13 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("SelectDiabled"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (args.length == 1) {
|
|
|
|
|
if (args[0].equals("size") || args[0].equals("cost")) {
|
|
|
|
|
|
|
|
|
|
final String subcmd = args[0];
|
|
|
|
|
switch (args.length) {
|
|
|
|
|
case 1:
|
|
|
|
|
switch (subcmd) {
|
|
|
|
|
case "size":
|
|
|
|
|
case "cost":
|
|
|
|
|
if (smanager.hasPlacedBoth(player.getName())) {
|
|
|
|
|
try {
|
|
|
|
|
smanager.showSelectionInfo(player);
|
|
|
|
|
@@ -67,16 +74,17 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (args[0].equals("vert")) {
|
|
|
|
|
return;
|
|
|
|
|
case "vert":
|
|
|
|
|
smanager.vert(player, resadmin);
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("sky")) {
|
|
|
|
|
case "sky":
|
|
|
|
|
smanager.sky(player, resadmin);
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("bedrock")) {
|
|
|
|
|
case "bedrock":
|
|
|
|
|
smanager.bedrock(player, resadmin);
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("coords")) {
|
|
|
|
|
case "coords":
|
|
|
|
|
final Location playerLoc1 = smanager.getPlayerLoc1(player.getName());
|
|
|
|
|
if (playerLoc1 != null) {
|
|
|
|
|
player.sendMessage(ChatColor.GREEN + language.getPhrase("Primary.Selection") + ":" + ChatColor.AQUA + " (" + playerLoc1.getBlockX() + ", " + playerLoc1.getBlockY() + ", "
|
|
|
|
|
@@ -88,17 +96,17 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
+ playerLoc2.getBlockZ() + ")");
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("chunk")) {
|
|
|
|
|
case "chunk":
|
|
|
|
|
smanager.selectChunk(player);
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("worldedit")) {
|
|
|
|
|
case "worldedit":
|
|
|
|
|
if (smanager.worldEdit(player)) {
|
|
|
|
|
player.sendMessage(ChatColor.GREEN + plugin.getLanguage().getPhrase("SelectionSuccess"));
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (args.length == 2) {
|
|
|
|
|
if (args[0].equals("expand")) {
|
|
|
|
|
return;
|
|
|
|
|
case 2:
|
|
|
|
|
int amount;
|
|
|
|
|
try {
|
|
|
|
|
amount = Integer.parseInt(args[1]);
|
|
|
|
|
@@ -106,26 +114,29 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
switch (subcmd) {
|
|
|
|
|
case "expand":
|
|
|
|
|
smanager.modify(player, false, amount);
|
|
|
|
|
return;
|
|
|
|
|
} else if (args[0].equals("shift")) {
|
|
|
|
|
int amount;
|
|
|
|
|
try {
|
|
|
|
|
amount = Integer.parseInt(args[1]);
|
|
|
|
|
} catch (final Exception ex) {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("InvalidAmount"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case "shift":
|
|
|
|
|
smanager.modify(player, true, amount);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 3:
|
|
|
|
|
try {
|
|
|
|
|
smanager.selectBySize(player, Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
|
|
|
|
|
} catch (final Exception ex) {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("SelectionFail"));
|
|
|
|
|
}
|
|
|
|
|
if (args.length > 0 && args[0].equals("residence")) {
|
|
|
|
|
return;
|
|
|
|
|
default:
|
|
|
|
|
if (args.length > 0) {
|
|
|
|
|
String resName;
|
|
|
|
|
String areaName;
|
|
|
|
|
ClaimedResidence res = null;
|
|
|
|
|
if (args.length > 1) {
|
|
|
|
|
res = rmanager.getByName(args[1]);
|
|
|
|
|
res = rmanager.getByName(args[0]);
|
|
|
|
|
} else {
|
|
|
|
|
res = rmanager.getByLoc(player.getLocation());
|
|
|
|
|
}
|
|
|
|
|
@@ -136,8 +147,8 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
resName = res.getName();
|
|
|
|
|
CuboidArea area = null;
|
|
|
|
|
if (args.length > 2) {
|
|
|
|
|
area = res.getArea(args[2]);
|
|
|
|
|
areaName = args[2];
|
|
|
|
|
area = res.getArea(args[1]);
|
|
|
|
|
areaName = args[1];
|
|
|
|
|
} else {
|
|
|
|
|
areaName = res.getAreaIDbyLoc(player.getLocation());
|
|
|
|
|
area = res.getArea(areaName);
|
|
|
|
|
@@ -149,15 +160,8 @@ public class CommandSelect extends BaseCommand {
|
|
|
|
|
} else {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("AreaNonExist"));
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
smanager.selectBySize(player, Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
|
|
|
|
|
return;
|
|
|
|
|
} catch (final Exception ex) {
|
|
|
|
|
player.sendMessage(ChatColor.RED + language.getPhrase("SelectionFail"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|