Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefMatch$MatchReportSaver


    { if (apl != null) apl.updateCarrying(); }
  }

  public void inventoryChange(HumanEntity entity)
  {
    AutoRefMatch match = plugin.getMatch(entity.getWorld());
    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


  { healthArmorChange(event.getEntity()); }

  @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
  public void playerFoodChange(FoodLevelChangeEvent event)
  {
    AutoRefMatch match = plugin.getMatch(event.getEntity().getWorld());
    if (match != null && event.getEntity().getType() == EntityType.PLAYER)
    {
      Player player = (Player) event.getEntity();
      match.messageReferees("player", player.getName(),
        "hunger", Integer.toString(event.getFoodLevel()));
    }
  }
View Full Code Here

    { if (apl != null) apl.updateHealthArmor(); }
  }

  public void healthArmorChange(Entity entity)
  {
    AutoRefMatch match = plugin.getMatch(entity.getWorld());
    if (match != null && entity.getType() == EntityType.PLAYER)
    {
      AutoRefPlayer apl = match.getPlayer((Player) entity);
      if (apl != null) plugin.getServer().getScheduler()
        .runTask(plugin, new HealthArmorChangeTask(apl));
    }
  }
View Full Code Here

  {
    HumanEntity he = event.getPlayer();
    if (!(he instanceof Player)) return;
    Player pl = (Player) he;

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

    if (match == null || apl == null)
    { return; }
    if (apl.getTeam() == null)
    { return; }
View Full Code Here

      throw new CommandPermissionException(command, "Command not available from console");

    if (sender instanceof Player)
    {
      Player player = (Player) sender;
      AutoRefMatch match = AutoReferee.getInstance().getMatch(player.getWorld());
      Role role = match == null ? AutoRefMatch.Role.NONE : match.getRole(player);

      if (!role.atLeast(permissions.role()))
        throw new CommandPermissionException(command, match == null
          ? "Command available only within an AutoReferee match"
          : ("Command not available to " + role.toString().toLowerCase()));
View Full Code Here

  {
    HumanEntity he = event.getPlayer();
    if (!(he instanceof Player)) return;
    Player pl = (Player) he;

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

    if (match == null || apl == null)
    { return; }
    if (apl.getTeam() == null)
    { return; }

    GoalsInventorySnapshot before = apl.getBeforeOpeningInventorySnapshot();
    GoalsInventorySnapshot snap = apl.getCarrying();

    if (before == null)
    { return; }

    MapDifference<BlockData, Integer> diff = before.getDiff(snap);
    if (diff.areEqual())
    { return; }

    GoalsInventorySnapshot droppedOff = GoalsInventorySnapshot.fromDiff(diff, true);
    GoalsInventorySnapshot pickedUp = GoalsInventorySnapshot.fromDiff(diff, false);

    if (!droppedOff.isEmpty() && !pickedUp.isEmpty())
    {
      match.addEvent(new TranscriptEvent(match,
          TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
          // {player} has dropped off {snap} and picked up {snap} from a {container} (@ {loc})
          "%s has dropped off %s and picked up %s from a %s (@ %s)", apl.getDisplayName(),
          droppedOff, pickedUp, apl.getInventoryDescription(),
          LocationUtil.toBlockCoords(apl.getInventoryLocation())),
          apl.getInventoryLocation(), unpack2(droppedOff, pickedUp, apl)
      ));
    }
    else if (!droppedOff.isEmpty())
    {
      match.addEvent(new TranscriptEvent(match,
          TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
          // {player} has dropped off {snap} in a {container} (@ {loc})
          "%s has dropped off %s in a %s (@ %s)", apl.getDisplayName(),
          droppedOff, apl.getInventoryDescription(),
          LocationUtil.toBlockCoords(apl.getInventoryLocation())),
          apl.getInventoryLocation(), unpack(droppedOff, apl)
      ));
    }
    else if (!pickedUp.isEmpty())
    {
      match.addEvent(new TranscriptEvent(match,
          TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
          // {player} has picked up {snap} from a {container} (@ {loc})
          "%s has picked up %s from a %s (@ %s)", apl.getDisplayName(),
          pickedUp, apl.getInventoryDescription(),
          LocationUtil.toBlockCoords(apl.getInventoryLocation())),
View Full Code Here

  public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
  {
    AutoReferee plugin = AutoReferee.getInstance();

    World world = plugin.getSenderWorld(sender);
    AutoRefMatch match = plugin.getMatch(world);

    // reparse the args properly using the string tokenizer from org.apache.commons
    args = new StrTokenizer(StringUtils.join(args, ' '), StrMatcher.splitMatcher(),
      StrMatcher.quoteMatcher()).setTrimmerMatcher(StrMatcher.trimMatcher()).getTokenArray();
View Full Code Here

  public void tracePlace(BlockPlaceEvent event)
  {
    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)
    { return; }
    if (apl.getTeam() == null)
    { return; }

    for (Map.Entry<BlockData, AutoRefGoal> entry :
        apl.getTeam().getGoalsByObjective().entrySet())
    {
      BlockData b = entry.getKey();
      AutoRefGoal g = entry.getValue();
      if (b.matchesBlock(block))
      {
        if (g.getItemStatus() != AutoRefGoal.ItemStatus.TARGET
            && g.isSatisfied(match)) {
          match.addEvent(new TranscriptEvent(match,
              TranscriptEvent.EventType.OBJECTIVE_PLACED, String.format(
              "%s has placed the %s on the Victory Monument!",
              apl.getDisplayName(), b.getDisplayName()), block.getLocation(), apl, b
          ));
        } else {
          // TranscriptEvent.ObjectiveDetailType.PLACE
          match.addEvent(new TranscriptEvent(match,
              TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
              // {player} has placed a {goal} block (@ {loc})
              "%s has placed a %s block (@ %s)", apl.getDisplayName(),
              b.getDisplayName(),
              LocationUtil.toBlockCoords(block.getLocation())),
View Full Code Here

  public void traceBreak(BlockBreakEvent event)
  {
    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)
    { return; }
    if (apl.getTeam() == null)
    { return; }

    checkContainerBreak(block, apl.getTeam().getObjectives(), match,
        apl.getDisplayName());
    for (BlockData b : apl.getTeam().getObjectives())
    {
      if (b.matchesBlock(block))
      {
        // TranscriptEvent.ObjectiveDetailType.BREAK_PLAYER
        match.addEvent(new TranscriptEvent(match,
            TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
            // {player} has broken a {goal} block (@ {loc})
            "%s has broken a %s block (@ %s)", apl.getDisplayName(),
            b.getDisplayName(),
            LocationUtil.toBlockCoords(block.getLocation())), block
View Full Code Here

    if (dropSkipPlayers.contains(pl))
    { return; }

    BlockData item = new BlockData(event.getItemDrop().getItemStack());

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

    if (match == null || apl == null)
    { return; }
    if (apl.getTeam() == null)
    { return; }

    for (BlockData b : apl.getTeam().getObjectives())
    {
      if (b.equals(item))
      {
        GoalsInventorySnapshot droppedItems = new GoalsInventorySnapshot(event.getItemDrop().getItemStack(), b);
        match.addEvent(new TranscriptEvent(match,
            TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
              // {player} has tossed {snap} (@ {loc})
              "%s has tossed %s (@ %s)", apl.getDisplayName(),
              droppedItems, LocationUtil.toBlockCoords(pl.getLocation())),
            pl.getLocation(), apl, b
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefMatch$MatchReportSaver

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.