map parser visual changes

This commit is contained in:
Chiss 2015-01-26 11:31:42 +11:00
parent f80e640d34
commit b98950b121

View File

@ -5,6 +5,7 @@ import java.io.File;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.mapparser.GameType; import mineplex.mapparser.GameType;
@ -15,6 +16,8 @@ import mineplex.mapparser.MapParser;
*/ */
public class ListCommand extends BaseCommand public class ListCommand extends BaseCommand
{ {
private boolean _colorSwitch = false;
public ListCommand(MapParser plugin) public ListCommand(MapParser plugin)
{ {
super(plugin, "list"); super(plugin, "list");
@ -27,9 +30,13 @@ public class ListCommand extends BaseCommand
{ {
UtilPlayer.message(player, F.main("Parser", "Listing Maps;")); UtilPlayer.message(player, F.main("Parser", "Listing Maps;"));
boolean colorSwitch = false;
for (GameType gameType : GameType.values()) for (GameType gameType : GameType.values())
{ {
listMaps(player, gameType); listMaps(player, gameType, colorSwitch);
colorSwitch = !colorSwitch;
} }
} }
else if (args.length == 1) else if (args.length == 1)
@ -46,16 +53,18 @@ public class ListCommand extends BaseCommand
UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName())));
listMaps(player, gameType); listMaps(player, gameType, false);
} }
return true; return true;
} }
private void listMaps(Player player, GameType gameType) private void listMaps(Player player, GameType gameType, boolean colorSwitch)
{ {
String maps = ""; String maps = "";
ChatColor color = ChatColor.YELLOW; ChatColor color = ChatColor.YELLOW;
if (colorSwitch)
color = ChatColor.AQUA;
File mapsFolder = new File("map" + File.separator + gameType.GetName()); File mapsFolder = new File("map" + File.separator + gameType.GetName());
if (!mapsFolder.exists()) if (!mapsFolder.exists())
@ -70,14 +79,18 @@ public class ListCommand extends BaseCommand
if (color == ChatColor.YELLOW) if (color == ChatColor.YELLOW)
color = ChatColor.GOLD; color = ChatColor.GOLD;
else else if (color == ChatColor.GOLD)
color = ChatColor.YELLOW; color = ChatColor.YELLOW;
else if (color == ChatColor.AQUA)
color = ChatColor.DARK_AQUA;
else if (color == ChatColor.DARK_AQUA)
color = ChatColor.AQUA;
} }
// Print line of maps for specific gametype // Print line of maps for specific gametype
if (maps.length() > 0) if (maps.length() > 0)
{ {
maps = F.elem(gameType.name()) + "> " + maps; maps = F.elem(colorSwitch ? C.cBlue : C.cRed + gameType.name()) + "> " + maps;
player.sendMessage(maps); player.sendMessage(maps);
} }
} }