【问题标题】:I'm trying to create simple bungee cord command plugin我正在尝试创建简单的弹力绳命令插件
【发布时间】:2021-04-04 11:16:09
【问题描述】:

问题是当我将 jar 文件放入插件文件夹并运行服务器时,我总是从控制台收到此消息:

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

【问题讨论】:

    标签: java plugins server command bungeecord


    【解决方案1】:

    你没有说那条消息有什么问题。

    邮件末尾的null 是否困扰您?在你的 plugin.yml 中指定作者

    name: FirstCommand
    version: ${project.version}
    author: ShashaS
    main: org.example.firstcommand.FirstCommand
    

    或者命令运行不正常?

    【讨论】:

      猜你喜欢
      • 2021-10-22
      • 2014-07-25
      • 1970-01-01
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 2019-04-27
      • 1970-01-01
      • 2021-08-09
      相关资源
      最近更新 更多