mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-03 19:15:44 +00:00
New config options repair-enchanted (default true) and permission essentials.repair.enchanted
This commit is contained in:
parent
1f1b6aff54
commit
1489203aca
4 changed files with 25 additions and 0 deletions
|
@ -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 | #
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue