コード例 #1
0
ファイル: Constants.java プロジェクト: AdmirilRed/GoldenApple
 private static void initTransparentBlocks() {
   transparentBlocks.add(((Integer) Material.AIR.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BREWING_STAND.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BROWN_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CAKE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CROPS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DETECTOR_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LADDER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LAVA.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LEVER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LONG_GRASS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.MELON_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.NETHER_STALK.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PAINTING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PORTAL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.POWERED_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PUMPKIN_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RAILS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_ROSE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_WIRE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SAPLING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SIGN_POST.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SNOW.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.TORCH.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.VINE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WALL_SIGN.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WATER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.YELLOW_FLOWER.getId()).byteValue());
 }
コード例 #2
0
 public void manageDeath(PlayerKilledEvent event) {
   Gamer killed = event.getKilled();
   final Player p = killed.getPlayer();
   p.setHealth(20);
   if (event.isCancelled()) return;
   for (HumanEntity human : p.getInventory().getViewers()) human.closeInventory();
   p.leaveVehicle();
   p.eject();
   p.setLevel(0);
   p.setExp(0F);
   if (event.getDeathMessage().equals(ChatColor.stripColor(event.getDeathMessage())))
     event.setDeathMessage(ChatColor.DARK_RED + event.getDeathMessage());
   event.setDeathMessage(
       this.formatDeathMessage(
           event.getDeathMessage().replace("%Remaining%", "" + (getAliveGamers().size() - 1)), p));
   if (event.getKillerPlayer() != null) {
     event.getKillerPlayer().addKill();
     event.setDeathMessage(
         this.formatDeathMessage(event.getDeathMessage(), event.getKillerPlayer().getPlayer()));
   }
   Bukkit.broadcastMessage(event.getDeathMessage());
   int reward = hg.getPrize(getAliveGamers().size());
   if (reward > 0) killed.addBalance(reward);
   hg.cannon();
   killed.clearInventory();
   World world = p.getWorld();
   for (ItemStack item : event.getDrops()) {
     if (item == null
         || item.getType() == Material.AIR
         || item.containsEnchantment(EnchantmentManager.UNLOOTABLE)) continue;
     else if (item.hasItemMeta())
       world
           .dropItemNaturally(event.getDropsLocation(), item.clone())
           .getItemStack()
           .setItemMeta(item.getItemMeta());
     else world.dropItemNaturally(event.getDropsLocation(), item);
   }
   setSpectator(killed);
   ScoreboardManager.makeScore(
       "Main", DisplaySlot.SIDEBAR, cm.getScoreboardPlayersLength(), getAliveGamers().size());
   hg.checkWinner();
   p.setVelocity(new Vector());
   for (PotionEffect effect : p.getActivePotionEffects()) p.removePotionEffect(effect.getType());
   p.teleport(p.getWorld().getHighestBlockAt(p.getLocation()).getLocation().clone().add(0, 10, 0));
   p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 9), true);
   p.sendBlockChange(p.getLocation(), Material.PORTAL.getId(), (byte) 0);
   p.sendBlockChange(p.getLocation(), Material.AIR.getId(), (byte) 0);
   for (Entity entity : p.getWorld().getEntities()) {
     if (entity instanceof Tameable
         && ((Tameable) entity).isTamed()
         && ((Tameable) entity).getOwner().getName().equals(p.getName())) {
       if (entity instanceof Wolf) ((Wolf) entity).setSitting(true);
       else if (entity instanceof Ocelot) ((Ocelot) entity).setSitting(true);
       else entity.remove();
     }
     if (entity instanceof Creature && ((Creature) entity).getTarget() == p)
       ((Creature) entity).setTarget(null);
   }
   if (HungergamesApi.getConfigManager().getMainConfig().isKickOnDeath()
       && !p.hasPermission("hungergames.spectate"))
     p.kickPlayer(String.format(cm.getKickDeathMessage(), event.getDeathMessage()));
   HungergamesApi.getAbilityManager().unregisterPlayer(p);
   HungergamesApi.getInventoryManager().updateSpectatorHeads();
 }