コード例 #1
0
ファイル: PlayerHandler.java プロジェクト: k4b4l74/Arena
  @Override
  public void destroyed() {
    for (Iterator<ArenaPlayer> iterator = arenaGame.getRedTeam().iterator(); iterator.hasNext(); ) {
      ArenaPlayer arenaPlayer = iterator.next();
      arenaPlayer.getPlayer().getInventory().clear();
    }

    for (Iterator<ArenaPlayer> iterator = arenaGame.getBlueTeam().iterator();
        iterator.hasNext(); ) {
      ArenaPlayer arenaPlayer = iterator.next();
      arenaPlayer.getPlayer().getInventory().clear();
    }
  }
コード例 #2
0
ファイル: PlayerHandler.java プロジェクト: k4b4l74/Arena
 public void onPlayerQuit_removePlayerOffTeam(ArenaPlayer arenaPlayer, PlayerQuitEvent event) {
   Server server = arenaPlayer.getPlayer().getServer();
   if (arenaGame.isOnRedTeam(arenaPlayer)) {
     arenaGame.getRedTeam().remove(arenaPlayer);
     server.broadcastMessage(
         ChatColor.RED
             + "Player "
             + arenaPlayer.getPlayer().getName()
             + " has been removed from RED team");
   } else {
     arenaGame.getBlueTeam().remove(arenaPlayer);
     server.broadcastMessage(
         ChatColor.BLUE
             + "Player "
             + arenaPlayer.getPlayer().getName()
             + " has been removed from BLUE team");
   }
 }
コード例 #3
0
ファイル: PlayerHandler.java プロジェクト: k4b4l74/Arena
  public boolean onEntityDamage_proceedDamage(ArenaPlayer arenaPlayer, EntityDamageEvent event) {
    boolean willDie = false;

    int damage = event.getDamage();
    int oldHealth = arenaPlayer.getPlayer().getHealth();
    int newHealth = oldHealth - damage;

    if (newHealth < 0) {
      event.setDamage(999);
      willDie = true;
    }

    return willDie;
  }
コード例 #4
0
ファイル: PlayerHandler.java プロジェクト: k4b4l74/Arena
  /*
   * UTIL FUNCTION
   */
  private void giveMaxHealtAndPlayerInventory(ArenaPlayer arenaPlayer) {
    Player player = arenaPlayer.getPlayer();

    player.setHealth(20);

    player.getInventory().clear();
    player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1));
    player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE, 1));
    player.getInventory().addItem(new ItemStack(Material.BOW, 1));
    player.getInventory().addItem(new ItemStack(Material.ARROW, 10));
    player.getInventory().addItem(new ItemStack(Material.LADDER, 6));
    player.getInventory().addItem(new ItemStack(Material.COOKED_FISH, 1));
    player.getInventory().addItem(new ItemStack(Material.BREAD, 1));
  }