FancyMcPlugins / FancyHolograms

FancyHolograms is a simple, lightweight and fast hologram plugin using display entities
https://modrinth.com/plugin/fancyholograms
MIT License
93 stars 29 forks source link

Error for spigot users. #80

Closed lorentedford closed 5 months ago

lorentedford commented 5 months ago

Here is a console error I got while loading up this plugin for my spigot servers. at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:88) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 8 more Caused by: java.lang.NoClassDefFoundError: io/papermc/paper/plugin/configuration/PluginMeta at de.oliver.fancylib.serverSoftware.ServerSoftware.isFolia(ServerSoftware.java:15) ~[?:?] at de.oliver.fancyholograms.FancyHolograms.<init>(FancyHolograms.java:52) ~[?:?] at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?] at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:88) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 8 more Caused by: java.lang.ClassNotFoundException: io.papermc.paper.plugin.configuration.PluginMeta at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:160) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:112) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?] at de.oliver.fancylib.serverSoftware.ServerSoftware.isFolia(ServerSoftware.java:15) ~[?:?] at de.oliver.fancyholograms.FancyHolograms.<init>(FancyHolograms.java:52) ~[?:?] at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?] at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:88) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?] ... 8 more

Plugin was downloaded at https://www.spigotmc.org/resources/fancy-holograms-text-items-blocks.108694/ Plugin file was named: FancyHolograms-2.0.6.jar

This is the first time running this plugin.

Minecraft Server information: image

OliverSchlueter commented 5 months ago

Hi, could you try to use Paper instead of Spigot?

lorentedford commented 5 months ago

Hi, could you try to use Paper instead of Spigot?

Unfortunately, no I can not.. This server has been online for 5 years was looking for a spigot plug in capable of 1.20.4

JasonHorkles commented 5 months ago

Paper is a drop in replacement for spigot and there's no reason to keep using spigot these days

lorentedford commented 5 months ago

Then why advertise this plugin in Spigot? This can't be fixed??

lorentedford commented 5 months ago

I am terrible at coding but just a quick google and copilot search and I got this.. I hope this helps your development team with this plugin.

To update the build.gradle.kts file of your plugin to work with Spigot 1.20.4, you'll need to make sure that you're using the correct dependencies for that version of Spigot. Here's a general guide on how to update your build.gradle.kts:

  1. Update the Spigot API Version: Ensure that the Spigot API version in your build.gradle.kts file matches the version of Spigot you are targeting, which in this case is 1.20.4.

  2. Check for the Latest Repository: Verify that you are using the latest Maven repository URLs for Spigot. As of my last update, the SpigotMC Maven repository URL was https://hub.spigotmc.org/nexus/content/repositories/snapshots/.

  3. Add Dependencies: Include the necessary dependencies for Spigot 1.20.4 in your build.gradle.kts file.

Here's an example of what your build.gradle.kts might look like after the update:

repositories {
    maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
    // Other repositories if needed
}

dependencies {
    compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
    // Other dependencies
}

Make sure to replace the version number with the exact version string for Spigot 1.20.4 once it's available. If you're unsure about the exact version string, you can check the SpigotMC Maven repository¹².

  1. Test Your Plugin: After making changes, compile your plugin and test it on a server running Spigot 1.20.4 to ensure compatibility.

  2. Resolve Any Issues: If you encounter any errors during compilation or runtime, check the Spigot API changes for version 1.20.4 and update your code accordingly.

Remember, the exact version string for the Spigot API dependency may vary, and you should verify it against the official SpigotMC Maven repository or other official Spigot resources¹². If you need further assistance, consider reaching out to the Spigot community or forums for help with specific issues related to plugin development for version 1.20.4.

Source: Conversation with Bing, 4/12/2024 (1) Spigot Gradle | SpigotMC - High Performance Minecraft. https://www.spigotmc.org/wiki/spigot-gradle/. (2) [1.17-1.20.4] LagFixer ⚡️ Best Performance Solution! ⭕ ... - SpigotMC. https://www.spigotmc.org/resources/1-17-1-20-4-lagfixer-%E2%9A%A1%EF%B8%8F-best-performance-solution-%E2%AD%95-well-optimized-%E2%9C%85-folia-supported.111684/. (3) UltraRepair ~ Advanced Item Repairing | SpigotMC - High Performance .... https://www.spigotmc.org/resources/ultrarepair-advanced-item-repairing.63035/. (4) LagFixer Plugin (1.20.4, 1.19.4) – Spigot - 9Minecraft.Net. https://www.9minecraft.net/lagfixer-plugin/. (5) WorldEdit Plugin (1.20.4, 1.19.4) – Bukkit, Spigot, Paper - 9Minecraft. https://www.9minecraft.net/world-edit-plugin/. (6) Overview - Console Spam Fix - Bukkit Plugins - Projects - Bukkit. https://dev.bukkit.org/projects/console-spam-fix. (7) undefined. https://discord.gg/CFmzJjgZdu. (8) undefined. https://github.com/Demeng7215/UltraRepair. (9) undefined. https://paypal.me/demengc. (10) undefined. https://github.com/Demeng7215/UltraRepair/blob/master/src/main/resources/settings.yml. (11) undefined. https://github.com/Demeng7215/UltraRepair/blob/master/src/main/resources/. (12) undefined. https://github.com/Demeng7215/UltraRepair/blob/master/src/main/resources/menus.yml. (13) How to know about new versions for the plugins in project build.gradle.kts?. https://stackoverflow.com/questions/77972935/how-to-know-about-new-versions-for-the-plugins-in-project-build-gradle-kts. (14) BuildTools | SpigotMC - High Performance Minecraft. https://www.spigotmc.org/wiki/buildtools/. (15) Downloading > spigot-1.20.4.jar - Get Bukkit. https://getbukkit.org/get/272245e4f948b0a66b0b4c34dfa27c49. (16) undefined. https://hub.spigotmc.org/nexus/. (17) undefined. https://hub.spigotmc.org/nexus/content/repositories/snapshots/. (18) undefined. https://oss.sonatype.org/content/repositories/snapshots. (19) undefined. https://oss.sonatype.org/content/repositories/central. (20) undefined. https://github.com/dependency-check/dependency-check-gradle. (21) undefined. https://mvnrepository.com/artifact/org.jetbrains.kotlin.android/org.jetbrains.kotlin.android.gradle.plugin.

The error java.lang.NoClassDefFoundError: io/papermc/paper/plugin/configuration/PluginMeta indicates that the class PluginMeta from the PaperMC library is not found at runtime, even though it may be present during the compile time. This can happen if the class is not included in the plugin's JAR file when it's built, or if the classpath is not set correctly when running the plugin.

Here are some steps to fix this issue:

  1. Ensure Dependency Inclusion: If you're using Maven or Gradle, make sure that the PaperMC dependency is included in your pom.xml or build.gradle file and that it's scoped correctly. It should not be set to provided unless you're certain that the PaperMC API is provided by the server at runtime.

  2. Shade the Dependency: If the dependency is not provided by the server, you may need to "shade" the dependency into your plugin's JAR file. This process includes the dependency classes directly within your JAR file. For Gradle, you can use the Shadow plugin³, and for Maven, you can use the Maven Shade Plugin⁴.

  3. Check for Server Software: Ensure that the server software you're running (Spigot, Paper, etc.) includes the PluginMeta class. If you're developing for Paper specifically, the server must be running Paper, not just Spigot.

  4. Update Your Build Tool: Make sure you're using the latest version of your build tool (Maven or Gradle) and that all plugins are up to date.

  5. Clean and Rebuild: Sometimes, simply cleaning the project and rebuilding the JAR file can resolve classpath issues.

  6. Review PluginClassLoader: If the issue persists, review the PluginClassLoader code and ensure that it's loading classes correctly.

  7. Seek Community Help: If you're still stuck, consider seeking help from the Spigot community, as they may have specific advice for your situation¹².

Remember to test your plugin thoroughly after making these changes to ensure that the issue is resolved and that no new issues have been introduced.

Source: Conversation with Bing, 4/12/2024 (1) java - NoClassDefFoundError on Spigot plugin trying to include Apache .... https://stackoverflow.com/questions/60356566/noclassdeffounderror-on-spigot-plugin-trying-to-include-apache-commons-text. (2) java - NoClassDefFoundError on Maven dependency - Stack Overflow. https://stackoverflow.com/questions/10568275/noclassdeffounderror-on-maven-dependency. (3) Solved NoClassDefFoundError and ClassNotFoundException - SpigotMC. https://www.spigotmc.org/threads/noclassdeffounderror-and-classnotfoundexception.544350/. (4) Solved NoClassDefFoundError and ClassNotFoundException - SpigotMC. https://www.spigotmc.org/threads/noclassdeffounderror-and-classnotfoundexception.[3](https://www.spigotmc.org/threads/noclassdeffounderror-and-classnotfoundexception.544350/)56[4](https://www.spigotmc.org/threads/noclassdeffounderror-and-classnotfoundexception.356478/)78/. (5) java.lang.NoClassDefFoundError: com/mongodb/XXXXXX Can't fix it! (Using .... https://stackoverflow.com/questions/37849127/java-lang-noclassdeffounderror-com-mongodb-xxxxxx-cant-fix-it-using-mongodb. (6) undefined. https://imperceptiblethoughts.com/shadow/getting-started/.

JasonHorkles commented 5 months ago

Paper has API methods that spigot doesn't have. Just use paper

OliverSchlueter commented 5 months ago

Thank you for your research, but FancyHolograms will not support Spigot in the near future. You need to use Paper or a fork of it. The Paper API offers so many benefits, I don't want to miss.