2020-05-07 16:59:29 +02:00
|
|
|
From 25d157fb08edec4ed3dd94c403bc9f2b7773c926 Mon Sep 17 00:00:00 2001
|
2020-02-26 22:22:46 +01:00
|
|
|
From: tr7zw <tr7zw@live.de>
|
|
|
|
Date: Wed, 26 Feb 2020 22:22:02 +0100
|
|
|
|
Subject: [PATCH] Add GameProfileLookupEvent
|
|
|
|
|
|
|
|
---
|
|
|
|
.../paper/profile/CraftPlayerProfile.java | 20 +++++++++++++++----
|
|
|
|
.../net/minecraft/server/TileEntitySkull.java | 15 +++++++++++++-
|
|
|
|
2 files changed, 30 insertions(+), 5 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
2020-04-21 13:55:39 +02:00
|
|
|
index b151a13c1b..a37db9a55a 100644
|
2020-02-26 22:22:46 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
|
|
@@ -5,8 +5,12 @@ import com.google.common.base.Charsets;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import com.mojang.authlib.properties.Property;
|
|
|
|
import com.mojang.authlib.properties.PropertyMap;
|
|
|
|
+
|
|
|
|
+import de.tr7zw.yapfa.events.GameProfileLookupEvent;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.server.UserCache;
|
|
|
|
+
|
|
|
|
+import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
|
|
import org.spigotmc.SpigotConfig;
|
|
|
|
|
|
|
|
@@ -174,10 +178,18 @@ public class CraftPlayerProfile implements PlayerProfile {
|
|
|
|
boolean isOnlineMode = server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode);
|
|
|
|
boolean isCompleteFromCache = this.completeFromCache(true);
|
|
|
|
if (isOnlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
|
|
|
|
- GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
|
|
|
|
- if (result != null) {
|
|
|
|
- this.profile = result;
|
|
|
|
- }
|
|
|
|
+ // YAPFA start
|
2020-03-21 17:29:35 +01:00
|
|
|
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
|
2020-02-26 22:22:46 +01:00
|
|
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.getGameProfile() != null) {
|
|
|
|
+ this.profile = event.getGameProfile();
|
|
|
|
+ } else {
|
|
|
|
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
|
|
|
|
+ if (result != null) {
|
|
|
|
+ this.profile = result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // YAPFA end
|
|
|
|
}
|
|
|
|
return profile.isComplete() && (!isOnlineMode || !textures || hasTextures());
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
2020-04-21 13:55:39 +02:00
|
|
|
index 0882d82cef..62607f495f 100644
|
2020-02-26 22:22:46 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
|
|
|
@@ -4,9 +4,14 @@ import com.google.common.collect.Iterables;
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
|
|
|
import com.mojang.authlib.properties.Property;
|
|
|
|
+
|
|
|
|
+import de.tr7zw.yapfa.events.GameProfileLookupEvent;
|
|
|
|
+
|
|
|
|
import java.util.UUID;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
+import org.bukkit.Bukkit;
|
|
|
|
+
|
|
|
|
// Spigot start
|
|
|
|
import com.google.common.base.Predicate;
|
|
|
|
import com.google.common.cache.LoadingCache;
|
|
|
|
@@ -74,7 +79,15 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
|
|
|
|
|
|
|
|
if ( property == null )
|
|
|
|
{
|
|
|
|
- profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
|
|
|
|
+ // YAPFA start
|
2020-03-21 17:29:35 +01:00
|
|
|
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
|
2020-02-26 22:22:46 +01:00
|
|
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.getGameProfile() != null) {
|
|
|
|
+ profile = event.getGameProfile();
|
|
|
|
+ } else {
|
|
|
|
+ profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
|
|
|
|
+ }
|
|
|
|
+ // YAPFA end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
|
|
|
2.25.1.windows.1
|
|
|
|
|