@EventHandler
  public void onPlayerInteract(PlayerInteractEvent e) {
    Player p = e.getPlayer();

    if (e.getAction() != Action.RIGHT_CLICK_BLOCK || p.getItemInHand().getType() != sc.getTool()) {
      return;
    }

    Block block = e.getClickedBlock();

    if (block.getType() != Material.MOB_SPAWNER) {
      return;
    }

    CreatureSpawner cs = (CreatureSpawner) block.getState();
    Spawner s = sc.getSpawner(block.getLocation());

    if (s == null) {
      return;
    }

    if (s.getOwner().equals(p.getName()) || p.hasPermission("sc.bypass")) {
      EntityType currentMob = cs.getSpawnedType();
      ActiveList<EntityType> al = sc.buildAllowed(p);

      if (al.isEmpty()) {
        p.sendMessage(sc.getMsg("NO_PERMISSION_SET"));
        return;
      }

      if (al.contains(currentMob)) {
        al.setActive(currentMob);
      }

      al.setActive(al.next());
      s.setMobType(al.getActive());
      s.setDate(new Date());
      cs.setSpawnedType(al.getActive());
      cs.update();

      if (s.getOwner().equals(p.getName()) && currentMob != al.getActive()) {
        p.sendMessage(
            String.format(
                sc.getMsg("CHANGED_MONSTER"), currentMob.getName(), al.getActive().getName()));
      } else {
        p.sendMessage(
            String.format(
                sc.getMsg("CHANGED_MONSTER_OTHER"),
                s.getOwner(),
                currentMob.getName(),
                al.getActive().getName()));
      }

      sc.writeDataAsynchronously();
      return;
    }

    p.sendMessage(String.format(sc.getMsg("OWNER_IS"), s.getOwner()));
  }
  public void setSpawnedType(EntityType entityType) {
    if (entityType == null || entityType.getName() == null) {
      throw new IllegalArgumentException(
          "Can't spawn EntityType " + entityType + " from mobspawners!");
    }

    spawner.setMobID(entityType.getName());
  }
  public boolean projectileHitEntity(Entity projectile, LivingEntity target, ProjectileInfo info) {
    if (!info.done
        && (maxDistanceSquared == 0
            || projectile.getLocation().distanceSquared(info.start) <= maxDistanceSquared)) {
      if (aoeRadius == 0) {
        float power = info.power;

        // check player
        if (!targetPlayers && target instanceof Player) return false;

        // call target event
        SpellTargetEvent evt = new SpellTargetEvent(this, info.player, target, power);
        Bukkit.getPluginManager().callEvent(evt);
        if (evt.isCancelled()) {
          return false;
        } else if (allowTargetChange) {
          target = evt.getTarget(); // TODO make an alternative to overriding the parameter
          power = evt.getPower();
        }

        // run spells
        for (Subspell spell : spells) {
          if (spell.isTargetedEntitySpell()) {
            spell.castAtEntity(info.player, target, power);
            playSpellEffects(EffectPosition.TARGET, target);
          } else if (spell.isTargetedLocationSpell()) {
            spell.castAtLocation(info.player, target.getLocation(), power);
            playSpellEffects(EffectPosition.TARGET, target.getLocation());
          }
        }

        // send messages
        String entityName;
        if (target instanceof Player) {
          entityName = ((Player) target).getDisplayName();
        } else {
          EntityType entityType = target.getType();
          entityName = MagicSpells.getEntityNames().get(entityType);
          if (entityName == null) {
            entityName = entityType.name().toLowerCase();
          }
        }
        sendMessage(
            formatMessage(strHitCaster, "%t", entityName), info.player, MagicSpells.NULL_ARGS);
        if (target instanceof Player) {
          sendMessage(
              formatMessage(strHitTarget, "%a", info.player.getDisplayName()),
              (Player) target,
              MagicSpells.NULL_ARGS);
        }
      } else {
        aoe(projectile, info);
      }

      info.done = true;
    }
    return true;
  }
Beispiel #4
0
  public void save(ConfigurationNode node) {
    // Set if the world can be directly accessed
    World w = this.getWorld();
    if (w != null) {
      this.difficulty = w.getDifficulty();
      this.keepSpawnInMemory = w.getKeepSpawnInMemory();
      this.autosave = w.isAutoSave();
    }
    if (this.worldname == null || this.worldname.equals(this.getConfigName())) {
      node.remove("name");
    } else {
      node.set("name", this.worldname);
    }
    node.set("loaded", w != null);
    node.set("keepSpawnLoaded", this.keepSpawnInMemory);
    node.set("environment", this.worldmode.getName());
    node.set("chunkGenerator", LogicUtil.fixNull(this.getChunkGeneratorName(), ""));
    node.set("clearInventory", this.clearInventory ? true : null);
    node.set("gamemode", this.gameMode == null ? "NONE" : this.gameMode.toString());

    if (this.timeControl.isLocked()) {
      node.set("lockedtime", this.timeControl.getTime());
    } else {
      node.remove("lockedtime");
    }

    ArrayList<String> creatures = new ArrayList<String>();
    for (EntityType type : this.spawnControl.deniedCreatures) {
      creatures.add(type.name());
    }
    node.set("forcedRespawn", this.forcedRespawn);
    node.set("rememberlastplayerpos", this.rememberLastPlayerPosition);
    node.set("pvp", this.pvp);
    node.set("defaultNetherPortal", this.defaultNetherPortal);
    node.set("defaultEndPortal", this.defaultEnderPortal);
    node.set("operators", this.OPlist);
    node.set("deniedCreatures", creatures);
    node.set("holdWeather", this.holdWeather);
    node.set("hunger", this.allowHunger);
    node.set("formIce", this.formIce);
    node.set("formSnow", this.formSnow);
    node.set("showRain", this.showRain);
    node.set("showSnow", this.showSnow);
    node.set("difficulty", this.difficulty == null ? "NONE" : this.difficulty.toString());
    node.set("reloadWhenEmpty", this.reloadWhenEmpty);
    if (this.spawnPoint == null) {
      node.remove("spawn");
    } else {
      node.set("spawn.world", this.spawnPoint.getWorldName());
      node.set("spawn.x", this.spawnPoint.getX());
      node.set("spawn.y", this.spawnPoint.getY());
      node.set("spawn.z", this.spawnPoint.getZ());
      node.set("spawn.yaw", (double) this.spawnPoint.getYaw());
      node.set("spawn.pitch", (double) this.spawnPoint.getPitch());
    }
  }
Beispiel #5
0
 @EventHandler
 public void onHealthRegenerate(EntityRegainHealthEvent event) {
   EntityType entityType = event.getEntityType();
   if (entityType.equals(EntityType.PLAYER)) {
     if (GameManager.INSTANCE.getSession((Player) event.getEntity()) == null) return;
     if (event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SATIATED)) {
       event.setCancelled(true);
     }
   }
 }
    @Override
    public void verify(ChangedSign sign) throws ICVerificationException {

      String[] splitLine3 = RegexUtil.ASTERISK_PATTERN.split(sign.getLine(3).trim());
      if (EntityType.fromName(splitLine3[0].trim().toLowerCase()) == null) {
        throw new ICVerificationException("Invalid Entity! See bukkit EntityType list!");
      } else if (!EntityType.fromName(splitLine3[0].trim().toLowerCase()).isSpawnable()) {
        throw new ICVerificationException("Entity is not spawnable!");
      }
    }
 @Override
 public void getParameterOptions(Spell spell, String parameterKey, Collection<String> examples) {
   if (parameterKey.equals("type")) {
     for (EntityType type : EntityType.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("reason")) {
     for (CreatureSpawnEvent.SpawnReason type : CreatureSpawnEvent.SpawnReason.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("skeleton_type")) {
     for (Skeleton.SkeletonType type : Skeleton.SkeletonType.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("ocelot_type")) {
     for (Ocelot.Type type : Ocelot.Type.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("villager_profession")) {
     for (Villager.Profession profession : Villager.Profession.values()) {
       examples.add(profession.name().toLowerCase());
     }
   } else if (parameterKey.equals("rabbity_type")) {
     for (Rabbit.Type type : Rabbit.Type.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("horse_variant")) {
     for (Horse.Variant type : Horse.Variant.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("horse_style")) {
     for (Horse.Style type : Horse.Style.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("horse_color")) {
     for (Horse.Color type : Horse.Color.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("color")) {
     for (DyeColor type : DyeColor.values()) {
       examples.add(type.name().toLowerCase());
     }
   } else if (parameterKey.equals("track")
       || parameterKey.equals("loot")
       || parameterKey.equals("baby")) {
     examples.addAll(Arrays.asList((BaseSpell.EXAMPLE_BOOLEANS)));
   } else if (parameterKey.equals("name")) {
     examples.add("Philbert");
   } else if (parameterKey.equals("speed")) {
     examples.addAll(Arrays.asList((BaseSpell.EXAMPLE_SIZES)));
   } else {
     super.getParameterOptions(spell, parameterKey, examples);
   }
 }
  /*
   * Another example of a event handler. This one will give you the name of
   * the entity you interact with, if it is a Creature it will give you the
   * creature Id.
   */
  @EventHandler
  public void onPlayerInteract(PlayerInteractEntityEvent event) {
    final EntityType entityType = event.getRightClicked().getType();

    event
        .getPlayer()
        .sendMessage(
            MessageFormat.format(
                "You interacted with a {0} it has an id of {1}",
                entityType.getName(), entityType.getTypeId()));
  }
Beispiel #9
0
  public static EntityType getProperMobType(String properName) {

    properName = properName.replaceAll("_", "").toUpperCase();
    for (EntityType et : EntityType.values()) {

      if (et.isAlive() && et.name().replaceAll("_", "").equalsIgnoreCase(properName)) {
        return et;
      }
    }

    return null;
  }
  private boolean killDecision(
      Entity e,
      List<String> thingsToKill,
      boolean negateAnimals,
      boolean negateMonsters,
      boolean specifiedAnimals,
      boolean specifiedMonsters) {
    boolean negate = false;
    boolean specified = false;
    if (e instanceof Golem || e instanceof Squid || e instanceof Animals) {
      // it's an animal
      if (specifiedAnimals && !negateAnimals) {
        Logging.finest(
            "Removing an entity because I was told to remove all animals in world %s: %s",
            e.getWorld().getName(), e);
        return true;
      }
      if (specifiedAnimals) specified = true;
      negate = negateAnimals;
    } else if (e instanceof Monster || e instanceof Ghast || e instanceof Slime) {
      // it's a monster
      if (specifiedMonsters && !negateMonsters) {
        Logging.finest(
            "Removing an entity because I was told to remove all monsters in world %s: %s",
            e.getWorld().getName(), e);
        return true;
      }
      if (specifiedMonsters) specified = true;
      negate = negateMonsters;
    }
    for (String s : thingsToKill) {
      EntityType type = EntityType.fromName(s);
      if (type != null && type.equals(e.getType())) {
        specified = true;
        if (!negate) {
          Logging.finest(
              "Removing an entity because it WAS specified and we are NOT negating in world %s: %s",
              e.getWorld().getName(), e);
          return true;
        }
        break;
      }
    }
    if (!specified && negate) {
      Logging.finest(
          "Removing an entity because it was NOT specified and we ARE negating in world %s: %s",
          e.getWorld().getName(), e);
      return true;
    }

    return false;
  }
Beispiel #11
0
  @EventHandler
  public void onLaunch(ProjectileLaunchEvent event) {
    LivingEntity shooter = event.getEntity().getShooter();
    EntityType entity = event.getEntityType();

    if (shooter instanceof Player && entity.equals(EntityType.ARROW)) {
      Player player = (Player) shooter;
      Location loc = player.getLocation();
      if (player.hasPermission("shockpvp.loudbow")) {
        loc.getWorld().playEffect(loc, Effect.GHAST_SHOOT, 50);
      }
    }
  }
Beispiel #12
0
 private List<EntityType> getSpawnableEntities(EnumCreatureType creatureType) {
   List<EntityType> entityTypes = new ArrayList<EntityType>();
   for (BiomeBase.BiomeMeta meta : (List<BiomeBase.BiomeMeta>) biomeBase.getMobs(creatureType)) {
     entityTypes.add(EntityType.fromId(ENTITY_CLASS_ID_MAP.get(meta.b)));
   }
   return entityTypes;
 }
Beispiel #13
0
 public boolean spawn(String world, double x, double y, double z, String mobName) {
   return getServer()
           .getWorld(world)
           .spawnEntity(
               new Location(getServer().getWorld(world), x, y, z), EntityType.fromName(mobName))
       != null;
 }
 private void saveDefaultMobDropConfig() {
   if (mobDropConfigFile == null) {
     mobDropConfigFile = new File(plugin.getDataFolder(), "mob-drops.yml");
   }
   if (!mobDropConfigFile.exists()) {
     mobDropConfig = new YamlConfiguration();
     for (EntityType entityType : EntityType.values()) {
       mobDropConfig.set(entityType.toString(), getDefaultDrops(entityType));
     }
     try {
       mobDropConfig.save(mobDropConfigFile);
     } catch (IOException exception) {
       exception.printStackTrace();
     }
   }
 }
  public static boolean isValidEntity(EntityType entityType) {
    if (validEntities.contains(entityType.toString())) {
      return true;
    }

    return false;
  }
  public static AbstractRewardSettings<EntityType> parseConfig(ConfigurationSection config) {
    Map<EntityType, List<AbstractRewardSource>> sources =
        new HashMap<EntityType, List<AbstractRewardSource>>();
    ConfigurationSection rewardTable = config.getConfigurationSection("RewardTable");

    if (rewardTable != null) {
      for (String typeName : rewardTable.getKeys(false)) {
        EntityType type = EntityType.fromName(typeName);

        if (type != null) {
          AbstractRewardSource source =
              configureRewardSource(
                  RewardSourceFactory.createSource(
                      typeName, rewardTable.getConfigurationSection(typeName)),
                  config);

          if (!sources.containsKey(type)) {
            sources.put(type, new ArrayList<AbstractRewardSource>());
          }

          sources
              .get(type)
              .add(
                  mergeSets(
                      source,
                      rewardTable.getConfigurationSection(typeName),
                      config.getConfigurationSection("RewardSets")));
        }
      }
    }

    EntityRewardSettings settings = new EntityRewardSettings(sources);
    settings.setHuntingRules(loadHuntingRules(config));
    return settings;
  }
Beispiel #17
0
  static {
    for (EntityType type : EntityType.values()) {
      try {
        if (TFM_DepreciationAggregator.getName_EntityType(type) != null) {
          if (Creature.class.isAssignableFrom(type.getEntityClass())) {
            mobtypes.put(TFM_DepreciationAggregator.getName_EntityType(type).toLowerCase(), type);
          }
        }
      } catch (Exception ex) {
      }
    }

    for (ChatColor chatColor : CHAT_COLOR_POOL) {
      CHAT_COLOR_NAMES.put(chatColor.name().toLowerCase().replace("_", ""), chatColor);
    }
  }
 public void setCreatureTypeByName(String creatureType) {
   // Verify input
   EntityType type = EntityType.fromName(creatureType);
   if (type == null) {
     return;
   }
   setSpawnedType(type);
 }
Beispiel #19
0
 public NMSNPC(UUID uuid, EntityType type, NMSRegistry registry) {
   if (!type.equals(EntityType.PLAYER))
     throw new UnsupportedOperationException("Can only spawn players");
   this.type = type;
   this.UUID = uuid;
   this.registry = registry;
   runTaskTimer(getRegistry().getPlugin(), 20, 1);
 }
Beispiel #20
0
 @SuppressWarnings("deprecation")
 public static String getName(EntityType paramEntityType) {
   for (String str : creatureMap.keySet()) {
     if (creatureMap.get(str) == paramEntityType) {
       return str;
     }
   }
   return paramEntityType.getName();
 }
 public List<ItemStack> getDrops(EntityType entityType, int level) {
   List<ItemStack> drops = new ArrayList<>();
   for (MobDrop mobDrop : (List<MobDrop>) getMobDropConfig().getList(entityType.toString())) {
     if (mobDrop.getMinLevel() <= level
         && (mobDrop.getMaxLevel() == -1 || level <= mobDrop.getMaxLevel())
         && random.nextInt(101) <= mobDrop.getChance()) {
       drops.add(mobDrop.getDrop());
     }
   }
   return drops;
 }
Beispiel #22
0
 private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type)
     throws SecurityException, NoSuchMethodException {
   Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);
   if (constructor == null) {
     constructor = clazz.getConstructor(World.class);
     constructor.setAccessible(true);
     ENTITY_CLASS_TO_INT.put(clazz, (int) type.getTypeId());
     ENTITY_CONSTRUCTOR_CACHE.put(clazz, constructor);
   }
   return constructor;
 }
Beispiel #23
0
  public static String getProperMobName(EntityType type) {

    String name = type.name().toLowerCase();

    name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
    while (fixUnderscore(name) != null) {
      name = fixUnderscore(name);
    }

    return name;
  }
  private void inGameInteractEntity(PlayerInteractEntityEvent iee, Game game, Player player) {

    if (iee.getPlayer().getItemInHand().getType().equals(Material.MONSTER_EGG)
        || iee.getPlayer().getItemInHand().getType().equals(Material.MONSTER_EGGS)
        || iee.getPlayer().getItemInHand().getType().equals(Material.DRAGON_EGG)) {
      iee.setCancelled(true);
      return;
    }

    if (iee.getRightClicked() != null) {
      if (!iee.getRightClicked().getType().equals(EntityType.VILLAGER)) {
        List<EntityType> preventClickTypes = Arrays.asList(EntityType.ITEM_FRAME);

        // armor stand in 1.8
        try {
          preventClickTypes.add(EntityType.valueOf("ARMOR_STAND"));
        } catch (Exception ex) {
          // nothing will happen, just not supported
        }

        if (preventClickTypes.contains(iee.getRightClicked().getType())) {
          iee.setCancelled(true);
        }

        return;
      }
    }

    iee.setCancelled(true);

    if (game.isSpectator(player)) {
      return;
    }

    BedwarsOpenShopEvent openShopEvent =
        new BedwarsOpenShopEvent(game, player, game.getItemShopCategories(), iee.getRightClicked());
    Main.getInstance().getServer().getPluginManager().callEvent(openShopEvent);

    if (openShopEvent.isCancelled()) {
      return;
    }

    if (game.isUsingOldShop(player)) {
      MerchantCategory.openCategorySelection(player, game);
    } else {
      NewItemShop itemShop = game.getNewItemShop(player);
      if (itemShop == null) {
        itemShop = game.openNewItemShop(player);
      }

      itemShop.setCurrentCategory(null);
      itemShop.openCategoryInventory(player);
    }
  }
  private AbstractRewardSource getRewardSource(EntityType entityType) {
    AbstractRewardSource source = null;

    if (hasRewardSource(entityType)) {
      source = getSources().get(entityType).get(nextInt(getSources().get(entityType).size()));
    } else {
      LoggerUtil.getInstance()
          .debug(this.getClass(), "No reward defined for entity type: " + entityType.getName());
    }

    return source;
  }
  @Override
  public Set<EntityType> decodeList(List<String> list) {
    Set<EntityType> types = EnumSet.noneOf(EntityType.class);

    for (String entry : list) {
      EntityType type = EntityType.fromName(entry.replace(' ', '_'));
      if (type != null) {
        types.add(type);
      }
    }

    return types;
  }
Beispiel #27
0
 @Override
 public void loadSettings(FileConfiguration config) {
   ConfigurationSection sectionE = config.getConfigurationSection("Skills.Weaponry.Entities");
   ConfigurationSection section = config.getConfigurationSection("Skills.Weaponry");
   if (sectionE.getKeys(false) != null) {
     for (String s : sectionE.getKeys(false)) {
       if (EntityType.valueOf(s.toUpperCase()) != null) {
         EntityType type = EntityType.valueOf(s.toUpperCase());
         Double val = sectionE.getDouble(s);
         entities.put(type, val);
       }
     }
   }
   if (section.getStringList("Weapons") != null) {
     for (String s : section.getStringList("Weapons")) {
       if (Material.valueOf(s.toUpperCase()) != null) {
         Material type = Material.valueOf(s.toUpperCase());
         weapons.add(type);
       }
     }
   }
 }
Beispiel #28
0
  @EventHandler
  public void onProjectileHit(ProjectileHitEvent event) {
    if (!State.isState(State.INGAME)) {
      return;
    }

    Projectile proj = event.getEntity();

    // check if the projectile is an egg, if not return.
    if (!(proj instanceof Egg)) {
      return;
    }

    Random rand = new Random();

    // make a list of all the entitytypes
    ArrayList<EntityType> types = new ArrayList<EntityType>();

    // Loop over all entity types.
    for (EntityType type : EntityType.values()) {
      // if the current looped type isnt alive AND isn't spawnable, hop over this loop.
      if (!type.isAlive() || !type.isSpawnable()) {
        continue;
      }

      // add the loop value to the list.
      types.add(type);
    }

    // get a random type out of the list we just created.
    EntityType type = types.get(rand.nextInt(types.size()));

    // get the location and world the projectile hit in.
    Location loc = proj.getLocation();
    World world = proj.getWorld();

    // spawn the entity in the world and location we got.
    world.spawnEntity(loc, type);
  }
  public static void main(String[] args) {
    // Generate code for toID() function
    System.out.println("/*");
    System.out.println(" * Returns a classic block type id related to the material");
    System.out.println(" */");
    System.out.println("@SuppressWarnings(\"deprecation\")");
    System.out.println("public static int toID(EntityType entityType)");
    System.out.println("{");
    boolean added = false;
    for (int i = 0; i < 1024; i++) {

      @SuppressWarnings("deprecation")
      EntityType entityType = EntityType.fromId(i);
      if (entityType != null) {
        String name = entityType.name();
        String suffix = "";
        if (added) {
          suffix = "else ";
        }
        System.out.println("\t" + suffix + "if(entityType.equals(EntityType." + name + "))");
        System.out.println("\t{");
        System.out.println("\t\treturn " + i + ";");
        System.out.println("\t}");
        added = true;
      }
    }
    System.out.println("\treturn entityType.getTypeId();");
    System.out.println("}");

    System.out.println();

    // Generate code for toMaterial() function
    System.out.println("/*");
    System.out.println(" * Returns a classic block type id related to the material");
    System.out.println(" */");
    System.out.println("@SuppressWarnings(\"deprecation\")");
    System.out.println("public static EntityType toEntityType(int id)");
    System.out.println("{");
    added = false;
    for (int i = 0; i < 1024; i++) {
      @SuppressWarnings("deprecation")
      EntityType entityType = EntityType.fromId(i);
      if (entityType != null) {
        String name = entityType.name();
        String suffix = "";
        if (added) {
          suffix = "else ";
        }
        System.out.println("\t" + suffix + "if(id==" + i + ")");
        System.out.println("\t{");
        System.out.println("\t\treturn EntityType." + name + ";");
        System.out.println("\t}");
        added = true;
      }
    }
    System.out.println("\treturn EntityType.fromId(id);");
    System.out.println("}");
  }
  @EventHandler(priority = EventPriority.HIGH)
  public void handleCustomMobDrops(EntityDeathEvent event) {

    if (!EventUtil.passesFilter(event)) return;
    EntityType entityType = event.getEntityType();
    if (entityType == null || !entityType.isAlive() || entityType.equals(EntityType.PLAYER)) return;
    CustomDropManager.DropDefinition[] drops = customDrops.getMobDrop(event.getEntity());
    if (drops != null) {
      if (!drops[0].append) {
        event.getDrops().clear();
        ((ExperienceOrb)
                event
                    .getEntity()
                    .getWorld()
                    .spawnEntity(event.getEntity().getLocation(), EntityType.EXPERIENCE_ORB))
            .setExperience(event.getDroppedExp());
      }
      // Add the custom drops
      for (CustomDropManager.DropDefinition dropDefinition : drops) {
        ItemStack stack = dropDefinition.getItemStack();
        if (ItemUtil.isStackValid(stack)) event.getDrops().add(stack);
      }
    }
  }