mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Fix Advancement#getDisplay() api break (#8541)
This commit is contained in:
parent
bf532ab0fb
commit
2f0e0c5f2b
3 changed files with 45 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: syldium <syldium@mailo.com>
|
||||
Date: Fri, 9 Jul 2021 18:49:40 +0200
|
||||
Subject: [PATCH] Add advancement display API
|
||||
Subject: [PATCH] Add more advancement API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java
|
|
@ -1,7 +1,7 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: syldium <syldium@mailo.com>
|
||||
Date: Fri, 9 Jul 2021 18:50:40 +0200
|
||||
Subject: [PATCH] Add advancement display API
|
||||
Subject: [PATCH] Add more advancement API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/PaperAdvancementDisplay.java
|
||||
|
@ -102,6 +102,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return this.handle.getDisplay() == null ? null : this.handle.getDisplay().paper;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse
|
||||
+ public AdvancementDisplay getDisplay0() { // May be called by plugins via Commodore
|
||||
+ return this.handle.getDisplay() == null ? null : new CraftAdvancementDisplay(this.handle.getDisplay());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.advancement.Advancement getParent() {
|
||||
+ return this.handle.getParent() == null ? null : this.handle.getParent().bukkit;
|
||||
|
@ -127,6 +132,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
+@Deprecated // Paper
|
||||
public class CraftAdvancementDisplay implements org.bukkit.advancement.AdvancementDisplay {
|
||||
|
||||
private final DisplayInfo handle;
|
||||
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
|
||||
) );
|
||||
|
||||
// Paper start - Plugin rewrites
|
||||
+ private static final String CB_PACKAGE = org.bukkit.Bukkit.getServer().getClass().getPackageName().replace('.', '/');
|
||||
private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
|
||||
private static final java.util.jar.Manifest manifest = io.papermc.paper.util.JarManifests.manifest(Commodore.class);
|
||||
private static Map<String, String> initReplacementsMap()
|
||||
@@ -0,0 +0,0 @@ public class Commodore
|
||||
{
|
||||
desc = getOriginalOrRewrite(desc);
|
||||
}
|
||||
+ 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.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE + "/advancement/CraftAdvancement", "getDisplay0", desc, false);
|
||||
+ 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
|
|
@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- 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
|
||||
{
|
||||
desc = getOriginalOrRewrite(desc);
|
||||
super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE + "/advancement/CraftAdvancement", "getDisplay0", desc, false);
|
||||
return;
|
||||
}
|
||||
+ if (owner.equals("org/bukkit/WorldCreator") && name.equals("keepSpawnLoaded") && desc.equals("(Lnet/kyori/adventure/util/TriState;)V")) {
|
||||
+ super.visitMethodInsn(opcode, owner, name, "(Lnet/kyori/adventure/util/TriState;)Lorg/bukkit/WorldCreator;", itf);
|
||||
|
|
Loading…
Reference in a new issue