diff --git a/src/config.yml b/src/config.yml index 7335935..d045fc7 100644 --- a/src/config.yml +++ b/src/config.yml @@ -19,6 +19,12 @@ destMemory: false ignoreEntrance: false # Whether to allow vehicles through gates handleVehicles: true +# Whether to sort network lists alphabetically +sortLists: false +# Whether to protect gate entrance material +protectEntrance: false +# The color used for drawing signs (Default: BLACK). +signColor: BLACK # Stargate economy options @@ -36,10 +42,6 @@ toowner: false chargefreedestination: true # Whether a free gate in the destination list is drawn green freegatesgreen: false -# Whether to sort network lists alphabetically -sortLists: false -# Whether to protect gate entrance material -protectEntrance: false # Debug -- Only enable if you have issues, massive console output debug: false diff --git a/src/net/TheDgtl/Stargate/Portal.java b/src/net/TheDgtl/Stargate/Portal.java index 1572256..af4424f 100644 --- a/src/net/TheDgtl/Stargate/Portal.java +++ b/src/net/TheDgtl/Stargate/Portal.java @@ -624,29 +624,29 @@ public class Portal { return; } Sign sign = (Sign)id.getBlock().getState(); - sign.setLine(0, "--" + name + "--"); + Stargate.setLine(sign, 0, "--" + name + "--"); int max = destinations.size() - 1; int done = 0; if (!isActive()) { - sign.setLine(++done, "Right click to"); - sign.setLine(++done, "use the gate"); + Stargate.setLine(sign, ++done, "Right click to"); + Stargate.setLine(sign, ++done, "use the gate"); if (!noNetwork) { - sign.setLine(++done, " (" + network + ") "); + Stargate.setLine(sign, ++done, " (" + network + ") "); } } else { if (isFixed()) { - sign.setLine(++done, "To: " + destination); + Stargate.setLine(sign, ++done, "To: " + destination); if (noNetwork) { - sign.setLine(++done, ""); + Stargate.setLine(sign, ++done, ""); } else { - sign.setLine(++done, " (" + network + ") "); + Stargate.setLine(sign, ++done, " (" + network + ") "); } Portal dest = Portal.getByName(destination, network); if (dest == null) { - sign.setLine(++done, "(Not Connected)"); + Stargate.setLine(sign, ++done, "(Not Connected)"); } else { - sign.setLine(++done, ""); + Stargate.setLine(sign, ++done, ""); } } else { int index = destinations.indexOf(destination); @@ -654,45 +654,45 @@ public class Portal { if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) { Portal dest = Portal.getByName(destinations.get(index - 2), network); boolean green = Stargate.isFree(activePlayer, this, dest); - sign.setLine(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 2)); + Stargate.setLine(sign, done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 2)); } else { - sign.setLine(done, destinations.get(index - 2)); + Stargate.setLine(sign, done, destinations.get(index - 2)); } } if ((index > 0) && (++done <= 3)) { if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) { Portal dest = Portal.getByName(destinations.get(index - 1), network); boolean green = Stargate.isFree(activePlayer, this, dest); - sign.setLine(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 1)); + Stargate.setLine(sign, done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 1)); } else { - sign.setLine(done, destinations.get(index - 1)); + Stargate.setLine(sign, done, destinations.get(index - 1)); } } if (++done <= 3) { if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) { Portal dest = Portal.getByName(destination, network); boolean green = Stargate.isFree(activePlayer, this, dest); - sign.setLine(done, (green ? ChatColor.DARK_GREEN : "") + " >" + destination + "< "); + Stargate.setLine(sign, done, (green ? ChatColor.DARK_GREEN : "") + " >" + destination + "< "); } else { - sign.setLine(done, " >" + destination + "< "); + Stargate.setLine(sign, done, " >" + destination + "< "); } } if ((max >= index + 1) && (++done <= 3)) { if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) { Portal dest = Portal.getByName(destinations.get(index + 1), network); boolean green = Stargate.isFree(activePlayer, this, dest); - sign.setLine(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 1)); + Stargate.setLine(sign, done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 1)); } else { - sign.setLine(done, destinations.get(index + 1)); + Stargate.setLine(sign, done, destinations.get(index + 1)); } } if ((max >= index + 2) && (++done <= 3)) { if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) { Portal dest = Portal.getByName(destinations.get(index + 2), network); boolean green = Stargate.isFree(activePlayer, this, dest); - sign.setLine(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 2)); + Stargate.setLine(sign, done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 2)); } else { - sign.setLine(done, destinations.get(index + 2)); + Stargate.setLine(sign, done, destinations.get(index + 2)); } } } diff --git a/src/net/TheDgtl/Stargate/Stargate.java b/src/net/TheDgtl/Stargate/Stargate.java index 431d182..1b031fb 100644 --- a/src/net/TheDgtl/Stargate/Stargate.java +++ b/src/net/TheDgtl/Stargate/Stargate.java @@ -18,6 +18,7 @@ import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.block.Block; +import org.bukkit.block.Sign; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; @@ -95,6 +96,7 @@ public class Stargate extends JavaPlugin { public static boolean handleVehicles = true; public static boolean sortLists = false; public static boolean protectEntrance = false; + public static ChatColor signColor; // Temp workaround for snowmen, don't check gate entrance public static boolean ignoreEntrance = false; @@ -179,6 +181,14 @@ public class Stargate extends JavaPlugin { handleVehicles = newConfig.getBoolean("handleVehicles"); sortLists = newConfig.getBoolean("sortLists"); protectEntrance = newConfig.getBoolean("protectEntrance"); + // Sign color + String sc = newConfig.getString("signColor"); + try { + signColor = ChatColor.valueOf(sc.toUpperCase()); + } catch (Exception ignore) { + log.warning("[Stargate] You have specified an invalid color in your config.yml. Defaulting to BLACK"); + signColor = ChatColor.BLACK; + } // Debug debug = newConfig.getBoolean("debug"); permDebug = newConfig.getBoolean("permdebug"); @@ -260,6 +270,10 @@ public class Stargate extends JavaPlugin { else player.sendMessage(ChatColor.GREEN + Stargate.getString("prefix") + ChatColor.WHITE + message); } + + public static void setLine(Sign sign, int index, String text) { + sign.setLine(index, Stargate.signColor + text); + } public static String getSaveLocation() { return portalFolder;