Revise help pages slightly, prevent future NPE in onDisable()
This commit is contained in:
@@ -19,7 +19,7 @@ import org.bukkit.event.Listener;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 3, minor = 2, revision = 8, compatible = 3)
|
@Version(major = 3, minor = 2, revision = 9, compatible = 3)
|
||||||
public final class BlockPlaceMods implements Module, Listener
|
public final class BlockPlaceMods implements Module, Listener
|
||||||
{
|
{
|
||||||
public static String PREFIX = ChatColor.GRAY + "[" + ChatColor.DARK_GREEN + "BPM" + ChatColor.GRAY + "]"
|
public static String PREFIX = ChatColor.GRAY + "[" + ChatColor.DARK_GREEN + "BPM" + ChatColor.GRAY + "]"
|
||||||
@@ -62,7 +62,8 @@ public final class BlockPlaceMods implements Module, Listener
|
|||||||
Map<String, org.bukkit.command.Command> commandMap = CommandMap.getCommandMap();
|
Map<String, org.bukkit.command.Command> commandMap = CommandMap.getCommandMap();
|
||||||
for (String alias : getCommandAliases())
|
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);
|
commandMap.remove(alias);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.redstoner.modules.blockplacemods.mods;
|
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.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -15,9 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import com.redstoner.modules.datamanager.DataManager;
|
import java.util.Arrays;
|
||||||
import com.redstoner.utils.CommandException;
|
|
||||||
import com.redstoner.utils.ItemProperties;
|
|
||||||
|
|
||||||
public class ModInventory extends ModAbstract
|
public class ModInventory extends ModAbstract
|
||||||
{
|
{
|
||||||
@@ -98,8 +97,8 @@ public class ModInventory extends ModAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append("&a### &3Container&a Help ###\n");
|
message.append(" &a### &3Container Mod&a Help ###\n");
|
||||||
message.append("&8").append(getDescription()).append('\n');
|
message.append("&7").append(getDescription()).append('\n');
|
||||||
message.append("&6/mod ").append(getName().toLowerCase())
|
message.append("&6/mod ").append(getName().toLowerCase())
|
||||||
.append("&o <slot> &bsets the item in slot to your hand\n");
|
.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");
|
message.append("&6/mod ").append(getName().toLowerCase()).append("&o clear &bclears the data\n");
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.redstoner.modules.blockplacemods.mods;
|
package com.redstoner.modules.blockplacemods.mods;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.redstoner.modules.datamanager.DataManager;
|
import com.redstoner.modules.datamanager.DataManager;
|
||||||
import com.redstoner.utils.CommandException;
|
import com.redstoner.utils.CommandException;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public abstract class ModToggledAbstract extends ModAbstract
|
public abstract class ModToggledAbstract extends ModAbstract
|
||||||
{
|
{
|
||||||
@@ -48,20 +47,14 @@ public abstract class ModToggledAbstract extends ModAbstract
|
|||||||
if (args[0].equalsIgnoreCase("help"))
|
if (args[0].equalsIgnoreCase("help"))
|
||||||
{
|
{
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append("&a### &3").append(getName()).append("&a Help ###");
|
message.append(" &a### &3Toggled Mod&a Help ###");
|
||||||
message.append("\n&8If enabled, ").append(getDescription());
|
message.append("\n&7").append(getDescription());
|
||||||
message.append("\n&6/mod ").append(getName().toLowerCase()).append("&o toggle &btoggles state");
|
message.append("\n&6/mod ").append(getName()).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()).append("&o on/off &bsets state");
|
||||||
message.append("\n&6/mod ").append(getName().toLowerCase()).append("&o help &bshows this help page");
|
message.append("\n&6/mod ").append(getName()).append("&o help &bshows this help page");
|
||||||
return message.toString();
|
return message.toString();
|
||||||
}
|
}
|
||||||
final boolean enable;
|
final boolean enable;
|
||||||
if (args[0] == null)
|
|
||||||
{
|
|
||||||
throw new CommandException("Missing argument");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (args[0].toLowerCase())
|
switch (args[0].toLowerCase())
|
||||||
{
|
{
|
||||||
case "on":
|
case "on":
|
||||||
@@ -78,7 +71,6 @@ public abstract class ModToggledAbstract extends ModAbstract
|
|||||||
throw new CommandException("Input '" + args[0] + "' was not understood. "
|
throw new CommandException("Input '" + args[0] + "' was not understood. "
|
||||||
+ "Use one of: \non, enable, true, off, disable, false.");
|
+ "Use one of: \non, enable, true, off, disable, false.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!setEnabled(sender, enable))
|
if (!setEnabled(sender, enable))
|
||||||
{
|
{
|
||||||
throw new CommandException("Was already " + (enable ? "enabled" : "disabled"));
|
throw new CommandException("Was already " + (enable ? "enabled" : "disabled"));
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ModToggledCauldron extends ModToggledAbstract
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
|
|||||||
Reference in New Issue
Block a user