如何解决如何修复异常的插件类型?
嗨,所以我在运行服务器专业版spigot服务器时收到此错误
[ERROR] Could not load 'plugins/max.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:80) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at org.bukkit.craftbukkit.v1_16_R2.CraftServer.loadPlugins(CraftServer.java:381) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:186) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:808) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.InstantiationException: me.goldk.max.Main
at java.lang.Class.newInstance(Class.java:427) ~[?:1.8.0_212]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
... 8 more
Caused by: java.lang.NoSuchMethodException: me.goldk.max.Main.<init>()
at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_212]
at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_212]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.2.jar:git-Spigot-b5a13e6-0491200]
我想知道如何解决它,这是我的代码:
package me.goldk.max;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.Random;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;
public class Main extends JavaPlugin implements Listener {
public Main (Main plugin) {
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = (Player) event.getPlayer();
Random rand = new Random();
int chance = 1;
if (chance == 0)
{
player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,60,1));
}
else if (chance == 1)
{
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1));
}
return;
}
}
如果可以的话,请帮助我。
解决方法
您必须删除构造函数。如果您在其中执行了某些操作,请改用onEnable
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。