所以我对我的yml进行了两次和三次检查,并通过了验证程序。我的插件加载良好,我可以在我的主类中创建一个helloworld命令。但是,在使用第二个.java文件和第二个命令时,它会连续显示我的yml用法文本。
主.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.");
}
}
常见问题.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;
}
}
插件.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>]
暂无答案!
目前还没有任何答案,快来回答吧!