From 88d8d0e6bbb31deb1a1ec90e651913a469c564e8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 11:20:51 -0700 Subject: [PATCH 01/21] Fix the Double Drop string in the mining command --- Changelog.txt | 3 +++ src/main/resources/locale/locale_en_US.properties | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 108f0b554..44ba63478 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.1.61 + Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' + Version 2.1.60 Fixed a NPE error if a LivingEntity's target was set to null Fixed a bug where tamed mobs could kill themselves if their owner shot them once diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 5846754c0..23202b5b8 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -303,7 +303,7 @@ Mining.SubSkill.SuperBreaker.Description=Speed+, Triple Drop Chance Mining.SubSkill.SuperBreaker.Stat=Super Breaker Length Mining.SubSkill.DoubleDrops.Name=Double Drops Mining.SubSkill.DoubleDrops.Description=Double the normal loot -Mining.SubSkill.DoubleDrops.Stat=Double Drop Chance: [[YELLOW]]{0} +Mining.SubSkill.DoubleDrops.Stat=Double Drop Chance Mining.SubSkill.BlastMining.Name=Blast Mining Mining.SubSkill.BlastMining.Description=Bonuses to mining with TNT Mining.SubSkill.BlastMining.Stat=Blast Mining:[[GREEN]] Rank {0}/{1} [[GRAY]]({2}) From ed3ec3aa401ecefea59456b922a79f7375aa4cc3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 11:29:45 -0700 Subject: [PATCH 02/21] Add note about JP locale update --- Changelog.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index 44ba63478..eabb9b4a5 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,7 @@ Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' + Updated the Japanese locale (thanks snake0053) + Version 2.1.60 Fixed a NPE error if a LivingEntity's target was set to null From c8a32b8b38eb43a9a64e21397d601e1d8ec6a5b3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 11:34:26 -0700 Subject: [PATCH 03/21] Add toggle for event broadcasts - General.EventBroadcasts --- Changelog.txt | 2 ++ .../gmail/nossr50/commands/XprateCommand.java | 18 ++++++++++++++---- .../java/com/gmail/nossr50/config/Config.java | 2 ++ src/main/resources/config.yml | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index eabb9b4a5..5402b7286 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,7 +1,9 @@ Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Updated the Japanese locale (thanks snake0053) + Added toggle to turn off event message broadcasts (XP rate) to config.yml - 'General.EventBroadcasts' + NOTE: The toggle for event message broadcasts is separate from the titles being shown, that's another config option (titles are the BIG TEXT in the middle of the screen) Version 2.1.60 Fixed a NPE error if a LivingEntity's target was set to null diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index 9f76e736e..ed0395752 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.commands; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; @@ -44,8 +45,12 @@ public class XprateCommand implements TabExecutor { 10, 10*20, 20); } - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop")); - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); + if(Config.getInstance().broadcastEventMessages()) + { + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop")); + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); + } + mcMMO.p.toggleXpEventEnabled(); } @@ -91,8 +96,13 @@ public class XprateCommand implements TabExecutor { LocaleLoader.getString("Commands.Event.XP", newXpRate), 10, 10*20, 20); } - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); + + if(Config.getInstance().broadcastEventMessages()) + { + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); + } + } else { sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate)); diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 2082d7522..70742ff54 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -567,4 +567,6 @@ public class Config extends AutoUpdateConfigLoader { public boolean getPVEEnabled(PrimarySkillType skill) { return config.getBoolean("Skills." + StringUtils.getCapitalized(skill.toString()) + ".Enabled_For_PVE", true); } //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); } + + public boolean broadcastEventMessages() { return config.getBoolean("General.EventBroadcasts", true);} } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1eae04589..611bc6261 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -16,6 +16,7 @@ General: Locale: en_US AprilFoolsEvent: true MOTD_Enabled: true + EventBroadcasts: true # Send a message to the player when his profile was successfully loaded Show_Profile_Loaded: false # Amount of time (in minutes) to wait between saves of player information From 734dfcdec55b26097de0819f11720fab2c14621b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 11:40:47 -0700 Subject: [PATCH 04/21] Add toggle to disable event information on player join --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/config/Config.java | 1 + src/main/java/com/gmail/nossr50/listeners/PlayerListener.java | 2 +- src/main/resources/config.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 5402b7286..4d0e79b79 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,7 @@ Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Updated the Japanese locale (thanks snake0053) Added toggle to turn off event message broadcasts (XP rate) to config.yml - 'General.EventBroadcasts' + Added toggle to not inform players of events when they join (XP rate, etc) to config.yml 'General.EventInfoOnPlayerJoin' NOTE: The toggle for event message broadcasts is separate from the titles being shown, that's another config option (titles are the BIG TEXT in the middle of the screen) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 70742ff54..096c76d91 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -569,4 +569,5 @@ public class Config extends AutoUpdateConfigLoader { //public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); } public boolean broadcastEventMessages() { return config.getBoolean("General.EventBroadcasts", true);} + public boolean playerJoinEventInfo() { return config.getBoolean("General.EventInfoOnPlayerJoin", true);} } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 7f8c447ad..9630db029 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -529,7 +529,7 @@ public class PlayerListener implements Listener { Motd.displayAll(player); } - if (plugin.isXPEventEnabled()) { + if (plugin.isXPEventEnabled() && Config.getInstance().playerJoinEventInfo()) { player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier())); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 611bc6261..7080c7133 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -17,6 +17,7 @@ General: AprilFoolsEvent: true MOTD_Enabled: true EventBroadcasts: true + EventInfoOnPlayerJoin: true # Send a message to the player when his profile was successfully loaded Show_Profile_Loaded: false # Amount of time (in minutes) to wait between saves of player information From 1c130aad42395c8d7024c4b04b100e25fafa83c4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 16 May 2019 13:30:43 -0700 Subject: [PATCH 05/21] 2.1.61 - Some fixes + Exploit prevention --- Changelog.txt | 2 ++ pom.xml | 2 +- .../config/experience/ExperienceConfig.java | 2 ++ .../gmail/nossr50/listeners/BlockListener.java | 16 ++++++++++++++++ src/main/resources/experience.yml | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 4d0e79b79..ba2c522da 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -3,8 +3,10 @@ Version 2.1.61 Updated the Japanese locale (thanks snake0053) Added toggle to turn off event message broadcasts (XP rate) to config.yml - 'General.EventBroadcasts' Added toggle to not inform players of events when they join (XP rate, etc) to config.yml 'General.EventInfoOnPlayerJoin' + Added anti-exploit protection for cobble/stone farms which can be automated, to turn this off you can toggle the new config options 'ExploitFix.LavaStoneAndCobbleFarming' in experience.yml NOTE: The toggle for event message broadcasts is separate from the titles being shown, that's another config option (titles are the BIG TEXT in the middle of the screen) + NOTE: The new anti-stone/cobble automation will not prevent XP gains from obsidian, since Obsidian requires some effort to farm Version 2.1.60 Fixed a NPE error if a LivingEntity's target was set to null diff --git a/pom.xml b/pom.xml index 38d3521c6..948d49f97 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.60 + 2.1.61 mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index a3e4b9f63..3f134cf66 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -332,4 +332,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader { { return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type)); } + + public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);} } diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index a627a09b3..e20334dc4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -180,6 +180,22 @@ public class BlockListener implements Listener { } } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onBlockFormEvent(BlockFormEvent event) + { + /* WORLD BLACKLIST CHECK */ + if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) + return; + + if(ExperienceConfig.getInstance().preventStoneLavaFarming()) + { + if(event.getNewState().getType() != Material.OBSIDIAN && BlockUtils.shouldBeWatched(event.getNewState())) + { + mcMMO.getPlaceStore().setTrue(event.getNewState()); + } + } + } + /** * Monitor BlockPlace events. * diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index ab546e708..473354b11 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -31,6 +31,7 @@ ExploitFix: Fishing: true EndermanEndermiteFarms: true Acrobatics: true + LavaStoneAndCobbleFarming: true Experience_Bars: # Turn this to false if you wanna disable XP bars Enable: true From b176fd9bca7cfa687bfeafb1ed05159c42919ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Marczink=C3=B3?= Date: Fri, 17 May 2019 13:08:49 +0200 Subject: [PATCH 06/21] Update locale_hu_HU.properties --- src/main/resources/locale/locale_hu_HU.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/locale/locale_hu_HU.properties b/src/main/resources/locale/locale_hu_HU.properties index c3d6ef46a..d898e423e 100644 --- a/src/main/resources/locale/locale_hu_HU.properties +++ b/src/main/resources/locale/locale_hu_HU.properties @@ -303,7 +303,7 @@ Mining.SubSkill.SuperBreaker.Description=Sebess\u00E9g+, 3x T\u00E1rgy Es\u00E9s Mining.SubSkill.SuperBreaker.Stat=Szuper T\u00F6r\u00E9s Hossz\u00FAs\u00E1g Mining.SubSkill.DoubleDrops.Name=Dupla Es\u00E9s Mining.SubSkill.DoubleDrops.Description=Dupl\u00E1zza a Zs\u00E1km\u00E1ny es\u00E9st -Mining.SubSkill.DoubleDrops.Stat=Dupla T\u00E1rgy Es\u00E9si Es\u00E9ly: [[YELLOW]]{0} +Mining.SubSkill.DoubleDrops.Stat=Dupla T\u00E1rgy Es\u00E9si Es\u00E9ly Mining.SubSkill.BlastMining.Name=Robbant\u00E1sb\u00E1ny\u00E1szat Mining.SubSkill.BlastMining.Description=TNT-vel val\u00F3 b\u00E1ny\u00E1sz\u00E1si b\u00F3nusz Mining.SubSkill.BlastMining.Stat=Robbant\u00E1sb\u00E1ny\u00E1szat:[[GREEN]] Szint {0}/{1} [[GRAY]]({2}) @@ -1077,3 +1077,5 @@ Holiday.AprilFools.Levelup=[[GOLD]]{0} jelenlegi szint [[GREEN]]{1}[[GOLD]]! Holiday.Anniversary=[[BLUE]]Boldog {0}. \u00C9vfordul\u00F3t!\n[[BLUE]]nossr50, \u00E9s az \u00F6sszes fejleszt\u0151 tisztelet\u00E9re itt egy t\u0171zij\u00E1t\u00E9k show! #Reminder Messages Reminder.Squelched=[[GRAY]]Eml\u00E9keztet\u0151: jelenleg nem kapsz \u00E9rtes\u00EDt\u00E9seket az mcMMO-t\u00F3l. Ahhoz, hogy enged\u00E9lyezd az \u00E9rtes\u00EDt\u00E9seket, futtasd \u00FAjra a /mcnotify parancsot. Ez egy automatikus, \u00F3r\u00E1nk\u00E9nti eml\u00E9keztet\u0151. +#Locale +Locale.Reloaded=[[GREEN]]Ford\u00EDt\u00E1s \u00FAjrat\u00F6ltve! From f3cbd450d087d4c422064a22235fd4ce8192faf9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 17 May 2019 04:27:27 -0700 Subject: [PATCH 07/21] Admin chat now sends useful information to admins/adminchat permissible players --- Changelog.txt | 9 +++ pom.xml | 2 +- .../gmail/nossr50/commands/XprateCommand.java | 66 ++++++++++++++----- .../resources/locale/locale_en_US.properties | 5 ++ 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index ba2c522da..57d67435b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,12 @@ +Version 2.1.62 + OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled + + New locale string - 'XPRate.Modified' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled + New locale string - 'XPRate.End' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled + New locale string - 'XPRate.AdminDetails.End' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued + New locale string - 'XPRate.AdminDetails.Start' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued + New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console + Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Updated the Japanese locale (thanks snake0053) diff --git a/pom.xml b/pom.xml index 948d49f97..ac2db416a 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.61 + 2.1.62-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index ed0395752..e296f1f11 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -10,12 +10,15 @@ import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.NotificationManager; import com.google.common.collect.ImmutableList; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; +import org.bukkit.entity.Player; import org.bukkit.util.StringUtil; +import java.security.Permission; import java.util.ArrayList; import java.util.List; @@ -51,6 +54,23 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); } + for(Player player : Bukkit.getServer().getOnlinePlayers()) + { + if(player.isOp() || Permissions.adminChat(player)) + { + String senderName = LocaleLoader.getString("Server.ConsoleName"); + + if(sender instanceof Player) + { + senderName = ((Player) sender).getDisplayName(); + } + + sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); + } + } + + sender.sendMessage(LocaleLoader.getString("XPRate.End")); + mcMMO.p.toggleXpEventEnabled(); } @@ -88,26 +108,38 @@ public class XprateCommand implements TabExecutor { ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate); - if (mcMMO.p.isXPEventEnabled()) { - if(AdvancedConfig.getInstance().useTitlesForXPEvent()) - { - NotificationManager.broadcastTitle(mcMMO.p.getServer(), - LocaleLoader.getString("Commands.Event.Start"), - LocaleLoader.getString("Commands.Event.XP", newXpRate), - 10, 10*20, 20); - } - - if(Config.getInstance().broadcastEventMessages()) - { - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); - mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); - } - + if(AdvancedConfig.getInstance().useTitlesForXPEvent()) + { + NotificationManager.broadcastTitle(mcMMO.p.getServer(), + LocaleLoader.getString("Commands.Event.Start"), + LocaleLoader.getString("Commands.Event.XP", newXpRate), + 10, 10*20, 20); } - else { - sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate)); + + if(Config.getInstance().broadcastEventMessages()) + { + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start")); + mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); } + for(Player player : Bukkit.getServer().getOnlinePlayers()) + { + if(player.isOp() || Permissions.adminChat(player)) + { + String senderName = LocaleLoader.getString("Server.ConsoleName"); + + if(sender instanceof Player) + { + senderName = ((Player) sender).getDisplayName(); + } + + sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); + } + } + + sender.sendMessage(LocaleLoader.getString("XPRate.Modified", newXpRate)); + + return true; default: diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 23202b5b8..e65b101d3 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -826,7 +826,12 @@ Commands.Event.Stop.Subtitle=[[GREEN]]I hope you had fun! Commands.Event.XP=[[DARK_AQUA]]XP Rate is now [[GOLD]]{0}[[DARK_AQUA]]x Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! +XPRate.Modified=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! +XPRate.End=[[GRAY]]You ended the XP rate event. XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! +XPRate.AdminDetails.End=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has ended the XP rate event +XPRate.AdminDetails.Start=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has started an XP rate event of {0}x +Server.ConsoleName=[Server Console] #GUIDES Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page] From 90480ca6262c78537d09545044f890a1d68ba710 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Fri, 17 May 2019 15:45:07 -0700 Subject: [PATCH 08/21] Add missing Magma_Block xp value --- Changelog.txt | 5 ++++- src/main/resources/experience.yml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 57d67435b..659769541 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,12 +1,15 @@ Version 2.1.62 OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled - + Updated hu_HU locale (thanks andris155) + Added XP for mining Magma_Block (default 30 XP - Update your config, see notes) New locale string - 'XPRate.Modified' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled New locale string - 'XPRate.End' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled New locale string - 'XPRate.AdminDetails.End' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued New locale string - 'XPRate.AdminDetails.Start' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console + NOTES: Add an entry of 'Magma_Block: 30' under Mining in experience.yml (or you can delete the file to generate a new one with default values, 2.2 is coming soon which will have brand new configs so you could just wait for that + Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Updated the Japanese locale (thanks snake0053) diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 473354b11..3bccdc004 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -348,6 +348,7 @@ Experience_Values: Lily_of_the_valley: 150 Wither_rose: 500 Mining: + Magma_Block: 30 Tube_Coral_Block: 75 Brain_Coral_Block: 80 Bubble_Coral_Block: 70 From 08223bd320ea4caeacc335f2a9244143c6c2459e Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 08:01:15 -0700 Subject: [PATCH 09/21] Hotfix for repairing diamond, nerf guardian xp rate --- Changelog.txt | 6 +++++- src/main/resources/experience.yml | 2 +- src/main/resources/repair.vanilla.yml | 18 +++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 659769541..97d91566e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,13 +2,17 @@ Version 2.1.62 OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled Updated hu_HU locale (thanks andris155) Added XP for mining Magma_Block (default 30 XP - Update your config, see notes) + Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes) + Guardian default combat XP multiplier reduced from 3.0 to 1.0 (update config if you want this change) New locale string - 'XPRate.Modified' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled New locale string - 'XPRate.End' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled New locale string - 'XPRate.AdminDetails.End' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued New locale string - 'XPRate.AdminDetails.Start' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console - NOTES: Add an entry of 'Magma_Block: 30' under Mining in experience.yml (or you can delete the file to generate a new one with default values, 2.2 is coming soon which will have brand new configs so you could just wait for that + NOTES: + Add an entry of 'Magma_Block: 30' under Mining in experience.yml section titled "Experience_Values" (or you can delete the file to generate a new one with default values, 2.2 is coming soon which will have brand new configs so you could just wait for that + 2.2 is the config rewrite, in this rewrite Repair and Salvage configs have been partially rewritten, it is not intended for Diamond Repair to take until level 50 in Standard level scaling to be available, since it'd be redundant to fix this in 2.1.X when 2.2 fixes it and its about to come out, the minimum level has temporarily been changed to 0. You can either update your repair.vanilla.yml config manually or delete it to generate a new one. Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 3bccdc004..8c7959fc9 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -461,7 +461,7 @@ Experience_Values: Iron_Golem: 2.0 Wither_Skeleton: 4.0 Endermite: 2.0 - Guardian: 3.0 + Guardian: 1.0 Elder_Guardian: 4.0 Shulker: 2.0 Donkey: 1.0 diff --git a/src/main/resources/repair.vanilla.yml b/src/main/resources/repair.vanilla.yml index f228633c8..50850eb7a 100644 --- a/src/main/resources/repair.vanilla.yml +++ b/src/main/resources/repair.vanilla.yml @@ -155,32 +155,32 @@ Repairables: ### # Tools DIAMOND_SWORD: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: .5 DIAMOND_SHOVEL: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: .3 DIAMOND_PICKAXE: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 1 DIAMOND_AXE: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 1 DIAMOND_HOE: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: .5 # Armor DIAMOND_HELMET: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 6 DIAMOND_CHESTPLATE: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 6 DIAMOND_LEGGINGS: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 6 DIAMOND_BOOTS: - MinimumLevel: 50 + MinimumLevel: 0 XpMultiplier: 6 # # Leather repairables From 2a471e409cd6f96ff80571a502c1051181341a75 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 08:02:16 -0700 Subject: [PATCH 10/21] Fix mistake in new admin notification locale --- src/main/resources/locale/locale_en_US.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index e65b101d3..ccbb855f7 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -830,7 +830,7 @@ XPRate.Modified=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! XPRate.End=[[GRAY]]You ended the XP rate event. XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! XPRate.AdminDetails.End=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has ended the XP rate event -XPRate.AdminDetails.Start=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has started an XP rate event of {0}x +XPRate.AdminDetails.Start=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has started an XP rate event of {1}x Server.ConsoleName=[Server Console] #GUIDES From 447ce97f242a874281d43a3c6a4317be990e1944 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 08:03:39 -0700 Subject: [PATCH 11/21] Send message to correct player --- src/main/java/com/gmail/nossr50/commands/XprateCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index e296f1f11..0d999d27d 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -65,7 +65,7 @@ public class XprateCommand implements TabExecutor { senderName = ((Player) sender).getDisplayName(); } - sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); + player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); } } @@ -133,7 +133,7 @@ public class XprateCommand implements TabExecutor { senderName = ((Player) sender).getDisplayName(); } - sender.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); + player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); } } From 92e6cedb148af2995feda94d47f8022072cac93c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 08:04:55 -0700 Subject: [PATCH 12/21] This is why you don't program when you haven't slept in 20 hours --- .../gmail/nossr50/commands/XprateCommand.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index 0d999d27d..7a2ad6934 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -54,17 +54,17 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); } + String senderName = LocaleLoader.getString("Server.ConsoleName"); + + if(sender instanceof Player) + { + senderName = ((Player) sender).getDisplayName(); + } + for(Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOp() || Permissions.adminChat(player)) { - String senderName = LocaleLoader.getString("Server.ConsoleName"); - - if(sender instanceof Player) - { - senderName = ((Player) sender).getDisplayName(); - } - player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); } } @@ -122,17 +122,18 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); } + + String senderName = LocaleLoader.getString("Server.ConsoleName"); + + if(sender instanceof Player) + { + senderName = ((Player) sender).getDisplayName(); + } + for(Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOp() || Permissions.adminChat(player)) { - String senderName = LocaleLoader.getString("Server.ConsoleName"); - - if(sender instanceof Player) - { - senderName = ((Player) sender).getDisplayName(); - } - player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); } } From b0dc41b4d97a9eeb4218e7cac674b186e9ed4882 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 08:12:32 -0700 Subject: [PATCH 13/21] Encapsulate admin notifications + add prefix --- .../gmail/nossr50/commands/XprateCommand.java | 24 +++---------------- .../nossr50/listeners/BlockListener.java | 5 +++- .../nossr50/listeners/EntityListener.java | 5 ---- .../nossr50/listeners/PlayerListener.java | 2 +- .../gmail/nossr50/locale/LocaleLoader.java | 7 +----- .../util/player/NotificationManager.java | 21 ++++++++++++++++ .../resources/locale/locale_en_US.properties | 5 ++-- 7 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index 7a2ad6934..a7f5275ef 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -10,7 +10,6 @@ import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.NotificationManager; import com.google.common.collect.ImmutableList; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -18,7 +17,6 @@ import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import org.bukkit.util.StringUtil; -import java.security.Permission; import java.util.ArrayList; import java.util.List; @@ -61,17 +59,9 @@ public class XprateCommand implements TabExecutor { senderName = ((Player) sender).getDisplayName(); } - for(Player player : Bukkit.getServer().getOnlinePlayers()) - { - if(player.isOp() || Permissions.adminChat(player)) - { - player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); - } - } - + NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); sender.sendMessage(LocaleLoader.getString("XPRate.End")); - mcMMO.p.toggleXpEventEnabled(); } @@ -122,7 +112,6 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); } - String senderName = LocaleLoader.getString("Server.ConsoleName"); if(sender instanceof Player) @@ -130,17 +119,10 @@ public class XprateCommand implements TabExecutor { senderName = ((Player) sender).getDisplayName(); } - for(Player player : Bukkit.getServer().getOnlinePlayers()) - { - if(player.isOp() || Permissions.adminChat(player)) - { - player.sendMessage(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); - } - } - + //Admin notification + NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); sender.sendMessage(LocaleLoader.getString("XPRate.Modified", newXpRate)); - return true; default: diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index e20334dc4..eef643ec5 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -30,7 +30,10 @@ import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; -import org.bukkit.*; +import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Tag; import org.bukkit.block.*; import org.bukkit.entity.Item; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 7681e196a..79c4999e3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -4,7 +4,6 @@ import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; -import com.gmail.nossr50.datatypes.meta.OldName; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; @@ -25,7 +24,6 @@ import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.block.Block; @@ -40,13 +38,10 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; -import java.util.List; - public class EntityListener implements Listener { private final mcMMO plugin; diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 9630db029..ff9c6cd46 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.chat.ChatMode; import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.ShareHandler; @@ -29,7 +30,6 @@ import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; -import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; diff --git a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java index 2bde9ea52..42df75d0f 100644 --- a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java +++ b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java @@ -10,12 +10,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; +import java.util.*; import java.util.logging.Level; public final class LocaleLoader { 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 2f46df5a0..18ffed705 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -6,7 +6,10 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Misc; +import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; @@ -154,4 +157,22 @@ public class NotificationManager { String.valueOf(RankUtils.getRank(mcMMOPlayer.getPlayer(), subSkillType)))));*/ } + + /** + * Sends a message to all admins with the admin notification formatting from the locale + * Admins are currently players with either Operator status or Admin Chat permission + * @param msg message contents + */ + public static void sendAdminNotification(String msg) { + for(Player player : Bukkit.getServer().getOnlinePlayers()) + { + if(player.isOp() || Permissions.adminChat(player)) + { + player.sendMessage(LocaleLoader.getString("Notifications.Admin", msg)); + } + } + + //Copy it out to Console too + mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin", msg)); + } } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index ccbb855f7..34a6aad2f 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -829,9 +829,10 @@ Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! XPRate.Modified=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! XPRate.End=[[GRAY]]You ended the XP rate event. XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! -XPRate.AdminDetails.End=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has ended the XP rate event -XPRate.AdminDetails.Start=[[GOLD]](Admin Notification) [[GRAY]]The user {0} [[GRAY]]has started an XP rate event of {1}x +XPRate.AdminDetails.End=The user {0} [[GRAY]]has ended the XP rate event +XPRate.AdminDetails.Start=The user {0} [[GRAY]]has started an XP rate event of {1}x Server.ConsoleName=[Server Console] +Notifications.Admin=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} #GUIDES Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page] From 04c6bd8750288e6b8a7bc80e05110244f179a8a3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:09:45 -0700 Subject: [PATCH 14/21] Admin notifications convenience methods handled by NotificationManager --- Changelog.txt | 12 ++++-- .../gmail/nossr50/commands/XprateCommand.java | 23 +++--------- .../java/com/gmail/nossr50/config/Config.java | 2 + .../notifications/SensitiveCommandType.java | 7 ++++ .../util/player/NotificationManager.java | 37 ++++++++++++++++++- src/main/resources/config.yml | 1 + .../resources/locale/locale_en_US.properties | 16 +++++--- 7 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/datatypes/notifications/SensitiveCommandType.java diff --git a/Changelog.txt b/Changelog.txt index 97d91566e..d90b4566c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,16 +1,20 @@ Version 2.1.62 + Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission) + Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2) OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled Updated hu_HU locale (thanks andris155) Added XP for mining Magma_Block (default 30 XP - Update your config, see notes) Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes) Guardian default combat XP multiplier reduced from 3.0 to 1.0 (update config if you want this change) - New locale string - 'XPRate.Modified' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled - New locale string - 'XPRate.End' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled - New locale string - 'XPRate.AdminDetails.End' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued - New locale string - 'XPRate.AdminDetails.Start' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console + New locale string - 'Notifications.Admin.Format' style formatting + prefix for admin notifications used in the other new strings below + New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled + New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued + New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled + New locale string - 'Notifications.Admin.XPRate.End.Others' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued NOTES: + Admin notifications currently only reports use of the XP rate command, it will be expanded to support other commands in upcoming patches Add an entry of 'Magma_Block: 30' under Mining in experience.yml section titled "Experience_Values" (or you can delete the file to generate a new one with default values, 2.2 is coming soon which will have brand new configs so you could just wait for that 2.2 is the config rewrite, in this rewrite Repair and Salvage configs have been partially rewritten, it is not intended for Diamond Repair to take until level 50 in Standard level scaling to be available, since it'd be redundant to fix this in 2.1.X when 2.2 fixes it and its about to come out, the minimum level has temporarily been changed to 0. You can either update your repair.vanilla.yml config manually or delete it to generate a new one. diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index a7f5275ef..b4de0bbe0 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -3,6 +3,7 @@ package com.gmail.nossr50.commands; import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; @@ -52,15 +53,8 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); } - String senderName = LocaleLoader.getString("Server.ConsoleName"); - - if(sender instanceof Player) - { - senderName = ((Player) sender).getDisplayName(); - } - - NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.End", senderName)); - sender.sendMessage(LocaleLoader.getString("XPRate.End")); + NotificationManager.processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_END); + sender.sendMessage(LocaleLoader.getString("Notifications.Admin.XPRate.End.Self")); mcMMO.p.toggleXpEventEnabled(); } @@ -112,16 +106,9 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate)); } - String senderName = LocaleLoader.getString("Server.ConsoleName"); - - if(sender instanceof Player) - { - senderName = ((Player) sender).getDisplayName(); - } - //Admin notification - NotificationManager.sendAdminNotification(LocaleLoader.getString("XPRate.AdminDetails.Start", senderName, newXpRate)); - sender.sendMessage(LocaleLoader.getString("XPRate.Modified", newXpRate)); + NotificationManager.processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_MODIFY, String.valueOf(newXpRate)); + sender.sendMessage(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", newXpRate)); return true; diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 096c76d91..ac272521f 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -570,4 +570,6 @@ public class Config extends AutoUpdateConfigLoader { public boolean broadcastEventMessages() { return config.getBoolean("General.EventBroadcasts", true);} public boolean playerJoinEventInfo() { return config.getBoolean("General.EventInfoOnPlayerJoin", true);} + public boolean adminNotifications() { return config.getBoolean("General.AdminNotifications", true);} + } diff --git a/src/main/java/com/gmail/nossr50/datatypes/notifications/SensitiveCommandType.java b/src/main/java/com/gmail/nossr50/datatypes/notifications/SensitiveCommandType.java new file mode 100644 index 000000000..0e59757c8 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/datatypes/notifications/SensitiveCommandType.java @@ -0,0 +1,7 @@ +package com.gmail.nossr50.datatypes.notifications; + +public enum SensitiveCommandType { + XPRATE_MODIFY, + XPRATE_END, + MMOEDIT +} 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 18ffed705..6f97b6e74 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -1,7 +1,9 @@ package com.gmail.nossr50.util.player; import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.interactions.NotificationType; +import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; @@ -19,6 +21,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.SoundCategory; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class NotificationManager { @@ -163,7 +166,7 @@ public class NotificationManager { * Admins are currently players with either Operator status or Admin Chat permission * @param msg message contents */ - public static void sendAdminNotification(String msg) { + private static void sendAdminNotification(String msg) { for(Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOp() || Permissions.adminChat(player)) @@ -175,4 +178,36 @@ public class NotificationManager { //Copy it out to Console too mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin", msg)); } + + /** + * Convenience method to report info about a command sender using a sensitive command + * @param commandSender the command user + * @param sensitiveCommandType type of command issued + */ + public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) { + //If its not enabled exit + if(!Config.getInstance().adminNotifications()) + return; + + /* + * Determine the 'identity' of the one who executed the command to pass as a parameters + */ + String senderName = LocaleLoader.getString("Server.ConsoleName"); + + if(commandSender instanceof Player) + { + senderName = ((Player) commandSender).getDisplayName(); + } + + //Send the notification + switch(sensitiveCommandType) + { + case XPRATE_MODIFY: + sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", senderName, args)); + break; + case XPRATE_END: + sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", senderName, args)); + break; + } + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7080c7133..7f7b9cf5c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -18,6 +18,7 @@ General: MOTD_Enabled: true EventBroadcasts: true EventInfoOnPlayerJoin: true + AdminNotifications: true # Send a message to the player when his profile was successfully loaded Show_Profile_Loaded: false # Amount of time (in minutes) to wait between saves of player information diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 34a6aad2f..8c3b7dfdc 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -826,13 +826,17 @@ Commands.Event.Stop.Subtitle=[[GREEN]]I hope you had fun! Commands.Event.XP=[[DARK_AQUA]]XP Rate is now [[GOLD]]{0}[[DARK_AQUA]]x Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! -XPRate.Modified=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! -XPRate.End=[[GRAY]]You ended the XP rate event. -XPRate.Event= [[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! -XPRate.AdminDetails.End=The user {0} [[GRAY]]has ended the XP rate event -XPRate.AdminDetails.Start=The user {0} [[GRAY]]has started an XP rate event of {1}x + +# Admin Notifications Server.ConsoleName=[Server Console] -Notifications.Admin=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.XPRate.Start.Self=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! +Notifications.Admin.XPRate.End.Self=[[GRAY]]You ended the XP rate event. +Notifications.Admin.XPRate.End.Others=The user {0} [[GRAY]]has ended the XP rate event +Notifications.Admin.XPRate.Start.Others=The user {0} [[GRAY]]has started or modified an XP rate event with properties: {1}x +Notifications.Admin.Format=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} + +# Event +XPRate.Event=[[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! #GUIDES Guides.Available=[[GRAY]]Guide for {0} available - type /{1} ? [page] From 1ced5d8ffc07edc2696fdb16e9c8723a8ba16687 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:40:06 -0700 Subject: [PATCH 15/21] Confirmation messages for admin commands are now moved into the convenience methods in NotificationManager --- Changelog.txt | 3 +- .../gmail/nossr50/commands/XprateCommand.java | 2 - .../nossr50/commands/skills/SkillCommand.java | 13 +------ .../util/player/NotificationManager.java | 38 ++++++++++++++++--- .../resources/locale/locale_en_US.properties | 5 ++- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index d90b4566c..b1b9e602b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -7,7 +7,8 @@ Version 2.1.62 Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes) Guardian default combat XP multiplier reduced from 3.0 to 1.0 (update config if you want this change) New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console - New locale string - 'Notifications.Admin.Format' style formatting + prefix for admin notifications used in the other new strings below + New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below + New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations send to the user who executed the command New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index b4de0bbe0..d7471e47c 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -54,7 +54,6 @@ public class XprateCommand implements TabExecutor { } NotificationManager.processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_END); - sender.sendMessage(LocaleLoader.getString("Notifications.Admin.XPRate.End.Self")); mcMMO.p.toggleXpEventEnabled(); } @@ -108,7 +107,6 @@ public class XprateCommand implements TabExecutor { //Admin notification NotificationManager.processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_MODIFY, String.valueOf(newXpRate)); - sender.sendMessage(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", newXpRate)); return true; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 7d6765e06..2fbea687a 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -11,6 +11,7 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.commands.CommandUtils; +import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.scoreboards.ScoreboardManager; @@ -268,21 +269,11 @@ public abstract class SkillCommand implements TabExecutor { return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars)); else { - String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars); + String[] mergedList = NotificationManager.addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars); return LocaleLoader.getString(templateKey, mergedList); } } - - public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) { - String[] newArray = new String[existingArray.length + 1]; - newArray[0] = itemToAdd; - - System.arraycopy(existingArray, 0, newArray, 1, existingArray.length); - - return newArray; - } - protected abstract void dataCalculations(Player player, float skillValue); protected abstract void permissionsCheck(Player player); 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 6f97b6e74..546fb88e9 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -164,19 +164,28 @@ public class NotificationManager { /** * Sends a message to all admins with the admin notification formatting from the locale * Admins are currently players with either Operator status or Admin Chat permission - * @param msg message contents + * @param msg message fetched from locale */ private static void sendAdminNotification(String msg) { for(Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOp() || Permissions.adminChat(player)) { - player.sendMessage(LocaleLoader.getString("Notifications.Admin", msg)); + player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg)); } } //Copy it out to Console too - mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin", msg)); + mcMMO.p.getLogger().info(LocaleLoader.getString("Notifications.Admin.Format.Others", msg)); + } + + /** + * Sends a confirmation message to the CommandSender who just executed an admin command + * @param commandSender target command sender + * @param msg message fetched from locale + */ + private static void sendAdminCommandConfirmation(CommandSender commandSender, String msg) { + commandSender.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Self", msg)); } /** @@ -203,11 +212,30 @@ public class NotificationManager { switch(sensitiveCommandType) { case XPRATE_MODIFY: - sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", senderName, args)); + sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args))); + sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args)); break; case XPRATE_END: - sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", senderName, args)); + sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args))); + sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.End.Self", args)); break; } } + + /** + * Takes an array and an object, makes a new array with object in the first position of the new array, + * and the following elements in this new array being a copy of the existing array retaining their order + * @param itemToAdd the string to put at the beginning of the new array + * @param existingArray the existing array to be copied to the new array at position [0]+1 relative to their original index + * @return the new array combining itemToAdd at the start and existing array elements following while retaining their order + */ + public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) { + String[] newArray = new String[existingArray.length + 1]; + newArray[0] = itemToAdd; + + System.arraycopy(existingArray, 0, newArray, 1, existingArray.length); + + return newArray; + } + } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 8c3b7dfdc..34b95c506 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -829,11 +829,12 @@ Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! # Admin Notifications Server.ConsoleName=[Server Console] -Notifications.Admin.XPRate.Start.Self=[[GREEN]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! +Notifications.Admin.XPRate.Start.Self=[[GRAY]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! Notifications.Admin.XPRate.End.Self=[[GRAY]]You ended the XP rate event. Notifications.Admin.XPRate.End.Others=The user {0} [[GRAY]]has ended the XP rate event Notifications.Admin.XPRate.Start.Others=The user {0} [[GRAY]]has started or modified an XP rate event with properties: {1}x -Notifications.Admin.Format=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO [[DARK_RED]]Admin Command Executed[[GOLD]]) [[GRAY]]{0} # Event XPRate.Event=[[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! From 663757352a2ded4758b96662121dd3b42d5cbb35 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:45:50 -0700 Subject: [PATCH 16/21] Tweak xp rate admin notification messages --- src/main/resources/locale/locale_en_US.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 34b95c506..79147bc69 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -828,13 +828,13 @@ Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! # Admin Notifications -Server.ConsoleName=[Server Console] -Notifications.Admin.XPRate.Start.Self=[[GRAY]]You have set the XP rate to [[GOLD]]{0}[[GREEN]]x! +Server.ConsoleName=[Server] +Notifications.Admin.XPRate.Start.Self=[[GRAY]]You have set the global XP rate multiplier to [[GOLD]]{0}x Notifications.Admin.XPRate.End.Self=[[GRAY]]You ended the XP rate event. Notifications.Admin.XPRate.End.Others=The user {0} [[GRAY]]has ended the XP rate event -Notifications.Admin.XPRate.Start.Others=The user {0} [[GRAY]]has started or modified an XP rate event with properties: {1}x +Notifications.Admin.XPRate.Start.Others=The user {0} [[GRAY]]has started or modified an XP rate event with global multiplier {1}x Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} -Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO [[DARK_RED]]Admin Command Executed[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0} # Event XPRate.Event=[[GOLD]]mcMMO is currently in an XP rate event! XP rate is {0}x! From 2433ef5db74aa85c46495b175a5d290e240db5ec Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:47:37 -0700 Subject: [PATCH 17/21] Move admin notification toggle check --- .../java/com/gmail/nossr50/commands/XprateCommand.java | 1 + .../gmail/nossr50/util/player/NotificationManager.java | 8 ++++---- src/main/resources/locale/locale_en_US.properties | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index d7471e47c..62e9cdc59 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -53,6 +53,7 @@ public class XprateCommand implements TabExecutor { mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle")); } + //Admin notification NotificationManager.processSensitiveCommandNotification(sender, SensitiveCommandType.XPRATE_END); mcMMO.p.toggleXpEventEnabled(); 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 546fb88e9..94141185c 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -167,6 +167,10 @@ public class NotificationManager { * @param msg message fetched from locale */ private static void sendAdminNotification(String msg) { + //If its not enabled exit + if(!Config.getInstance().adminNotifications()) + return; + for(Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOp() || Permissions.adminChat(player)) @@ -194,10 +198,6 @@ public class NotificationManager { * @param sensitiveCommandType type of command issued */ public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) { - //If its not enabled exit - if(!Config.getInstance().adminNotifications()) - return; - /* * Determine the 'identity' of the one who executed the command to pass as a parameters */ diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 79147bc69..60960db06 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -828,7 +828,7 @@ Commands.xprate.started.0=[[GOLD]]XP EVENT FOR mcMMO HAS STARTED! Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! # Admin Notifications -Server.ConsoleName=[Server] +Server.ConsoleName=[[YELLOW]][Server] Notifications.Admin.XPRate.Start.Self=[[GRAY]]You have set the global XP rate multiplier to [[GOLD]]{0}x Notifications.Admin.XPRate.End.Self=[[GRAY]]You ended the XP rate event. Notifications.Admin.XPRate.End.Others=The user {0} [[GRAY]]has ended the XP rate event From 3b3a36c64dca993ea73a27431ba80b6c70be6d4b Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:51:21 -0700 Subject: [PATCH 18/21] Updating changelog --- Changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.txt b/Changelog.txt index b1b9e602b..002937c84 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -19,6 +19,9 @@ Version 2.1.62 Add an entry of 'Magma_Block: 30' under Mining in experience.yml section titled "Experience_Values" (or you can delete the file to generate a new one with default values, 2.2 is coming soon which will have brand new configs so you could just wait for that 2.2 is the config rewrite, in this rewrite Repair and Salvage configs have been partially rewritten, it is not intended for Diamond Repair to take until level 50 in Standard level scaling to be available, since it'd be redundant to fix this in 2.1.X when 2.2 fixes it and its about to come out, the minimum level has temporarily been changed to 0. You can either update your repair.vanilla.yml config manually or delete it to generate a new one. + Admin notifications are a step in the right direction for finding naughty admins in mcMMO, I will be changing which permission node is used for players to be considered an admin in the future as not everyone wants or uses admin chat. + I expect to add logging of admin commands which will be viewable in game via command, so you won't have to have access to the servers log files to view who has been executing what. + Version 2.1.61 Fixed the locale string formatting of 'Mining.SubSkill.DoubleDrops.Stat' Updated the Japanese locale (thanks snake0053) From 66425ba48db7c0641ede287904b0ea4e97133096 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 10:59:52 -0700 Subject: [PATCH 19/21] Add UUID to admin notifications --- Changelog.txt | 2 +- .../com/gmail/nossr50/util/player/NotificationManager.java | 7 ++----- src/main/resources/locale/locale_en_US.properties | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 002937c84..de1efab67 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,7 +8,7 @@ Version 2.1.62 Guardian default combat XP multiplier reduced from 3.0 to 1.0 (update config if you want this change) New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below - New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations send to the user who executed the command + New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations sent to the user who executed the command New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled 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 94141185c..f350de361 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -17,10 +17,7 @@ import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.SoundCategory; +import org.bukkit.*; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -205,7 +202,7 @@ public class NotificationManager { if(commandSender instanceof Player) { - senderName = ((Player) commandSender).getDisplayName(); + senderName = ((Player) commandSender).getDisplayName() + ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId(); } //Send the notification diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 60960db06..04a0e5f1f 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -831,9 +831,9 @@ Commands.xprate.started.1=[[GOLD]]mcMMO XP RATE IS NOW {0}x! Server.ConsoleName=[[YELLOW]][Server] Notifications.Admin.XPRate.Start.Self=[[GRAY]]You have set the global XP rate multiplier to [[GOLD]]{0}x Notifications.Admin.XPRate.End.Self=[[GRAY]]You ended the XP rate event. -Notifications.Admin.XPRate.End.Others=The user {0} [[GRAY]]has ended the XP rate event -Notifications.Admin.XPRate.Start.Others=The user {0} [[GRAY]]has started or modified an XP rate event with global multiplier {1}x -Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin Notification[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.XPRate.End.Others={0} [[GRAY]]has ended the XP rate event +Notifications.Admin.XPRate.Start.Others={0} [[GRAY]]has started or modified an XP rate event with global multiplier {1}x +Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]Admin[[GOLD]]) [[GRAY]]{0} Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0} # Event From 5d6690fc1a54a2a09f1e563d5471897e099f6203 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 18 May 2019 11:06:48 -0700 Subject: [PATCH 20/21] 2.1.62 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac2db416a..9366ee06a 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.62-SNAPSHOT + 2.1.62 mcMMO https://github.com/mcMMO-Dev/mcMMO From d46fae2d1a23266399ee6a6e716aef51f3257408 Mon Sep 17 00:00:00 2001 From: SNAKE0053 <6961187+snake0053@users.noreply.github.com> Date: Sun, 19 May 2019 03:46:48 +0900 Subject: [PATCH 21/21] Update locale_ja_JP.properties --- .../resources/locale/locale_ja_JP.properties | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/resources/locale/locale_ja_JP.properties b/src/main/resources/locale/locale_ja_JP.properties index 98b05650f..83f78fe42 100644 --- a/src/main/resources/locale/locale_ja_JP.properties +++ b/src/main/resources/locale/locale_ja_JP.properties @@ -605,12 +605,16 @@ Commands.xplock.locked=[[GOLD]]\u3042\u306a\u305f\u306eXP\u30d0\u30fc\u306f\u73f Commands.xplock.unlocked=[[GOLD]]\u3042\u306a\u305f\u306eXP\u30d0\u30fc\u306f\u73fe\u5728[[GREEN]]\u30ed\u30c3\u30af\u89e3\u9664[[GOLD]]\u3055\u308c\u3066\u3044\u307e\u3059\uff01 Commands.xprate.modified=[[RED]]XP\u30ec\u30fc\u30c8\u306f{0}\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f Commands.xprate.over=[[RED]]mcMMO XP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\uff01 +Commands.xprate.proper.0=[[RED]]XP\u30ec\u30fc\u30c8\u3092\u5909\u66f4\u3059\u308b\u305f\u3081\u306e\u6b63\u3057\u3044\u65b9\u6cd5\u306f\/xprate \u3067\u3059\u3002 +Commands.xprate.proper.1=[[RED]]XP\u30ec\u30fc\u30c8\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u623b\u3059\u6b63\u3057\u3044\u65b9\u6cd5\u306f\/xprate reset \u3067\u3059\u3002 +Commands.xprate.proper.2=[[RED]]XP\u30ec\u30fc\u30c8\u3092\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u623b\u3059\u6b63\u3057\u3044\u65b9\u6cd5\u306f\/xprate reset \u3067\u3059\u3002 Commands.NegativeNumberWarn=\u8ca0\u306e\u5024\u3092\u4f7f\u308f\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002 Commands.Event.Start=[[GREEN]]mcMMO[[GOLD]] \u30a4\u30d9\u30f3\u30c8\uff01 +Commands.Event.Stop=[[GREEN]]mcMMO[[DARK_AQUA]] \u30a4\u30d9\u30f3\u30c8\u7d42\u4e86\uff01 +Commands.Event.Stop.Subtitle=[[GREEN]]\u697d\u3057\u3093\u3067\u304f\u308c\u305f\u3053\u3068\u3092\u9858\u3063\u3066\u307e\u3059\uff01 Commands.Event.XP=[[DARK_AQUA]]XP\u30ec\u30fc\u30c8\u306f\u73fe\u5728[[GOLD]]{0}[[DARK_AQUA]]x -Commands.xprate.started.0=[[GOLD]]mcMMO\u306eXP\u30a4\u30d9\u30f3\u30c8\u304c\u958b\u59cb\u3055\u308c\u307e\u3057\u305f\u3002 -Commands.xprate.started.1=[[GOLD]]mcMMO XP\u30ec\u30fc\u30c8\u306f\u73fe\u5728{0}x\u3067\u3059\u3002 -XPRate.Event= [[GOLD]]mcMMO\u306f\u73fe\u5728XP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u4e2d\u3067\u3059\u3002 XP\u30ec\u30fc\u30c8\u306f{0}x\u3067\u3059\u3002 +Commands.xprate.started.0=[[GOLD]]mcMMO\u306eXP\u30a4\u30d9\u30f3\u30c8\u304c\u958b\u59cb\u3055\u308c\u307e\u3057\u305f\uff01 +Commands.xprate.started.1=[[GOLD]]mcMMO\u306eXP\u30ec\u30fc\u30c8\u306f3\u500d\u306b\u306a\u308a\u307e\u3057\u305f\uff01 #GUIDES Guides.Header=[[GOLD]]-=[[GREEN]]{0} \u30ac\u30a4\u30c9[[GOLD]]=- @@ -657,9 +661,22 @@ Smelting.SubSkill.FluxMining.Stat=\u30d5\u30e9\u30c3\u30af\u30b9\u30de\u30a4\u30 Smelting.Listener=\u7cbe\u932c: Smelting.SkillName=\u7cbe\u932c +# Admin Notifications +Server.ConsoleName=[[YELLOW]][Server] +Notifications.Admin.XPRate.Start.Self=[[GRAY]]\u3042\u306a\u305f\u306f[[GOLD]]{0}x[[GRAY]]\u306b\u30b0\u30ed\u30fc\u30d0\u30ebXP\u30ec\u30fc\u30c8\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002 +Notifications.Admin.XPRate.End.Self=[[GRAY]]XP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u3092\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002 +Notifications.Admin.XPRate.End.Others={0}[[GRAY]]\u306fXP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u3092\u7d42\u4e86\u3057\u307e\u3057\u305f +Notifications.Admin.XPRate.Start.Others={0}[[GRAY]]\u304c{1}x\u3067\u30b0\u30ed\u30fc\u30d0\u30ebXP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u3092\u958b\u59cb\u307e\u305f\u306f\u5909\u66f4\u3057\u307e\u3057\u305f +Notifications.Admin.Format.Others=[[GOLD]]([[GREEN]]mcMMO [[DARK_AQUA]]\u7ba1\u7406\u8005[[GOLD]]) [[GRAY]]{0} +Notifications.Admin.Format.Self=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0} + +# Event +XPRate.Event=[[GOLD]]mcMMO\u306f\u73fe\u5728XP\u30ec\u30fc\u30c8\u30a4\u30d9\u30f3\u30c8\u4e2d\u3067\u3059\uff01XP\u30ec\u30fc\u30c8\u306f{0}x\u3067\u3059\uff01 + #UPDATE CHECKER UpdateChecker.Outdated=\u3042\u306a\u305f\u306f\u53e4\u3044mcMMO\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\uff01 UpdateChecker.NewAvailable=Spigot\u306b\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002 + #SCOREBOARD HEADERS Scoreboard.Header.PlayerStats=[[YELLOW]]mcMMO \u7d71\u8a08 Scoreboard.Header.PlayerCooldowns=[[YELLOW]]mcMMO \u30af\u30fc\u30eb\u30c0\u30a6\u30f3 @@ -673,8 +690,15 @@ Scoreboard.Misc.RemainingXP=[[YELLOW]]\u6b8b\u308aXP Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]\u30af\u30fc\u30eb\u30c0\u30a6\u30f3 Scoreboard.Misc.Overall=[[GOLD]]\u5408\u8a08 Scoreboard.Misc.Ability=\u30a2\u30d3\u30ea\u30c6\u30a3 + #DATABASE RECOVERY Profile.PendingLoad=[[RED]]mcMMO\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u306f\u307e\u3060\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002 Profile.Loading.Success=[[GREEN]]\u3042\u306a\u305f\u306emcMMO\u30d7\u30ed\u30d5\u30a3\u30fc\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3057\u305f\u3002 Profile.Loading.FailurePlayer=[[RED]]mcMMO\u306e\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u306b\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u3002[[GREEN]]{0}[[RED]]\u56de\u8aad\u307f\u8fbc\u307f\u3092\u8a66\u3057\u307e\u3057\u305f\u3002[[LIGHT_GRAY]] \u3053\u306e\u554f\u984c\u306b\u3064\u3044\u3066\u30b5\u30fc\u30d0\u30fc\u7ba1\u7406\u8005\u306b\u9023\u7d61\u3057\u3066\u304f\u3060\u3055\u3044\u3002mcMMO\u306f\u3042\u306a\u305f\u304c\u5207\u65ad\u3059\u308b\u307e\u3067\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u9593XP\u3092\u7372\u5f97\u3067\u304d\u306a\u3044\u304b\u3001\u30b9\u30ad\u30eb\u3092\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u305b\u3093\u3002 -Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO\u306f[[YELLOW]]{0}[[RED]]\u306e\u30d7\u30ec\u30fc\u30e4\u30fc\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093\u3067\u3057\u305f\u3002 [[LIGHT_PURPLE]]\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u307e\u3067\u306e\u8a66\u884c\u56de\u6570\u306f{1}\u56de\u3067\u3059\u3002 \ No newline at end of file +Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO\u306f[[YELLOW]]{0}[[RED]]\u306e\u30d7\u30ec\u30fc\u30e4\u30fc\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093\u3067\u3057\u305f\u3002 [[LIGHT_PURPLE]]\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u307e\u3067\u306e\u8a66\u884c\u56de\u6570\u306f{1}\u56de\u3067\u3059\u3002 + +#Reminder Messages +Reminder.Squelched=[[GRAY]]\u30ea\u30de\u30a4\u30f3\u30c0\u30fc: \u3042\u306a\u305f\u306f\u73fe\u5728mcMMO\u304b\u3089\u901a\u77e5\u3092\u53d7\u3051\u53d6\u3063\u3066\u3044\u307e\u305b\u3093\u3002\u901a\u77e5\u3092\u6709\u52b9\u306b\u3059\u308b\u305f\u3081\u306b\u306f\/mcnotify\u30b3\u30de\u30f3\u30c9\u3092\u3082\u3046\u4e00\u5ea6\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306f\u81ea\u52d5\u5316\u3055\u308c\u305f1\u6642\u9593\u3054\u3068\u306e\u901a\u77e5\u3067\u3059\u3002 + +#Locale +Locale.Reloaded=[[GREEN]]\u30ed\u30b1\u30fc\u30eb \u30ea\u30ed\u30fc\u30c9\uff01 \ No newline at end of file