浏览代码

UserManager::getPlayer returns null again (oopsie)

nossr50 6 年之前
父节点
当前提交
f6e01ea910
共有 3 个文件被更改,包括 9 次插入3 次删除
  1. 6 0
      Changelog.txt
  2. 1 1
      pom.xml
  3. 2 2
      src/main/java/com/gmail/nossr50/util/player/UserManager.java

+ 6 - 0
Changelog.txt

@@ -7,6 +7,12 @@ Key:
   ! Change
   - Removal
 
+Version 2.1.42
+    Fixed McMMOPlayerNotFoundException being thrown instead of null
+    (API) UserManager.getPlayer() returns null again (oopsie)
+
+    NOTE: Sorry about that, when trying to improve Bungee Cord compatibility I made a big oopsie!
+
 Version 2.1.41
     Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded
     Added new locale string Profile.PendingLoad

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.41</version>
+    <version>2.1.42-SNAPSHOT</version>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>

+ 2 - 2
src/main/java/com/gmail/nossr50/util/player/UserManager.java

@@ -101,12 +101,12 @@ public final class UserManager {
      * @param player target player
      * @return McMMOPlayer object for this player, null if Player has not been loaded
      */
-    public static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {
+    public static McMMOPlayer getPlayer(Player player) {
         //Avoid Array Index out of bounds
         if(player.hasMetadata(mcMMO.playerDataKey))
             return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
         else
-            throw new McMMOPlayerNotFoundException(player);
+            return null;
     }
 
     private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {