Skip to content

Commit

Permalink
Added an option to disable the statistics before the game.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryCarrade committed Dec 27, 2014
1 parent 57f833d commit e71468a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/me/azenet/UHPlugin/listeners/UHGameListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import me.azenet.UHPlugin.events.UHTeamDeathEvent;
import me.azenet.UHPlugin.i18n.I18n;

import org.bukkit.Achievement;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
Expand All @@ -65,6 +64,7 @@
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerStatisticIncrementEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
Expand Down Expand Up @@ -469,6 +469,18 @@ public void onPlayerAchievementAwarded(PlayerAchievementAwardedEvent ev) {
}
}

/**
* Used to disable the statistics before the game.
*
* @param ev
*/
@EventHandler
public void onPlayerStatisticIncrement(PlayerStatisticIncrementEvent ev) {
if(!p.getGameManager().isGameStarted() && p.getConfig().getBoolean("statistics.disableStatisticsBeforeStart", true)) {
ev.setCancelled(true);
}
}


/**
* Used to prevent players from breaking blocks if the game is not currently running.
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ achievements:



statistics:
# A player cannot increment a statistic if the game is not started?
disableStatisticsBeforeStart: true



start:
slow:
delayBetweenTP: 3 # in seconds
Expand Down

0 comments on commit e71468a

Please sign in to comment.