New config options repair-enchanted (default true) and permission essentials.repair.enchanted

This commit is contained in:
snowleo 2011-12-02 08:30:52 +01:00
parent 1f1b6aff54
commit 1489203aca
4 changed files with 25 additions and 0 deletions

View File

@ -138,4 +138,6 @@ public interface ISettings extends IConf
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
boolean getRepairEnchanted();
}

View File

@ -549,4 +549,8 @@ public class Settings implements ISettings
{
this.debug = debug;
}
public boolean getRepairEnchanted() {
return config.getBoolean("repair-enchanted", true);
}
}

View File

@ -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
{

View File

@ -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 | #