[Forge] Better handle null platform field in ForgeWorldEdit.

This commit is contained in:
sk89q 2014-07-31 16:41:40 -07:00
parent 6e739b3000
commit 7eb487aef7

View File

@ -106,7 +106,7 @@ public class ForgeWorldEdit {
} }
@EventHandler @EventHandler
public void serverAboutToSTart(FMLServerAboutToStartEvent event) { public void serverAboutToStart(FMLServerAboutToStartEvent event) {
if (this.platform != null) { if (this.platform != null) {
logger.warning("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't"); logger.warning("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't");
WorldEdit.getInstance().getPlatformManager().unregister(platform); WorldEdit.getInstance().getPlatformManager().unregister(platform);
@ -144,6 +144,11 @@ public class ForgeWorldEdit {
@ForgeSubscribe @ForgeSubscribe
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (platform == null) {
logger.warning("WorldEdit didn't initialize correctly! Please report this error.");
return;
}
if (!platform.isHookingEvents()) return; // We have to be told to catch these events if (!platform.isHookingEvents()) return; // We have to be told to catch these events
if (event.useItem == Result.DENY || event.entity.worldObj.isRemote) return; if (event.useItem == Result.DENY || event.entity.worldObj.isRemote) return;