Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
390f9bb913
This improves plugins like Citizens that rely on direct instance of Yggdrasil implementations. Instead of wrapping, directly extend and override the methods. Went ahead and wrapped all of the services in prep in the base patch, then features modify what they need
43 Zeilen
1.9 KiB
Diff
43 Zeilen
1.9 KiB
Diff
From 778f0a583f0d95f233434b8eef9e7136915455a9 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 2 Jan 2018 00:31:26 -0500
|
|
Subject: [PATCH] Fill Profile Property Events
|
|
|
|
Allows plugins to populate profile properties from local sources to avoid calls out to Mojang API
|
|
to fill in textures for example.
|
|
|
|
If Mojang API does need to be hit, event fire so you can get the results.
|
|
|
|
This is useful for implementing a ProfileCache for Player Skulls
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
|
index 4b2a67423..f83aa5ef0 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
|
@@ -1,5 +1,7 @@
|
|
package com.destroystokyo.paper.profile;
|
|
|
|
+import com.destroystokyo.paper.event.profile.FillProfileEvent;
|
|
+import com.destroystokyo.paper.event.profile.PreFillProfileEvent;
|
|
import com.mojang.authlib.GameProfile;
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
|
@@ -19,7 +21,13 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
|
|
|
|
@Override
|
|
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
|
|
- return super.fillProfileProperties(profile, requireSecure);
|
|
+ new PreFillProfileEvent(CraftPlayerProfile.asBukkitMirror(profile)).callEvent();
|
|
+ if (profile.isComplete() && profile.getProperties().containsKey("textures")) {
|
|
+ return profile;
|
|
+ }
|
|
+ GameProfile gameProfile = super.fillProfileProperties(profile, requireSecure);
|
|
+ new FillProfileEvent(CraftPlayerProfile.asBukkitMirror(gameProfile)).callEvent();
|
|
+ return gameProfile;
|
|
}
|
|
|
|
@Override
|
|
--
|
|
2.17.0
|
|
|