aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0736-Mitigate-effects-of-WorldCreator-keepSpawnLoaded-ret.patch
blob: fb6e8b07ea789ec7c21294aa1ee481920d187a65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 19 Sep 2022 00:13:02 +0100
Subject: [PATCH] Mitigate effects of WorldCreator#keepSpawnLoaded ret type
 change

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 63d4ffe93a445abf3c766d4f1f8fbf4a412a2a03..419b899f0e65b9656432513b69f60150c75bd13f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -458,6 +458,12 @@ public class Commodore {
                             super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, runtimeCbPkgPrefix() + "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);
+                            // new method has a return, so, make sure we pop it
+                            super.visitInsn(Opcodes.POP);
+                            return;
+                        }
                         // Paper end
 
                         // Paper start - ItemFactory#getSpawnEgg (paper had original method that returned ItemStack, upstream added identical but returned Material)