Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Added missing null check for enchantments. Fixes BUKKIT-897
Dieser Commit ist enthalten in:
Ursprung
90fae3b579
Commit
4ac2b08320
@ -150,6 +150,7 @@ public class ContainerEnchantTable extends Container {
|
||||
if (!this.world.isStatic) {
|
||||
List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]);
|
||||
|
||||
if (list != null) {
|
||||
// CraftBukkit start
|
||||
Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new HashMap<org.bukkit.enchantments.Enchantment, Integer>();
|
||||
for (Object obj : list) {
|
||||
@ -162,10 +163,9 @@ public class ContainerEnchantTable extends Container {
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
int level = event.getExpLevelCost();
|
||||
if (event.isCancelled() || (level > entityhuman.expLevel)) {
|
||||
if (event.isCancelled() || (level > entityhuman.expLevel) || enchants.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (enchants.isEmpty() == false) {
|
||||
entityhuman.levelDown(level);
|
||||
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
|
||||
try {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren