gpt4 book ai didi

Java/Bukkit 插件 & Fat Jar : ClassNotFoundError

转载 作者:行者123 更新时间:2023-12-01 10:49:34 24 4
gpt4 key购买 nike

我无法加载我的 Bukkit 插件。

Caused by: java.lang.ClassNotFoundException: com.thestratagemmc.aikenbot.chat.ChatMessage
[20:40:59 WARN]: at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[20:40:59 WARN]: at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[20:40:59 WARN]: at java.security.AccessController.doPrivileged(Native Method)
[20:40:59 WARN]: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[20:40:59 WARN]: at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101)
[20:40:59 WARN]: at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86)
[20:40:59 WARN]: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[20:40:59 WARN]: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[20:40:59 WARN]: ... 17 more

现在,我知道这通常意味着该类不存在。 ChatMessage.java 不是这个项目的一部分,我将它包含在 Maven 阴影中。

但我知道它存在于我尝试加载的 jar 文件中: Proof that the jar file actually contains com/thestratagemmc/aikenbot/chat/ChatMessage

这就是 ChatMessage.java 的全部内容

package com.thestratagemmc.aikenbot.chat;

/**
* Created by axel on 11/29/15.
*/
public interface ChatMessage {
public String getSender();
public String getMessage();
public void reply(String message);
public void replySender(String message);
}

这就是它的调用方式

package com.thestratagemmc.aikenbot.providers.minecraft;

import com.dthielke.herochat.Channel;
import com.dthielke.herochat.ChannelChatEvent;
import com.thestratagemmc.aikenbot.chat.ChatMessage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

/**
* Created by axel on 11/29/15.
*/
public class MinecraftChatMessage implements ChatMessage {

public Channel channel;
public Player sender;
public String message;


public String getSender() {
return sender.getName();
}

public String getMessage() {
return message;
}

public MinecraftChatMessage(Channel channel, Player sender, String message) {
this.channel = channel;
this.sender = sender;
this.message = message;
}

public void reply(String s) {
synchronized (Bukkit.getServer()){
if (channel == null) {
sender.sendMessage(s);
}
else{
channel.sendRawMessage(ChatColor.GREEN+"["+channel.getNick()+"] "+ ChatColor.WHITE + "TSMC Bot "+ChatColor.getByChar('7')+ChatColor.ITALIC+s);
}
}

}

public void replySender(String s) {
synchronized(Bukkit.getServer()){
sender.sendMessage(s);
}
}
}

最佳答案

发现问题,我只需要重新启动服务器...我尝试使用/plugman reload 加载插件。

关于Java/Bukkit 插件 & Fat Jar : ClassNotFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33990571/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com