diff --git a/Changelog.txt b/Changelog.txt index 5227cac81..ba128ce29 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -7,6 +7,12 @@ Key: ! Change - Removal +Version 2.1.36 + Updated German locale (Thanks OverCrave) + The /mcnotify command will now squelch almost all chat messages or action bar notifications sent to the player from mcMMO + mcMMO will now remind players on an hourly basis that they are are not receiving notifications from mcMMO if they have run the mcnotify command and toggled squelch mode + Added a new setting to advanced.yml "Feedback.PlayerTips", when set to true this will allow mcMMO to send periodic helpful messages to players, currently this only affects mcnotify reminders. + Version 2.1.35 Readded the detonator config option diff --git a/pom.xml b/pom.xml index 85060027b..6dfa87b6e 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.35 + 2.1.36-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 42aeaf730..aff6e7ae7 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -646,6 +646,10 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { /* GENERAL */ public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 1); } + public boolean allowPlayerTips() { + return config.getBoolean("Feedback.PlayerTips", true); + } + /** * This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level. * It returns a different value depending on whether or not the server is in retro mode diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 7d8664e4b..79f8999ab 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -19,6 +19,7 @@ import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.runnables.CheckDateTask; import com.gmail.nossr50.runnables.SaveTimerTask; import com.gmail.nossr50.runnables.backups.CleanBackupsTask; +import com.gmail.nossr50.runnables.commands.NotifySquelchReminderTask; import com.gmail.nossr50.runnables.database.UserPurgeTask; import com.gmail.nossr50.runnables.party.PartyAutoKickTask; import com.gmail.nossr50.runnables.player.ClearRegisteredXPGainTask; @@ -539,6 +540,11 @@ public class mcMMO extends JavaPlugin { if (ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60); } + + if(AdvancedConfig.getInstance().allowPlayerTips()) + { + new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60)); + } } private void checkModConfigs() { diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java new file mode 100644 index 000000000..4d7b11fc6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/runnables/commands/NotifySquelchReminderTask.java @@ -0,0 +1,23 @@ +package com.gmail.nossr50.runnables.commands; + +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.player.UserManager; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +public class NotifySquelchReminderTask extends BukkitRunnable { + + @Override + public void run() { + for (Player player : Bukkit.getOnlinePlayers()) { + if(UserManager.getPlayer(player) != null) + { + if(!UserManager.getPlayer(player).useChatNotifications()) + { + player.sendMessage(LocaleLoader.getString("Reminder.Squelched")); + } + } + } + } +} diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 3558bf5e7..b47627ff4 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -28,6 +28,9 @@ public class NotificationManager { */ public static void sendPlayerInformation(Player player, NotificationType notificationType, String key) { + if(!UserManager.getPlayer(player).useChatNotifications()) + return; + ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key, notificationType); @@ -57,8 +60,10 @@ public class NotificationManager { public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values) { - ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; + if(!UserManager.getPlayer(player).useChatNotifications()) + return; + ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, notificationType, values); McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message); @@ -103,6 +108,9 @@ public class NotificationManager { */ public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel) { + if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications()) + return; + ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel); @@ -121,6 +129,9 @@ public class NotificationManager { public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) { + if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications()) + return; + //CHAT MESSAGE mcMMOPlayer.getPlayer().spigot().sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType)); diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index fb9c99f4c..bd651b3ba 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -17,6 +17,7 @@ Metrics: bstats: true Feedback: + PlayerTips: true SkillCommand: BlankLinesAboveHeader: true # If sendtitles is true messages will be sent using the title api (BIG TEXT ON SCREEN) diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 68b47680c..1d21f42da 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -1073,4 +1073,6 @@ Profile.Loading.Failure=[[RED]]mcMMO still cannot load your data. You may want t Profile.Loading.AdminFailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. #Holiday Holiday.AprilFools.Levelup=[[GOLD]]{0} is now level [[GREEN]]{1}[[GOLD]]! -Holiday.Anniversary=[[BLUE]]Happy {0} Year Anniversary!\n[[BLUE]]In honor of all of nossr50's work and all the devs, here's a firework show! \ No newline at end of file +Holiday.Anniversary=[[BLUE]]Happy {0} Year Anniversary!\n[[BLUE]]In honor of all of nossr50's work and all the devs, here's a firework show! +#Reminder Messages +Reminder.Squelched=[[GRAY]]Reminder: You are currently not receiving notifications from mcMMO, to enable notifications please run the /mcnotify command again. This is an automated hourly reminder. \ No newline at end of file