Java 类org.bukkit.event.block.BlockExpEvent 实例源码

项目:Skript    文件:EvtExperienceSpawn.java   
@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);
}
项目:Skellett    文件:ExprBlockXP.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(BlockExpEvent.class)) {
        Skript.error("You can not use Block xp expression in any event but on block xp drop!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBlockXP.java   
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
    Number xp = (Number)delta[0];
    Number xpNow = ((BlockExpEvent)e).getExpToDrop();
    if (mode == ChangeMode.SET) {
        ((BlockExpEvent)e).setExpToDrop(xp.intValue());
    } else if (mode == ChangeMode.ADD) {
        ((BlockExpEvent)e).setExpToDrop(xpNow.intValue() + xp.intValue());
    } else if (mode == ChangeMode.REMOVE) {
        ((BlockExpEvent)e).setExpToDrop(xpNow.intValue() - xp.intValue());
    }
}
项目:SleepingPlus    文件:PlayerEvent.java   
@EventHandler
public void onDropXpEvent(BlockExpEvent event)
{
    if(plugin.isXpBar())
    {
        if(event.getExpToDrop() != 0)
        {
            event.setExpToDrop(0);
        }
    }
}
项目:Skellett    文件:ExprBlockXP.java   
@Override
@Nullable
protected Number[] get(Event e) {
    return new Number[]{((BlockExpEvent)e).getExpToDrop()};
}
项目:RoyalSurvivors    文件:SurvivorsListener.java   
@EventHandler
public void mineXP(BlockExpEvent e) {
    if (!RUtils.isInInfectedWorld(e.getBlock().getLocation())) return;
    e.setExpToDrop(0);
}