2020-07-17 18:05:50 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-08-07 02:59:57 +02:00
|
|
|
From: tr7zw <tr7zw@live.de>
|
2020-08-05 21:38:36 +02:00
|
|
|
Date: Wed, 5 Aug 2020 14:25:50 -0500
|
2020-02-26 22:22:46 +01:00
|
|
|
Subject: [PATCH] Add GameProfileLookupEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
2020-10-08 13:04:22 +02:00
|
|
|
index 2751ce7f1556da07ef853807a588f096adf6ef7f..8bda2180576d3c58ad592e6158621160a8c4c5cf 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
|
2020-10-08 13:04:22 +02:00
|
|
|
@@ -183,13 +183,24 @@ public class CraftPlayerProfile implements PlayerProfile {
|
2020-02-26 22:22:46 +01:00
|
|
|
|
2020-06-27 15:45:01 +02:00
|
|
|
boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
|
2020-06-24 17:21:23 +02:00
|
|
|
if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
|
2020-08-05 21:59:22 +02:00
|
|
|
- GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true);
|
2020-02-26 22:22:46 +01:00
|
|
|
- if (result != null) {
|
2020-06-21 00:40:04 +02:00
|
|
|
- copyProfileProperties(result, this.profile, true);
|
2020-08-11 20:40:29 +02:00
|
|
|
- }
|
2020-06-27 15:45:01 +02:00
|
|
|
- if (this.profile.isComplete()) {
|
|
|
|
- server.getUserCache().saveProfile(this.profile);
|
2020-08-11 20:40:29 +02:00
|
|
|
+ // Yatopia start
|
|
|
|
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent event = new
|
|
|
|
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent(
|
|
|
|
+ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
|
|
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
|
|
|
+ GameProfile eventProfile = event.getGameProfile();
|
|
|
|
+ if (eventProfile != null) {
|
|
|
|
+ this.profile = eventProfile;
|
|
|
|
+ } else {
|
|
|
|
+ GameProfile result = server.getMinecraftSessionService().fillProfileProperties(profile, true);
|
|
|
|
+ if (result != null) {
|
|
|
|
+ copyProfileProperties(result, this.profile, true);
|
|
|
|
+ }
|
|
|
|
+ if (this.profile.isComplete()) {
|
|
|
|
+ server.getUserCache().saveProfile(this.profile);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
+ // Yatopia end
|
|
|
|
}
|
2020-06-24 17:21:23 +02:00
|
|
|
return profile.isComplete() && (!onlineMode || !textures || hasTextures());
|
2020-02-26 22:22:46 +01:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
2020-08-11 20:40:29 +02:00
|
|
|
index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..ab553f408b31cb7e2d281cc3d8fe42e19dc717d9 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
|
2020-08-11 20:40:29 +02:00
|
|
|
@@ -77,7 +77,18 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
|
2020-02-26 22:22:46 +01:00
|
|
|
|
|
|
|
if ( property == null )
|
|
|
|
{
|
2020-08-11 20:40:29 +02:00
|
|
|
+ // Yatopia start
|
|
|
|
+ dev.tr7zw.yatopia.events.GameProfileLookupEvent event =
|
|
|
|
+ new dev.tr7zw.yatopia.events.GameProfileLookupEvent(
|
|
|
|
+ !org.bukkit.Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
|
|
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
|
|
|
+ GameProfile eventProfile = event.getGameProfile();
|
|
|
|
+ if (eventProfile != null) {
|
|
|
|
+ profile = eventProfile;
|
|
|
|
+ } else {
|
|
|
|
profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
|
|
|
|
+ }
|
|
|
|
+ // Yatopia end
|
2020-02-26 22:22:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|