Package org.mctourney.autoreferee.AutoRefMatch

Examples of org.mctourney.autoreferee.AutoRefMatch.TranscriptEvent


    //  images += getResourceString("webstats/image-items.css");
    }
    catch (IOException e) { return null; }

    StringWriter transcript = new StringWriter();
    TranscriptEvent endEvent = null;
    for (TranscriptEvent e : match.getTranscript())
    {
      transcript.write(transcriptEventHTML(match, e));
      if (e.getType() != TranscriptEvent.EventType.MATCH_END) endEvent = e;
    }

    AutoRefTeam win = match.getWinningTeam();
    String winningTeam = (win == null) ? "??" :
      String.format("<span class='team team-%s'>%s</span>",
        getTag(win), ChatColor.stripColor(win.getDisplayName()));

    Set<String> refList = Sets.newHashSet();
    for (Player pl : match.getReferees())
      refList.add(String.format("<span class='referee'>%s</span>", pl.getName()));

    Set<String> streamerList = Sets.newHashSet();
    for (Player pl : match.getStreamers())
      streamerList.add(String.format("<span class='streamer'>%s</span>", pl.getName()));

    List<String> extraRows = Lists.newLinkedList();
    for (Map.Entry<String, String> e : this.customDetails.entrySet())
      extraRows.add(String.format("<tr><th>%s</th><td>%s</td></tr>", e.getKey(), e.getValue()));

    File mapImage = new File(match.getWorld().getWorldFolder(), "map.png");
    if (!mapImage.exists()) match.saveMapImage();
    Location ptMin = match.getMapCuboid().getMinimumPoint();

    return (htm
      // base files get replaced first
      .replaceAll("#base-css#", css.replaceAll("\\s+", " ") + images)
      .replaceAll("#base-js#", Matcher.quoteReplacement(js))

      // followed by the team, player, and block styles
      .replaceAll("#team-css#", getTeamStyles(match).replaceAll("\\s+", " "))
      .replaceAll("#plyr-css#", getPlayerStyles(match).replaceAll("\\s+", " "))
      .replaceAll("#blok-css#", getBlockStyles(match).replaceAll("\\s+", " "))
      .replaceAll("#map-data#", String.format("{image:'%s', x:%d, z:%d}",
        MapImageGenerator.imageToDataURI(mapImage, "image/png"), ptMin.getBlockX(), ptMin.getBlockZ()))

      // then match and map names
      .replaceAll("#title#", match.getMatchName())
      .replaceAll("#map#", match.getMapName())

      // date and length of match
      .replaceAll("#date#", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL).format(new Date()))
      .replaceAll("#length#", endEvent == null ? "??" : endEvent.getTimestamp())

      // team information (all teams, and winning team)
      .replaceAll("#teams#", getTeamList(match))
      .replaceAll("#winners#", winningTeam)
View Full Code Here


    if (getExitLocation() != null) loc = getExitLocation();

    match.messageReferees("player", getName(), "deathpos", LocationUtil.toBlockCoords(loc));
    match.messageReferees("player", getName(), "deaths", Integer.toString(totalDeaths));

    TranscriptEvent entry = new TranscriptEvent(match, TranscriptEvent.EventType.PLAYER_DEATH,
      e.getDeathMessage(), loc, this, killer);

    match.addEvent(entry);

    String m = entry.getColoredMessage();
    for (Player pl : match.getWorld().getPlayers())
      pl.sendMessage(pl != e.getEntity().getKiller() || from == null ? m
        : String.format("%s " + ChatColor.DARK_GRAY + "(@ %.2f)", m, getLocation().distance(from)));

    this.setLastDeathLocation(loc);
View Full Code Here

   */
  public void resetKillStreak()
  {
    // if it meets the requirements, report it
    if (totalStreak >= MIN_KILLSTREAK)
      getMatch().addEvent(new TranscriptEvent(getMatch(), TranscriptEvent.EventType.PLAYER_STREAK,
        String.format("%s had a %d-kill streak!", this.getName(), totalStreak), null, this));

    // reset to zero
    this.totalStreak = 0;
  }
View Full Code Here

    match.messageReferees("player", getName(), "kills", Integer.toString(totalKills));

    if (getStreak(apl) + 1 == MIN_DOMINATE)
    {
      match.messageReferees("player", getName(), "dominate", apl.getName());
      match.addEvent(new TranscriptEvent(match, TranscriptEvent.EventType.PLAYER_DOMINATE,
        String.format("%s is dominating %s", this.getName(), apl.getName()), apl.getLocation(), apl, this));
    }

    if (apl.isDominating(this))
    {
      match.messageReferees("player", getName(), "revenge", apl.getName());
      match.addEvent(new TranscriptEvent(match, TranscriptEvent.EventType.PLAYER_REVENGE,
        String.format("%s got revenge on %s", this.getName(), apl.getName()), loc, this, apl));
      this.addPoints(AchievementPoints.REVENGE);
    }

    // reset player streaks
View Full Code Here

        for (BlockGoal goal : getTeam().getTeamGoals(BlockGoal.class))
          if (goal.getItemStatus() == AutoRefGoal.ItemStatus.NONE && carrying.containsKey(goal.getItem()))
          {
            // generate a transcript event for being the first
            String m = String.format("%s is carrying the first %s!", getDisplayName(), goal.getItem().getDisplayName());
            getMatch().addEvent(new TranscriptEvent(getMatch(),
              TranscriptEvent.EventType.OBJECTIVE_FOUND, m, getLocation(), this, goal.getItem()));
            this.addPoints(AchievementPoints.OBJECTIVE_FOUND);

            // store the player's location as the last objective location
            getTeam().setLastObjectiveLocation(getLocation());
View Full Code Here

    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

      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

    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

    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

        .fromItemsAndGoals(ev.getDrops(), apl.getTeam().getObjectives());

    if (snapshot.isEmpty())
    { return; }

    match.addEvent(new TranscriptEvent(
            match,
            TranscriptEvent.EventType.OBJECTIVE_DETAIL,
            // {player} has dropped {snap} when dying (@ {loc})
            String.format("%s has dropped %s when dying (@ %s)",
                apl.getDisplayName(), snapshot, LocationUtil.toBlockCoords(
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefMatch.TranscriptEvent

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.