mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 10:31:31 +01:00
Alternative implementation of unsafe enchant blocking for signs.
Permission: essentials.signs.enchant.allowunsafe - required to add unsafe enchants using enchant signs.
This reverts commit 3f2c2aadbb
.
This commit is contained in:
parent
34599b7428
commit
e409363426
@ -156,8 +156,6 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean allowUnsafeEnchantments();
|
||||
|
||||
boolean allowUnsafeEnchantmentsInKits();
|
||||
|
||||
boolean getRepairEnchanted();
|
||||
|
||||
boolean isWorldTeleportPermissions();
|
||||
|
@ -174,7 +174,7 @@ public class Kit
|
||||
IText output = new KeywordReplacer(input, user.getSource(), ess);
|
||||
|
||||
boolean spew = false;
|
||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantmentsInKits();
|
||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
|
||||
for (String kitItem : output.getLines())
|
||||
{
|
||||
if (kitItem.startsWith(ess.getSettings().getCurrencySymbol()))
|
||||
|
@ -944,12 +944,6 @@ public class Settings implements net.ess3.api.ISettings
|
||||
return config.getBoolean("repair-enchanted", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUnsafeEnchantmentsInKits()
|
||||
{
|
||||
return config.getBoolean("unsafe-enchantments-in-kits", config.getBoolean("unsafe-enchantments", false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowUnsafeEnchantments()
|
||||
{
|
||||
|
@ -50,7 +50,8 @@ public class SignEnchant extends EssentialsSign
|
||||
sign.setLine(2, "§c<enchant>");
|
||||
throw new SignException(ex.getMessage(), ex);
|
||||
}
|
||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && player.isAuthorized("essentials.enchantments.allowunsafe");
|
||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments()
|
||||
&& player.isAuthorized("essentials.enchantments.allowunsafe") && player.isAuthorized("essentials.signs.enchant.allowunsafe");
|
||||
if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel()))
|
||||
{
|
||||
level = enchantment.getMaxLevel();
|
||||
@ -127,7 +128,7 @@ public class SignEnchant extends EssentialsSign
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ess.getSettings().allowUnsafeEnchantments())
|
||||
if (ess.getSettings().allowUnsafeEnchantments() && player.isAuthorized("essentials.signs.enchant.allowunsafe"))
|
||||
{
|
||||
toEnchant.addUnsafeEnchantment(enchantment, level);
|
||||
}
|
||||
|
@ -395,11 +395,7 @@ oversized-stacksize: 64
|
||||
# essentials.repair.enchanted
|
||||
repair-enchanted: true
|
||||
|
||||
# Allow 'unsafe' enchantments in kits.
|
||||
# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
|
||||
unsafe-enchantments-in-kits: false
|
||||
|
||||
# Allow 'unsafe' enchantments in item spawning.
|
||||
# Allow 'unsafe' enchantments in kits and item spawning.
|
||||
# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
|
||||
unsafe-enchantments: false
|
||||
|
||||
|
@ -1195,4 +1195,10 @@ public class FakeServer implements Server
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BanList getBanList(BanList.Type arg0)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user