summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-03-19 08:21:39 +0000
committerKHobbits <rob@khobbits.co.uk>2012-03-19 08:21:39 +0000
commit970364886c4bf2400460c4903381ba295f89dfac (patch)
tree3574564d97636967d21b5dbc0e8c8f842e9b94cd
parent07f859e38bf524ed2360826e0c8c3a450420237c (diff)
downloadEssentials-970364886c4bf2400460c4903381ba295f89dfac.tar
Essentials-970364886c4bf2400460c4903381ba295f89dfac.tar.gz
Essentials-970364886c4bf2400460c4903381ba295f89dfac.tar.lz
Essentials-970364886c4bf2400460c4903381ba295f89dfac.tar.xz
Essentials-970364886c4bf2400460c4903381ba295f89dfac.zip
Add 'color' sign type to config file.
Enforce colour permission on signs when essentials signs are enabled.
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/Signs.java1
-rw-r--r--Essentials/src/config.yml3
4 files changed, 22 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index e0e2dd63b..6db8dcafc 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -303,7 +303,7 @@ public class Settings implements ISettings
@Override
public boolean areSignsDisabled()
{
- return enabledSigns.isEmpty();
+ return !signsEnabled;
}
@Override
@@ -422,6 +422,7 @@ public class Settings implements ISettings
return epItemSpwn;
}
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
+ private boolean signsEnabled = false;
@Override
public List<EssentialsSign> enabledSigns()
@@ -440,6 +441,11 @@ public class Settings implements ISettings
{
continue;
}
+ if (signName.equals("COLOR") || signName.equals("COLOUR"))
+ {
+ signsEnabled = true;
+ continue;
+ }
try
{
newSigns.add(Signs.valueOf(signName).getSign());
@@ -447,7 +453,9 @@ public class Settings implements ISettings
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
+ continue;
}
+ signsEnabled = true;
}
return newSigns;
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index e57919ab1..bd90d6c47 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.signs;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Material;
@@ -87,9 +88,17 @@ public class SignBlockListener implements Listener
{
for (int i = 0; i < 4; i++)
{
- event.setLine(i, event.getLine(i).replaceAll("&([0-9a-f])", "ยง$1"));
+ event.setLine(i, Util.replaceColor(event.getLine(i)));
}
}
+ else
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ event.setLine(i, Util.stripColor(event.getLine(i)));
+ }
+ }
+
for (Signs signs : Signs.values())
{
final EssentialsSign sign = signs.getSign();
diff --git a/Essentials/src/com/earth2me/essentials/signs/Signs.java b/Essentials/src/com/earth2me/essentials/signs/Signs.java
index e29d45ad4..2cf05ee77 100644
--- a/Essentials/src/com/earth2me/essentials/signs/Signs.java
+++ b/Essentials/src/com/earth2me/essentials/signs/Signs.java
@@ -19,6 +19,7 @@ public enum Signs
TRADE(new SignTrade()),
WARP(new SignWarp()),
WEATHER(new SignWeather());
+
private final EssentialsSign sign;
private Signs(final EssentialsSign sign)
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 3aea83772..7b72ee1c0 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -175,10 +175,11 @@ kits:
# Essentials Sign Control
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
# To enable signs, remove # symbol. To disable all signs, comment/remove each sign.
-# If there are no signs enabled, all sign features will be disabled including sign colours.
+# Essentials Colored sign support will be enabled when any sign types are enabled.
# We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette).
enabledSigns:
+ #- color
#- balance
#- buy
#- sell