CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
390 stars 128 forks source link

[ActionBar] - Could not initialize class (v11-beta) #258

Closed BGHDDevelopment closed 4 months ago

BGHDDevelopment commented 4 months ago

Description Hey! Testing out v11-beta and getting Could not initialize class com.bghddevelopment.utils.reflection.minecraft.MinecraftConnection (after re-location of course) when using ActionBar.sendActionBar on 1.8.8. Testing on 1.20.6 (and other recent versions), the issue does not exist and things work fine.

Version 1.8.8 - Latest PaperSpigot build.

Full error:

[22:31:23 WARN]:        at com.bghddevelopment.utils.messages.ActionBar.sendActionBar(ActionBar.java:202)
[22:31:23 WARN]:        at com.bghddevelopment.utils.messages.ActionBar$1.run(ActionBar.java:230)
[22:31:23 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59)
[22:31:23 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
[22:31:23 WARN]:        at org.github.paperspigot.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:23)
[22:31:23 WARN]:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[22:31:23 WARN]:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[22:31:23 WARN]:        at java.lang.Thread.run(Thread.java:750)

Code Example:

            if (plugin.getActionbarFile().getBoolean("ACTIONBAR.FINAL-HEAL")) {
                if (plugin.getGameManager().getGameTask() != null && plugin.getGameManager().getGameTask().getSeconds() <=
                        plugin.getNewConfigManager().getByConfig(Config.FINAL_HEAL).getAmount() * 60) {
                    String format = plugin.getActionbarFile().getString("FINAL-HEAL");
                    format = format.replace("{time}", Utilities.formatTime(plugin.getNewConfigManager().getByConfig(Config.FINAL_HEAL).getAmount() * 60
                            - plugin.getGameManager().getGameTask().getSeconds()));
                    ActionBar.sendActionBar(plugin, player, format, 20);
                }
            }
        }
CryptoMorin commented 4 months ago
  1. I need the full error. The error you gave doesn't have the full information.
  2. I need a minimum reproducible example, not one that involves your plugin configured values or any other code.
BGHDDevelopment commented 4 months ago

Sure, here is a log from the start of when we attempt to display the actionbars: https://pastebin.com/Xe5RDCGi Forgot to pull that earlier. The error just repeats after that point, happy to send the full log but I just force quit the server after.

Then, just doing this triggers the error on my end; any formatting we add in does not seem to make a difference. ActionBar.sendActionBar(plugin, player, "Test", 20); Happy to test the non-tick method tomorrow morning to see if it makes a difference.

CryptoMorin commented 4 months ago

It seems like you're excluding certain classes in your shading process? Reflection-dependent classes now need the com.cryptomorin.xseries.reflection.XReflection package too.

Oh nevermind. I found the issue. I'll fix it.

BGHDDevelopment commented 4 months ago

Thanks! Appreciate it, great work on the continued support.