From 3365da7f8d35a2f9341a8f98e6a89f6836da581b Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 4 Oct 2013 09:41:01 -0400 Subject: [PATCH] MCPC+ checks, notify server owners that they're missing out. --- src/main/java/com/gmail/nossr50/mcMMO.java | 33 +++++++++++++++++++ .../gmail/nossr50/skills/repair/Repair.java | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index dd57ecf3e..9188118ef 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -78,6 +78,7 @@ public class mcMMO extends JavaPlugin { /* Plugin Checks */ private static boolean combatTagEnabled; private static boolean healthBarPluginEnabled; + private static boolean mcpcEnabled; // Config Validation Check public boolean noErrorsInConfigFiles = true; @@ -111,6 +112,7 @@ public class mcMMO extends JavaPlugin { metadataValue = new FixedMetadataValue(this, true); setupFilePaths(); + loadConfigFiles(); if (!noErrorsInConfigFiles) { @@ -119,6 +121,11 @@ public class mcMMO extends JavaPlugin { combatTagEnabled = getServer().getPluginManager().getPlugin("CombatTag") != null; healthBarPluginEnabled = getServer().getPluginManager().getPlugin("HealthBar") != null; + mcpcEnabled = getServer().getName().equals("MCPC+"); + + if (mcpcEnabled) { + checkModConfigs(); + } if (healthBarPluginEnabled) { getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled."); @@ -270,6 +277,10 @@ public class mcMMO extends JavaPlugin { return healthBarPluginEnabled; } + public static boolean isMCPCEnabled() { + return mcpcEnabled; + } + /** * Setup the various storage file paths */ @@ -381,4 +392,26 @@ public class mcMMO extends JavaPlugin { new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks); } } + + private void checkModConfigs() { + if (!Config.getInstance().getToolModsEnabled()) { + getLogger().info("MCPC+ implementation found, but the custom tool config for mcMMO is disabled!"); + getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml."); + } + + if (!Config.getInstance().getArmorModsEnabled()) { + getLogger().info("MCPC+ implementation found, but the custom armor config for mcMMO is disabled!"); + getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml."); + } + + if (!Config.getInstance().getBlockModsEnabled()) { + getLogger().info("MCPC+ implementation found, but the custom block config for mcMMO is disabled!"); + getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml."); + } + + if (!Config.getInstance().getEntityModsEnabled()) { + getLogger().info("MCPC+ implementation found, but the custom entity config for mcMMO is disabled!"); + getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml."); + } + } } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 1c3d187b9..39fbb44b4 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -86,7 +86,7 @@ public class Repair { protected static int getSalvagedAmount(ItemStack inHand) { // Temporary workaround until they get their stuff fixed. - if (mcMMO.p.getServer().getName().equals("MCPC+")) { + if (mcMMO.isMCPCEnabled()) { if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || ItemUtils.isBow(inHand) || inHand.getType() == Material.BUCKET) { return 3; }