@SuppressWarnings("unchecked") private final static void registerExecutor() { if (registeredExecutor) return; for (final Class<? extends Event> c : new Class[] {BlockExpEvent.class, EntityDeathEvent.class, ExpBottleEvent.class, PlayerFishEvent.class}) Bukkit.getPluginManager().registerEvent(c, new Listener() {}, SkriptConfig.defaultEventPriority.value(), executor, Skript.getInstance(), true); }
@EventHandler(priority = EventPriority.LOWEST) public void onExpBottle(ExpBottleEvent event) { //if in a creative world, cancel the event (don't drop exp on the ground) if(GriefPrevention.instance.creativeRulesApply(event.getEntity().getLocation())) { event.setExperience(0); } }
@EventHandler(priority = EventPriority.NORMAL) public void onExpBottleEvent (ExpBottleEvent event) { for (MetadataValue meta : event.getEntity().getMetadata( "expbottlelevel")) { if (meta == null) return; if (meta.getOwningPlugin() != plugin) continue; event.setExperience(event.getExperience() * meta.asInt()); break; } }
@EventHandler(priority = EventPriority.LOW) public void onExpBottleEvent(ExpBottleEvent event) { event.setExperience(0); }