UserManager::getPlayer returns null again (oopsie)

This commit is contained in:
nossr50 2019-04-13 12:58:32 -07:00
parent 2a053a0be2
commit f6e01ea910
3 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,12 @@ Key:
! Change ! Change
- Removal - 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 Version 2.1.41
Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded
Added new locale string Profile.PendingLoad Added new locale string Profile.PendingLoad

View File

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

View File

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