@SuppressWarnings("deprecation") public void onDragonCreatesPortal(EntityCreatePortalEvent event) { if (event.isCancelled()) return; Entity entity = event.getEntity(); if (!(entity instanceof EnderDragon)) return; log("The dragon has been killed!"); Location enderEggLoc = entity.getLocation(); if (enderEggLoc != null) { End.getBlockAt(enderEggLoc).setTypeId(122); } else { log("Failed to process portal, cancelling event anyway!"); } event.setCancelled(true); }
@EventHandler public void onPortal(EntityCreatePortalEvent e) { if (e.getPortalType() == PortalType.ENDER && e.getEntity().getType() == EntityType.ENDER_DRAGON) if (QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds().contains( e.getEntity().getWorld().getName())) { e.setCancelled(true); return; } }
@EventHandler(priority = EventPriority.LOW) public void onEntityPortalCreate(EntityCreatePortalEvent event) { event.setCancelled(true); }
@EventHandler public void onEntityCreatesPortal(EntityCreatePortalEvent event) { if (endDragonRespawn != null) endDragonRespawn.onDragonCreatesPortal(event); }