Skip to content

Commit

Permalink
PlayerProfile.complete shouldn't throw NPE
Browse files Browse the repository at this point in the history
We have a result boolean for this already, and this
method was meant to be "Try from cache, if that fails, look it up"

So NPE'ing there just wasn't correct.
  • Loading branch information
aikar committed Jul 31, 2018
1 parent d54ce6c commit a3db62f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions Spigot-Server-Patches/0216-Basic-PlayerProfile-API.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 67efca2ab5f2797aeceff4a62a7b777f2ea616d9 Mon Sep 17 00:00:00 2001
From 9fc6ead2cb78a551d09710035213395077e6f795 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API
Expand All @@ -7,10 +7,10 @@ Establishes base extension of profile systems for future edits too

diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644
index 000000000..9ad5853de
index 0000000000..b151a13c1b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,281 @@
@@ -0,0 +1,280 @@
+package com.destroystokyo.paper.profile;
+
+import com.destroystokyo.paper.PaperConfig;
Expand Down Expand Up @@ -166,10 +166,9 @@ index 000000000..9ad5853de
+ // Make an OfflinePlayer using an offline mode UUID since the name has no profile
+ profile = new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name);
+ }
+ if (profile == null) {
+ throw new NullPointerException("Could not get UUID for Player " + name);
+ if (profile != null) {
+ this.profile = profile;
+ }
+ this.profile = profile;
+ }
+
+ if (profile.getName() == null) {
Expand Down Expand Up @@ -294,7 +293,7 @@ index 000000000..9ad5853de
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
new file mode 100644
index 000000000..25836b975
index 0000000000..25836b975b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
@@ -0,0 +1,30 @@
Expand Down Expand Up @@ -330,7 +329,7 @@ index 000000000..25836b975
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
new file mode 100644
index 000000000..3bcdb8f93
index 0000000000..3bcdb8f93f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@@ -0,0 +1,17 @@
Expand All @@ -353,7 +352,7 @@ index 000000000..3bcdb8f93
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
new file mode 100644
index 000000000..4b2a67423
index 0000000000..4b2a67423f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +1,29 @@
Expand Down Expand Up @@ -388,7 +387,7 @@ index 000000000..4b2a67423
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
new file mode 100644
index 000000000..3aceb0ea8
index 0000000000..3aceb0ea8a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
@@ -0,0 +1,11 @@
Expand All @@ -404,7 +403,7 @@ index 000000000..3aceb0ea8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 02940d697..4539b5601 100644
index 02940d697f..4539b56012 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -1,6 +1,9 @@
Expand All @@ -429,7 +428,7 @@ index 02940d697..4539b5601 100644
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e8bddc171..fcf6bac08 100644
index e8bddc171c..fcf6bac08f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1018,7 +1018,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
Expand All @@ -450,7 +449,7 @@ index e8bddc171..fcf6bac08 100644
return this.W;
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 7ce08eb8b..6a750c25e 100644
index 7ce08eb8bb..6a750c25eb 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -44,7 +44,7 @@ public class UserCache {
Expand Down Expand Up @@ -486,7 +485,7 @@ index 7ce08eb8b..6a750c25e 100644

private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 77c16fe2c..2dd7ed96a 100644
index 77c16fe2c4..2dd7ed96a4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
Expand Down

0 comments on commit a3db62f

Please sign in to comment.