Examples of AutoRefTeam


Examples of org.mctourney.autoreferee.AutoRefTeam

        player.setFallDistance(0.0f);
      }
      return;
    }

    AutoRefTeam team = apl.getTeam();
    if (team == null) return;

    // announce region (for cosmetic regions)
    for (AutoRefRegion reg : team.getRegions())
      if (reg.getName() != null && reg.isEnterEvent(event)) reg.announceRegion(apl);

    double fallspeed = event.getFrom().getY() - event.getTo().getY();
    Location exit = apl.getExitLocation();

    // don't bother if the player isn't in survival mode
    if (player.getGameMode() != GameMode.SURVIVAL
      || match.inStartRegion(event.getTo())) return;

    // if a player leaves the start region...
    if (!match.inStartRegion(event.getTo()))
    {
      if (match.getCurrentState().inProgress())
      {
        // if they are leaving the start region, clear everything
        if (match.inStartRegion(event.getFrom()) && !apl.isActive()) apl.reset();

        // one way or another, the player is now active
        apl.setActive();
      }

      else if (match.getCurrentState().isBeforeMatch())
      { if (onGround) apl.die(null, false); return; }
    }

    // if they have left their region, mark their exit location
    if (!team.canEnter(event.getTo(), 0.3) && !player.isSleeping())
    {
      // player is sneaking off the edge and not in freefall
      if (player.isSneaking() && team.canEnter(event.getTo()) && fallspeed < FREEFALL_THRESHOLD);

      // if there is no exit position, set the exit position
      else if (exit == null) apl.setExitLocation(player.getLocation());

      // if there is an exit position and they aren't falling, kill them
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

            else if ("spawn".equalsIgnoreCase(parts[3])) loc = apl.getBedLocation();
          }
        }
        else if ("team".equalsIgnoreCase(parts[1]))
        {
          AutoRefTeam team = match.getTeam(parts[2]);
          if (team != null)
          {
            if ("vm".equalsIgnoreCase(parts[3])) loc = team.getVictoryMonumentLocation();
            else if ("spawn".equalsIgnoreCase(parts[3])) loc = team.getSpawnLocation();
          }
        }

        // teleport to the location, if any
        loc = TeleportationUtil.locationTeleport(loc);
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

              addedPlayers.add(offlinePlayer.getName());

              // AUTOREFEREE START - check for AutoRefTeam
              if (match != null)
              {
                AutoRefTeam autorefteam = match.getScoreboardTeam(teamName);
                if (autorefteam != null && player != null)
                {
                  PlayerTeamJoinEvent.Reason reason = PlayerTeamJoinEvent.Reason.AUTOMATIC;
                  match.joinTeam(player, autorefteam, reason, false);
                }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

      }

      return true;
    }

    AutoRefTeam team = match.getTeam(args[0]);
    if (team == null)
    {
      // team name is invalid. let the player know
      sender.sendMessage(ChatColor.DARK_GRAY + args[1] +
        ChatColor.RESET + " is not a valid team.");
      sender.sendMessage("Teams are " + match.getTeamList());
    }
    else
    {
      boolean append = options.hasOption('a');
      if (!append) team.clearSpawnRegions();
      team.addSpawnRegion(player.getLocation());

      sender.sendMessage(ChatColor.GRAY + String.format("%s set as spawn for %s",
        LocationUtil.toBlockCoords(player.getLocation()), team.getDisplayName()));
      if (append) sender.sendMessage(ChatColor.GRAY + "Appended.");
    }
    return true;
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

  {
    AutoRefMatch match = plugin.getMatch(event.getWhoClicked().getWorld());
    if (match == null) return;

    if (!(event.getWhoClicked() instanceof Player)) return;
    AutoRefTeam team = plugin.getTeam((Player) event.getWhoClicked());

    BlockData recipeTarget = BlockData.fromItemStack(event.getRecipe().getResult());
    if (team != null && !team.canCraft(recipeTarget)) event.setCancelled(true);

    // if this is on the blacklist, cancel
    if (!match.canCraft(recipeTarget)) event.setCancelled(true);
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

    }

    // if the speaker isn't in a match, that's all we can do
    if (match == null) return;

    AutoRefTeam speakerTeam = match.getPlayerTeam(speaker);
    if (speakerTeam != null)
    {
      ChatColor teamColor = speakerTeam.getColor();
      event.setFormat("<" + teamColor + "%s" + ChatColor.RESET + "> %s");
    }
    else event.setFormat("<%s> %s");
    modifyChatRecipients(match, speaker, event.getRecipients());
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

      event.setMessage("/autoref me " + message.substring(4));
  }

  public static void modifyChatRecipients(AutoRefMatch match, Player speaker, Set<Player> recipients)
  {
    AutoRefTeam speakerTeam = match.getPlayerTeam(speaker);
    Role speakerRole = match.getRole(speaker);
    boolean practiceMode = match.isPracticeMode();

    Iterator<Player> iter = recipients.iterator();
    if (!match.getCurrentState().isBeforeMatch()) while (iter.hasNext())
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

  public void playerLogin(PlayerLoginEvent event)
  {
    Player player = event.getPlayer();

    // if this player needs to be in a specific world, put them there
    AutoRefTeam team = plugin.getExpectedTeam(player);
    AutoRefMatch match = plugin.getMatch(player.getWorld());

    if (team != null)
    {
      team.join(player, PlayerTeamJoinEvent.Reason.EXPECTED);
      match = team.getMatch();
    }

    if (match != null && match.isPlayer(player))
      match.messageReferees("player", player.getName(), "login");
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

    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());
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

    Set<AutoRefTeam> teams = null;

    // if a team has been specified as an argument
    if (args.length > 0)
    {
      AutoRefTeam t = match.getTeam(args[0]);
      teams = Sets.newHashSet(t);

      if (t == null)
      {
        // team name is invalid. let the player know
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.