mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix OfflinePlayer#getPlayerProfile returning deprecated type (#8543)
This commit is contained in:
parent
d20d36a172
commit
b28618e07c
4 changed files with 40 additions and 11 deletions
|
@ -201,8 +201,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
private static Map<String, String> initReplacementsMap()
|
||||
{
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
{
|
||||
desc = getOriginalOrRewrite(desc);
|
||||
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
|
||||
return;
|
||||
}
|
||||
+ if (owner.equals("org/bukkit/advancement/Advancement") && name.equals("getDisplay") && desc.endsWith(")Lorg/bukkit/advancement/AdvancementDisplay;")) {
|
||||
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE + "/advancement/CraftAdvancement");
|
||||
|
@ -210,8 +210,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
if ( modern )
|
||||
{
|
||||
diff --git a/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
|
|
@ -167,20 +167,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
{
|
||||
switch ( name )
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Paper start - Rewrite plugins
|
||||
// Paper start - Rewrite plugins
|
||||
+ owner = getOriginalOrRewrite( owner) ;
|
||||
+ if (desc != null)
|
||||
+ {
|
||||
+ desc = getOriginalOrRewrite(desc);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if ( modern )
|
||||
{
|
||||
if ( owner.equals( "org/bukkit/Material" ) )
|
||||
if (owner.equals("org/bukkit/OfflinePlayer") && name.equals("getPlayerProfile") && desc.equals("()Lorg/bukkit/profile/PlayerProfile;")) {
|
||||
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
|
||||
return;
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
@Override
|
||||
public void visitLdcInsn(Object value)
|
||||
|
|
|
@ -21,5 +21,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
if ( modern )
|
||||
{
|
||||
|
|
|
@ -26,6 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
||||
playerName = gameProfile.getName();
|
||||
uniqueId = gameProfile.getId();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
}
|
||||
|
||||
@Override
|
||||
- public PlayerProfile getPlayerProfile() {
|
||||
- return new CraftPlayerProfile(this.profile);
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() { // Paper
|
||||
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile(this.profile); // Paper
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
|
@ -146,3 +161,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
public void onEntityRemove(Entity entity) {
|
||||
this.hiddenEntities.remove(entity.getUUID());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Paper start - Rewrite plugins
|
||||
+ if (owner.equals("org/bukkit/OfflinePlayer") && name.equals("getPlayerProfile") && desc.equals("()Lorg/bukkit/profile/PlayerProfile;")) {
|
||||
+ super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if ( modern )
|
||||
{
|
||||
if ( owner.equals( "org/bukkit/Material" ) )
|
||||
|
|
Loading…
Reference in a new issue