问题描述
问题是当我将 jar 文件放入 plugins 文件夹并运行服务器时,我总是从控制台收到此消息:
Enabled plugin FirstCommand version 1.0-SNAPSHOT by null
我的代码由 2 个类组成:
public final class FirstCommand extends Plugin {
@Override
public void onEnable() {
// Plugin startup logic
getLogger().info("has loaded");
getProxy().getPluginManager().registerCommand(this,new PingCommand());
}
@Override
public void ondisable() {
// Plugin shutdown logic
}
}
和
public class PingCommand extends Command {
public PingCommand() {
super("ping");
}
@Override
public void execute(CommandSender sender,String[] args) {
if (sender instanceof Proxiedplayer) {
Proxiedplayer player = (Proxiedplayer) sender;
int ping = player.getPing();
player.sendMessage(new TextComponent(ChatColor.GRAY + "Your ping is: " + ChatColor.GREEN + ping));
}
}
}
bungee.yml :
name: FirstCommand
version: ${project.version}
main: org.example.firstcommand.FirstCommand
解决方法
您没有说明该消息有什么问题。
消息末尾的 null
是否让您感到困扰?在 plugin.yml 中指定作者
name: FirstCommand
version: ${project.version}
author: ShashaS
main: org.example.firstcommand.FirstCommand
还是命令运行不正常?