gpt4 book ai didi

java - Bukkit不会加载插件: name is not defined

转载 作者:行者123 更新时间:2023-12-01 07:36:48 24 4
gpt4 key购买 nike

这是我的代码:

package me.chimericalhobo.BlockChanger;

import java.util.ArrayList;
import java.util.logging.Logger;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

public class BlockChanger extends JavaPlugin
{

private static final Logger log = Logger.getLogger("Minecraft");
private final BlockChangerListener blockListener = new BlockChangerListener(this);
public final ArrayList<Player> BlockChangerUsers = new ArrayList<Player>();

@Override
public void onEnable()
{
log.info("[BlockChanger] has been enabled!");
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(this.blockListener, this);
}

@Override
public void onDisable()
{
log.info("[BlockChanger] has been disabled!");
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if(commandLabel.equalsIgnoreCase("BlockChanger"))
toggleBlockChanger(sender);

return true;

}

private void toggleBlockChanger(CommandSender sender)
{
if(!enabled((Player) sender)){
BlockChangerUsers.add((Player) sender);
((Player) sender).sendMessage(ChatColor.BLUE + "BlockChanger has been enabled!");

}
else
{
BlockChangerUsers.remove((Player) sender);
((Player) sender).sendMessage(ChatColor.RED + "BlockChanger has been disabled!");
}

}

public boolean enabled(Player player)
{
return BlockChangerUsers.contains(player);
}

}

每次我尝试加载它时,命令提示符都会显示:

15:53:08 [SEVERE] Could not load 'plugins\BlockChanger.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: name is not defined

最佳答案

plugin.yml中添加以下内容:

name: (Plugin Name)
main: (Package.name.name(or whatever).(MainClass Ex: .Main)) Ex: me.name.plugin.Main
version: (Version number)

您可以选择添加诸如作者:(作者姓名)之类的内容。

看看http://wiki.bukkit.org/Plugin_YAML了解更多信息。

关于java - Bukkit不会加载插件: name is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10889587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com