mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-05 15:02:16 +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 allowUnsafeEnchantments();
|
||||||
|
|
||||||
boolean allowUnsafeEnchantmentsInKits();
|
|
||||||
|
|
||||||
boolean getRepairEnchanted();
|
boolean getRepairEnchanted();
|
||||||
|
|
||||||
boolean isWorldTeleportPermissions();
|
boolean isWorldTeleportPermissions();
|
||||||
|
@ -174,7 +174,7 @@ public class Kit
|
|||||||
IText output = new KeywordReplacer(input, user.getSource(), ess);
|
IText output = new KeywordReplacer(input, user.getSource(), ess);
|
||||||
|
|
||||||
boolean spew = false;
|
boolean spew = false;
|
||||||
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantmentsInKits();
|
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
|
||||||
for (String kitItem : output.getLines())
|
for (String kitItem : output.getLines())
|
||||||
{
|
{
|
||||||
if (kitItem.startsWith(ess.getSettings().getCurrencySymbol()))
|
if (kitItem.startsWith(ess.getSettings().getCurrencySymbol()))
|
||||||
|
@ -944,12 +944,6 @@ public class Settings implements net.ess3.api.ISettings
|
|||||||
return config.getBoolean("repair-enchanted", true);
|
return config.getBoolean("repair-enchanted", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean allowUnsafeEnchantmentsInKits()
|
|
||||||
{
|
|
||||||
return config.getBoolean("unsafe-enchantments-in-kits", config.getBoolean("unsafe-enchantments", false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowUnsafeEnchantments()
|
public boolean allowUnsafeEnchantments()
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,8 @@ public class SignEnchant extends EssentialsSign
|
|||||||
sign.setLine(2, "§c<enchant>");
|
sign.setLine(2, "§c<enchant>");
|
||||||
throw new SignException(ex.getMessage(), ex);
|
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()))
|
if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel()))
|
||||||
{
|
{
|
||||||
level = enchantment.getMaxLevel();
|
level = enchantment.getMaxLevel();
|
||||||
@ -127,7 +128,7 @@ public class SignEnchant extends EssentialsSign
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ess.getSettings().allowUnsafeEnchantments())
|
if (ess.getSettings().allowUnsafeEnchantments() && player.isAuthorized("essentials.signs.enchant.allowunsafe"))
|
||||||
{
|
{
|
||||||
toEnchant.addUnsafeEnchantment(enchantment, level);
|
toEnchant.addUnsafeEnchantment(enchantment, level);
|
||||||
}
|
}
|
||||||
|
@ -395,11 +395,7 @@ oversized-stacksize: 64
|
|||||||
# essentials.repair.enchanted
|
# essentials.repair.enchanted
|
||||||
repair-enchanted: true
|
repair-enchanted: true
|
||||||
|
|
||||||
# Allow 'unsafe' enchantments in kits.
|
# Allow 'unsafe' enchantments in kits and item spawning.
|
||||||
# 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.
|
|
||||||
# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
|
# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
|
||||||
unsafe-enchantments: false
|
unsafe-enchantments: false
|
||||||
|
|
||||||
|
@ -1195,4 +1195,10 @@ public class FakeServer implements Server
|
|||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
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