summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Ward <chris@chrisgward.com>2012-12-24 01:55:53 +1100
committerChris Ward <chris@chrisgward.com>2012-12-24 01:55:53 +1100
commit6b18259af6e206bcccd22098c277e78b815d5dd3 (patch)
treee8c926df6199501bac6e4a6d24bcff61210cc3a2
parent99c750d18bf1f2a426e801a38c732923e3f50b11 (diff)
downloadEssentials-6b18259af6e206bcccd22098c277e78b815d5dd3.tar
Essentials-6b18259af6e206bcccd22098c277e78b815d5dd3.tar.gz
Essentials-6b18259af6e206bcccd22098c277e78b815d5dd3.tar.lz
Essentials-6b18259af6e206bcccd22098c277e78b815d5dd3.tar.xz
Essentials-6b18259af6e206bcccd22098c277e78b815d5dd3.zip
Adding permission node to speak, with config option to enable the node
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java6
-rw-r--r--Essentials/src/config.yml3
-rw-r--r--Essentials/src/messages.properties1
-rw-r--r--Essentials/src/messages_cs.properties1
-rw-r--r--Essentials/src/messages_da.properties1
-rw-r--r--Essentials/src/messages_de.properties1
-rw-r--r--Essentials/src/messages_en.properties1
-rw-r--r--Essentials/src/messages_es.properties1
-rw-r--r--Essentials/src/messages_fi.properties1
-rw-r--r--Essentials/src/messages_fr.properties1
-rw-r--r--Essentials/src/messages_it.properties1
-rw-r--r--Essentials/src/messages_nl.properties1
-rw-r--r--Essentials/src/messages_pl.properties1
-rw-r--r--Essentials/src/messages_pt.properties1
-rw-r--r--Essentials/src/messages_se.properties1
17 files changed, 30 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 8887955a4..f617ff85b 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -60,6 +60,12 @@ public class EssentialsPlayerListener implements Listener
user.sendMessage(_("playerMuted"));
LOGGER.info(_("mutedUserSpeaks", user.getName()));
}
+ if(ess.getSettings().isChatPermEnabled() && !user.isAuthorized("essentials.chat.allowed"))
+ {
+ event.setCancelled(true);
+ user.sendMessage(_("playerChatDenied"));
+ LOGGER.info(_("mutedUserSpeaks", user.getName()));
+ }
final Iterator<Player> it = event.getRecipients().iterator();
while (it.hasNext())
{
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index a261c80bb..eb2af8554 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -187,4 +187,6 @@ public interface ISettings extends IConf
public void setEssentialsChatActive(boolean b);
long getMaxTempban();
+
+ boolean isChatPermEnabled();
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index d3c6b49d5..4138ae835 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -1014,4 +1014,10 @@ public class Settings implements ISettings
{
return config.getLong("max-tempban-time", -1);
}
+
+ @Override
+ public boolean isChatPermEnabled()
+ {
+ return config.getBoolean("enable-chat-perm", false);
+ }
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 3b03a9560..12e932b1c 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -351,6 +351,9 @@ mails-per-minute: 1000
# Set to -1 to disable, and essentials.tempban.unlimited can be used to override.
max-tempban-time: -1
+# Require users have essentials.chat before they can speak? Any users without this node will not be able to speak
+enable-chat-perm: false
+
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index cec54fb85..acec050ff 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index 486c085cb..4cbf3e91e 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -481,3 +481,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index f69dc4ebb..8d66386d5 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 2d2284542..f5d666727 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index cec54fb85..acec050ff 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index 7915968fb..34dacad69 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index 05da0a0d6..cf01efa93 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 82566c31e..869599d02 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index c8bcdd711..fe001b319 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 07c85443e..a4d39da29 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 4c666c1cc..45123abbe 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index 8db1a6bc4..4a6ab2eee 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index fde632b89..4ad4a5267 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -478,3 +478,4 @@ recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1}
recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 <number> to see other recipes for \u00a7c{2}
recipeWhere=\u00a76Where: {0}
recipeShapeless=\u00a76Combine \u00a7c{0}
+playerChatDenied=\u00a76You do not have permission to speak.