Clean up our main class a bit more. Still not perfect, but it's getting

there.
This commit is contained in:
GJ 2013-04-30 15:07:29 -04:00
parent 14050cf096
commit b55ce30b2d
9 changed files with 104 additions and 90 deletions

View File

@ -28,7 +28,7 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(mcSplit); sender.sendMessage(mcSplit);
if (Config.getInstance().getDonateMessageEnabled()) { if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) { if (mcMMO.isSpoutEnabled() && sender instanceof SpoutPlayer) {
SpoutPlayer spoutPlayer = (SpoutPlayer) sender; SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND); spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
} }

View File

@ -22,7 +22,7 @@ public abstract class SpoutCommand implements TabExecutor {
return true; return true;
} }
if (!mcMMO.spoutEnabled || !SpoutConfig.getInstance().getXPBarEnabled()) { if (!mcMMO.isSpoutEnabled() || !SpoutConfig.getInstance().getXPBarEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }

View File

@ -42,7 +42,7 @@ public class PlayerProfile {
public PlayerProfile(String playerName, boolean addNew) { public PlayerProfile(String playerName, boolean addNew) {
this.playerName = playerName; this.playerName = playerName;
hudType = mcMMO.spoutEnabled ? SpoutConfig.getInstance().getDefaultHudType() : HudType.DISABLED; hudType = mcMMO.isSpoutEnabled() ? SpoutConfig.getInstance().getDefaultHudType() : HudType.DISABLED;
mobHealthbarType = Config.getInstance().getMobHealthbarDefault(); mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
for (AbilityType abilityType : AbilityType.values()) { for (AbilityType abilityType : AbilityType.values()) {

View File

@ -63,9 +63,9 @@ public class mcMMO extends JavaPlugin {
private final SelfListener selfListener = new SelfListener(); private final SelfListener selfListener = new SelfListener();
/* Managers */ /* Managers */
private static ChunkManager placeStore; private static ChunkManager placeStore;
private static RepairableManager repairableManager; private static RepairableManager repairableManager;
private static DatabaseManager databaseManager; private static DatabaseManager databaseManager;
/* File Paths */ /* File Paths */
private static String mainDirectory; private static String mainDirectory;
@ -81,14 +81,14 @@ public class mcMMO extends JavaPlugin {
// Update Check // Update Check
private boolean updateAvailable; private boolean updateAvailable;
// Plugin Checks /* Plugin Checks */
public static boolean spoutEnabled; private static boolean spoutEnabled;
public static boolean combatTagEnabled; private static boolean combatTagEnabled;
// XP Event Check // XP Event Check
private boolean xpEventEnabled; private boolean xpEventEnabled;
// Metadata Values /* Metadata Values */
public final static String entityMetadataKey = "mcMMO: Spawned Entity"; public final static String entityMetadataKey = "mcMMO: Spawned Entity";
public final static String blockMetadataKey = "mcMMO: Piston Tracking"; public final static String blockMetadataKey = "mcMMO: Piston Tracking";
public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace"; public final static String furnaceMetadataKey = "mcMMO: Tracked Furnace";
@ -129,7 +129,7 @@ public class mcMMO extends JavaPlugin {
debug("Version " + getDescription().getVersion() + " is enabled!"); debug("Version " + getDescription().getVersion() + " is enabled!");
scheduleTasks(); scheduleTasks();
registerCommands(); CommandRegistrationManager.registerCommands();
MetricsManager.setup(); MetricsManager.setup();
@ -242,6 +242,14 @@ public class mcMMO extends JavaPlugin {
return repairableManager; return repairableManager;
} }
public static boolean isSpoutEnabled() {
return spoutEnabled;
}
public static boolean isCombatTagEnabled() {
return combatTagEnabled;
}
/** /**
* Setup the various storage file paths * Setup the various storage file paths
*/ */
@ -332,48 +340,6 @@ public class mcMMO extends JavaPlugin {
pluginManager.registerEvents(worldListener, this); pluginManager.registerEvents(worldListener, this);
} }
/**
* Register the commands.
*/
private void registerCommands() {
CommandRegistrationManager.registerSkillCommands();
// mc* commands
CommandRegistrationManager.registerMcpurgeCommand();
CommandRegistrationManager.registerMcremoveCommand();
CommandRegistrationManager.registerMcabilityCommand();
CommandRegistrationManager.registerMcgodCommand();
CommandRegistrationManager.registerMcmmoCommand();
CommandRegistrationManager.registerMcrefreshCommand();
CommandRegistrationManager.registerMctopCommand();
CommandRegistrationManager.registerMcrankCommand();
CommandRegistrationManager.registerMcstatsCommand();
CommandRegistrationManager.registerMcscoreboardCommand();
// Party commands
CommandRegistrationManager.registerAdminChatCommand();
CommandRegistrationManager.registerPartyCommand();
CommandRegistrationManager.registerPartyChatCommand();
CommandRegistrationManager.registerPtpCommand();
// Other commands
CommandRegistrationManager.registerAddxpCommand();
CommandRegistrationManager.registerAddlevelsCommand();
CommandRegistrationManager.registerMmoeditCommand();
CommandRegistrationManager.registerInspectCommand();
CommandRegistrationManager.registerXprateCommand();
CommandRegistrationManager.registerMmoupdateCommand();
CommandRegistrationManager.registerSkillresetCommand();
CommandRegistrationManager.registerHardcoreCommand();
CommandRegistrationManager.registerVampirismCommand();
CommandRegistrationManager.registerMcnotifyCommand();
CommandRegistrationManager.registerMobhealthCommand();
// Spout commands
CommandRegistrationManager.registerXplockCommand();
CommandRegistrationManager.registerMchudCommand();
}
private void registerCustomRecipes() { private void registerCustomRecipes() {
if (Config.getInstance().getChimaeraEnabled()) { if (Config.getInstance().getChimaeraEnabled()) {
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe()); getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());

View File

@ -45,7 +45,7 @@ public class RepairManager extends SkillManager {
return; return;
} }
if (mcMMO.spoutEnabled) { if (mcMMO.isSpoutEnabled()) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer.isSpoutCraftEnabled()) { if (spoutPlayer.isSpoutCraftEnabled()) {

View File

@ -39,7 +39,7 @@ public class ItemUtils {
if (customToolsEnabled && CustomToolConfig.getInstance().customSwordIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolConfig.getInstance().customSwordIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutSwords.contains(is)) { else if (mcMMO.isSpoutEnabled() && SpoutToolsAPI.spoutSwords.contains(is)) {
return true; return true;
} }
else { else {
@ -67,7 +67,7 @@ public class ItemUtils {
if (customToolsEnabled && CustomToolConfig.getInstance().customHoeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolConfig.getInstance().customHoeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) { else if (mcMMO.isSpoutEnabled() && SpoutToolsAPI.spoutHoes.contains(is)) {
return true; return true;
} }
else { else {
@ -95,7 +95,7 @@ public class ItemUtils {
if (customToolsEnabled && CustomToolConfig.getInstance().customShovelIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolConfig.getInstance().customShovelIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) { else if (mcMMO.isSpoutEnabled() && SpoutToolsAPI.spoutShovels.contains(is)) {
return true; return true;
} }
else { else {
@ -123,7 +123,7 @@ public class ItemUtils {
if (customToolsEnabled && CustomToolConfig.getInstance().customAxeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolConfig.getInstance().customAxeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) { else if (mcMMO.isSpoutEnabled() && SpoutToolsAPI.spoutAxes.contains(is)) {
return true; return true;
} }
else { else {
@ -151,7 +151,7 @@ public class ItemUtils {
if (customToolsEnabled && CustomToolConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) { else if (mcMMO.isSpoutEnabled() && SpoutToolsAPI.spoutPickaxes.contains(is)) {
return true; return true;
} }
else { else {

View File

@ -44,7 +44,7 @@ public final class Misc {
} }
public static boolean isNPCEntity(Entity entity) { public static boolean isNPCEntity(Entity entity) {
return (entity == null || entity.hasMetadata("NPC") || (mcMMO.combatTagEnabled && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger"))); return (entity == null || entity.hasMetadata("NPC") || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger")));
} }
/** /**
@ -185,7 +185,7 @@ public final class Misc {
if (player.isOnline()) { if (player.isOnline()) {
UserManager.addUser(player); UserManager.addUser(player);
if (mcMMO.spoutEnabled) { if (mcMMO.isSpoutEnabled()) {
SpoutUtils.reloadSpoutPlayer(player); SpoutUtils.reloadSpoutPlayer(player);
} }
} }

View File

@ -57,7 +57,7 @@ public final class CommandRegistrationManager {
private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission"); private static String permissionsMessage = LocaleLoader.getString("mcMMO.NoPermission");
public static void registerSkillCommands() { private static void registerSkillCommands() {
for (SkillType skill : SkillType.values()) { for (SkillType skill : SkillType.values()) {
String commandName = skill.toString().toLowerCase(); String commandName = skill.toString().toLowerCase();
String localizedName = SkillUtils.getSkillName(skill).toLowerCase(); String localizedName = SkillUtils.getSkillName(skill).toLowerCase();
@ -130,7 +130,7 @@ public final class CommandRegistrationManager {
} }
} }
public static void registerAddlevelsCommand() { private static void registerAddlevelsCommand() {
PluginCommand command = mcMMO.p.getCommand("addlevels"); PluginCommand command = mcMMO.p.getCommand("addlevels");
command.setDescription(LocaleLoader.getString("Commands.Description.addlevels")); command.setDescription(LocaleLoader.getString("Commands.Description.addlevels"));
command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others"); command.setPermission("mcmmo.commands.addlevels;mcmmo.commands.addlevels.others");
@ -139,7 +139,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new AddlevelsCommand()); command.setExecutor(new AddlevelsCommand());
} }
public static void registerAddxpCommand() { private static void registerAddxpCommand() {
PluginCommand command = mcMMO.p.getCommand("addxp"); PluginCommand command = mcMMO.p.getCommand("addxp");
command.setDescription(LocaleLoader.getString("Commands.Description.addxp")); command.setDescription(LocaleLoader.getString("Commands.Description.addxp"));
command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others"); command.setPermission("mcmmo.commands.addxp;mcmmo.commands.addxp.others");
@ -148,7 +148,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new AddxpCommand()); command.setExecutor(new AddxpCommand());
} }
public static void registerMcgodCommand() { private static void registerMcgodCommand() {
PluginCommand command = mcMMO.p.getCommand("mcgod"); PluginCommand command = mcMMO.p.getCommand("mcgod");
command.setDescription(LocaleLoader.getString("Commands.Description.mcgod")); command.setDescription(LocaleLoader.getString("Commands.Description.mcgod"));
command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others"); command.setPermission("mcmmo.commands.mcgod;mcmmo.commands.mcgod.others");
@ -157,7 +157,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McgodCommand()); command.setExecutor(new McgodCommand());
} }
public static void registerMcrefreshCommand() { private static void registerMcrefreshCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrefresh"); PluginCommand command = mcMMO.p.getCommand("mcrefresh");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh")); command.setDescription(LocaleLoader.getString("Commands.Description.mcrefresh"));
command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others"); command.setPermission("mcmmo.commands.mcrefresh;mcmmo.commands.mcrefresh.others");
@ -166,7 +166,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McrefreshCommand()); command.setExecutor(new McrefreshCommand());
} }
public static void registerMmoeditCommand() { private static void registerMmoeditCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoedit"); PluginCommand command = mcMMO.p.getCommand("mmoedit");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit")); command.setDescription(LocaleLoader.getString("Commands.Description.mmoedit"));
command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others"); command.setPermission("mcmmo.commands.mmoedit;mcmmo.commands.mmoedit.others");
@ -175,7 +175,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new MmoeditCommand()); command.setExecutor(new MmoeditCommand());
} }
public static void registerSkillresetCommand() { private static void registerSkillresetCommand() {
PluginCommand command = mcMMO.p.getCommand("skillreset"); PluginCommand command = mcMMO.p.getCommand("skillreset");
command.setDescription(LocaleLoader.getString("Commands.Description.skillreset")); command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones command.setPermission("mcmmo.commands.skillreset;mcmmo.commands.skillreset.others"); // Only need the main ones, not the individual skill ones
@ -184,7 +184,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new SkillresetCommand()); command.setExecutor(new SkillresetCommand());
} }
public static void registerXprateCommand() { private static void registerXprateCommand() {
List<String> aliasList = new ArrayList<String>(); List<String> aliasList = new ArrayList<String>();
aliasList.add("mcxprate"); aliasList.add("mcxprate");
@ -198,7 +198,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new XprateCommand()); command.setExecutor(new XprateCommand());
} }
public static void registerInspectCommand() { private static void registerInspectCommand() {
PluginCommand command = mcMMO.p.getCommand("inspect"); PluginCommand command = mcMMO.p.getCommand("inspect");
command.setDescription(LocaleLoader.getString("Commands.Description.inspect")); command.setDescription(LocaleLoader.getString("Commands.Description.inspect"));
command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline"); command.setPermission("mcmmo.commands.inspect;mcmmo.commands.inspect.far;mcmmo.commands.inspect.offline");
@ -207,7 +207,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new InspectCommand()); command.setExecutor(new InspectCommand());
} }
public static void registerMcabilityCommand() { private static void registerMcabilityCommand() {
PluginCommand command = mcMMO.p.getCommand("mcability"); PluginCommand command = mcMMO.p.getCommand("mcability");
command.setDescription(LocaleLoader.getString("Commands.Description.mcability")); command.setDescription(LocaleLoader.getString("Commands.Description.mcability"));
command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others"); command.setPermission("mcmmo.commands.mcability;mcmmo.commands.mcability.others");
@ -216,7 +216,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McabilityCommand()); command.setExecutor(new McabilityCommand());
} }
public static void registerMcmmoCommand() { private static void registerMcmmoCommand() {
PluginCommand command = mcMMO.p.getCommand("mcmmo"); PluginCommand command = mcMMO.p.getCommand("mcmmo");
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo")); command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help"); command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help");
@ -226,7 +226,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McmmoCommand()); command.setExecutor(new McmmoCommand());
} }
public static void registerMcrankCommand() { private static void registerMcrankCommand() {
PluginCommand command = mcMMO.p.getCommand("mcrank"); PluginCommand command = mcMMO.p.getCommand("mcrank");
command.setDescription(LocaleLoader.getString("Commands.Description.mcrank")); command.setDescription(LocaleLoader.getString("Commands.Description.mcrank"));
command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline"); command.setPermission("mcmmo.commands.mcrank;mcmmo.commands.mcrank.others;mcmmo.commands.mcrank.others.far;mcmmo.commands.mcrank.others.offline");
@ -235,7 +235,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McrankCommand()); command.setExecutor(new McrankCommand());
} }
public static void registerMcstatsCommand() { private static void registerMcstatsCommand() {
PluginCommand command = mcMMO.p.getCommand("mcstats"); PluginCommand command = mcMMO.p.getCommand("mcstats");
command.setDescription(LocaleLoader.getString("Commands.Description.mcstats")); command.setDescription(LocaleLoader.getString("Commands.Description.mcstats"));
command.setPermission("mcmmo.commands.mcstats"); command.setPermission("mcmmo.commands.mcstats");
@ -244,7 +244,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McstatsCommand()); command.setExecutor(new McstatsCommand());
} }
public static void registerMctopCommand() { private static void registerMctopCommand() {
PluginCommand command = mcMMO.p.getCommand("mctop"); PluginCommand command = mcMMO.p.getCommand("mctop");
command.setDescription(LocaleLoader.getString("Commands.Description.mctop")); command.setDescription(LocaleLoader.getString("Commands.Description.mctop"));
command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones command.setPermission("mcmmo.commands.mctop"); // Only need the main one, not the individual skill ones
@ -253,7 +253,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new MctopCommand()); command.setExecutor(new MctopCommand());
} }
public static void registerMcpurgeCommand() { private static void registerMcpurgeCommand() {
PluginCommand command = mcMMO.p.getCommand("mcpurge"); PluginCommand command = mcMMO.p.getCommand("mcpurge");
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff())); command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
@ -261,7 +261,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McpurgeCommand()); command.setExecutor(new McpurgeCommand());
} }
public static void registerMcremoveCommand() { private static void registerMcremoveCommand() {
PluginCommand command = mcMMO.p.getCommand("mcremove"); PluginCommand command = mcMMO.p.getCommand("mcremove");
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove")); command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
@ -269,7 +269,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McremoveCommand()); command.setExecutor(new McremoveCommand());
} }
public static void registerMmoupdateCommand() { private static void registerMmoupdateCommand() {
PluginCommand command = mcMMO.p.getCommand("mmoupdate"); PluginCommand command = mcMMO.p.getCommand("mmoupdate");
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate")); command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
@ -277,7 +277,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new MmoupdateCommand()); command.setExecutor(new MmoupdateCommand());
} }
public static void registerAdminChatCommand() { private static void registerAdminChatCommand() {
PluginCommand command = mcMMO.p.getCommand("adminchat"); PluginCommand command = mcMMO.p.getCommand("adminchat");
command.setDescription(LocaleLoader.getString("Commands.Description.adminchat")); command.setDescription(LocaleLoader.getString("Commands.Description.adminchat"));
command.setPermission("mcmmo.chat.adminchat"); command.setPermission("mcmmo.chat.adminchat");
@ -288,7 +288,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new AdminChatCommand()); command.setExecutor(new AdminChatCommand());
} }
public static void registerPartyChatCommand() { private static void registerPartyChatCommand() {
PluginCommand command = mcMMO.p.getCommand("partychat"); PluginCommand command = mcMMO.p.getCommand("partychat");
command.setDescription(LocaleLoader.getString("Commands.Description.partychat")); command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party"); command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
@ -299,7 +299,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new PartyChatCommand()); command.setExecutor(new PartyChatCommand());
} }
public static void registerMchudCommand() { private static void registerMchudCommand() {
PluginCommand command = mcMMO.p.getCommand("mchud"); PluginCommand command = mcMMO.p.getCommand("mchud");
command.setDescription(LocaleLoader.getString("Commands.Description.mchud")); command.setDescription(LocaleLoader.getString("Commands.Description.mchud"));
command.setPermission("mcmmo.commands.mchud"); command.setPermission("mcmmo.commands.mchud");
@ -308,7 +308,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new MchudCommand()); command.setExecutor(new MchudCommand());
} }
public static void registerXplockCommand() { private static void registerXplockCommand() {
PluginCommand command = mcMMO.p.getCommand("xplock"); PluginCommand command = mcMMO.p.getCommand("xplock");
command.setDescription(LocaleLoader.getString("Commands.Description.xplock")); command.setDescription(LocaleLoader.getString("Commands.Description.xplock"));
command.setPermission("mcmmo.commands.xplock"); command.setPermission("mcmmo.commands.xplock");
@ -319,7 +319,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new XplockCommand()); command.setExecutor(new XplockCommand());
} }
public static void registerPartyCommand() { private static void registerPartyCommand() {
PluginCommand command = mcMMO.p.getCommand("party"); PluginCommand command = mcMMO.p.getCommand("party");
command.setDescription(LocaleLoader.getString("Commands.Description.party")); command.setDescription(LocaleLoader.getString("Commands.Description.party"));
command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" + command.setPermission("mcmmo.commands.party;mcmmo.commands.party.accept;mcmmo.commands.party.create;mcmmo.commands.party.disband;" +
@ -330,7 +330,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new PartyCommand()); command.setExecutor(new PartyCommand());
} }
public static void registerPtpCommand() { private static void registerPtpCommand() {
PluginCommand command = mcMMO.p.getCommand("ptp"); PluginCommand command = mcMMO.p.getCommand("ptp");
command.setDescription(LocaleLoader.getString("Commands.Description.ptp")); command.setDescription(LocaleLoader.getString("Commands.Description.ptp"));
command.setPermission("mcmmo.commands.ptp"); // Only need the main one, not the individual ones for toggle/accept/acceptall command.setPermission("mcmmo.commands.ptp"); // Only need the main one, not the individual ones for toggle/accept/acceptall
@ -340,7 +340,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new PtpCommand()); command.setExecutor(new PtpCommand());
} }
public static void registerHardcoreCommand() { private static void registerHardcoreCommand() {
PluginCommand command = mcMMO.p.getCommand("hardcore"); PluginCommand command = mcMMO.p.getCommand("hardcore");
command.setDescription(LocaleLoader.getString("Commands.Description.hardcore")); command.setDescription(LocaleLoader.getString("Commands.Description.hardcore"));
command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify"); command.setPermission("mcmmo.commands.hardcore;mcmmo.commands.hardcore.toggle;mcmmo.commands.hardcore.modify");
@ -350,7 +350,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new HardcoreCommand()); command.setExecutor(new HardcoreCommand());
} }
public static void registerVampirismCommand() { private static void registerVampirismCommand() {
PluginCommand command = mcMMO.p.getCommand("vampirism"); PluginCommand command = mcMMO.p.getCommand("vampirism");
command.setDescription(LocaleLoader.getString("Commands.Description.vampirism")); command.setDescription(LocaleLoader.getString("Commands.Description.vampirism"));
command.setPermission("mcmmo.commands.vampirism;mcmmo.commands.vampirism.toggle;mcmmo.commands.vampirism.modify"); command.setPermission("mcmmo.commands.vampirism;mcmmo.commands.vampirism.toggle;mcmmo.commands.vampirism.modify");
@ -360,7 +360,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new VampirismCommand()); command.setExecutor(new VampirismCommand());
} }
public static void registerMcnotifyCommand() { private static void registerMcnotifyCommand() {
PluginCommand command = mcMMO.p.getCommand("mcnotify"); PluginCommand command = mcMMO.p.getCommand("mcnotify");
command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify")); command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
command.setPermission("mcmmo.commands.mcnotify"); command.setPermission("mcmmo.commands.mcnotify");
@ -369,7 +369,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new McnotifyCommand()); command.setExecutor(new McnotifyCommand());
} }
public static void registerMobhealthCommand() { private static void registerMobhealthCommand() {
PluginCommand command = mcMMO.p.getCommand("mobhealth"); PluginCommand command = mcMMO.p.getCommand("mobhealth");
command.setDescription("Change the style of the mob healthbar"); //TODO: Localize command.setDescription("Change the style of the mob healthbar"); //TODO: Localize
command.setPermission("mcmmo.commands.mobhealth"); command.setPermission("mcmmo.commands.mobhealth");
@ -378,7 +378,7 @@ public final class CommandRegistrationManager {
command.setExecutor(new MobhealthCommand()); command.setExecutor(new MobhealthCommand());
} }
public static void registerMcscoreboardCommand() { private static void registerMcscoreboardCommand() {
PluginCommand command = mcMMO.p.getCommand("mcscoreboard"); PluginCommand command = mcMMO.p.getCommand("mcscoreboard");
command.setDescription("Change the current mcMMO scoreboard being displayed"); //TODO: Localize command.setDescription("Change the current mcMMO scoreboard being displayed"); //TODO: Localize
command.setPermission("mcmmo.commands.mcscoreboard"); command.setPermission("mcmmo.commands.mcscoreboard");
@ -387,4 +387,52 @@ public final class CommandRegistrationManager {
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.3", "mcscoreboard", "top", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]")); command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.3", "mcscoreboard", "top", "[" + LocaleLoader.getString("Commands.Usage.Skill") + "]", "[" + LocaleLoader.getString("Commands.Usage.Page") + "]"));
command.setExecutor(new McscoreboardCommand()); command.setExecutor(new McscoreboardCommand());
} }
public static void registerCommands() {
// Generic Commands
registerMcabilityCommand();
registerMcgodCommand();
registerMcmmoCommand();
registerMcnotifyCommand();
registerMcrefreshCommand();
registerMcscoreboardCommand();
registerMobhealthCommand();
registerXprateCommand();
// Chat Commands
registerPartyChatCommand();
registerAdminChatCommand();
// Database Commands
registerMcpurgeCommand();
registerMcremoveCommand();
registerMmoupdateCommand();
// Experience Commands
registerAddlevelsCommand();
registerAddxpCommand();
registerMmoeditCommand();
registerSkillresetCommand();
// Hardcore Commands
registerHardcoreCommand();
registerVampirismCommand();
// Party Commands
registerPartyCommand();
registerPtpCommand();
// Player Commands
registerInspectCommand();
registerMcrankCommand();
registerMcstatsCommand();
registerMctopCommand();
// Skill Commands
registerSkillCommands();
// Spout Commands
registerXplockCommand();
registerMchudCommand();
}
} }

View File

@ -183,7 +183,7 @@ public class SkillUtils {
String capitalized = StringUtils.getCapitalized(skillType.toString()); String capitalized = StringUtils.getCapitalized(skillType.toString());
/* Spout Stuff */ /* Spout Stuff */
if (mcMMO.spoutEnabled) { if (mcMMO.isSpoutEnabled()) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer != null && spoutPlayer.isSpoutCraftEnabled()) { if (spoutPlayer != null && spoutPlayer.isSpoutCraftEnabled()) {
@ -203,7 +203,7 @@ public class SkillUtils {
} }
} }
if (mcMMO.spoutEnabled) { if (mcMMO.isSpoutEnabled()) {
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
if (spoutPlayer != null && spoutPlayer.isSpoutCraftEnabled()) { if (spoutPlayer != null && spoutPlayer.isSpoutCraftEnabled()) {