Abilities no longer activate if you don't have permission

This commit is contained in:
nossr50 2019-02-04 22:04:50 -08:00
parent 9a428332a9
commit 4ea5432561
6 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,7 @@ Key:
! Change ! Change
- Removal - Removal
Version 2.1.8 Version 2.1.8
Fixed a bug where Abilities didn't check for permission nodes before activating
MaxBonusLevel now has specific entries for Standard and Retro in advanced.yml MaxBonusLevel now has specific entries for Standard and Retro in advanced.yml
MaxBonusLevel for Critical Strikes changed from 75/750 to 100/1000 MaxBonusLevel for Critical Strikes changed from 75/750 to 100/1000
MaxBonusLevel of Dodge changed from 80/800 to 100/1000 MaxBonusLevel of Dodge changed from 80/800 to 100/1000

View File

@ -791,7 +791,7 @@ public class McMMOPlayer {
ToolType tool = skill.getTool(); ToolType tool = skill.getTool();
SuperAbilityType ability = skill.getAbility(); SuperAbilityType ability = skill.getAbility();
if (getAbilityMode(ability)) { if (getAbilityMode(ability) || !ability.getPermissions(player)) {
return; return;
} }
@ -894,7 +894,7 @@ public class McMMOPlayer {
* Woodcutting & Axes need to be treated differently. * Woodcutting & Axes need to be treated differently.
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action * Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
*/ */
if (ability.getPermissions(player) && tool.inHand(inHand) && !getToolPreparationMode(tool)) { if (tool.inHand(inHand) && !getToolPreparationMode(tool)) {
if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) { if (skill != PrimarySkillType.WOODCUTTING && skill != PrimarySkillType.AXES) {
int timeRemaining = calculateTimeRemaining(ability); int timeRemaining = calculateTimeRemaining(ability);

View File

@ -46,7 +46,7 @@ public class SwordsManager extends SkillManager {
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES)) if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES))
return false; return false;
return mcMMOPlayer.getAbilityMode(SuperAbilityType.SERRATED_STRIKES) && Permissions.serratedStrikes(getPlayer()); return mcMMOPlayer.getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
} }
/** /**

View File

@ -43,7 +43,7 @@ public class UnarmedManager extends SkillManager {
} }
public boolean canUseBerserk() { public boolean canUseBerserk() {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && Permissions.berserk(getPlayer()); return mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK);
} }
public boolean canDisarm(LivingEntity target) { public boolean canDisarm(LivingEntity target) {

View File

@ -38,7 +38,8 @@ public class WoodcuttingManager extends SkillManager {
} }
public boolean canUseTreeFeller(ItemStack heldItem) { public boolean canUseTreeFeller(ItemStack heldItem) {
return mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) && Permissions.treeFeller(getPlayer()) && ItemUtils.isAxe(heldItem); return mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER)
&& ItemUtils.isAxe(heldItem);
} }
protected boolean canGetDoubleDrops() { protected boolean canGetDoubleDrops() {

View File

@ -198,7 +198,6 @@ public final class Permissions {
/* /*
* PARTY * PARTY
*/ */
public static boolean partySizeBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.partylimit" ); } public static boolean partySizeBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.partylimit" ); }
public static boolean party(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.party"); } public static boolean party(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.party"); }
public static boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase()); } public static boolean partySubcommand(Permissible permissible, PartySubcommandType subcommand) { return permissible.hasPermission("mcmmo.commands.party." + subcommand.toString().toLowerCase()); }