diff --git a/src/main/java/com/gmail/nossr50/api/AbilityAPI.java b/src/main/java/com/gmail/nossr50/api/AbilityAPI.java index cccdfe256..e770d8731 100644 --- a/src/main/java/com/gmail/nossr50/api/AbilityAPI.java +++ b/src/main/java/com/gmail/nossr50/api/AbilityAPI.java @@ -1,14 +1,18 @@ package com.gmail.nossr50.api; import org.bukkit.Material; +import org.bukkit.block.BlockState; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility; +import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.runnables.skills.BleedTimerTask; +import com.gmail.nossr50.skills.SkillAbilityManager; import com.gmail.nossr50.util.player.UserManager; public final class AbilityAPI { @@ -99,7 +103,23 @@ public final class AbilityAPI { } public static AbilityType createAbility(String name, String skillName, final Material... materials) { - return AbilityType.createAbility(name, skillName, materials); + return createAbility(name, skillName, 240, materials); + } + + public static AbilityType createAbility(String name, String skillName) { + return createAbility(name, skillName, 240); + } + + public static AbilityType createAbility(String name, String skillName, int cooldown, final Material... materials) { + AbilityType ability = AbilityType.createAbility(name, skillName, materials); + Config.getInstance().createAbility(ability, cooldown); + return ability; + } + + public static AbilityType createAbility(String name, String skillName, int cooldown) { + AbilityType ability = AbilityType.createAbility(name, skillName); + Config.getInstance().createAbility(ability, cooldown); + return ability; } public static SecondaryAbility createSecondaryAbility(String name, String skillName) { @@ -111,4 +131,18 @@ public final class AbilityAPI { AdvancedConfig.getInstance().createNewSkill(ability, skillName, maxBonusLevel, maxChance); return ability; } + + public static void activateSkillAbility(SkillType skill, Player player, BlockState blockState) { + SkillAbilityManager abilityManager = SkillAPI.getSkillAbilityManager(skill, player); + if(abilityManager != null) { + abilityManager.doAbilityPreparationCheck(blockState); + } + } + + public static void activateSkillAbility(SkillType skill, Player player) { + SkillAbilityManager abilityManager = SkillAPI.getSkillAbilityManager(skill, player); + if(abilityManager != null) { + abilityManager.doAbilityPreparationCheck(null); + } + } } diff --git a/src/main/java/com/gmail/nossr50/api/SkillAPI.java b/src/main/java/com/gmail/nossr50/api/SkillAPI.java index b25f07818..85ca42ff3 100644 --- a/src/main/java/com/gmail/nossr50/api/SkillAPI.java +++ b/src/main/java/com/gmail/nossr50/api/SkillAPI.java @@ -5,6 +5,8 @@ import java.util.List; import org.bukkit.Color; import org.bukkit.Material; +import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; import com.gmail.nossr50.commands.skills.SkillCommand; import com.gmail.nossr50.config.AdvancedConfig; @@ -13,9 +15,11 @@ import com.gmail.nossr50.datatypes.skills.SecondaryAbility; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.SkillType.SkillUseType; +import com.gmail.nossr50.skills.SkillAbilityManager; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandRegistrationManager; +import com.gmail.nossr50.util.player.UserManager; import com.google.common.collect.ImmutableList; public final class SkillAPI { @@ -109,8 +113,14 @@ public final class SkillAPI { return skill; } - public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material material, List secondaryAbilities) { - SkillType skill = SkillType.createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, ToolType.createToolType(StringUtils.getCapitalized(name), material), secondaryAbilities); + public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material[] materials, List secondaryAbilities) { + SkillType skill = SkillType.createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, ToolType.createToolType(StringUtils.getCapitalized(name), materials), secondaryAbilities); + CommandRegistrationManager.registerSkillCommandAndPassSkillToConstructor(skill); + return skill; + } + + public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, List secondaryAbilities) { + SkillType skill = SkillType.createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, ToolType.createToolType(StringUtils.getCapitalized(name)), secondaryAbilities); CommandRegistrationManager.registerSkillCommandAndPassSkillToConstructor(skill); return skill; } @@ -119,8 +129,24 @@ public final class SkillAPI { return createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ImmutableList.copyOf(secondaryAbilities)); } - public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material material, SecondaryAbility... secondaryAbilities) { - return createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, material, ImmutableList.copyOf(secondaryAbilities)); + public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material[] materials, SecondaryAbility... secondaryAbilities) { + return createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, materials, ImmutableList.copyOf(secondaryAbilities)); + } + + public static SkillType createSkill(String name, Class managerClass, Class commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, SecondaryAbility... secondaryAbilities) { + return createSkill(name, managerClass, commandClass, isChild, runescapeColor, skillUseType, ability, ImmutableList.copyOf(secondaryAbilities)); + } + + public static SkillManager getSkillManager(SkillType skill, Player player) { + return UserManager.getPlayer(player).getSkillManager(skill); + } + + public static SkillAbilityManager getSkillAbilityManager(SkillType skill, Player player) { + SkillManager skillManager = getSkillManager(skill, player); + if(skillManager instanceof SkillAbilityManager) { + return (SkillAbilityManager)skillManager; + } + return null; } public static void loadNewSkills() { diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 19d385089..a1967ad32 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -688,8 +688,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public void createNewSkill(SecondaryAbility skillAbility, String skillName, int maxBonusLevel, double maxChance) { String skillAbilityString = "Skills." + StringUtils.getCapitalized(skillName) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", ""); - config.set(skillAbilityString + ".MaxBonusLevel", maxBonusLevel); - config.set(skillAbilityString + ".ChanceMax", maxChance); + if(!config.contains(skillAbilityString + ".MaxBonusLevel")) { + config.set(skillAbilityString + ".MaxBonusLevel", maxBonusLevel); + } + if(!config.contains(skillAbilityString + ".ChanceMax")) { + config.set(skillAbilityString + ".ChanceMax", maxChance); + } try { config.save(getFile()); } catch (IOException e) { diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 3aa8d1706..243f915c7 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.config; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -236,6 +237,19 @@ public class Config extends AutoUpdateConfigLoader { @Override protected void loadKeys() {} + public void createAbility(AbilityType ability, int cooldown) { + String abilityString = "Abilities.Cooldowns." + ability.toString(); + if(config.contains(abilityString)) { + return; + } + config.set(abilityString, cooldown); + try { + config.save(getFile()); + } catch (IOException e) { + e.printStackTrace(); + } + } + /* * GENERAL SETTINGS */ diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 7e6311c27..c04cb203c 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -1488,6 +1488,15 @@ public final class SQLDatabaseManager implements DatabaseManager { statement.executeUpdate("ALTER TABLE `" + tablePrefix + "experience` ADD `" + skill + "` int(10) NOT NULL DEFAULT '0'"); } } + for (String ability : AbilityType.getLowerAbilitieNames()) { + try { + statement.executeQuery("SELECT `" + ability + "` FROM `" + tablePrefix + "cooldowns` LIMIT 1"); + } + catch (SQLException ex) { + mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing..."); + statement.executeUpdate("ALTER TABLE `" + tablePrefix + "cooldowns` ADD `" + ability + "` int(32) NOT NULL DEFAULT '0'"); + } + } } catch (SQLException ex) { printErrors(ex); diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 9a2eb37fb..078b74a1e 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -29,6 +29,7 @@ import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.runnables.skills.AbilityDisableTask; import com.gmail.nossr50.runnables.skills.ToolLowerTask; +import com.gmail.nossr50.skills.SkillAbilityManager; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.alchemy.AlchemyManager; @@ -702,6 +703,7 @@ public class McMMOPlayer { * Check to see if an ability can be activated. * * @param skill The skill the ability is based on + * @return whether the ability was successfully activated */ public void checkAbilityActivation(SkillType skill) { ToolType tool = skill.getTool(); @@ -749,7 +751,10 @@ public class McMMOPlayer { if (ability == AbilityType.superBreaker || ability == AbilityType.gigaDrillBreaker) { SkillUtils.handleAbilitySpeedIncrease(player); } - + SkillManager manager = this.getSkillManager(skill); + if(manager instanceof SkillAbilityManager) { + ((SkillAbilityManager) manager).onAbilityActivated(); + } new AbilityDisableTask(this, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java index ec44ca431..aff8f9007 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/AbilityType.java @@ -163,11 +163,11 @@ public class AbilityType { String capitalizedName = StringUtils.createPrettyStringWithSpacer(name, ""); String capitalizedSkill = StringUtils.getCapitalized(skillName); this.name = name; - this.abilityOn = capitalizedSkill + ".Skills." + capitalizedName + "On"; - this.abilityOff = capitalizedSkill + ".Skills." + capitalizedName + "Off"; - this.abilityPlayer = capitalizedSkill + ".Skills." + capitalizedName + "Other.On"; - this.abilityRefresh = capitalizedSkill + ".Skills." + capitalizedName + "Refresh"; - this.abilityPlayerOff = capitalizedSkill + ".Skills." + capitalizedName + "Other.Off"; + this.abilityOn = capitalizedSkill + ".Skills." + capitalizedName + ".On"; + this.abilityOff = capitalizedSkill + ".Skills." + capitalizedName + ".Off"; + this.abilityPlayer = capitalizedSkill + ".Skills." + capitalizedName + ".Other.On"; + this.abilityRefresh = capitalizedSkill + ".Skills." + capitalizedName + ".Refresh"; + this.abilityPlayerOff = capitalizedSkill + ".Skills." + capitalizedName + ".Other.Off"; } public static AbilityType createAbility(String name, String skillName, final Material... materials) { @@ -185,6 +185,14 @@ public class AbilityType { lowerAbilityNames.add(ability.getUnprettyName().toLowerCase()); return ability; } + + public static AbilityType createAbility(String name, String skillName) { + AbilityType ability = new AbilityType(name, skillName); + abilityTypes.add(ability); + abilityNames.add(ability.getUnprettyName()); + lowerAbilityNames.add(ability.getUnprettyName().toLowerCase()); + return ability; + } public int getCooldown() { return Config.getInstance().getCooldown(this); @@ -262,7 +270,7 @@ public class AbilityType { * @return true if the block is affected by this ability, false otherwise */ public boolean blockCheck(BlockState blockState) { - return false; + return true; } public static List getAbilities() { diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java index da5f4af74..0f9f5b064 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SkillType.java @@ -29,6 +29,7 @@ import com.gmail.nossr50.commands.skills.WoodcuttingCommand; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.SkillAbilityManager; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager; import com.gmail.nossr50.skills.alchemy.AlchemyManager; @@ -68,6 +69,8 @@ public class SkillType { private static List gatheringSkills = new ArrayList(); private static List miscSkills = new ArrayList(); + private static List abilitySkills = new ArrayList(); + public static final SkillType acrobatics = createSkill("ACROBATICS" , AcrobaticsManager.class , AcrobaticsCommand.class , false, Color.WHITE, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.dodge, SecondaryAbility.gracefullRoll, SecondaryAbility.roll)); public static final SkillType alchemy = createSkill("ALCHEMY" , AlchemyManager.class , AlchemyCommand.class , false, Color.FUCHSIA, SkillUseType.MISC, ImmutableList.of(SecondaryAbility.catalysis, SecondaryAbility.concoctions)); @@ -280,11 +283,15 @@ public class SkillType { public static void setUpSkillTypes() { Collections.sort(skillNames); - lowerSkillNames = new ArrayList(); + lowerSkillNames.clear(); + abilitySkills.clear(); for(SkillType skill : nonChildSkills) { if(skill != null) { lowerSkillNames.add(skill.getName()); } + if(SkillAbilityManager.class.isAssignableFrom(skill.getManagerClass())) { + abilitySkills.add(skill); + } } } @@ -319,4 +326,8 @@ public class SkillType { public static List getMiscSkills() { return miscSkills; } + + public static List getAbilitySkills() { + return abilitySkills; + } } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 1fb2314f2..3f4e7efc7 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -33,6 +33,7 @@ import com.gmail.nossr50.events.fake.FakeBlockBreakEvent; import com.gmail.nossr50.events.fake.FakeBlockDamageEvent; import com.gmail.nossr50.runnables.PistonTrackerTask; import com.gmail.nossr50.runnables.StickyPistonTrackerTask; +import com.gmail.nossr50.skills.SkillAbilityManager; import com.gmail.nossr50.skills.alchemy.Alchemy; import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.herbalism.Herbalism; diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 47d565973..b5da41bdb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -547,6 +547,10 @@ public class PlayerListener implements Listener { mcMMOPlayer.processAbilityActivation(SkillType.swords); mcMMOPlayer.processAbilityActivation(SkillType.unarmed); mcMMOPlayer.processAbilityActivation(SkillType.woodcutting); + + for(SkillType skill : SkillType.getAbilitySkills()) { + mcMMOPlayer.processAbilityActivation(skill); + } } ChimaeraWing.activationCheck(player); diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index bedf10007..088df8e7c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -9,6 +9,9 @@ import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.AbilityType; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.skills.SkillAbilityManager; +import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.skills.ParticleEffectUtils; @@ -53,6 +56,10 @@ public class AbilityDisableTask extends BukkitRunnable { } SkillUtils.sendSkillMessage(player, ability.getAbilityPlayerOff(player)); + SkillManager manager = mcMMOPlayer.getSkillManager(SkillType.byAbility(ability)); + if(manager instanceof SkillAbilityManager) { + ((SkillAbilityManager) manager).onAbilityDeactivated(); + } new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); } diff --git a/src/main/java/com/gmail/nossr50/skills/SkillAbilityManager.java b/src/main/java/com/gmail/nossr50/skills/SkillAbilityManager.java new file mode 100644 index 000000000..715e8b484 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/skills/SkillAbilityManager.java @@ -0,0 +1,37 @@ +package com.gmail.nossr50.skills; + +import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.AbilityType; +import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.datatypes.skills.ToolType; +import com.gmail.nossr50.util.Permissions; + +public class SkillAbilityManager extends SkillManager { + + public SkillAbilityManager(McMMOPlayer mcMMOPlayer, SkillType skill) { + super(mcMMOPlayer, skill); + } + + public void doAbilityPreparationCheck(BlockState blockState) { + ToolType tool = skill.getTool(); + AbilityType ability = skill.getAbility(); + if (mcMMOPlayer.getToolPreparationMode(tool) && tool.inHand(getPlayer().getItemInHand()) && ability.blockCheck(blockState) && Permissions.skillAbility(getPlayer(), skill) && canAbilityActivate(getPlayer(), getPlayer().getItemInHand(), blockState)) { + mcMMOPlayer.checkAbilityActivation(skill); + } + } + + public boolean canAbilityActivate(Player player, ItemStack itemInHand, BlockState blockState) { + return true; + } + + public void onAbilityActivated() { + } + + public void onAbilityDeactivated() { + } + +} diff --git a/src/main/java/com/gmail/nossr50/skills/SkillManager.java b/src/main/java/com/gmail/nossr50/skills/SkillManager.java index 3d8ffec57..5b6940248 100644 --- a/src/main/java/com/gmail/nossr50/skills/SkillManager.java +++ b/src/main/java/com/gmail/nossr50/skills/SkillManager.java @@ -1,15 +1,23 @@ package com.gmail.nossr50.skills; +import org.bukkit.block.BlockState; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.SkillType; +import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.XPGainReason; +import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.skills.PerksUtils; +import com.gmail.nossr50.util.skills.SkillUtils; public abstract class SkillManager { + public boolean usesAPIAbilitySystem = false; + protected McMMOPlayer mcMMOPlayer; protected int activationChance; protected SkillType skill; diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index d46d94f1c..8834644b4 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -128,6 +128,7 @@ public final class Permissions { * SKILLS */ + public static boolean skillAbility(Permissible permissible, SkillType skill) { return (skill.getAbility() == null) ? false : permissible.hasPermission("mcmmo.ability." + StringUtils.createStringForPermission(skill.getName()) + "." + StringUtils.createStringForPermission(skill.getAbility().getUnprettyName())); } public static boolean skillEnabled(Permissible permissible, SkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase()); } public static boolean vanillaXpBoost(Permissible permissible, SkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".vanillaxpboost"); } public static boolean secondaryAbilityEnabled(Permissible permissible, SecondaryAbility skillAbility) { return permissible.hasPermission("mcmmo.ability." + SkillType.bySecondaryAbility(skillAbility).toString().toLowerCase() + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace(" ", "").toLowerCase()); } @@ -189,7 +190,7 @@ public final class Permissions { /* WOODCUTTING */ public static boolean treeFeller(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.woodcutting.treefeller"); } - + /* * PARTY */ diff --git a/src/main/java/com/gmail/nossr50/util/StringUtils.java b/src/main/java/com/gmail/nossr50/util/StringUtils.java index e5581e56b..3081250ab 100644 --- a/src/main/java/com/gmail/nossr50/util/StringUtils.java +++ b/src/main/java/com/gmail/nossr50/util/StringUtils.java @@ -79,6 +79,10 @@ public class StringUtils { return prettyString; } + + public static String createStringForPermission(String baseString) { + return baseString.replace("_", "").toLowerCase(); + } /** * Determine if a string represents an Integer