From 31c7c4ead629bdb51226e358ed6be48b89477cc8 Mon Sep 17 00:00:00 2001 From: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com> Date: Sat, 20 Jan 2024 15:10:17 -0600 Subject: [PATCH 1/2] Make SlimefunItem#getOptionalByItem static like intended (#4098) --- .../github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java index 28dc680ff14..6400d8b925e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java @@ -1199,7 +1199,7 @@ public final int hashCode() { * The {@link ItemStack} to check * @return The {@link Optional} {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise empty */ - public @Nonnull Optional getOptionalByItem(@Nullable ItemStack item) { + public static @Nonnull Optional getOptionalByItem(@Nullable ItemStack item) { return Optional.ofNullable(getByItem(item)); } } From cd3672c3f29dcb9d02d02cd1c80758c3badb6931 Mon Sep 17 00:00:00 2001 From: ybw0014 Date: Sun, 21 Jan 2024 09:49:07 -0500 Subject: [PATCH 2/2] fix: fix spawn in ArmorStandUtils (#4109) --- .../thebusybiscuit/slimefun4/utils/ArmorStandUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java index 5635a040c2c..e2cf5ae10f4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java @@ -21,6 +21,8 @@ */ public class ArmorStandUtils { + private ArmorStandUtils() {} + /** * Spawns an {@link ArmorStand} at the given {@link Location} with the given custom name *
@@ -51,15 +53,14 @@ public class ArmorStandUtils { // The consumer method was moved from World to RegionAccessor in 1.20.2 // Due to this, we need to use a rubbish workaround to support 1.20.1 and below // This causes flicker on these versions which sucks but not sure a better way around this right now. - if (PaperLib.getMinecraftVersion() <= 20 - && PaperLib.getMinecraftPatchVersion() < 2 - ) { + if (PaperLib.getMinecraftVersion() < 20 || + (PaperLib.getMinecraftVersion() == 20 && PaperLib.getMinecraftPatchVersion() < 2)) { ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class); setupArmorStand(armorStand); return armorStand; } - return location.getWorld().spawn(location, ArmorStand.class, armorStand -> setupArmorStand(armorStand)); + return location.getWorld().spawn(location, ArmorStand.class, ArmorStandUtils::setupArmorStand); } private static void setupArmorStand(ArmorStand armorStand) {