Fix for potential NPE in CraftBukkit caused by LWC location world returning null
This commit is contained in:
		@@ -30,9 +30,15 @@ public class LWCFeatures
 | 
			
		||||
		P.p.log("Successfully hooked into LWC!"+(Conf.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\")."));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static boolean getEnabled()
 | 
			
		||||
	{
 | 
			
		||||
		return Conf.lwcIntegration && lwc != null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void clearOtherChests(FLocation flocation, Faction faction)
 | 
			
		||||
	{
 | 
			
		||||
		Location location = new Location(Bukkit.getWorld(flocation.getWorldName()), flocation.getX() * 16, 5, flocation.getZ() * 16);
 | 
			
		||||
		if (location.getWorld() == null) return;  // world not loaded or something? cancel out to prevent error
 | 
			
		||||
		Chunk chunk = location.getChunk();
 | 
			
		||||
		BlockState[] blocks = chunk.getTileEntities();
 | 
			
		||||
		List<Block> chests = new LinkedList<Block>();
 | 
			
		||||
@@ -58,6 +64,7 @@ public class LWCFeatures
 | 
			
		||||
	public static void clearAllChests(FLocation flocation)
 | 
			
		||||
	{
 | 
			
		||||
		Location location = new Location(Bukkit.getWorld(flocation.getWorldName()), flocation.getX() * 16, 5, flocation.getZ() * 16);
 | 
			
		||||
		if (location.getWorld() == null) return;  // world not loaded or something? cancel out to prevent error
 | 
			
		||||
		Chunk chunk = location.getChunk();
 | 
			
		||||
		BlockState[] blocks = chunk.getTileEntities();
 | 
			
		||||
		List<Block> chests = new LinkedList<Block>();
 | 
			
		||||
@@ -78,9 +85,4 @@ public class LWCFeatures
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static boolean getEnabled()
 | 
			
		||||
	{
 | 
			
		||||
		return Conf.lwcIntegration && lwc != null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user