Skip to content

Commit

Permalink
Merge pull request #212 from rmct/2.8.1
Browse files Browse the repository at this point in the history
Release 2.8.1
  • Loading branch information
net committed Jan 3, 2016
2 parents f7a70c5 + fcdbbce commit ccae07a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.mctourney.autoreferee</groupId>
<artifactId>AutoReferee</artifactId>
<version>2.8</version>
<version>2.8.1</version>
<name>AutoReferee Core Plugin</name>
<url>https://www.reddit.com/r/mctourney</url>
<description>Bukkit plugin for automatically refereeing competitive Minecraft matches.</description>
Expand Down
25 changes: 16 additions & 9 deletions src/main/java/org/mctourney/autoreferee/AutoRefMatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -2368,37 +2368,44 @@ protected void _startMatch()
// match minute timer
AutoReferee plugin = AutoReferee.getInstance();
clockTask = new MatchClockTask();
clockTask.runTaskTimer(plugin, 60 * 20L, 60 * 20L);
clockTask.runTaskTimer(plugin, 20L, 20L);

if (plugin.playedMapsTracker != null)
plugin.playedMapsTracker.increment(normalizeMapName(this.getMapName()));
}

private static final Set<Long> announceMinutes =
Sets.newHashSet(60L, 30L, 10L, 5L, 4L, 3L, 2L, 1L);

// handle to the clock task
protected MatchClockTask clockTask;

protected class MatchClockTask extends BukkitRunnable
{
private Set<Long> announceMinutes = Sets.newHashSet(60L, 30L, 10L, 5L, 4L, 3L, 2L, 1L);

public void run()
{
AutoRefMatch match = AutoRefMatch.this;

if (match.hasTimeLimit())
{
long minutesRemaining = match.getTimeRemaining() / 60L;
if (minutesRemaining == 0L)
long secondsRemaining = match.getTimeRemaining();
if (secondsRemaining <= 0L)
{
String timelimit = (match.getTimeLimit() / 60L) + " min";
match.addEvent(new TranscriptEvent(match, TranscriptEvent.EventType.MATCH_END,
"Match time limit reached: " + timelimit, null));
match.endMatch();
}
else if (AutoRefMatch.announceMinutes.contains(minutesRemaining))
match.broadcast(">>> " + ChatColor.GREEN +
"Match ends in " + minutesRemaining + "m");
else
{
long minutesRemaining = secondsRemaining / 60L - 1;

if (announceMinutes.contains(minutesRemaining))
{
match.broadcast(">>> " + ChatColor.GREEN +
"Match ends in " + minutesRemaining + "m");
announceMinutes.remove(minutesRemaining);
}
}
}

// send clock updates to ensure that client hud stays sync'd
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mctourney/autoreferee/AutoRefPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Player getPlayer()
*/
public boolean isOnline()
{
return AutoReferee.getInstance().getServer().getOfflinePlayer(pname).isOnline()
return AutoReferee.getInstance().getServer().getPlayer(pname) != null
&& getPlayer().getWorld() == getMatch().getWorld();
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: AutoReferee
main: org.mctourney.autoreferee.AutoReferee
version: 2.8
version: 2.8.1
author: "authorblues, net"
load: startup

Expand Down

0 comments on commit ccae07a

Please sign in to comment.