How can I set a mob to not attack it's owner(Player who spawned it in with egg) What I have as of now: Code (Move your mouse to reveal the content) Code (open) Code (close) Code: @EventHandler public void onCreatureSpawn(CreatureSpawnEvent event) { final Entity e=event.getEntity(); Player spawner=null; if(spawner != null && e.getType() == EntityType.SKELETON || e.getType() == EntityType.CREEPER || e.getType() == EntityType.WITHER || e.getType() == EntityType.ZOMBIE || e.getType() == EntityType.SKELETON || e.getType() == EntityType.PIG_ZOMBIE || e.getType() == EntityType.SPIDER || e.getType() == EntityType.CAVE_SPIDER || e.getType() == EntityType.BLAZE || e.getType() == EntityType.SKELETON || e.getType() == EntityType.ENDERMAN || e.getType() == EntityType.GHAST || e.getType() == EntityType.WITCH || e.getType() == EntityType.SILVERFISH || e.getType() == EntityType.IRON_GOLEM && ((CreatureSpawnEvent) e).getSpawnReason() == SpawnReason.EGG) { } }
Well I can't answer your question but for starters try setting Players spawner as a variable other then null.