Java Minecraft插件

时间:2012-12-05 23:20:44

标签: java minecraft bukkit

我得到了非常奇怪的错误,错误,我知道不应该发生。

错误:

  

令牌“}”上的语法错误,删除此令牌在两行上。

package me.itunes89.test;

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.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

public class Test extends JavaPlugin{
    public final Logger logger = Logger.getLogger("Minecraft");
    public static Test plugin;

    @Override
    public void onDisable(){
        PluginDescriptionFile pdfFile = this.getDescription();
        this.logger.info(pdfFile.getName() + " Has been disabled!");
    }

    @Override
    public void onEnable(){
        PluginDescriptionFile pdfFile = this.getDescription();
        this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has been enabled!"); //You
    }
} //Here

public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
    Player player = (Player) sender;
    if (commandLabel.equalsIgnoreCase("sendme"))
    {
        player.sendMessage(ChatColor.BLUE + "Sent");
    }
    return false;
} // and here

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

您过早关闭了课程范围。您需要删除包含括号的行:

} //Here

而是将其移动到文件的末尾。