无效的Bukkit命令|YML错误捕获具有有效的YML



所以我已经双重和三次检查了我的YML,并通过验证器运行它。我的插件加载良好,我可以在Main类中创建一个helloworld命令。然而,当使用第二个.java文件和第二个命令时,它会持续显示我的YML用法文本。

Main.java

package lordfluffyjr.TarrenCraft.jEssentialsX.commandSrc;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener { //Extending JavaPlugin so that Bukkit 
knows its the main class
//Housekeeping
Logger jEssentialsXLogger = Bukkit.getLogger();
@Override
public void onEnable(){//  Where plugins will be loaded.
PluginManager manager = getServer().getPluginManager();
manager.registerEvents(this, this);
Bukkit.getServer().getConsoleSender().sendMessage("jEssentialsX has been enabled!");

//Enable FAQ
manager.registerEvents(new Faq(), this);
Bukkit.getServer().getConsoleSender().sendMessage("FAQ has been enabled!");
}
@Override
public void onDisable(){//  Where plugins will be disabled.
jEssentialsXLogger.info("Test 1 has been disabled!");
jEssentialsXLogger.severe("Test 1 has an error and has not loaded.");  
}
}

Faq.java

package lordfluffyjr.TarrenCraft.jEssentialsX.commandSrc;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Listener;
public class Faq implements Listener, CommandExecutor{
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (commandLabel.equalsIgnoreCase("faq")) {
sender.sendMessage("Welcome to our FAQ!");
return true;
}
return false;
}
}

plugin.yml

main: lordfluffyjr.TarrenCraft.jEssentialsX.commandSrc.Main
name: jEssentialsX
version: 0.1
author: LordFluffyJr
api-version: 1.16
commands:
faq:
description: A list of our frequently asked questions plugin description!
usage: Syntax error! Use [/faq <topic> <page number>]

您没有将Faq类注册为命令执行器。你需要设置

Bukkit.getPluginCommand("faq").setExecutor(- Faq class instance-);

相关内容

  • 没有找到相关文章

最新更新