mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Made you able to add new abilities
This commit is contained in:
parent
eb81f7ca96
commit
4b7d748920
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material material, List<SecondaryAbility> 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<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, Material[] materials, List<SecondaryAbility> 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<? extends SkillManager> managerClass, Class<? extends SkillCommand> commandClass, boolean isChild, Color runescapeColor, SkillUseType skillUseType, AbilityType ability, List<SecondaryAbility> 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<? extends SkillManager> managerClass, Class<? extends SkillCommand> 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<? extends SkillManager> managerClass, Class<? extends SkillCommand> 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<? extends SkillManager> managerClass, Class<? extends SkillCommand> 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() {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
@ -186,6 +186,14 @@ public class AbilityType {
|
||||
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<AbilityType> getAbilities() {
|
||||
|
@ -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<SkillType> gatheringSkills = new ArrayList<SkillType>();
|
||||
private static List<SkillType> miscSkills = new ArrayList<SkillType>();
|
||||
|
||||
private static List<SkillType> abilitySkills = new ArrayList<SkillType>();
|
||||
|
||||
|
||||
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<String>();
|
||||
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<SkillType> getMiscSkills() {
|
||||
return miscSkills;
|
||||
}
|
||||
|
||||
public static List<SkillType> getAbilitySkills() {
|
||||
return abilitySkills;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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()); }
|
||||
|
@ -80,6 +80,10 @@ public class StringUtils {
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
public static String createStringForPermission(String baseString) {
|
||||
return baseString.replace("_", "").toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a string represents an Integer
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user