コード例 #1
0
ファイル: Match.java プロジェクト: Legobrah/SnowballFight
 /**
  * Teleports player to their team spawn
  *
  * @param player The player that is being teleported
  */
 public void teleportPlayer(Player player) {
   Location spawn = getSpawnLoc(player);
   if (isSpawnValid(spawn)) {
     player.teleport(spawn);
     SnowballFight.announce(player.getName() + " has spawned!");
   } else {
     SnowballFight.log("Player has no team!");
   }
 }
コード例 #2
0
ファイル: Match.java プロジェクト: Legobrah/SnowballFight
  /**
   * Adds player to the appropriate team
   *
   * @param player The player to add to the team
   */
  public void joinPlayer(Player player) {
    if (getPlayerTeam(player) == null) {
      Team teamToJoin = getTeamToJoin();
      teamToJoin.addPlayer(player);
      teleportPlayer(player);

      SnowballFight.announce(player.getName() + " has joined " + teamToJoin.getTeamName() + "!");
    } else {
      SnowballFight.log(player.getName() + " is already on " + getPlayerTeam(player) + "!");
    }
  }
コード例 #3
0
ファイル: Match.java プロジェクト: Legobrah/SnowballFight
  /**
   * Gets the team that the specified player is on
   *
   * @param player The player to check
   * @return The team that the player is on
   */
  public Team getPlayerTeam(Player player) {
    if (team1.isOnTeam(player)) {
      return team1;
    } else if (team2.isOnTeam(player)) {
      return team2;
    } else {
      SnowballFight.log(player.getName() + " has no team!");

      return null;
    }
  }
コード例 #4
0
ファイル: Match.java プロジェクト: Legobrah/SnowballFight
 /**
  * Updates player info
  *
  * @param killer The killer
  * @param player The person that was killed
  */
 public void onPlayerKill(Player killer, Player player) {
   SnowballFight.announce(killer + " has killed " + player + "!");
   addKill(killer);
   addDeath(player);
 }