diff options
author | snowleo <schneeleo@gmail.com> | 2011-12-02 08:30:52 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-12-02 08:30:52 +0100 |
commit | 1489203acaabfd48efe4868a51f7b5d7f48722b6 (patch) | |
tree | 502bee174e7dcade454379a5430a42d370e43e6e | |
parent | 1f1b6aff5482dc8494f7302c18e9bacb0f511787 (diff) | |
download | Essentials-1489203acaabfd48efe4868a51f7b5d7f48722b6.tar Essentials-1489203acaabfd48efe4868a51f7b5d7f48722b6.tar.gz Essentials-1489203acaabfd48efe4868a51f7b5d7f48722b6.tar.lz Essentials-1489203acaabfd48efe4868a51f7b5d7f48722b6.tar.xz Essentials-1489203acaabfd48efe4868a51f7b5d7f48722b6.zip |
New config options repair-enchanted (default true) and permission essentials.repair.enchanted
4 files changed, 25 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 9724d1a16..d7764ed16 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -138,4 +138,6 @@ public interface ISettings extends IConf Set<String> getNoGodWorlds(); boolean getUpdateBedAtDaytime(); + + boolean getRepairEnchanted(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index ac74329ec..b65d53616 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -549,4 +549,8 @@ public class Settings implements ISettings { this.debug = debug; } + + public boolean getRepairEnchanted() { + return config.getBoolean("repair-enchanted", true); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 50c6ac7af..cf9e43f9f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -32,6 +32,14 @@ public class Commandrepair extends EssentialsCommand { throw new Exception(_("repairInvalidType")); } + + if (!item.getEnchantments().isEmpty() + && !ess.getSettings().getRepairEnchanted() + && !user.isAuthorized("essentials.repair.enchanted")) + { + throw new Exception(_("repairEnchanted")); + } + final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); @@ -104,6 +112,12 @@ public class Commandrepair extends EssentialsCommand user.sendMessage(ex.getMessage()); continue; } + if (!item.getEnchantments().isEmpty() + && !ess.getSettings().getRepairEnchanted() + && !user.isAuthorized("essentials.repair.enchanted")) + { + continue; + } try { diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index e1a7e9d5a..f9eaa2ba4 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -227,6 +227,11 @@ no-god-in-worlds: # How many items should be in a oversized stack? oversized-stacksize: 64 +# Do you allow to repair enchanted weapons and armor? +# If you set this to false, you can still allow it for certain players using the permission +# essentials.repair.enchanted +repair-enchanted: true + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # |