Add 'color' sign type to config file.

Enforce colour permission on signs when essentials signs are enabled.
This commit is contained in:
KHobbits 2012-03-19 08:21:39 +00:00
parent 07f859e38b
commit 970364886c
4 changed files with 22 additions and 3 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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)

View File

@ -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