Add chat configurables.

This commit is contained in:
KHobbits 2014-03-30 15:50:32 +01:00
parent f272a7ecd6
commit 0e6a5240db
4 changed files with 43 additions and 7 deletions

View File

@ -29,6 +29,10 @@ public interface ISettings extends IConf
String getChatFormat(String group);
int getChatRadius();
char getChatShout();
char getChatQuestion();
BigDecimal getCommandCost(IEssentialsCommand cmd);

View File

@ -94,6 +94,34 @@ public class Settings implements net.ess3.api.ISettings
{
return chatRadius;
}
// #easteregg
private char chatShout = '!';
private char _getChatShout()
{
return config.getString("chat.shout", "!").charAt(0);
}
@Override
public char getChatShout()
{
return chatShout;
}
// #easteregg
private char chatQuestion = '?';
private char _getChatQuestion()
{
return config.getString("chat.question", "?").charAt(0);
}
@Override
public char getChatQuestion()
{
return chatQuestion;
}
private boolean teleportSafety;
@ -524,6 +552,8 @@ public class Settings implements net.ess3.api.ISettings
disablePrefix = _disablePrefix();
disableSuffix = _disableSuffix();
chatRadius = _getChatRadius();
chatShout = _getChatShout();
chatQuestion = _getChatQuestion();
commandCosts = _getCommandCosts();
socialSpyCommands = _getSocialSpyCommands();
warnOnBuildDisallow = _warnOnBuildDisallow();

View File

@ -33,7 +33,6 @@ public class EssentialsChat extends JavaPlugin
final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<AsyncPlayerChatEvent, ChatStore>());
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore);

View File

@ -47,15 +47,18 @@ public abstract class EssentialsChatPlayer implements Listener
//Ignore empty chat events generated by plugins
return "";
}
switch (message.charAt(0))
final char prefix = message.charAt(0);
if (prefix == ess.getSettings().getChatShout())
{
case '!':
return "shout";
case '?':
}
else if (prefix == ess.getSettings().getChatQuestion())
{
return "question";
//case '@':
//return "admin";
default:
}
else
{
return "";
}
}