From d726b5740fc8840575c958201066755f4f60e831 Mon Sep 17 00:00:00 2001 From: Pim van der Loos Date: Sun, 12 Jul 2026 13:45:14 +0200 Subject: [PATCH] Disabled fake player creator for < 1.16.5 due to a lack of Library Loader support on legacy versions - This allows us to load ByteBuddy at runtime again, reducing the filesize of the jar from 10.6MiB to 1.5MiB. The main advantage of this is that we can upload the jar to Spigot again. --- NEXT_RELEASE_CHANGELOG.md | 1 + core/pom.xml | 6 +---- .../compatibility/FakePlayerCreator.java | 26 +++++++++++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/NEXT_RELEASE_CHANGELOG.md b/NEXT_RELEASE_CHANGELOG.md index e69de29bb..7fae2a44a 100644 --- a/NEXT_RELEASE_CHANGELOG.md +++ b/NEXT_RELEASE_CHANGELOG.md @@ -0,0 +1 @@ +- Disabled fake player creator for < 1.16.5 due to a lack of Library Loader support on legacy versions. diff --git a/core/pom.xml b/core/pom.xml index e2bffe98e..9a43e587f 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -258,7 +258,7 @@ net.bytebuddy byte-buddy ${dependency.bytebuddy.version} - compile + provided @@ -408,10 +408,6 @@ com.github.Anon8281.universalScheduler nl.pim16aap2.bigDoors.lib.universalScheduler - - net.bytebuddy - nl.pim16aap2.bigDoors.lib.bytebuddy - diff --git a/core/src/main/java/nl/pim16aap2/bigDoors/compatibility/FakePlayerCreator.java b/core/src/main/java/nl/pim16aap2/bigDoors/compatibility/FakePlayerCreator.java index 89525db23..660418dbd 100644 --- a/core/src/main/java/nl/pim16aap2/bigDoors/compatibility/FakePlayerCreator.java +++ b/core/src/main/java/nl/pim16aap2/bigDoors/compatibility/FakePlayerCreator.java @@ -7,6 +7,7 @@ import javax.annotation.Nullable; import java.util.function.BiFunction; +import java.util.logging.Level; /** * Class used to create a fake-online player who is actually offline. @@ -36,9 +37,30 @@ public FakePlayerCreator(final BigDoors plugin) return new FakePlayerClassGenerator(plugin).getInstantiator(); } - catch (Exception e) + catch (Exception exception) { - new RuntimeException("Failed to create fake player constructor!", e).printStackTrace(); + BigDoors.get().getMyLogger().log( + "Failed to create fake player constructor! Checks for offline players will not work!", + exception + ); + return null; + } + catch (NoClassDefFoundError e) + { + boolean isByteBuddy = e.getMessage().startsWith("net/bytebuddy"); + if (isByteBuddy) + { + BigDoors.get().getMyLogger().logMessage( + Level.SEVERE, + "Could not find ByteBuddy classes. Either the Library Loader failed or you are on a legacy version that does not have it (<1.16.5). Checks for offline players will not work!" + ); + return null; + } + + BigDoors.get().getMyLogger().logMessage( + Level.SEVERE, + "Could not find class '" + e.getMessage() + "'. Checks for offline players will not work!" + ); return null; } }