Allow changing of sign colors
This commit is contained in:
parent
dcc978a07e
commit
13c9f174c6
@ -19,6 +19,12 @@ destMemory: false
|
|||||||
ignoreEntrance: false
|
ignoreEntrance: false
|
||||||
# Whether to allow vehicles through gates
|
# Whether to allow vehicles through gates
|
||||||
handleVehicles: true
|
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
|
# Stargate economy options
|
||||||
|
|
||||||
@ -36,10 +42,6 @@ toowner: false
|
|||||||
chargefreedestination: true
|
chargefreedestination: true
|
||||||
# Whether a free gate in the destination list is drawn green
|
# Whether a free gate in the destination list is drawn green
|
||||||
freegatesgreen: false
|
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 -- Only enable if you have issues, massive console output
|
||||||
debug: false
|
debug: false
|
||||||
|
@ -624,29 +624,29 @@ public class Portal {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Sign sign = (Sign)id.getBlock().getState();
|
Sign sign = (Sign)id.getBlock().getState();
|
||||||
sign.setLine(0, "--" + name + "--");
|
Stargate.setLine(sign, 0, "--" + name + "--");
|
||||||
int max = destinations.size() - 1;
|
int max = destinations.size() - 1;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
sign.setLine(++done, "Right click to");
|
Stargate.setLine(sign, ++done, "Right click to");
|
||||||
sign.setLine(++done, "use the gate");
|
Stargate.setLine(sign, ++done, "use the gate");
|
||||||
if (!noNetwork) {
|
if (!noNetwork) {
|
||||||
sign.setLine(++done, " (" + network + ") ");
|
Stargate.setLine(sign, ++done, " (" + network + ") ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isFixed()) {
|
if (isFixed()) {
|
||||||
sign.setLine(++done, "To: " + destination);
|
Stargate.setLine(sign, ++done, "To: " + destination);
|
||||||
if (noNetwork) {
|
if (noNetwork) {
|
||||||
sign.setLine(++done, "");
|
Stargate.setLine(sign, ++done, "");
|
||||||
} else {
|
} else {
|
||||||
sign.setLine(++done, " (" + network + ") ");
|
Stargate.setLine(sign, ++done, " (" + network + ") ");
|
||||||
}
|
}
|
||||||
Portal dest = Portal.getByName(destination, network);
|
Portal dest = Portal.getByName(destination, network);
|
||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
sign.setLine(++done, "(Not Connected)");
|
Stargate.setLine(sign, ++done, "(Not Connected)");
|
||||||
} else {
|
} else {
|
||||||
sign.setLine(++done, "");
|
Stargate.setLine(sign, ++done, "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int index = destinations.indexOf(destination);
|
int index = destinations.indexOf(destination);
|
||||||
@ -654,45 +654,45 @@ public class Portal {
|
|||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destinations.get(index - 2), network);
|
Portal dest = Portal.getByName(destinations.get(index - 2), network);
|
||||||
boolean green = Stargate.isFree(activePlayer, this, dest);
|
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 {
|
} else {
|
||||||
sign.setLine(done, destinations.get(index - 2));
|
Stargate.setLine(sign, done, destinations.get(index - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((index > 0) && (++done <= 3)) {
|
if ((index > 0) && (++done <= 3)) {
|
||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destinations.get(index - 1), network);
|
Portal dest = Portal.getByName(destinations.get(index - 1), network);
|
||||||
boolean green = Stargate.isFree(activePlayer, this, dest);
|
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 {
|
} else {
|
||||||
sign.setLine(done, destinations.get(index - 1));
|
Stargate.setLine(sign, done, destinations.get(index - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (++done <= 3) {
|
if (++done <= 3) {
|
||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destination, network);
|
Portal dest = Portal.getByName(destination, network);
|
||||||
boolean green = Stargate.isFree(activePlayer, this, dest);
|
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 {
|
} else {
|
||||||
sign.setLine(done, " >" + destination + "< ");
|
Stargate.setLine(sign, done, " >" + destination + "< ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((max >= index + 1) && (++done <= 3)) {
|
if ((max >= index + 1) && (++done <= 3)) {
|
||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destinations.get(index + 1), network);
|
Portal dest = Portal.getByName(destinations.get(index + 1), network);
|
||||||
boolean green = Stargate.isFree(activePlayer, this, dest);
|
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 {
|
} else {
|
||||||
sign.setLine(done, destinations.get(index + 1));
|
Stargate.setLine(sign, done, destinations.get(index + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((max >= index + 2) && (++done <= 3)) {
|
if ((max >= index + 2) && (++done <= 3)) {
|
||||||
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
Portal dest = Portal.getByName(destinations.get(index + 2), network);
|
Portal dest = Portal.getByName(destinations.get(index + 2), network);
|
||||||
boolean green = Stargate.isFree(activePlayer, this, dest);
|
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 {
|
} else {
|
||||||
sign.setLine(done, destinations.get(index + 2));
|
Stargate.setLine(sign, done, destinations.get(index + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -95,6 +96,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
public static boolean handleVehicles = true;
|
public static boolean handleVehicles = true;
|
||||||
public static boolean sortLists = false;
|
public static boolean sortLists = false;
|
||||||
public static boolean protectEntrance = false;
|
public static boolean protectEntrance = false;
|
||||||
|
public static ChatColor signColor;
|
||||||
|
|
||||||
// Temp workaround for snowmen, don't check gate entrance
|
// Temp workaround for snowmen, don't check gate entrance
|
||||||
public static boolean ignoreEntrance = false;
|
public static boolean ignoreEntrance = false;
|
||||||
@ -179,6 +181,14 @@ public class Stargate extends JavaPlugin {
|
|||||||
handleVehicles = newConfig.getBoolean("handleVehicles");
|
handleVehicles = newConfig.getBoolean("handleVehicles");
|
||||||
sortLists = newConfig.getBoolean("sortLists");
|
sortLists = newConfig.getBoolean("sortLists");
|
||||||
protectEntrance = newConfig.getBoolean("protectEntrance");
|
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
|
||||||
debug = newConfig.getBoolean("debug");
|
debug = newConfig.getBoolean("debug");
|
||||||
permDebug = newConfig.getBoolean("permdebug");
|
permDebug = newConfig.getBoolean("permdebug");
|
||||||
@ -260,6 +270,10 @@ public class Stargate extends JavaPlugin {
|
|||||||
else
|
else
|
||||||
player.sendMessage(ChatColor.GREEN + Stargate.getString("prefix") + ChatColor.WHITE + message);
|
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() {
|
public static String getSaveLocation() {
|
||||||
return portalFolder;
|
return portalFolder;
|
||||||
|
Loading…
Reference in New Issue
Block a user