testserver/CraftBukkit-Patches/0108-Log-null-TileEntity-Ow...

30 lines
1.3 KiB
Diff
Raw Normal View History

2015-06-01 09:22:52 +00:00
From 0ceed1d335bb351dc9f27ca0882e993284f88949 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 20 Apr 2014 11:16:54 +1000
Subject: [PATCH] Log null TileEntity Owner
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
2015-05-25 12:05:40 +00:00
index b8d0961..c268a40 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
2015-05-25 12:05:40 +00:00
@@ -229,7 +229,14 @@ public abstract class TileEntity {
// CraftBukkit start - add method
public InventoryHolder getOwner() {
2015-03-22 19:50:13 +00:00
if (world == null) return null;
2014-11-28 01:17:45 +00:00
- org.bukkit.block.BlockState state = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState();
+ // Spigot start
2014-11-28 01:17:45 +00:00
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
+ if (block == null) {
2014-11-28 01:17:45 +00:00
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), position.getX(), position.getY(), position.getZ()});
+ return null;
+ }
+ // Spigot end
+ org.bukkit.block.BlockState state = block.getState();
if (state instanceof InventoryHolder) return (InventoryHolder) state;
return null;
}
--
2015-05-09 20:23:26 +00:00
2.1.4