예제 #1
0
 @Override
 protected boolean giveInternal(Main plugin) {
   Location l = this.player.getLocation();
   l.setY(l.getY() + 3.0);
   this.bat = this.player.getWorld().spawn(l, Bat.class);
   this.bat.addPotionEffect(
       new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 100));
   this.block =
       this.player
           .getWorld()
           .spawnFallingBlock(
               l,
               this.cosmeticStorage.getjLibItem().getItemStack().getType(),
               (byte) this.cosmeticStorage.getjLibItem().getItemStack().getDurability());
   this.block.setDropItem(false);
   this.bat.setLeashHolder(this.player);
   Methods.setPassenger(this.bat, this.block);
   this.bat.setRemoveWhenFarAway(false);
   this.bat.setNoDamageTicks(Integer.MAX_VALUE);
   this.bat.setMetadata("Balloon", new FixedMetadataValue(plugin, this.player.getName()));
   plugin.queueEntity(this.bat);
   plugin.queueEntity(this.block);
   return true;
 }