这是我的代码。底部的最后一个大括号有错误。这很烦人,我一直在努力解决它。是我的牙套太多还是怎么的?我真的很难过。请帮忙。
enter code here
package me.sapita.medic;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class medicplugin1 extends JavaPlugin {
public void onEnable() {
Bukkit.getServer().getLogger().info("Medic enabled!");
}
public void onDisable() {
Bukkit.getServer().getLogger().info("Medic disabled!");
}
@SuppressWarnings("deprecation")
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
if (!(sender instanceof Player)){
sender.sendMessage(ChatColor.RED + "The console cannot be regenerated!");
return true;
}
Player player = (Player) sender;
if (cmd.getName().equalsIgnoreCase("regen")){
Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null){
player.sendMessage(ChatColor.RED + "Could not find user.");
return true;
}
if (args.length == 0){
player.setHealth(20);
player.setFoodLevel(20);
player.sendMessage(ChatColor.GREEN + "Your health & food have been regenerated!");
}
if (target == null){
player.sendMessage("Please specify a player to regenerate.");
}
sender.sendMessage(target.getName() + "has been regenerated!");
target.setHealth(20);
target.sendMessage(sender.getName()+ "has regenerated your health & food!");
return true;
}
return true;
if (cmd.getName().equalsIgnoreCase("resetfood")){
Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null){
player.setFoodLevel(20);
player.sendMessage(ChatColor.GREEN + "Your food health has been regenerated!");
return true;
}
if (args.length == 0){
sender.sendMessage(ChatColor.GREEN + "You have fed yourself!");
player.setFoodLevel(20);
return true;
}
target.setFoodLevel(20);
target.sendMessage(sender.getName() + "has regenerated your food!");
sender.sendMessage(ChatColor.GREEN + target.getName() + "has been food health has been regenerated!");{
return true;
}