package me.stefvanschie.buildinggame.timers;

import me.stefvanschie.buildinggame.managers.arenas.ArenaManager;
import me.stefvanschie.buildinggame.managers.files.SettingsManager;
import me.stefvanschie.buildinggame.utils.Arena;
import me.stefvanschie.buildinggame.utils.GameState;
import me.stefvanschie.buildinggame.utils.plot.Plot;

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

public class ScoreboardUpdater extends BukkitRunnable {

	@Override
	public void run() {
		YamlConfiguration config = SettingsManager.getInstance().getConfig();
		
		for (Arena arena : ArenaManager.getInstance().getArenas()) {
			if (arena.getState() == GameState.VOTING && !config.getBoolean("names-after-voting")) {
				for (Plot plot : arena.getUsedPlots()) {
					arena.getScoreboard().show(plot.getGamePlayer().getPlayer());
				}
				return;
			}
			
			if (arena.getState() == GameState.RESETING && config.getBoolean("names-after-voting")) {
				for (Plot plot : arena.getUsedPlots()) {
					arena.getScoreboard().show(plot.getGamePlayer().getPlayer());
				}
				return;
			}
			
			for (Plot plot : arena.getUsedPlots()) {
				arena.getBuildScoreboard().update(plot.getGamePlayer().getPlayer());
			}
		}
	}
}

@@ -215,21 +215,26 @@
 e.utils.
-Arena
+GamePlayer
 ;%0Aimport
@@ -280,16 +280,71 @@
 eState;%0A
+import me.stefvanschie.buildinggame.utils.arena.Arena;%0A
 import m
@@ -845,32 +845,92 @@
 tUsedPlots()) %7B%0A
+%09%09%09%09%09for (GamePlayer gamePlayer : plot.getGamePlayers()) %7B%0A%09
 %09%09%09%09%09arena.getSc
@@ -941,33 +941,25 @@
 oard().show(
-plot.getG
+g
 amePlayer().
@@ -947,34 +947,32 @@
 .show(gamePlayer
-()
 .getPlayer());%0A%09
@@ -962,32 +962,39 @@
 r.getPlayer());%0A
+%09%09%09%09%09%7D%0A
 %09%09%09%09%7D%0A%09%09%09%09return
@@ -1137,24 +1137,84 @@
 dPlots()) %7B%0A
+%09%09%09%09%09for (GamePlayer gamePlayer : plot.getGamePlayers()) %7B%0A%09
 %09%09%09%09%09arena.g
@@ -1233,25 +1233,17 @@
 ().show(
-plot.getG
+g
 amePlaye
@@ -1235,34 +1235,32 @@
 .show(gamePlayer
-()
 .getPlayer());%0A%09
@@ -1254,24 +1254,31 @@
 tPlayer());%0A
+%09%09%09%09%09%7D%0A
 %09%09%09%09%7D%0A%09%09%09%09re
@@ -1332,24 +1332,83 @@
 dPlots()) %7B%0A
+%09%09%09%09for (GamePlayer gamePlayer : plot.getGamePlayers()) %7B%0A%09
 %09%09%09%09arena.ge
@@ -1433,25 +1433,17 @@
 .update(
-plot.getG
+g
 amePlaye
@@ -1443,18 +1443,16 @@
 mePlayer
-()
 .getPlay
@@ -1458,16 +1458,22 @@
 yer());%0A
+%09%09%09%09%7D%0A
 %09%09%09%7D%0A%09%09%7D

Update ScoreboardUpdater.java