2019-06-14 04:27:40 +02:00
|
|
|
From 67526168597faba34192685d6062a1b33eb6f724 Mon Sep 17 00:00:00 2001
|
2018-01-19 06:55:38 +01:00
|
|
|
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
|
|
|
|
|
2018-05-11 05:01:52 +02:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
|
2019-06-06 17:36:57 +02:00
|
|
|
index 4b2a67423f..61cfdf73c8 100644
|
2018-05-11 05:01:52 +02:00
|
|
|
--- 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;
|
|
|
|
|
2018-01-19 06:55:38 +01:00
|
|
|
+import com.destroystokyo.paper.event.profile.FillProfileEvent;
|
|
|
|
+import com.destroystokyo.paper.event.profile.PreFillProfileEvent;
|
2018-05-11 05:01:52 +02:00
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
|
|
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
2018-11-09 00:50:17 +01:00
|
|
|
@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
|
2018-05-11 05:01:52 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
|
|
|
|
- return super.fillProfileProperties(profile, requireSecure);
|
2018-11-09 00:50:17 +01:00
|
|
|
+ CraftPlayerProfile playerProfile = (CraftPlayerProfile) CraftPlayerProfile.asBukkitMirror(profile);
|
|
|
|
+ new PreFillProfileEvent(playerProfile).callEvent();
|
|
|
|
+ profile = playerProfile.getGameProfile();
|
2018-01-29 01:40:19 +01:00
|
|
|
+ if (profile.isComplete() && profile.getProperties().containsKey("textures")) {
|
2018-01-19 06:55:38 +01:00
|
|
|
+ return profile;
|
|
|
|
+ }
|
2018-05-11 05:01:52 +02:00
|
|
|
+ GameProfile gameProfile = super.fillProfileProperties(profile, requireSecure);
|
2018-01-19 06:55:38 +01:00
|
|
|
+ new FillProfileEvent(CraftPlayerProfile.asBukkitMirror(gameProfile)).callEvent();
|
|
|
|
+ return gameProfile;
|
2018-05-11 05:01:52 +02:00
|
|
|
}
|
2018-01-19 06:55:38 +01:00
|
|
|
|
2018-05-11 05:01:52 +02:00
|
|
|
@Override
|
2018-01-19 06:55:38 +01:00
|
|
|
--
|
2019-03-20 02:46:00 +01:00
|
|
|
2.21.0
|
2018-01-19 06:55:38 +01:00
|
|
|
|