diff --git a/src/me/PauMAVA/TTR/TTRCore.java b/src/me/PauMAVA/TTR/TTRCore.java index c0df35f..ac4bdfb 100644 --- a/src/me/PauMAVA/TTR/TTRCore.java +++ b/src/me/PauMAVA/TTR/TTRCore.java @@ -26,7 +26,7 @@ public class TTRCore extends JavaPlugin { private static TTRCore instance; - private boolean enabled = false; + private boolean enabled = true; private TTRMatch match; private TTRTeamHandler teamHandler; private TTRConfigManager configManager; @@ -64,4 +64,8 @@ public TTRMatch getCurrentMatch() { public TTRTeamHandler getTeamHandler() { return this.teamHandler; } + + public TTRConfigManager getConfigManager() { + return this.configManager; + } } diff --git a/src/me/PauMAVA/TTR/config/TTRConfigManager.java b/src/me/PauMAVA/TTR/config/TTRConfigManager.java index b785b05..57b218f 100644 --- a/src/me/PauMAVA/TTR/config/TTRConfigManager.java +++ b/src/me/PauMAVA/TTR/config/TTRConfigManager.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; public class TTRConfigManager { @@ -81,6 +82,10 @@ public int getTeamCount() { return this.teamsSection.getKeys(false).size(); } + public Set getTeamNames() { + return this.teamsSection.getKeys(false); + } + private ConfigurationSection getTeam(String teamName) { for(String key: this.teamsSection.getKeys(false)) { if(key.equalsIgnoreCase(teamName)) { diff --git a/src/me/PauMAVA/TTR/ui/TeamSelector.java b/src/me/PauMAVA/TTR/ui/TeamSelector.java index 131c198..6463e27 100644 --- a/src/me/PauMAVA/TTR/ui/TeamSelector.java +++ b/src/me/PauMAVA/TTR/ui/TeamSelector.java @@ -18,15 +18,21 @@ package me.PauMAVA.TTR.ui; +import me.PauMAVA.TTR.TTRCore; +import org.bukkit.Material; +import org.bukkit.entity.Item; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; public class TeamSelector extends CustomUI { private Player owner; + private int selected = -1; public TeamSelector(Player player) { super(27, "Team Selection"); this.owner = player; + setUp(); } public void openSelector() { @@ -37,4 +43,12 @@ public void closeSelector() { super.closeUI(this.owner); } + public void setUp() { + int i = 0; + for(String teamName: TTRCore.getInstance().getConfigManager().getTeamNames()) { + setSlot(i, new ItemStack(Material.valueOf(TTRCore.getInstance().getConfigManager().getTeamColor(teamName).name() + "_WOOL"), 1), TTRCore.getInstance().getConfigManager().getTeamColor(teamName) + teamName, null); + i++; + } + } + }