我正在制作一个spigot插件,并在onDisable函数(服务器关闭时调用)中让它保存我的数据。问题是,当它由于某种原因禁用时,它找不到我用来保存数据的类(ObjectWriter)。
然而,如下面的截图所示,类是非常有和非常存在,这也可以证明的事实,我可以保存它正常,它的工作刚刚好。它是只有当插件禁用,我有这个问题。
我已经试着修复这个问题几个月了。是的,我试着运行mvn clean
。是的,我试着删除依赖jar以防它损坏。自从我遇到这个问题后,我已经搜索了所以,并尝试了每一个. single. post。没有一个工作。我不认为这是一个问题与maven比它是一个问题与依赖关闭之前的插件完成,因为有时候它确实工作了,但却没有出错。这让我非常困惑,我不知道该怎么办。
下面是我的pom.xml,如果有人想查看它:
<?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>com.uhmily</groupId>
<artifactId>scovilleplugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ScovillePlugin</name>
<description>The Main Plugin for the Scoville Parkour Server</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.nms.path>C:/Users/depia/Documents/My_Stuff/Programs/Minecraft/spigot-1.12.jar</project.nms.path>
<project.mainClass>ScovillePlugin</project.mainClass>
<jackson.version>2.13.1</jackson.version>
</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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.1-SNAPSHOT</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<!-- <include>com.fasterxml.jackson.core:jackson-databind</include>
<include>com.fasterxml.jackson.core:jackson-core</include>
<include>com.fasterxml.jackson.core:jackson-annotations</include> -->
<include>com.fasterxml.jackson.*:*</include>
<include>de.tr7zw:*</include>
</includes>
</artifactSet>
<relocations>
<!-- <relocation>
<pattern>com.fasterxml.jackson.core</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shaded.com.fasterxml.jackson.core</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml.jackson.databind</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shaded.com.fasterxml.jackson.databind</shadedPattern> -->
<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shaded.com.fasterxml.jackson</shadedPattern>
</relocation>
<relocation>
<pattern>de.tr7zw.changeme.nbtapi</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.shaded.de.tr7zw.changeme.nbtapi</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>module-info.class</exclude>
<exclude>LICENSE</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${project.groupId}.${project.artifactId}.${project.mainClass}</Main-Class>
<Build-Number>${project.version}</Build-Number>
</manifestEntries>
</transformer>
</transformers>
</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>enginehub</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>plotsquared</id>
<url>https://plotsquared.com/mvn/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
<layout>default</layout>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-snapshot</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.minecraft</groupId>
<artifactId>server</artifactId>
<version>v1.12</version>
<scope>system</scope>
<systemPath>${project.nms.path}</systemPath>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-api</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-legacy</artifactId>
<version>6.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.luckperms</groupId>
<artifactId>api</artifactId>
<version>5.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
1条答案
按热度按时间6tdlim6h1#
我发现由于this post,当你在关闭服务器之前替换jar文件时会发生这种情况。这可以解释我所遇到的所有行为。