Add test plugin to verify functionality
I have created this basic test plugin because of #184, so I could verify that AnvilGUI actually works on 1.18.1.
I have also added basic argument parsing to change the calls made on the AnvilGUI.Builder.
I think I have relocated the dependency , but only received error report when I used it. Here are my error report and pom.xml . Could you help me find what's wrong? pom.zip
[17:14:24 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'towname' in plugin NameCard v2.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:git-Paper-788]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[server.jar:git-Paper-788]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:826) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2185) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1953) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:7) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1266) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1259) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1220) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1134) ~[server.jar:git-Paper-788]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[server.jar:git-Paper-788]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoClassDefFoundError: net/wesjd/anvilgui/AnvilGUI$Builder
at xanadu.namecard.commands.anvilgui.onCommand(anvilgui.java:21) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:git-Paper-788]
... 19 more
Just for your information: You just commented on a pull request. If you have problems you should create a new issue instead.
To solve your problem this should suffice (click this)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xanadu</groupId>
<artifactId>NameCard</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>NameCard</name>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<!--<plugin> You had accidentally added the configuration for the maven shade plugin twice
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>net.wesjd.anvilgui</pattern>
<shadedPattern>xanadu.namecard.commands.anvilgui</shadedPattern>
</relocation>
</relocations>
<minimizeJar>false</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.5.3-SNAPSHOT</version>
<scope>compile</scope> <!-- I also recommend explicitly adding the scope "compile" so that the Maven shade plugin knows it should go into the final JAR -->
</dependency>
</dependencies>
</project>
While this would be a nice addition, it is another point of maintenance and something that can be easily whipped up for testing when developing.
Ultimately, it would be nice to have actual unit tests in this project, so that we could have a common set of truths to work around. That's a larger goal though.