Here’s all my code:
@Override
public void onEnable()
{
getLogger().info("Plugin Enabled!");
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if(cmd.getName().equalsIgnoreCase("Plugin"))
{
// If the player typed /plugin then do the following...
if (sender instanceof Player)
{
Player player = (Player) sender;
// Gives player item
return true;
}
else
{
sender.sendMessage("You must be a player!");
return false;
}
}
}
@Override
public void onDisable()
{
getLogger().info("Plugin Disabled!");
}
}
In case you didn’t know, this is a plugin for Minecraft Bukkit.
Here’s the error line:
getLogger().info("Plugin Enabled!");
When I delete the semicolon, the message in ” ” is an error, and when I insert a “}” or/and a “{” it shows an error.
How do I fix this?
You have a method (
onCommand) within another method (onEnable) – this is not possible.I suppose you are missing a closing brace
}beforepublic boolean onCommand.