better naming and more feedback for xray

This commit is contained in:
Bella 2020-03-09 21:06:15 -04:00
parent 8502838eab
commit badb45d103
No known key found for this signature in database
GPG Key ID: 03B01AC937D1C89C
1 changed files with 13 additions and 11 deletions

View File

@ -21,20 +21,20 @@ public class XRayCommand extends Command {
public void call(String[] args) {
XRay xr = (XRay) ModuleManager.getModuleByName("XRay");
if (xr == null) {
Command.sendErrorMessage("&cThe XRay module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
Command.sendErrorMessage("&cThe module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!");
return;
}
if (!xr.isEnabled()) {
Command.sendWarningMessage("&6Warning: The XRay module is not enabled!");
Command.sendWarningMessage("&6Warning: The " + xr.getName() + " module is not enabled!");
Command.sendWarningMessage("These commands will still have effect, but will not visibly do anything.");
}
for (String s : args) {
if (s == null)
continue;
if (s.equalsIgnoreCase("help")) {
Command.sendChatMessage("The XRay module has a list of blocks");
Command.sendChatMessage("Normally, the XRay module hides these blocks");
Command.sendChatMessage("When the Invert setting is on, the XRay only shows these blocks");
Command.sendChatMessage("The " + xr.getName() + " module has a list of blocks");
Command.sendChatMessage("Normally, the " + xr.getName() + " module hides these blocks");
Command.sendChatMessage("When the Invert setting is on, the " + xr.getName() + " only shows these blocks");
Command.sendChatMessage("This command is a convenient way to quickly edit the list");
Command.sendChatMessage("Available options: \n" +
"+block: Adds a block to the list\n" +
@ -42,28 +42,28 @@ public class XRayCommand extends Command {
"=block: Changes the list to only that block\n" +
"list: Prints the list of selected blocks\n" +
"defaults: Resets the list to the default list\n" +
"clear: Removes all blocks from the XRay block list\n" +
"clear: Removes all blocks from the " + xr.getName() + " block list\n" +
"invert: Quickly toggles the invert setting");
} else if (s.equalsIgnoreCase("clear")) {
xr.extClear();
Command.sendWarningMessage("Cleared the XRay block list");
Command.sendWarningMessage("Cleared the " + xr.getName() + " block list");
} else if (s.equalsIgnoreCase("defaults")) {
xr.extDefaults();
Command.sendChatMessage("Reset the XRay block list to default");
Command.sendChatMessage("Reset the " + xr.getName() + " block list to default");
} else if (s.equalsIgnoreCase("list")) {
Command.sendChatMessage("\n" + xr.extGet());
} else if (s.equalsIgnoreCase("invert")) {
if (xr.invert.getValue()) {
xr.invert.setValue(false);
Command.sendChatMessage("Disabled XRay Invert");
Command.sendChatMessage("Disabled " + xr.getName() + " Invert");
} else {
xr.invert.setValue(true);
Command.sendChatMessage("Enabled XRay Invert");
Command.sendChatMessage("Enabled " + xr.getName() + " Invert");
}
} else if (s.startsWith("=")) {
String sT = s.replace("=" ,"");
xr.extSet(sT);
Command.sendChatMessage("Set the XRay block list to " + sT);
Command.sendChatMessage("Set the " + xr.getName() + " block list to " + sT);
} else if (s.startsWith("+") || s.startsWith("-")) {
String name = s.substring(1);
Block b = Block.getBlockFromName(name);
@ -71,8 +71,10 @@ public class XRayCommand extends Command {
Command.sendChatMessage("&cInvalid block name <" + name + ">");
} else {
if (s.startsWith("+")) {
Command.sendChatMessage("Added <" + name + "> to the " + xr.getName() + " block list");
xr.extAdd(name);
} else {
Command.sendChatMessage("Removed <" + name + "> from the " + xr.getName() + " block list");
xr.extRemove(name);
}
}