Hi, When I start a Velocity server with my plugin, it gives the following error:
Here is the main class and pom.xml for my plugin:
Code:
[17:20:47 ERROR]: Unable to load plugin plugins\dataplugin-1.0.0.jar
com.velocitypowered.api.plugin.InvalidPluginException: Did not find a valid velocity-plugin.json.
at com.velocitypowered.proxy.plugin.loader.java.JavaPluginLoader.loadCandidate(JavaPluginLoader.java:65) ~[velocity.jar:3.4.0-SNAPSHOT (git-9cfcfcf2-b451)]
at com.velocitypowered.proxy.plugin.VelocityPluginManager.loadPlugins(VelocityPluginManager.java:101) ~[velocity.jar:3.4.0-SNAPSHOT (git-9cfcfcf2-b451)]
at com.velocitypowered.proxy.VelocityServer.loadPlugins(VelocityServer.java:418) ~[velocity.jar:3.4.0-SNAPSHOT (git-9cfcfcf2-b451)]
at com.velocitypowered.proxy.VelocityServer.start(VelocityServer.java:289) ~[velocity.jar:3.4.0-SNAPSHOT (git-9cfcfcf2-b451)]
at com.velocitypowered.proxy.Velocity.main(Velocity.java:71) ~[velocity.jar:3.4.0-SNAPSHOT (git-9cfcfcf2-b451)]
Here is the main class and pom.xml for my plugin:
Java:
package com.spektrsoyuz.data;
import com.google.inject.Inject;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.yaml.NodeStyle;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.sql.SQLException;
@Plugin(
id = "dataplugin",
name = "Data Plugin",
version = "1.0.0",
description = "A velocity plugin",
authors = {"SpektrSoyuz"}
)
public class DataPlugin {
private static DataPlugin instance;
private final ProxyServer server;
private final Logger logger;
private final Path dataFolder;
private final VelocityConfig config;
@Inject
public DataPlugin(ProxyServer server, Logger logger, Path dataFolder) {
instance = this;
this.server = server;
this.logger = logger;
this.dataFolder = dataFolder;
}
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
this.logger.info("{} {} has been enabled!", this.getClass().getAnnotation(Plugin.class).name(), this.getClass().getAnnotation(Plugin.class).version());
}
@Subscribe
public void onProxyShutdown(ProxyShutdownEvent event) {
this.logger.info("{} {} has been disabled!", this.getClass().getAnnotation(Plugin.class).name(), this.getClass().getAnnotation(Plugin.class).version());
}
public @NotNull ProxyServer getServer() {
return this.server;
}
public static DataPlugin getInstance() {
return instance;
}
}
XML:
<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.spektrsoyuz</groupId>
<artifactId>dataplugin</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<main.class>com.spektrsoyuz.data.DataPlugin</main.class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>3.4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>6.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>9.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
- Version Output
- Velocity 3.4.0-SNAPSHOT (git-9cfcfcf2-b451)
Last edited: