-3
我對java很陌生,這是我的第一個項目。我已經結束了,但它說「語法錯誤,插入 「}」 來完成ClassBody 這裏是我的代碼:。語法錯誤,插入「}」以完成ClassBody,初學者
package me.IPK.MFP;
import java.util.logging.Logger;
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 MFP extends JavaPlugin{
public final Logger logger = Logger.getLogger("Minercraft");
public static MFP 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!");
}
@SuppressWarnings("deprecation")
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
Player player = (Player) sender;
if(commandLabel.equalsIgnoreCase("p")){
if(args.length == 0){
player.setHealth(20);
player.kickPlayer(args[0]);
}
}
}
幫助是極大的讚賞
也許如果您正確縮進代碼,問題會比顯式錯誤消息更加明顯。 –
只需按照_「insert」}「來完成ClassBody」_!正如你所看到的,你沒有用閉括號'}'關閉你的類。並且,請正確地縮進你的代碼。 – Baby
[語法錯誤插入}可能重複以完成classbody](http://stackoverflow.com/questions/4030032/syntax-error-insert-to-complete-classbody?rq=1) –