improve Profile Fill Events early return logic - #997

This commit is contained in:
Aikar 2018-01-28 19:40:19 -05:00
parent 09182f737d
commit a485501ce4
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -1,4 +1,4 @@
From 97c93bfff69a27ca204861f28b76d848a495b340 Mon Sep 17 00:00:00 2001 From ab9a259b3a06cfb7d65b6a3e246eb3c732765814 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 2 Jan 2018 00:31:26 -0500 Date: Tue, 2 Jan 2018 00:31:26 -0500
Subject: [PATCH] Fill Profile Property Events Subject: [PATCH] Fill Profile Property Events
@ -12,7 +12,7 @@ This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java diff --git a/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java
new file mode 100644 new file mode 100644
index 000000000..0901d9838 index 000000000..9914f98c2
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/WrappedMinecraftSessionService.java
@@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
@ -79,7 +79,7 @@ index 000000000..0901d9838
+ @Override + @Override
+ public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) { + public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
+ new PreFillProfileEvent(CraftPlayerProfile.asBukkitMirror(profile)).callEvent(); + new PreFillProfileEvent(CraftPlayerProfile.asBukkitMirror(profile)).callEvent();
+ if (!profile.getProperties().isEmpty()) { + if (profile.isComplete() && profile.getProperties().containsKey("textures")) {
+ return profile; + return profile;
+ } + }
+ GameProfile gameProfile = orig.fillProfileProperties(profile, requireSecure); + GameProfile gameProfile = orig.fillProfileProperties(profile, requireSecure);