mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-11-05 19:41:56 +00:00
Add 'color' sign type to config file.
Enforce colour permission on signs when essentials signs are enabled.
This commit is contained in:
parent
07f859e38b
commit
970364886c
4 changed files with 22 additions and 3 deletions
|
@ -303,7 +303,7 @@ public class Settings implements ISettings
|
||||||
@Override
|
@Override
|
||||||
public boolean areSignsDisabled()
|
public boolean areSignsDisabled()
|
||||||
{
|
{
|
||||||
return enabledSigns.isEmpty();
|
return !signsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -422,6 +422,7 @@ public class Settings implements ISettings
|
||||||
return epItemSpwn;
|
return epItemSpwn;
|
||||||
}
|
}
|
||||||
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
||||||
|
private boolean signsEnabled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EssentialsSign> enabledSigns()
|
public List<EssentialsSign> enabledSigns()
|
||||||
|
@ -440,6 +441,11 @@ public class Settings implements ISettings
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (signName.equals("COLOR") || signName.equals("COLOUR"))
|
||||||
|
{
|
||||||
|
signsEnabled = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newSigns.add(Signs.valueOf(signName).getSign());
|
newSigns.add(Signs.valueOf(signName).getSign());
|
||||||
|
@ -447,7 +453,9 @@ public class Settings implements ISettings
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
|
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
signsEnabled = true;
|
||||||
}
|
}
|
||||||
return newSigns;
|
return newSigns;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.earth2me.essentials.signs;
|
||||||
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -87,9 +88,17 @@ public class SignBlockListener implements Listener
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
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())
|
for (Signs signs : Signs.values())
|
||||||
{
|
{
|
||||||
final EssentialsSign sign = signs.getSign();
|
final EssentialsSign sign = signs.getSign();
|
||||||
|
|
|
@ -19,6 +19,7 @@ public enum Signs
|
||||||
TRADE(new SignTrade()),
|
TRADE(new SignTrade()),
|
||||||
WARP(new SignWarp()),
|
WARP(new SignWarp()),
|
||||||
WEATHER(new SignWeather());
|
WEATHER(new SignWeather());
|
||||||
|
|
||||||
private final EssentialsSign sign;
|
private final EssentialsSign sign;
|
||||||
|
|
||||||
private Signs(final EssentialsSign sign)
|
private Signs(final EssentialsSign sign)
|
||||||
|
|
|
@ -175,10 +175,11 @@ kits:
|
||||||
# Essentials Sign Control
|
# Essentials Sign Control
|
||||||
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
|
# 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.
|
# 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).
|
# We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette).
|
||||||
|
|
||||||
enabledSigns:
|
enabledSigns:
|
||||||
|
#- color
|
||||||
#- balance
|
#- balance
|
||||||
#- buy
|
#- buy
|
||||||
#- sell
|
#- sell
|
||||||
|
|
Loading…
Reference in a new issue