diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index ffd22f509..f3959bea8 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.commands.skills; +import org.bukkit.entity.EntityType; + import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.locale.LocaleLoader; @@ -36,7 +38,7 @@ public class TamingCommand extends SkillCommand { @Override protected void permissionsCheck() { canBeastLore = Permissions.beastLore(player); - canCallWild = Permissions.callOfTheWild(player); + canCallWild = Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT); canEnvironmentallyAware = Permissions.environmentallyAware(player); canFastFood = Permissions.fastFoodService(player); canGore = Permissions.gore(player); diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index f47c1ba8c..993c48669 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -572,7 +572,7 @@ public class PlayerListener implements Listener { case LEFT_CLICK_BLOCK: /* CALL OF THE WILD CHECKS */ - if (player.isSneaking() && Permissions.callOfTheWild(player)) { + if (player.isSneaking()) { Material type = heldItem.getType(); TamingManager tamingManager = mcMMOPlayer.getTamingManager(); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index b96967631..741d935f0 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -130,6 +130,10 @@ public class TamingManager extends SkillManager { * Summon an ocelot to your side. */ public void summonOcelot() { + if (!Permissions.callOfTheWild(getPlayer(), EntityType.OCELOT)) { + return; + } + callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWOcelotCost()); } @@ -137,6 +141,10 @@ public class TamingManager extends SkillManager { * Summon a wolf to your side. */ public void summonWolf() { + if (!Permissions.callOfTheWild(getPlayer(), EntityType.WOLF)) { + return; + } + callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost()); } diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index aad23d435..8fb1419a8 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.util; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.entity.EntityType; import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; @@ -196,8 +197,8 @@ public final class Permissions { /* TAMING */ public static boolean beastLore(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.beastlore"); } - public static boolean callOfTheWild(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild"); } - public static boolean renamePets(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild_renamepets"); } + public static boolean callOfTheWild(Permissible permissible, EntityType type) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild." + type.toString().toLowerCase()); } + public static boolean renamePets(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.callofthewild.renamepets"); } public static boolean environmentallyAware(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.environmentallyaware"); } public static boolean fastFoodService(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.fastfoodservice"); } public static boolean gore(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.taming.gore"); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d8048b7c1..4d0b26f41 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -525,8 +525,7 @@ permissions: description: Allows access to all Taming abilities children: mcmmo.ability.taming.beastlore: true - mcmmo.ability.taming.callofthewild: true - mcmmo.ability.taming.callofthewild_renamepets: true + mcmmo.ability.taming.callofthewild.all: true mcmmo.ability.taming.environmentallyaware: true mcmmo.ability.taming.fastfoodservice: true mcmmo.ability.taming.gore: true @@ -536,10 +535,33 @@ permissions: mcmmo.ability.taming.thickfur: true mcmmo.ability.taming.beastlore: description: Allows access to the Beast Lore ability - mcmmo.ability.taming.callofthewild: + mcmmo.ability.taming.callofthewild.*: + default: false description: Allows access to the Call of the Wild ability + children: + mcmmo.ability.taming.callofthewild.all: true + mcmmo.ability.taming.callofthewild: + default: false + description: Allows access to the Call of the Wild ability + children: + mcmmo.ability.taming.callofthewild.all: true + mcmmo.ability.taming.callofthewild.all: + description: Allows access to the Call of the Wild abilities + children: + mcmmo.ability.taming.callofthewild.ocelot: true + mcmmo.ability.taming.callofthewild.renamepets: true + mcmmo.ability.taming.callofthewild.wolf: true + mcmmo.ability.taming.callofthewild.ocelot: + description: Allows players to summon Ocelots with Call of the Wild + mcmmo.ability.taming.callofthewild.renamepets: + description: Allows players to rename pets with Call of the Wild + mcmmo.ability.taming.callofthewild.wolf: + description: Allows players to summon Wolves with Call of the Wild mcmmo.ability.taming.callofthewild_renamepets: + default: false description: Pets spawned with Call of the Wild will have custom names + children: + mcmmo.ability.taming.callofthewild.renamepets: true mcmmo.ability.taming.environmentallyaware: description: Allows access to the Environmentally Aware ability mcmmo.ability.taming.fastfoodservice: