From 4e8010aa00ee1c33a81b7aa28a5581d951f890d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Sun, 29 Sep 2013 10:31:29 +0200 Subject: [PATCH] Added permission to allow free catches despite costs in configuration file. --- .../EggCatcher/listeners/EggCatcherEntityListener.java | 6 ++++-- src/main/resources/plugin.yml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java b/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java index a8d64fc..f1ea7f6 100644 --- a/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java +++ b/src/main/java/me/shansen/EggCatcher/listeners/EggCatcherEntityListener.java @@ -188,8 +188,10 @@ public class EggCatcherEntityListener implements Listener { return; } } + + boolean freeCatch = player.hasPermission("eggcatcher.free"); - if (this.useVaultCost) { + if (this.useVaultCost && !freeCatch) { vaultCost = config.getDouble("VaultCost." + eggType.getFriendlyName()); if (!EggCatcher.economy.has(player.getName(), vaultCost)) { player.sendMessage(String.format(config.getString("Messages.VaultFail"), vaultCost)); @@ -209,7 +211,7 @@ public class EggCatcherEntityListener implements Listener { } } - if (this.useItemCost) { + if (this.useItemCost && !freeCatch) { int itemId = config.getInt("ItemCost.ItemId", 266); int itemData = config.getInt("ItemCost.ItemData", 0); int itemAmount = config.getInt("ItemCost.Amount." + eggType.getFriendlyName(), 0); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b252fa6..4abd8cb 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -33,4 +33,7 @@ permissions: eggcatcher.catch.ocelot: true eggcatcher.catch.bat: true eggcatcher.catch.witch: true - eggcatcher.catch.horse: true \ No newline at end of file + eggcatcher.catch.horse: true + eggcatcher.free: + description: Makes catching a mob free. + default: false \ No newline at end of file