SPIGOT-5650: Lectern.setPage(int) causes a NullPointerException

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-04-01 09:30:47 +11:00
parent 7cc234d159
commit deee71fef3
2 changed files with 21 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockLectern;
import net.minecraft.server.TileEntityLectern;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -40,4 +41,15 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
return new CraftInventoryLectern(this.getTileEntity().inventory);
}
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
if (result && this.isPlaced() && this.getType() == Material.LECTERN) {
BlockLectern.a(this.world.getHandle(), this.getPosition(), this.getHandle());
}
return result;
}
}