diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index c9ec9a8..439cc80 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -135,6 +135,7 @@ public class GriefPrevention extends JavaPlugin public boolean config_spam_enabled; //whether or not to monitor for spam public int config_spam_loginCooldownSeconds; //how long players must wait between logins. combats login spam. + public int config_spam_loginLogoutNotificationsPerMinute; //how many login/logout notifications to show per minute (global, not per player) public ArrayList config_spam_monitorSlashCommands; //the list of slash commands monitored for spam public boolean config_spam_banOffenders; //whether or not to ban spammers automatically public String config_spam_banMessage; //message to show an automatically banned player @@ -564,6 +565,7 @@ public class GriefPrevention extends JavaPlugin this.config_spam_enabled = config.getBoolean("GriefPrevention.Spam.Enabled", true); this.config_spam_loginCooldownSeconds = config.getInt("GriefPrevention.Spam.LoginCooldownSeconds", 60); + this.config_spam_loginLogoutNotificationsPerMinute = config.getInt("GriefPrevention.Spam.LoginLogoutNotificationsPerMinute", 5); this.config_spam_warningMessage = config.getString("GriefPrevention.Spam.WarningMessage", "Please reduce your noise level. Spammers will be banned."); this.config_spam_allowedIpAddresses = config.getString("GriefPrevention.Spam.AllowedIpAddresses", "1.2.3.4; 5.6.7.8"); this.config_spam_banOffenders = config.getBoolean("GriefPrevention.Spam.BanOffenders", true); @@ -817,6 +819,7 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Spam.Enabled", this.config_spam_enabled); outConfig.set("GriefPrevention.Spam.LoginCooldownSeconds", this.config_spam_loginCooldownSeconds); + outConfig.set("GriefPrevention.Spam.LoginLogoutNotificationsPerMinute", this.config_spam_loginLogoutNotificationsPerMinute); outConfig.set("GriefPrevention.Spam.ChatSlashCommands", slashCommandsToMonitor); outConfig.set("GriefPrevention.Spam.WhisperSlashCommands", whisperCommandsToMonitor); outConfig.set("GriefPrevention.Spam.WarningMessage", this.config_spam_warningMessage); diff --git a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 1e6c8d6..51965d3 100644 --- a/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -924,8 +924,12 @@ class PlayerEventHandler implements Listener //determines whether or not a login or logout notification should be silenced, depending on how many there have been in the last minute private boolean shouldSilenceNotification() { + if (instance.config_spam_loginLogoutNotificationsPerMinute <= 0) + { + return false; // not silencing login/logout notifications + } + final long ONE_MINUTE = 60000; - final int MAX_ALLOWED = 5; Long now = Calendar.getInstance().getTimeInMillis(); //eliminate any expired entries (longer than a minute ago) @@ -945,7 +949,7 @@ class PlayerEventHandler implements Listener //add the new entry this.recentLoginLogoutNotifications.add(now); - return this.recentLoginLogoutNotifications.size() > MAX_ALLOWED; + return this.recentLoginLogoutNotifications.size() > instance.config_spam_loginLogoutNotificationsPerMinute; } //when a player drops an item