mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-16 11:37:30 +02:00
New config options repair-enchanted (default true) and permission essentials.repair.enchanted
This commit is contained in:
@@ -138,4 +138,6 @@ public interface ISettings extends IConf
|
|||||||
Set<String> getNoGodWorlds();
|
Set<String> getNoGodWorlds();
|
||||||
|
|
||||||
boolean getUpdateBedAtDaytime();
|
boolean getUpdateBedAtDaytime();
|
||||||
|
|
||||||
|
boolean getRepairEnchanted();
|
||||||
}
|
}
|
||||||
|
@@ -549,4 +549,8 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
this.debug = debug;
|
this.debug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getRepairEnchanted() {
|
||||||
|
return config.getBoolean("repair-enchanted", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,14 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception(_("repairInvalidType"));
|
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 String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||||
|
|
||||||
@@ -104,6 +112,12 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
user.sendMessage(ex.getMessage());
|
user.sendMessage(ex.getMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!item.getEnchantments().isEmpty()
|
||||||
|
&& !ess.getSettings().getRepairEnchanted()
|
||||||
|
&& !user.isAuthorized("essentials.repair.enchanted"))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -227,6 +227,11 @@ no-god-in-worlds:
|
|||||||
# How many items should be in a oversized stack?
|
# How many items should be in a oversized stack?
|
||||||
oversized-stacksize: 64
|
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 | #
|
# | EssentialsHome | #
|
||||||
|
Reference in New Issue
Block a user