2
0
Эх сурвалжийг харах

Add mcMMO reload command "/mcmmoreload"

nossr50 6 жил өмнө
parent
commit
faed690602

+ 75 - 70
Changelog.txt

@@ -1,73 +1,3 @@
-Version 2.1.50
-    Fixed a bug where early game XP boost (level 1-5) didn't function in certain circumstances
-    Updated German locale (thanks OverCrave)
-    Added missing Herbalism XP values for: Bamboo, Cornflower, Lily of the valley, Wither rose (thanks Zed-I)
-    Added missing Mining XP values for: Stone Bricks, Cracked Stone Bricks, Mossy Stone Bricks, Chiseled Stone Bricks, Prismarine Bricks, Dark Prismarine, Sea Lantern (thanks Zed-I)
-    Added missing Combat XP multiplier for: Wandering Trader (thanks Zed-I)
-
-    Notes:
-    If you haven't upgraded mcMMO since version 2.1.47 or before you will not need to do these steps as the experience file will update once automatically.
-    You can either delete experience.yml to generate a new one or edit it manually
-    This is what the default experience.yml looks like
-    https://paste.gg/p/anonymous/946f62ce7dff4ab7a87cae70c0266313
-
-
-Version 2.1.49
-    Added sweet berry bush to Herbalism XP (Update your experience.yml config or delete it to gen a new one)
-    Fixed a bug where falling blocks were not marked as unnatural in water
-    Fixed a bug where tool lower notifications were being called async when they are sync only
-    Fixed NPE when checking inventory location
-    Improved herbalism compatibility with anti-cheat (thanks LogGits)
-
-    NOTE: This is what the default herbalism XP table looks like
-    https://paste.gg/p/anonymous/1022088f20cf44298870930e9bc58e8a
-
-Version 2.1.48
-    1.14 Support
-    Added Cats, Foxes, and Pandas to Taming XP rewards
-    Added Cats, Foxes, Pandas, Trader Llamas, Pillagers, and Ravagers to Combat XP rewards
-    "Experience" section of experience.yml has been renamed to "Experience_Values"
-    Dodge now gives 800 XP
-    Roll now gives 600 XP
-    Fall now gives 600 XP
-
-    The first 5/50 levels of skills now give large amounts of XP so players get key early skills much faster
-        Note: First 5 in Standard, first 50 in Retro
-
-    Dev Notes:
-    I will be making a write up soon explaining near future plans for mcMMO and what is going on with the config update, abstraction update, etc...
-    Currently this version of mcMMO will work on both 1.13 and 1.14, in the abstraction update I will expand compatible versions of mcMMO to include: 1.14 / 1.13.2 / 1.12.2 / 1.8.8 / Sponge 1.14
-    It is not necessary to update your configs if you are upgrading from 1.13 -> 1.14, however if you had custom XP values in your experience.yml you will want to update your config.
-    Acrobatics XP was buffed since many AFK counter-measures were put into place to prevent repetitive grinding.
-    Experience node in experience.yml was renamed to "automatically" update configs for the new stuff 1.14
-    There are 4 updates planned for mcMMO, including a patreon rewards update, a large content update, a config update, and backwards compatibility for 1.13/1.12/1.8.8 and support for Sponge
-
-Version 2.1.47
-    Fix NPE when party leader is offline and players grab a party list
-
-Version 2.1.46
-    Party member lists now show the whole party, including offline players again.
-    Party lists now have special markers for players who are in shared XP range
-    Party lists now have special markers for players who are offline
-    Party lists now have special markers for the party leader
-    Fixed an error where bleed was setting health outside minimum values
-    [See NOTE] Fixed a bug where Creepers and Zombies were not dropping the correct heads from Shake (thanks Zed-I)
-    [See NOTE] Fixed a bug where salvage was not returning the correct amount of materials for AXE items (thanks Zed-I)
-    [See NOTE] Added missing STRIPPED_WOOD entries to experience.yml for Woodcutting
-    [See NOTE] Added about 15-20 missing entries to experience.yml for coral to Herbalism
-    Fixed a bug where admin chat from console would fail to send (thanks OverCrave)
-    Reduced default XP values for DEAD_* coral plants from 30 -> 10
-    Updated hu_HU locale (thanks andris155)
-
-    NOTE: These bugfixes were related to default config values, to receive these changes you can either delete experience.yml, treasures.yml and salvage.vanilla.yml to generate new ones or make the necessary edits.
-    This is what the files should look like after being edited.
-    Experience Correct Default Config - https://paste.gg/p/anonymous/ff695df1417e4232957a3d176fd14ed4
-    Salvage Correct Default Config - https://paste.gg/p/anonymous/c4eb2f4e66ed444e872021051760f3be
-    Treasures Correct Default Config - https://paste.gg/p/anonymous/b0120210f8c149958ca0303c68c19ebd
-
-Version 2.1.45
-    mcMMO will now check to see if the server version is incompatible and inform server admins on how to fix the problem.
-
 Version 2.2.0
     mcMMO's config system has been rewritten
     Added new subskill to Fishing named 'Inner Peace'
@@ -95,6 +25,10 @@ Version 2.2.0
     Acrobatic's Dodge XP increased from 120 -> 480
     Fishing's always catch fish setting now defaults to true instead of false
     Optimized code related to Fishing
+    Added a new command "mcmmoreload" to reload config values
+    Added new locale string 'Commands.Reload.Start'
+    Added new locale string 'Commands.Reload.Finished'
+    Added new permission 'mcmmo.commands.reload'
     NOTE: Not every config key that was renamed will be listed here
     Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected")
         Note: Admins are players who are op or have adminchat permission.
@@ -230,6 +164,77 @@ Version 2.2.0
     Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
     Added API method to check if a skill was being level capped
 
+
+Version 2.1.50
+    Fixed a bug where early game XP boost (level 1-5) didn't function in certain circumstances
+    Updated German locale (thanks OverCrave)
+    Added missing Herbalism XP values for: Bamboo, Cornflower, Lily of the valley, Wither rose (thanks Zed-I)
+    Added missing Mining XP values for: Stone Bricks, Cracked Stone Bricks, Mossy Stone Bricks, Chiseled Stone Bricks, Prismarine Bricks, Dark Prismarine, Sea Lantern (thanks Zed-I)
+    Added missing Combat XP multiplier for: Wandering Trader (thanks Zed-I)
+
+    Notes:
+    If you haven't upgraded mcMMO since version 2.1.47 or before you will not need to do these steps as the experience file will update once automatically.
+    You can either delete experience.yml to generate a new one or edit it manually
+    This is what the default experience.yml looks like
+    https://paste.gg/p/anonymous/946f62ce7dff4ab7a87cae70c0266313
+
+
+Version 2.1.49
+    Added sweet berry bush to Herbalism XP (Update your experience.yml config or delete it to gen a new one)
+    Fixed a bug where falling blocks were not marked as unnatural in water
+    Fixed a bug where tool lower notifications were being called async when they are sync only
+    Fixed NPE when checking inventory location
+    Improved herbalism compatibility with anti-cheat (thanks LogGits)
+
+    NOTE: This is what the default herbalism XP table looks like
+    https://paste.gg/p/anonymous/1022088f20cf44298870930e9bc58e8a
+
+Version 2.1.48
+    1.14 Support
+    Added Cats, Foxes, and Pandas to Taming XP rewards
+    Added Cats, Foxes, Pandas, Trader Llamas, Pillagers, and Ravagers to Combat XP rewards
+    "Experience" section of experience.yml has been renamed to "Experience_Values"
+    Dodge now gives 800 XP
+    Roll now gives 600 XP
+    Fall now gives 600 XP
+
+    The first 5/50 levels of skills now give large amounts of XP so players get key early skills much faster
+        Note: First 5 in Standard, first 50 in Retro
+
+    Dev Notes:
+    I will be making a write up soon explaining near future plans for mcMMO and what is going on with the config update, abstraction update, etc...
+    Currently this version of mcMMO will work on both 1.13 and 1.14, in the abstraction update I will expand compatible versions of mcMMO to include: 1.14 / 1.13.2 / 1.12.2 / 1.8.8 / Sponge 1.14
+    It is not necessary to update your configs if you are upgrading from 1.13 -> 1.14, however if you had custom XP values in your experience.yml you will want to update your config.
+    Acrobatics XP was buffed since many AFK counter-measures were put into place to prevent repetitive grinding.
+    Experience node in experience.yml was renamed to "automatically" update configs for the new stuff 1.14
+    There are 4 updates planned for mcMMO, including a patreon rewards update, a large content update, a config update, and backwards compatibility for 1.13/1.12/1.8.8 and support for Sponge
+
+Version 2.1.47
+    Fix NPE when party leader is offline and players grab a party list
+
+Version 2.1.46
+    Party member lists now show the whole party, including offline players again.
+    Party lists now have special markers for players who are in shared XP range
+    Party lists now have special markers for players who are offline
+    Party lists now have special markers for the party leader
+    Fixed an error where bleed was setting health outside minimum values
+    [See NOTE] Fixed a bug where Creepers and Zombies were not dropping the correct heads from Shake (thanks Zed-I)
+    [See NOTE] Fixed a bug where salvage was not returning the correct amount of materials for AXE items (thanks Zed-I)
+    [See NOTE] Added missing STRIPPED_WOOD entries to experience.yml for Woodcutting
+    [See NOTE] Added about 15-20 missing entries to experience.yml for coral to Herbalism
+    Fixed a bug where admin chat from console would fail to send (thanks OverCrave)
+    Reduced default XP values for DEAD_* coral plants from 30 -> 10
+    Updated hu_HU locale (thanks andris155)
+
+    NOTE: These bugfixes were related to default config values, to receive these changes you can either delete experience.yml, treasures.yml and salvage.vanilla.yml to generate new ones or make the necessary edits.
+    This is what the files should look like after being edited.
+    Experience Correct Default Config - https://paste.gg/p/anonymous/ff695df1417e4232957a3d176fd14ed4
+    Salvage Correct Default Config - https://paste.gg/p/anonymous/c4eb2f4e66ed444e872021051760f3be
+    Treasures Correct Default Config - https://paste.gg/p/anonymous/b0120210f8c149958ca0303c68c19ebd
+
+Version 2.1.45
+    mcMMO will now check to see if the server version is incompatible and inform server admins on how to fix the problem.
+
 Version 2.1.44
     Fixed a NPE with Alchemy brewing
 

+ 26 - 0
src/main/java/com/gmail/nossr50/commands/server/ReloadCommand.java

@@ -0,0 +1,26 @@
+package com.gmail.nossr50.commands.server;
+
+import com.gmail.nossr50.locale.LocaleLoader;
+import com.gmail.nossr50.mcMMO;
+import com.gmail.nossr50.util.Permissions;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+
+public class ReloadCommand implements CommandExecutor {
+    @Override
+    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+        if (sender instanceof Player) {
+            if (!Permissions.reload(sender))
+                return false;
+        }
+
+        Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Start"));
+        mcMMO.getConfigManager().reloadConfigs();
+        Bukkit.broadcastMessage(LocaleLoader.getString("Commands.Reload.Finished"));
+        return true;
+    }
+}

+ 0 - 1
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -425,7 +425,6 @@ public class mcMMO extends JavaPlugin {
         //Unload configs last
         configManager.unloadAllConfigsAndRegisters();
 
-
         debug("Was disabled."); // How informative!
     }
 

+ 4 - 0
src/main/java/com/gmail/nossr50/util/Permissions.java

@@ -177,6 +177,10 @@ public final class Permissions {
         return permissible.hasPermission("mcmmo.commands.mmoedit");
     }
 
+    public static boolean reload(Permissible permissible) {
+        return permissible.hasPermission("mcmmo.commands.reload");
+    }
+
     public static boolean mmoeditOthers(Permissible permissible) {
         return permissible.hasPermission("mcmmo.commands.mmoedit.others");
     }

+ 13 - 0
src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java

@@ -14,6 +14,7 @@ import com.gmail.nossr50.commands.experience.SkillresetCommand;
 import com.gmail.nossr50.commands.party.PartyCommand;
 import com.gmail.nossr50.commands.party.teleport.PtpCommand;
 import com.gmail.nossr50.commands.player.*;
+import com.gmail.nossr50.commands.server.ReloadCommand;
 import com.gmail.nossr50.commands.skills.*;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 import com.gmail.nossr50.locale.LocaleLoader;
@@ -174,6 +175,15 @@ public final class CommandRegistrationManager {
         command.setExecutor(new MmoeditCommand());
     }
 
+    private static void registerMcmmoReloadCommand() {
+        PluginCommand command = mcMMO.p.getCommand("mcmmoreload");
+        command.setDescription(LocaleLoader.getString("Commands.Description.mcmmoreload"));
+        command.setPermission("mcmmo.commands.reload");
+        command.setPermissionMessage(permissionsMessage);
+        command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmoreload"));
+        command.setExecutor(new ReloadCommand());
+    }
+
     private static void registerSkillresetCommand() {
         PluginCommand command = mcMMO.p.getCommand("skillreset");
         command.setDescription(LocaleLoader.getString("Commands.Description.skillreset"));
@@ -445,5 +455,8 @@ public final class CommandRegistrationManager {
 
         // Skill Commands
         registerSkillCommands();
+
+        //Config Commands
+        registerMcmmoReloadCommand();
     }
 }

+ 5 - 1
src/main/resources/locale/locale_en_US.properties

@@ -1043,6 +1043,7 @@ Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
 Commands.Description.mcremove=Remove a user from the mcMMO database
 Commands.Description.mcscoreboard=Manage your mcMMO Scoreboard
 Commands.Description.mcstats=Show your mcMMO levels and XP
+Commands.Description.mcmmoreload=Reload all mcMMO config files
 Commands.Description.mctop=Show mcMMO leader boards
 Commands.Description.mmoedit=Edit mcMMO levels for a user
 Commands.Description.mmoupdate=Migrate mcMMO database from an old database into the current one
@@ -1081,4 +1082,7 @@ Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load th
 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!
 #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.
+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.
+#Misc
+Commands.Reload.Start=mcMMO is reloading... this may take a moment
+Commands.Reload.Finished=mcMMO has finished reloading!

+ 6 - 0
src/main/resources/plugin.yml

@@ -71,6 +71,9 @@ commands:
     mmoedit:
         description: Edit the mcMMO skill values for a user
         permission: mcmmo.commands.mmoedit
+    mcmmoreload:
+        description: Reloads mcMMO's config files
+        permission: mcmmo.commands.reload
     ptp:
         description: Teleport to a party member
         permission: mcmmo.commands.ptp
@@ -792,6 +795,7 @@ permissions:
             mcmmo.commands.mcrefresh: true
             mcmmo.commands.mcrefresh.others: true
             mcmmo.commands.mcremove: true
+            mcmmo.commands.mcmmoreload: true
             mcmmo.commands.mmoedit: true
             mcmmo.commands.mmoedit.others: true
             mcmmo.commands.mmoshowdb: true
@@ -978,6 +982,8 @@ permissions:
         description: Allows access to the mining command
     mcmmo.commands.mmoedit:
         description: Allows access to the mmoedit command
+    mcmmo.commands.reload:
+        description: Allows acces to the mcmmoreload command
     mcmmo.commands.mmoedit.others:
         description: Allows access to the mmoedit command for other players
     mcmmo.commands.mmoshowdb: