Permalink
Browse files

Fixed console flooding on server startup

  • Loading branch information...
1 parent 9f2deb5 commit bb762e437857590ee77d85a0d6869b798d136552 @brad811 committed Apr 14, 2011
View
13 src/com/bradsproject/com/bradsproject/BradleyJewell/bMobs/bMobsEntityListener.java
@@ -30,13 +30,18 @@ public void onEntityTarget(EntityTargetEvent event)
@Override
public void onCreatureSpawn(CreatureSpawnEvent event)
{
- //event.getEntity().getWorld();
World world = event.getLocation().getWorld();
- bMobsWorld w = plugin.worlds.get(world.getName());
+ bMobsWorld w = plugin.worlds.get(world.getName());
String mobType = event.getCreatureType().name().replace("_", "").toLowerCase();
- if(!w.active.contains(mobType))
+
+ try {
+ if(!w.active.contains(mobType))
+ {
+ event.setCancelled(true);
+ }
+ }catch(NullPointerException e)
{
- event.setCancelled(true);
+ // the world hasn't finished loading yet!
}
}
}
View
4 src/com/bradsproject/com/bradsproject/BradleyJewell/bMobs/bMobsWorldListener.java
@@ -3,8 +3,8 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-import org.bukkit.event.world.WorldEvent;
import org.bukkit.event.world.WorldListener;
+import org.bukkit.event.world.WorldLoadEvent;
public class bMobsWorldListener extends WorldListener
{
@@ -16,7 +16,7 @@ public bMobsWorldListener(bMobs instance)
}
@Override
- public void onWorldLoad(WorldEvent event)
+ public void onWorldLoad(WorldLoadEvent event)
{
try
{

0 comments on commit bb762e4

Please sign in to comment.