Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefPlayer


    if (match == null) return;

    if (!validPlayer(player))
    { event.setCancelled(true); return; }

    AutoRefPlayer apl = match.getPlayer(player);
    if (apl != null && apl.getTeam().hasFlag(block, AutoRefRegion.Flag.NO_BUILD))
    { event.setCancelled(true); return; }
  }
View Full Code Here


    AutoRefMatch match = plugin.getMatch(block.getWorld());
    if (match == null) return;

    if (match.isPlayer(player))
    {
      AutoRefPlayer apl = match.getPlayer(player);
      boolean noaccess = apl.getTeam().hasFlag(block, Flag.NO_ACCESS);

      if (!match.getPlayer(player).isInsideLane() || (noaccess && !event.isBlockInHand()))
      { event.setCancelled(true); return; }

      if (match.isStartMechanism(block) && !match.getStartMechanism(block).canFlip(match))
View Full Code Here

    if (match == null) return;

    if (!validPlayer(player))
    { event.setCancelled(true); return; }

    AutoRefPlayer apl = match.getPlayer(player);
    if (apl != null)
    {
      if (!apl.isInsideLane() || apl.getTeam().hasFlag(loc, Flag.NO_ACCESS))
      { event.setCancelled(true); return; }
    }
  }
View Full Code Here

    AutoRefMatch match = plugin.getMatch(to.getWorld());
    if (match == null || match.getCurrentState() == MatchStatus.NONE) return;

    // get the player that teleported
    AutoRefPlayer apl = match.getPlayer(pl);
    if (apl == null) return;
    apl.setLastTeleportLocation(to);

    // generate message regarding the teleport event
    String bedrock = BlockGoal.blockInRange(BlockData.BEDROCK, to, 5) != null ? " (near bedrock)" : "";
    String message = apl.getDisplayName() + ChatColor.GRAY + " has teleported @ " +
      LocationUtil.toBlockCoords(to) + bedrock + (reason != null ? " " + reason : "");

    boolean excludeStreamers = dsq <= LONG_TELE_DISTANCE * LONG_TELE_DISTANCE;
    for (Player ref : match.getReferees(excludeStreamers)) ref.sendMessage(message);
  }
View Full Code Here

    if (event.getTo() == null) return;

    AutoRefMatch match = plugin.getMatch(event.getTo().getWorld());
    if (match == null || match.getCurrentState() == MatchStatus.NONE) return;

    AutoRefPlayer apl = match.getPlayer(event.getPlayer());
    if (apl == null) return;

    playerMove(event);
    switch (event.getCause())
    {
      case PLUGIN: // if this teleport is caused by a plugin
      case COMMAND: // or a vanilla command of some sort, do nothing
        break;

      case UNKNOWN: // not meaningful data
        break;

      default: // otherwise, fire a teleport event (to notify)
        if (apl.getTeam().hasFlag(event.getTo(), Flag.NO_TELEPORT))
        { event.setCancelled(true); return; }

        String reason = "by " + event.getCause().name().toLowerCase().replaceAll("_", " ");
        teleportEvent(event.getPlayer(), event.getFrom(), event.getTo(), reason);
View Full Code Here

      if ("tp".equalsIgnoreCase(parts[0]))
      {
        Location loc = null;
        if ("player".equalsIgnoreCase(parts[1]))
        {
          AutoRefPlayer apl = match.getPlayer(parts[2]);
          if (apl != null)
          {
            if ("player".equalsIgnoreCase(parts[3])) loc = apl.getLocation();
            else if ("death".equalsIgnoreCase(parts[3])) loc = apl.getLastDeathLocation();
            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);
        if (loc == null) player.sendMessage(ChatColor.DARK_GRAY +
          "You cannot teleport to this location: invalid or unsafe.");
        else
        {
          match.getSpectator(player).setPrevLocation(player.getLocation());
          player.teleport(loc); player.setFlying(true);
        }
      }
      else if ("inventory".equalsIgnoreCase(parts[0]))
      {
        if ("player".equalsIgnoreCase(parts[1]))
        {
          AutoRefPlayer apl = match.getPlayer(parts[2]);
          boolean old = parts.length > 3 && "prev".equalsIgnoreCase(parts[3]);

          // if we are unable to show the inventory, tell the streamer that
          if (apl == null || !apl.showInventory(player, old))
            player.sendMessage(ChatColor.DARK_GRAY + "Cannot show inventory for " + parts[2]);
        }
      }
    }
    catch (UnsupportedEncodingException e)
View Full Code Here

    if (AutoReferee.REFEREE_PLUGIN_CHANNEL.equals(event.getChannel()) && match != null)
    {
      // if this is a player, complain and force them to quit their team!
      if (match.isPlayer(pl) && !pl.isOp())
      {
        AutoRefPlayer apl = match.getPlayer(pl);
        for (Player ref : match.getReferees(true)) ref.sendMessage(apl.getDisplayName() +
          ChatColor.DARK_GRAY + " attempted to log in with a modified client!");
        match.leaveTeam(pl, true);
      }

      // update a referee with the latest information regarding the match
View Full Code Here

    if (match != null) match.checkWinConditions();

    if (entity.getType() == EntityType.PLAYER && match != null
      && match.isSpectator(pl) && match.isPlayer((Player) entity))
    {
      AutoRefPlayer a = match.getPlayer((Player) entity);
      a.showInventory(pl);
    }
  }
View Full Code Here

  {
    Player pl = event.getPlayer();
    Block block = event.getBlock();

    AutoRefMatch match = plugin.getMatch(block.getWorld());
    AutoRefPlayer apl = match == null ? null : match.getPlayer(pl);

    if (match != null && apl != null && match.getCurrentState().inProgress()
      && match.getRespawnMode() == RespawnMode.BEDS_ONLY && block.getType() == Material.BED_BLOCK)
        match.new BedUpdateTask(apl).runTask(plugin);
  }
View Full Code Here

    if (match == null) return;

    if (match.getCurrentState().inProgress() &&
      entity.getType() == EntityType.PLAYER)
    {
      AutoRefPlayer apl = match.getPlayer((Player) entity);
      if (apl != null) plugin.getServer().getScheduler()
        .runTask(plugin, new InventoryChangeTask(apl));
    }
  }
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefPlayer

Copyright © 2018 www.massapicom. 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.