package me.stefvanschie.buildinggame.timers;

import me.confuser.barapi.BarAPI;
import me.stefvanschie.buildinggame.Main;
import me.stefvanschie.buildinggame.managers.files.SettingsManager;
import me.stefvanschie.buildinggame.managers.messages.MessageManager;
import me.stefvanschie.buildinggame.managers.softdependencies.SDBarApi;
import me.stefvanschie.buildinggame.utils.Arena;
import me.stefvanschie.buildinggame.utils.GameState;
import me.stefvanschie.buildinggame.utils.Plot;

import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

public class BuildTimer extends BukkitRunnable {

	private int seconds;
	private int originalSeconds;
	private Arena arena;
	
	public BuildTimer(int seconds, Arena arena) {
		this.seconds = seconds;
		originalSeconds = seconds;
		this.arena = arena;
	}
	
	@Override
	public void run() {
		YamlConfiguration messages = SettingsManager.getInstance().getMessages();
		
		if (seconds <= 0) {
			//voten
			for (Plot plot : arena.getPlots()) {
				if (plot.getPlayerData() != null) {
					Player player = plot.getPlayerData().getPlayer();
					if (SDBarApi.getInstance().isEnabled()) {
						if (BarAPI.hasBar(player)) {
							BarAPI.removeBar(player);
						}
					}
				}
			}
			arena.getVoteTimer().runTaskTimer(Main.getInstance(), 20L, 20L);
			arena.setState(GameState.VOTING);
			this.cancel();
		} else if ((seconds != originalSeconds && seconds % 60 == 0) || seconds == 30 || seconds == 15 || (seconds <= 10 && seconds >= 1)) {
			for (Plot plot : arena.getPlots()) {
				if (plot.getPlayerData() != null) {
					Player player = plot.getPlayerData().getPlayer();
					MessageManager.getInstance().send(player, messages.getString("buildingCountdown.message")
							.replace("%seconds%", seconds + "")
							.replaceAll("&", "§"));
				}
			}
		}
		seconds--;
	}
	
	public int getSeconds() {
		return seconds;
	}
}

@@ -473,15 +473,48 @@
 ils.
+plot.
 Plot;%0A%0A
+import org.bukkit.GameMode;%0A
 impo
@@ -719,38 +719,8 @@
 ds;%0A
-%09private int originalSeconds;%0A
 %09pri
@@ -816,37 +816,8 @@
 ds;%0A
-%09%09originalSeconds = seconds;%0A
 %09%09th
@@ -1114,24 +1114,68 @@
 etPlayer();%0A
+%09%09%09%09%09player.setGameMode(GameMode.CREATIVE);%0A
 %09%09%09%09%09if (SDB
@@ -1443,39 +1443,8 @@
 if (
-(seconds != originalSeconds && 
 seco
@@ -1456,17 +1456,16 @@
  60 == 0
-)
  %7C%7C seco

Update BuildTimer.java