mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +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()
|
private static Map<String, String> initReplacementsMap()
|
||||||
{
|
{
|
||||||
@@ -0,0 +0,0 @@ public class Commodore
|
@@ -0,0 +0,0 @@ public class Commodore
|
||||||
{
|
super.visitMethodInsn(opcode, owner, name, "()Lcom/destroystokyo/paper/profile/PlayerProfile;", itf);
|
||||||
desc = getOriginalOrRewrite(desc);
|
return;
|
||||||
}
|
}
|
||||||
+ if (owner.equals("org/bukkit/advancement/Advancement") && name.equals("getDisplay") && desc.endsWith(")Lorg/bukkit/advancement/AdvancementDisplay;")) {
|
+ if (owner.equals("org/bukkit/advancement/Advancement") && name.equals("getDisplay") && desc.endsWith(")Lorg/bukkit/advancement/AdvancementDisplay;")) {
|
||||||
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE + "/advancement/CraftAdvancement");
|
+ super.visitTypeInsn(Opcodes.CHECKCAST, CB_PACKAGE + "/advancement/CraftAdvancement");
|
||||||
|
@ -210,8 +210,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
if ( modern )
|
if ( modern )
|
||||||
|
{
|
||||||
diff --git a/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java b/src/test/java/io/papermc/paper/advancement/AdvancementFrameTest.java
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
|
|
@ -167,20 +167,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
{
|
{
|
||||||
switch ( name )
|
switch ( name )
|
||||||
@@ -0,0 +0,0 @@ public class Commodore
|
@@ -0,0 +0,0 @@ public class Commodore
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Rewrite plugins
|
// Paper start - Rewrite plugins
|
||||||
+ owner = getOriginalOrRewrite( owner) ;
|
+ owner = getOriginalOrRewrite( owner) ;
|
||||||
+ if (desc != null)
|
+ if (desc != null)
|
||||||
+ {
|
+ {
|
||||||
+ desc = getOriginalOrRewrite(desc);
|
+ desc = getOriginalOrRewrite(desc);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
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);
|
||||||
if ( modern )
|
return;
|
||||||
{
|
|
||||||
if ( owner.equals( "org/bukkit/Material" ) )
|
|
||||||
@@ -0,0 +0,0 @@ public class Commodore
|
@@ -0,0 +0,0 @@ public class Commodore
|
||||||
@Override
|
@Override
|
||||||
public void visitLdcInsn(Object value)
|
public void visitLdcInsn(Object value)
|
||||||
|
|
|
@ -21,5 +21,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
if ( modern )
|
if ( modern )
|
||||||
|
{
|
||||||
|
|
|
@ -26,6 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
||||||
playerName = gameProfile.getName();
|
playerName = gameProfile.getName();
|
||||||
uniqueId = gameProfile.getId();
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
@ -146,3 +161,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
public void onEntityRemove(Entity entity) {
|
public void onEntityRemove(Entity entity) {
|
||||||
this.hiddenEntities.remove(entity.getUUID());
|
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