Merge pull request #2 from RedstonerServer/blockplacemods_3.1
Revise help pages slightly, prevent future NPE in onDisable()
This commit is contained in:
@@ -67,7 +67,8 @@ public final class BlockPlaceMods implements Module, Listener
|
||||
Map<String, org.bukkit.command.Command> commandMap = CommandMap.getCommandMap();
|
||||
for (String alias : getCommandAliases())
|
||||
{
|
||||
if (commandMap.get(alias).getClass() == BlockPlaceModsCommand.class)
|
||||
org.bukkit.command.Command command = commandMap.get(alias);
|
||||
if (command != null && command.getClass() == BlockPlaceModsCommand.class)
|
||||
{
|
||||
commandMap.remove(alias);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.redstoner.modules.blockplacemods.mods;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.redstoner.modules.datamanager.DataManager;
|
||||
import com.redstoner.utils.CommandException;
|
||||
import com.redstoner.utils.ItemProperties;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -16,9 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.redstoner.modules.datamanager.DataManager;
|
||||
import com.redstoner.utils.CommandException;
|
||||
import com.redstoner.utils.ItemProperties;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ModInventory extends ModAbstract
|
||||
{
|
||||
@@ -99,8 +98,8 @@ public class ModInventory extends ModAbstract
|
||||
}
|
||||
}
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("&a### &3Container&a Help ###\n");
|
||||
message.append("&8").append(getDescription()).append('\n');
|
||||
message.append(" &a### &3Container Mod&a Help ###\n");
|
||||
message.append("&7").append(getDescription()).append('\n');
|
||||
message.append("&6/mod ").append(getName().toLowerCase())
|
||||
.append("&o <slot> &bsets the item in slot to your hand\n");
|
||||
message.append("&6/mod ").append(getName().toLowerCase()).append("&o clear &bclears the data\n");
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.redstoner.modules.blockplacemods.mods;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.redstoner.modules.datamanager.DataManager;
|
||||
import com.redstoner.utils.CommandException;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class ModToggledAbstract extends ModAbstract
|
||||
{
|
||||
@@ -48,36 +47,29 @@ public abstract class ModToggledAbstract extends ModAbstract
|
||||
if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("&a### &3").append(getName()).append("&a Help ###");
|
||||
message.append("\n&8If enabled, ").append(getDescription());
|
||||
message.append("\n&6/mod ").append(getName().toLowerCase()).append("&o toggle &btoggles state");
|
||||
message.append("\n&6/mod ").append(getName().toLowerCase()).append("&o on/off &bsets state");
|
||||
message.append("\n&6/mod ").append(getName().toLowerCase()).append("&o help &bshows this help page");
|
||||
message.append(" &a### &3Toggled Mod&a Help ###");
|
||||
message.append("\n&7").append(getDescription());
|
||||
message.append("\n&6/mod ").append(getName()).append("&o (toggle) &btoggles state");
|
||||
message.append("\n&6/mod ").append(getName()).append("&o on/off &bsets state");
|
||||
message.append("\n&6/mod ").append(getName()).append("&o help &bshows this help page");
|
||||
return message.toString();
|
||||
}
|
||||
final boolean enable;
|
||||
if (args[0] == null)
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
throw new CommandException("Missing argument");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "on":
|
||||
case "enable":
|
||||
case "true":
|
||||
enable = true;
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "false":
|
||||
enable = false;
|
||||
break;
|
||||
default:
|
||||
throw new CommandException("Input '" + args[0] + "' was not understood. "
|
||||
+ "Use one of: \non, enable, true, off, disable, false.");
|
||||
}
|
||||
case "on":
|
||||
case "enable":
|
||||
case "true":
|
||||
enable = true;
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "false":
|
||||
enable = false;
|
||||
break;
|
||||
default:
|
||||
throw new CommandException("Input '" + args[0] + "' was not understood. "
|
||||
+ "Use one of: \non, enable, true, off, disable, false.");
|
||||
}
|
||||
if (!setEnabled(sender, enable))
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ModToggledCauldron extends ModToggledAbstract
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
return "If active, placed cauldrons are filled, and they cycle on right click";
|
||||
return "If active, placed cauldrons are filled, and they cycle on shiftless right click with redstone or fist";
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
Reference in New Issue
Block a user