mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
Update Commodore modifications (#8542)
* Handle ldc insn for getOriginalOrRewrite in Commodore * Remove fastutil rewrite It's no longer relocated upstream
This commit is contained in:
parent
3d15120f7e
commit
2b47227e38
@ -8,7 +8,7 @@ our own relocation. Also lets us rewrite NMS calls for when we're
|
||||
debugging in an IDE pre-relocate.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index a679133a3de51e26eb19932ece9ade292879aefd..89a32de0a3fbb7465b078b2aa1cc1d156a4a174d 100644
|
||||
index a679133a3de51e26eb19932ece9ade292879aefd..2c537a80951ddf98d3135ca19a34a238484c2d88 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -6,7 +6,9 @@ import java.io.FileOutputStream;
|
||||
@ -37,19 +37,18 @@ index a679133a3de51e26eb19932ece9ade292879aefd..89a32de0a3fbb7465b078b2aa1cc1d15
|
||||
/**
|
||||
* This file is imported from Commodore.
|
||||
*
|
||||
@@ -46,6 +53,42 @@ public class Commodore
|
||||
@@ -46,6 +53,41 @@ public class Commodore
|
||||
"org/bukkit/inventory/ItemStack (I)V setTypeId"
|
||||
) );
|
||||
|
||||
+ // Paper start - Plugin rewrites
|
||||
+ 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()
|
||||
+ {
|
||||
+ Map<String, String> getAndRemove = new HashMap<>();
|
||||
+ // Be wary of maven shade's relocations
|
||||
+ getAndRemove.put( "org/bukkit/".concat( "craftbukkit/libs/it/unimi/dsi/fastutil/" ), "org/bukkit/".concat( "craftbukkit/libs/" ) ); // Remap fastutil to our location
|
||||
+
|
||||
+ final java.util.jar.Manifest manifest = io.papermc.paper.util.JarManifests.manifest(Commodore.class);
|
||||
+ if ( Boolean.getBoolean( "debug.rewriteForIde" ) && manifest != null)
|
||||
+ {
|
||||
+ // unversion incoming calls for pre-relocate debug work
|
||||
@ -80,7 +79,7 @@ index a679133a3de51e26eb19932ece9ade292879aefd..89a32de0a3fbb7465b078b2aa1cc1d15
|
||||
public static void main(String[] args)
|
||||
{
|
||||
OptionParser parser = new OptionParser();
|
||||
@@ -130,15 +173,86 @@ public class Commodore
|
||||
@@ -130,15 +172,86 @@ public class Commodore
|
||||
|
||||
cr.accept( new ClassVisitor( Opcodes.ASM9, cw )
|
||||
{
|
||||
@ -167,7 +166,7 @@ index a679133a3de51e26eb19932ece9ade292879aefd..89a32de0a3fbb7465b078b2aa1cc1d15
|
||||
if ( owner.equals( "org/bukkit/block/Biome" ) )
|
||||
{
|
||||
switch ( name )
|
||||
@@ -306,6 +420,14 @@ public class Commodore
|
||||
@@ -306,6 +419,14 @@ public class Commodore
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,3 +181,17 @@ index a679133a3de51e26eb19932ece9ade292879aefd..89a32de0a3fbb7465b078b2aa1cc1d15
|
||||
if ( modern )
|
||||
{
|
||||
if ( owner.equals( "org/bukkit/Material" ) )
|
||||
@@ -395,6 +516,13 @@ public class Commodore
|
||||
@Override
|
||||
public void visitLdcInsn(Object value)
|
||||
{
|
||||
+ // Paper start
|
||||
+ if (value instanceof Type type) {
|
||||
+ if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
|
||||
+ value = Type.getType(getOriginalOrRewrite(type.getDescriptor()));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
if ( value instanceof String && ( (String) value ).equals( "com.mysql.jdbc.Driver" ) )
|
||||
{
|
||||
super.visitLdcInsn( "com.mysql.cj.jdbc.Driver" );
|
||||
|
@ -50,10 +50,10 @@ index e2d3fe9af7d3bd82bee519b20e141cd58f68bbd6..944a4fee237730c0d89567aaa6ddf268
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index 89a32de0a3fbb7465b078b2aa1cc1d156a4a174d..27646d963bd1158f3fe0a9c0593a312404f0e7b0 100644
|
||||
index 2c537a80951ddf98d3135ca19a34a238484c2d88..cf73d333ae625ea1bdc32d5f79daf408937bb13b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -252,6 +252,14 @@ public class Commodore
|
||||
@@ -251,6 +251,14 @@ public class Commodore
|
||||
desc = getOriginalOrRewrite( desc );
|
||||
}
|
||||
// Paper end
|
||||
|
@ -145,7 +145,7 @@ index 4aa8cda2bf72627b153e636a408fb3971caf2309..e29d7c6e1cef10a76c8630855fada11c
|
||||
|
||||
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 27646d963bd1158f3fe0a9c0593a312404f0e7b0..e5259280c31d0ba6cfef527f9ac1ebd55a9ae859 100644
|
||||
index cf73d333ae625ea1bdc32d5f79daf408937bb13b..6fdecd4bed469fffc04d37e3563fb9c7c393761b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -54,6 +54,7 @@ public class Commodore
|
||||
@ -154,9 +154,9 @@ index 27646d963bd1158f3fe0a9c0593a312404f0e7b0..e5259280c31d0ba6cfef527f9ac1ebd5
|
||||
// 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()
|
||||
@@ -434,6 +435,11 @@ public class Commodore
|
||||
{
|
||||
@@ -433,6 +434,11 @@ public class Commodore
|
||||
{
|
||||
desc = getOriginalOrRewrite(desc);
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ Subject: [PATCH] Mitigate effects of WorldCreator#keepSpawnLoaded ret type
|
||||
TODO: Remove in 1.21?
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
index e5259280c31d0ba6cfef527f9ac1ebd55a9ae859..aa4ba0e42387f9381df2938769ee72bde8e9f9ba 100644
|
||||
index 6fdecd4bed469fffc04d37e3563fb9c7c393761b..1ea5be29f3f06042d7cc278ce82790e4e439a81f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||
@@ -440,6 +440,12 @@ public class Commodore
|
||||
@@ -439,6 +439,12 @@ public class Commodore
|
||||
super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CB_PACKAGE + "/advancement/CraftAdvancement", "getDisplay0", desc, false);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user