Fix event (again)

This commit is contained in:
tr7zw 2020-03-09 21:11:48 +01:00
parent b4fef81706
commit 7b8f2699e3
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
From 1bd45bffe8d3ae9c4b67794f60b2ac31e360002c Mon Sep 17 00:00:00 2001
From d9c138fbfa962b5aafcc8b5387882523bab251dc Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 22:21:14 +0100
Subject: [PATCH] Add GameProfileLookupEvent
@ -40,7 +40,7 @@ index ca897873..3f97b2be 100644
<artifactId>fastutil</artifactId>
diff --git a/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java b/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java
new file mode 100644
index 00000000..82ffe5a5
index 00000000..4ab5fd19
--- /dev/null
+++ b/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java
@@ -0,0 +1,45 @@
@ -59,8 +59,8 @@ index 00000000..82ffe5a5
+ private final UUID uuid;
+ private final String name;
+
+ public GameProfileLookupEvent(UUID uuid, String name) {
+ super(true);
+ public GameProfileLookupEvent(boolean async, UUID uuid, String name) {
+ super(async);
+ this.uuid = uuid;
+ this.name = name;
+ }

View File

@ -1,4 +1,4 @@
From 290c5a49d9a5f4d38e0cd8e227a042a053fa472e Mon Sep 17 00:00:00 2001
From 8005dcac9b78f662be51bc0734b9d334a15d5a5a Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 20:47:06 +0100
Subject: [PATCH] Add MainThreadHandler to allow custom "MainThreads"

View File

@ -1,4 +1,4 @@
From 34ab733aef834e541424baa5e8b985d71be880f4 Mon Sep 17 00:00:00 2001
From 08c19476a6b5359ebc6fe21668c9a9dbb38e01c6 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 22:22:02 +0100
Subject: [PATCH] Add GameProfileLookupEvent
@ -9,7 +9,7 @@ Subject: [PATCH] Add GameProfileLookupEvent
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
index b151a13c..502f8a20 100644
index b151a13c1..9eacb3c43 100644
--- 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;
@ -34,7 +34,7 @@ index b151a13c..502f8a20 100644
- this.profile = result;
- }
+ // YAPFA start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(profile.getId(), profile.getName());
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!de.tr7zw.yapfa.MainThreadHandler.isMainThread(Thread.currentThread()), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ this.profile = event.getGameProfile();
@ -49,7 +49,7 @@ index b151a13c..502f8a20 100644
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
index 0882d82c..270533c2 100644
index 0882d82ce..8ed2c09ad 100644
--- 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;
@ -73,7 +73,7 @@ index 0882d82c..270533c2 100644
{
- profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
+ // YAPFA start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(profile.getId(), profile.getName());
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!de.tr7zw.yapfa.MainThreadHandler.isMainThread(Thread.currentThread()), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ profile = event.getGameProfile();