Paper/patches/api/0091-Player.setPlayerProfile-API.patch
Nassim Jahnke fb2c24b36d
Updated Upstream (Bukkit/CraftBukkit) (#8015)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
05ae036c PR-746: Add option to use cached map color palette
57849c1b PR-759: Add preview chat option in ServerListPingEvent
0169e65d PR-758: Add missing server properties methods from 1.19

CraftBukkit Changes:
622dbe6c2 SPIGOT-7068: SKULK and SKULK_VEIN BlockSpreadEvents Still do not reference the correct source (SKULK_CATALYST)
6c61b73f3 PR-1052: Add option to use cached map color palette
c882f38ea SPIGOT-7066: Fix custom END worlds not generating DragonBattle
6866aab59 SPIGOT-2420: Can't set exp drops for EnderDragon death
9dcd46530 PR-1067: Add preview chat option in ServerListPingEvent
36c2681af PR-1066: Add missing server properties methods from 1.19
031eaadd0 Increase outdated build delay
8fda4b12f SPIGOT-7060: SCULK and SCULK_VEIN BlockSpreadEvents do not reference the correct source
2022-06-20 19:12:05 +02:00

129 lines
5.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 18 Mar 2018 12:28:55 -0400
Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9368087971288f45056ac16a8087f8c2a7df462f..9d093f2393f2657e16c205b6b8e67c8e4c19bddc 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1196,8 +1196,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
+ * @deprecated use {@link #createProfile(UUID, String)}
*/
@NotNull
+ @Deprecated // Paper
public static PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name) {
return server.createPlayerProfile(uniqueId, name);
}
@@ -1208,8 +1210,10 @@ public final class Bukkit {
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
+ * @deprecated use {@link #createProfile(UUID)}
*/
@NotNull
+ @Deprecated // Paper
public static PlayerProfile createPlayerProfile(@NotNull UUID uniqueId) {
return server.createPlayerProfile(uniqueId);
}
@@ -1221,8 +1225,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank
+ * @deprecated use {@link #createProfile(String)}
*/
@NotNull
+ @Deprecated // Paper
public static PlayerProfile createPlayerProfile(@NotNull String name) {
return server.createPlayerProfile(name);
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 29196330f4fd875d7c0183e13e484d3c9925db0b..a46cb6762b6c88611642625a38230d6cec363a1a 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1014,8 +1014,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
+ * @deprecated use {@link #createProfile(UUID, String)}
*/
@NotNull
+ @Deprecated // Paper
PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name);
/**
@@ -1024,8 +1026,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
+ * @deprecated use {@link #createProfile(UUID)}
*/
@NotNull
+ @Deprecated // Paper
PlayerProfile createPlayerProfile(@NotNull UUID uniqueId);
/**
@@ -1035,8 +1039,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank
+ * @deprecated use {@link #createProfile(String)}
*/
@NotNull
+ @Deprecated
PlayerProfile createPlayerProfile(@NotNull String name);
/**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 33c83abbdca9fa6e5d29e8d79221682dc1218687..a329feec55b85fee5348b34ec2789698bafe3c9b 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2284,6 +2284,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
*/
boolean hasResourcePack();
+
+ /**
+ * Gets a copy of this players profile
+ * @return The players profile object
+ */
+ @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile();
+
+ /**
+ * Changes the PlayerProfile for this player. This will cause this player
+ * to be reregistered to all clients that can currently see this player
+ * @param profile The new profile to use
+ */
+ void setPlayerProfile(@NotNull com.destroystokyo.paper.profile.PlayerProfile profile);
// Paper end
// Spigot start
diff --git a/src/main/java/org/bukkit/profile/PlayerProfile.java b/src/main/java/org/bukkit/profile/PlayerProfile.java
index 16ae1282f3178e8873483a25a5d5cce16b2c21a9..c4aa20fbb0865a0b43ece475ee115ad6a7c65a48 100644
--- a/src/main/java/org/bukkit/profile/PlayerProfile.java
+++ b/src/main/java/org/bukkit/profile/PlayerProfile.java
@@ -16,7 +16,9 @@ import org.jetbrains.annotations.Nullable;
* <p>
* New profiles can be created via
* {@link Server#createPlayerProfile(UUID, String)}.
+ * @deprecated see {@link com.destroystokyo.paper.profile.PlayerProfile}
*/
+@Deprecated // Paper
public interface PlayerProfile extends Cloneable, ConfigurationSerializable {
/**
@@ -25,6 +27,7 @@ public interface PlayerProfile extends Cloneable, ConfigurationSerializable {
* @return the player's unique id, or <code>null</code> if not available
*/
@Nullable
+ @Deprecated // Paper
UUID getUniqueId();
/**