Java 类org.bukkit.event.entity.EntityBreedEvent 实例源码

项目:BetonQuest    文件:BreedObjective.java   
@EventHandler
public void onBreeding(EntityBreedEvent event) {
    if (event.getEntityType() == type && event.getBreeder() instanceof Player) {
        String playerID = PlayerConverter.getID((Player) event.getBreeder());
        if (!containsPlayer(playerID)) {
            return;
        }
        if (checkConditions(playerID)) {
            BreedData data = (BreedData) dataMap.get(playerID);
            data.breed();
            if (data.getAmount() == 0) {
                completeObjective(playerID);
            } else if (notify) {
                Config.sendMessage(playerID, "animals_to_breed", new String[]{String.valueOf(data.getAmount())});
            }
        }
    }
}
项目:Skellett    文件:ExprBreedingXP.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Bred xp expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBreedingXP.java   
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
    Number xp = (Number)delta[0];
    Number xpNow = ((EntityBreedEvent)e).getExperience();
    if (mode == ChangeMode.SET) {
        ((EntityBreedEvent)e).setExperience(xp.intValue());
    } else if (mode == ChangeMode.RESET) {
        ((EntityBreedEvent)e).setExperience(0);
    } else if (mode == ChangeMode.ADD) {
        ((EntityBreedEvent)e).setExperience(xpNow.intValue() + xp.intValue());
    } else if (mode == ChangeMode.REMOVE) {
        ((EntityBreedEvent)e).setExperience(xpNow.intValue() - xp.intValue());
    }
}
项目:Skellett    文件:ExprBreedingItem.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Breed item expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBreedingFather.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Breeder father expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBreedingBreeder.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Breeder expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBreedingMother.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Breeder mother expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprBreedingEntity.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityBreedEvent.class)) {
        Skript.error("You can not use Final bred entity expression in any event but on breeding event!");
        return false;
    }
    return true;
}
项目:AdvancedAchievements    文件:AchieveBreedListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityBreed(EntityBreedEvent event) {
    if (!(event.getBreeder() instanceof Player)) {
        return;
    }

    Player player = (Player) event.getBreeder();

    if (player == null) {
        return;
    }

    if (!shouldIncreaseBeTakenIntoAccountNoPermissions(player)) {
        return;
    }

    Entity entity = event.getMother();

    if (!(entity instanceof LivingEntity)) {
        return;
    }

    String mobName = entity.getType().name().toLowerCase();

    MultipleAchievements category = MultipleAchievements.BREEDING;

    if (plugin.getPluginConfig().isConfigurationSection(category + "." + mobName)
            && player.hasPermission(category.toPermName() + '.' + mobName)) {
        updateStatisticAndAwardAchievementsIfAvailable(player, category, mobName, 1);
    }
}
项目:WildSex    文件:WildSexTaskListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityBreedEvent(EntityBreedEvent e) {
    Set<Entity> matedAnimals = plugin.lastMateAnimals;
    if (matedAnimals.contains(e.getFather()) || matedAnimals.contains(e.getMother())) {
        e.setExperience(0);
        matedAnimals.remove(e.getFather());
        matedAnimals.remove(e.getMother());
    }
}
项目:Skellett    文件:ExprBreedingXP.java   
@Override
@Nullable
protected Number[] get(Event e) {
    return new Number[]{((EntityBreedEvent)e).getExperience()};
}
项目:Skellett    文件:ExprBreedingItem.java   
@Override
@Nullable
protected ItemStack[] get(Event e) {
    return new ItemStack[]{((EntityBreedEvent)e).getBredWith()};
}
项目:Skellett    文件:ExprBreedingFather.java   
@Override
@Nullable
protected LivingEntity[] get(Event e) {
    return new LivingEntity[]{((EntityBreedEvent)e).getFather()};
}
项目:Skellett    文件:ExprBreedingBreeder.java   
@Override
@Nullable
protected LivingEntity[] get(Event e) {
    return new LivingEntity[]{((EntityBreedEvent)e).getBreeder()};
}
项目:Skellett    文件:ExprBreedingMother.java   
@Override
@Nullable
protected LivingEntity[] get(Event e) {
    return new LivingEntity[]{((EntityBreedEvent)e).getMother()};
}
项目:Skellett    文件:ExprBreedingEntity.java   
@Override
@Nullable
protected LivingEntity[] get(Event e) {
    return new LivingEntity[]{((EntityBreedEvent)e).getEntity()};
}