Examples of AutoRefMatch


Examples of org.mctourney.autoreferee.AutoRefMatch

  @EventHandler(priority=EventPriority.MONITOR)
  public void playerQuit(PlayerQuitEvent event)
  {
    Player player = event.getPlayer();
    AutoRefMatch match = plugin.getMatch(player.getWorld());
    if (match == null) return;

    // leave the team, if necessary
    AutoRefTeam team = plugin.getTeam(player);
    if (team != null) match.messageReferees("player", player.getName(), "logout");
    if (team != null && !match.getCurrentState().inProgress()) team.leave(player);

    AutoRefPlayer apl = match.getPlayer(player);
    if (apl != null && player.getLocation() != null)
      apl.setLastLogoutLocation(player.getLocation());

    // if this player was damaged recently (during the match), notify
    if (match.getCurrentState().inProgress() && apl != null && !apl.isDead() && apl.wasDamagedRecently())
    {
      String message = apl.getDisplayName() + ChatColor.GRAY + " logged out during combat " +
        String.format("with %2.1f hearts remaining", apl.getPlayer().getHealth() / 2.0);
      for (Player ref : match.getReferees(true)) ref.sendMessage(message);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.