Ver código fonte

Fixed a bug that would spam other players when someone used an ability

nossr50 6 anos atrás
pai
commit
1cda612e86

+ 4 - 1
Changelog.txt

@@ -1,10 +1,13 @@
 Version 2.1.64
+    Corrected how Standard mode (1-100 scaling) XP to next level was calculated, it is now a true 1:10 ratio with Retro (1-1000) scale, which is how it was intended to be to begin with
+    Fixed a bug that caused skill messages to spam nearby players
     (API) method to get XP in FormulaManager has been renamed to getXPtoNextLevel(...), this shouldn't break anything as plugins should be using our Experience API methods instead of this
     (API) Added method getLevel(Player player, PrimarySkillType primarySkillType) to ExperienceAPI.java
-    Corrected how Standard mode (1-100 scaling) XP to next level was calculated, it is now a true 1:10 ratio with Retro (1-1000) scale, which is how it was intended to be to begin with
+
 
     NOTE: The net result of this change is it will take a bit longer to level with Standard, but it should not be a drastic change. You might not even notice it.
     Standard is meant to take the same amount of time to level from levels 1-100 as it takes Retro to do 1-1000, this change corrects from errors in the code that made Standard actually take less XP than Retro despite intending for it to be a cosmetic difference in progression.
+    I made a google sheet visualizing the difference between Standard and Retro Mode using default settings and Linear formula - https://docs.google.com/spreadsheets/d/1VlJtvNHlypACHyz_zulEdhgLwFjL01xMPkqlnu0XBSs/edit?usp=sharing
 
 Version 2.1.63
     Fixed Armor Impact not scaling by skill rank

+ 3 - 8
src/main/java/com/gmail/nossr50/util/player/NotificationManager.java

@@ -55,19 +55,14 @@ public class NotificationManager {
      * Sends players notifications from mcMMO
      * This does this by sending out an event so other plugins can cancel it
      * This event in particular is provided with a source player, and players near the source player are sent the information
-     * @param source the source player for this event
+     * @param targetPlayer the recipient player for this message
      * @param notificationType type of notification
      * @param key Locale Key for the string to use with this event
      * @param values values to be injected into the locale string
      */
-    public static void sendNearbyPlayersInformation(Player source, NotificationType notificationType, String key, String... values)
+    public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key, String... values)
     {
-        Location location = source.getLocation();
-        for (Player otherPlayer : source.getWorld().getPlayers()) {
-            if (otherPlayer != source && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
-                sendPlayerInformation(otherPlayer, notificationType, key, values);
-            }
-        }
+        sendPlayerInformation(targetPlayer, notificationType, key, values);
     }
 
     public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)

+ 1 - 1
src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java

@@ -125,7 +125,7 @@ public class SkillUtils {
 
         for (Player otherPlayer : player.getWorld().getPlayers()) {
             if (otherPlayer != player && Misc.isNear(location, otherPlayer.getLocation(), Misc.SKILL_MESSAGE_MAX_SENDING_DISTANCE)) {
-                NotificationManager.sendNearbyPlayersInformation(player, notificationType, key, player.getName());
+                NotificationManager.sendNearbyPlayersInformation(otherPlayer, notificationType, key, player.getName());
             }
         }
     }