summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-11-14 20:28:47 -0500
committerKHobbits <rob@khobbits.co.uk>2013-12-05 23:03:33 +0000
commit1ae2b094f303a9b7adefcef6c9e5808d21851ebe (patch)
tree587505af5e28ee0ad7b4e9a256f7b0249d4a211b
parentdde8cd8f72baf0161d966f0bdfa6cc1c22ce30f7 (diff)
downloadEssentials-1ae2b094f303a9b7adefcef6c9e5808d21851ebe.tar
Essentials-1ae2b094f303a9b7adefcef6c9e5808d21851ebe.tar.gz
Essentials-1ae2b094f303a9b7adefcef6c9e5808d21851ebe.tar.lz
Essentials-1ae2b094f303a9b7adefcef6c9e5808d21851ebe.tar.xz
Essentials-1ae2b094f303a9b7adefcef6c9e5808d21851ebe.zip
Add options to disable join/quit messages and custom join/quit messages
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java26
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java26
-rw-r--r--Essentials/src/config.yml9
4 files changed, 64 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 3eb1fd645..e020cfd62 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -164,9 +164,15 @@ public class EssentialsPlayerListener implements Listener
{
user.getBase().getOpenInventory().getTopInventory().clear();
}
- if (user.hasPermission("essentials.silentquit"))
+ if (ess.getSettings().isJoinQuitMessagesDisabled())
{
event.setQuitMessage(null);
+
+ }
+ if (!ess.getSettings().customQuitMessage().equals("none"))
+ {
+ event.setQuitMessage(null);
+ ess.broadcastMessage(ess.getSettings().customQuitMessage());
}
user.updateActivity(false);
user.dispose();
@@ -175,7 +181,11 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(final PlayerJoinEvent event)
{
- if (event.getPlayer().hasPermission("essentials.silentjoin"))
+ if (ess.getSettings().isJoinQuitMessagesDisabled())
+ {
+ event.setJoinMessage(null);
+ }
+ if (!ess.getSettings().customJoinMessage().equals("none"))
{
event.setJoinMessage(null);
}
@@ -184,13 +194,21 @@ public class EssentialsPlayerListener implements Listener
@Override
public void run()
{
- delayedJoin(event.getPlayer());
+ delayedJoin(event.getPlayer(), event.getJoinMessage());
}
});
}
- public void delayedJoin(final Player player)
+ public void delayedJoin(final Player player, final String message)
{
+ if (!ess.getSettings().customJoinMessage().equals("none"))
+ {
+ ess.broadcastMessage(ess.getSettings().customJoinMessage());
+ }
+ else
+ {
+ ess.broadcastMessage(message);
+ }
if (!player.isOnline())
{
return;
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index bbf11fcb1..9a4e6d246 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -195,6 +195,12 @@ public interface ISettings extends IConf
Map<String, Object> getListGroupConfig();
int getMaxNickLength();
-
+
int getMaxUserCacheCount();
+
+ boolean isJoinQuitMessagesDisabled();
+
+ String customJoinMessage();
+
+ String customQuitMessage();
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 0f36bf026..5b0bfe602 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -519,6 +519,7 @@ public class Settings implements net.ess3.api.ISettings
economyLog = _isEcoLogEnabled();
economyLogUpdate = _isEcoLogUpdateEnabled();
economyDisabled = _isEcoDisabled();
+ joinQuitMessagesDisabled = _isJoinQuitMessagesDisabled();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@@ -1113,6 +1114,31 @@ public class Settings implements net.ess3.api.ISettings
return config.getInt("max-nick-length", 30);
}
+ private boolean joinQuitMessagesDisabled;
+
+ public boolean _isJoinQuitMessagesDisabled()
+ {
+ return config.getBoolean("allow-silent-join-quit");
+ }
+
+ @Override
+ public boolean isJoinQuitMessagesDisabled()
+ {
+ return joinQuitMessagesDisabled;
+ }
+
+ @Override
+ public String customJoinMessage()
+ {
+ return config.getString("custom-join-message");
+ }
+
+ @Override
+ public String customQuitMessage()
+ {
+ return config.getString("custom-quit-message");
+ }
+
// #easteregg
@Override
public int getMaxUserCacheCount()
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 6c330772e..e59b96515 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -353,6 +353,15 @@ cancel-afk-on-move: true
# You can disable the death messages of Minecraft here.
death-messages: true
+# You can disable join and quit messages here.
+allow-silent-join-quit: false
+
+# You can set a custom join message here, set to "none" to disable.
+custom-join-message: none
+
+# You can set a custom quit message here, set to "none" to disable.
+custom-quit-message: none
+
# Add worlds to this list, if you want to automatically disable god mode there.
no-god-in-worlds:
# - world_nether