遵循YouTube教程,但当我运行插件时,我根本不注册它。插件的意思是返回“嗨!”当剧本开始的时候,/hello或/hi。当我把插件放在我的服务器上什么都没有,甚至没有注册在/plugins
代码: Main.java:
package me.Cheese_Echidna.helloworld;
import me.Cheese_Echidna.helloworld.commands.HelloCommand;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
new HelloCommand(this);
}
}HelloCommand.java:
package me.Cheese_Echidna.helloworld.commands;
import me.Cheese_Echidna.helloworld.Main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class HelloCommand implements CommandExecutor {
@SuppressWarnings("unused")
private Main plugin;
public HelloCommand(Main plugin) {
this.plugin = plugin;
plugin.getCommand("hello").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players may execute this command!");
return true;
}
Player p = (Player) sender;
if (p.hasPermission("hello.use")) {
p.sendMessage("Hi!");
return true;
} else {
p.sendMessage("You do not have permission to execute this command!");
}
return false;
}
}plugin.yml:
name: HelloWorld
version: 1.0
author: Cheese_Echidna
main: me.Cheese_Echidna.helloworld.main
description: My first Bukkit plugin
commands:
hello:
aliases: [hi]
description: This is the hello command!YT教程:https://www.youtube.com/watch?v=XaU8JKQW0Ao
我在这里附上了一张文件结构的照片:

任何帮助都会很感激的。
发布于 2020-06-22 19:21:57
我有个基本问题。您是否在您的“我的世界”服务器上安装了Vanilla Min克拉夫特版本?要使用Bukkit或Spigot插件,您必须使用,它们的扩展。
发布于 2021-05-06 23:13:58
我不是舒尔。但问题可能在plugin.yml!
首先,在plugin.yml中为制表符使用一个空格是很重要的
另一个问题是,在main后面有一条路径:必须导致一个类--在本例中,它将是main: me.Cheese_Echidna.helloworld.main.Main
更正后的plugin.yml应该如下所示:
name: HelloWorld
version: 1.0
author: Cheese_Echidna
main: me.Cheese_Echidna.helloworld.main.Main
description: My first Bukkit plugin
commands:
hello:
aliases: [hi]
description: This is the hello command!发布于 2021-05-16 03:07:35
您忘了在plugin.yml中添加API版本。很常见的错误,别担心,很多人都这么做。以下是plugin.yml wiki以获取更多信息:Plugin.yml维基
也应该是这样的。你好像把文件放在文件夹里,而不是包里。
https://stackoverflow.com/questions/61436530
复制相似问题