@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())}); } } } }
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; }
@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()); } }
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; }
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; }
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; }
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; }
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; }
@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); } }
@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()); } }
@Override @Nullable protected Number[] get(Event e) { return new Number[]{((EntityBreedEvent)e).getExperience()}; }
@Override @Nullable protected ItemStack[] get(Event e) { return new ItemStack[]{((EntityBreedEvent)e).getBredWith()}; }
@Override @Nullable protected LivingEntity[] get(Event e) { return new LivingEntity[]{((EntityBreedEvent)e).getFather()}; }
@Override @Nullable protected LivingEntity[] get(Event e) { return new LivingEntity[]{((EntityBreedEvent)e).getBreeder()}; }
@Override @Nullable protected LivingEntity[] get(Event e) { return new LivingEntity[]{((EntityBreedEvent)e).getMother()}; }
@Override @Nullable protected LivingEntity[] get(Event e) { return new LivingEntity[]{((EntityBreedEvent)e).getEntity()}; }