/** * Gets the type of creature being spawned. * * @return A CreatureType value detailing the type of creature being * spawned * @deprecated In favour of {@link #getEntityType()}. */ @Deprecated public CreatureType getCreatureType() { return CreatureType.fromEntityType(getEntityType()); }
/** * Gets the type of creature being spawned. * * @return A CreatureType value detailing the type of creature being * spawned * @deprecated In favour of {@link #getEntityType()}. */ @Deprecated public CreatureType getCreatureType() { return CreatureType.fromEntityType(getEntityType()); }
@EventHandler public void onEntitySpawn(CreatureSpawnEvent ese) { if (BedwarsRel.getInstance().getGameManager() == null) { return; } if (ese.getLocation() == null) { return; } if (ese.getLocation().getWorld() == null) { return; } Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(ese.getLocation()); if (game == null) { return; } if (game.getState() == GameState.STOPPED) { return; } if (ese.getEntityType().equals(EntityType.CREEPER) || ese.getEntityType().equals(EntityType.CAVE_SPIDER) || ese.getEntityType().equals(EntityType.SPIDER) || ese.getEntityType().equals(EntityType.ZOMBIE) || ese.getEntityType().equals(EntityType.SKELETON) || ese.getEntityType().equals(EntityType.SILVERFISH)) { ese.setCancelled(true); } }
@EventHandler public void onEntitySpawn(CreatureSpawnEvent ese) { if (BedwarsRel.getInstance().getGameManager() == null) { return; } if (ese.getLocation() == null) { return; } if (ese.getLocation().getWorld() == null) { return; } Game game = BedwarsRel.getInstance().getGameManager().getGameByLocation(ese.getLocation()); if (game == null) { return; } if (game.getState() == GameState.STOPPED) { return; } if (ese.getEntityType().equals(EntityType.CREEPER) || ese.getEntityType().equals(EntityType.CAVE_SPIDER) || ese.getEntityType().equals(EntityType.SPIDER) || ese.getEntityType().equals(EntityType.ZOMBIE) || ese.getEntityType().equals(EntityType.SKELETON) || ese.getEntityType().equals(EntityType.SILVERFISH)) { ese.setCancelled(true); } }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) public void onCreatureSpawn(CreatureSpawnEvent event) { if (event.getLocation() == null) { return; } if (Conf.safeZoneNerfedCreatureTypes.contains(event.getEntityType()) && Board.getInstance().getFactionAt(new FLocation(event.getLocation())).noMonstersInTerritory()) { event.setCancelled(true); } }
/** * Track where the mob was created. This will determine its allowable movement zone. * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onMobSpawn(CreatureSpawnEvent e) { if (getIWM().inWorld(e.getLocation()) && getIWM().getGeoLimitSettings(e.getLocation().getWorld()).contains(e.getEntityType().name())) { getIslands().getIslandAt(e.getLocation()).ifPresent(i -> mobSpawnTracker.put(e.getEntity(), i)); } }
@EventHandler(priority = EventPriority.LOWEST) public void onEntitySpawn(CreatureSpawnEvent event) { //these rules apply only to creative worlds if(!GriefPrevention.instance.creativeRulesApply(event.getLocation())) return; //chicken eggs and breeding could potentially make a mess in the wilderness, once griefers get involved SpawnReason reason = event.getSpawnReason(); if(reason != SpawnReason.SPAWNER_EGG && reason != SpawnReason.BUILD_IRONGOLEM && reason != SpawnReason.BUILD_SNOWMAN && event.getEntityType() != EntityType.ARMOR_STAND) { event.setCancelled(true); return; } //otherwise, just apply the limit on total entities per claim (and no spawning in the wilderness!) Claim claim = this.dataStore.getClaimAt(event.getLocation(), false, null); if(claim == null || claim.allowMoreEntities(true) != null) { event.setCancelled(true); return; } }
/** * This handles end dragon spawning prevention * * @param e - event * @return true if dragon can spawn, false if not */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public boolean onDragonSpawn(CreatureSpawnEvent e) { if (!e.getEntityType().equals(EntityType.ENDER_DRAGON) || plugin.getIWM().isDragonSpawn(e.getEntity().getWorld())) { return true; } e.getEntity().setHealth(0); e.getEntity().remove(); e.setCancelled(true); return false; }
public void onCreatureSpawn(CreatureSpawnEvent event) { if (!arena.getRegion().contains(event.getLocation())) { return; } if (arena.inEditMode() && event.getEntityType() == EntityType.ARMOR_STAND) { return; } if (event.getSpawnReason() != SpawnReason.CUSTOM) { if (event.getSpawnReason() == SpawnReason.BUILD_IRONGOLEM || event.getSpawnReason() == SpawnReason.BUILD_SNOWMAN) { monsters.addGolem(event.getEntity()); } else { event.setCancelled(true); return; } } LivingEntity entity = event.getEntity(); if (arena.isRunning() && entity instanceof Slime) monsters.addMonster(entity); // If running == true, setCancelled(false), and vice versa. event.setCancelled(!arena.isRunning()); }
Location l = event.getLocation(); if (l.getWorld().getName().contains("TARDIS")) { if (event.getEntityType().equals(EntityType.ARMOR_STAND)) { return; return; if (!event.getEntityType().isAlive()) { return;
/** * Handle Animal/Monster Spawn settings, seems like a more concrete method than using CraftBukkit. * @param event The event. */ @EventHandler public void creatureSpawn(CreatureSpawnEvent event) { // Check to see if the Creature is spawned by a plugin, we don't want to prevent this behaviour. // TODO: Allow the egg thing to be a config param. Doubt this will be per world; seems silly. if (event.getSpawnReason() == SpawnReason.CUSTOM || event.getSpawnReason() == SpawnReason.SPAWNER_EGG || event.getSpawnReason() == SpawnReason.BREEDING) { return; } World world = event.getEntity().getWorld(); if (event.isCancelled()) return; // Check if it's a world which we are meant to be managing. if (!(this.worldManager.isMVWorld(world.getName()))) return; EntityType type = event.getEntityType(); /** * Handle people with non-standard animals: ie a patched craftbukkit. */ if (type == null || type.getName() == null) { this.plugin.log(Level.FINER, "Found a null typed creature."); return; } MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName()); event.setCancelled(this.plugin.getMVWorldManager().getTheWorldPurger().shouldWeKillThisCreature(mvworld, event.getEntity())); }
EntityType entityType = event.getEntityType();