[SPIGOT-6633] Im new to spigot and im trying to get a basic heal command working Created: 08/Jul/21  Updated: 08/Jul/21  Resolved: 08/Jul/21

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: abdelrahman rashwan Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: 1.16.1, command, nullpointerexception, spigot
Environment:

```java

package pluginsUghhhh.vzplugin;

import org.bukkit.plugin.java.JavaPlugin;
import pluginsUghhhh.vzplugin.heal;

public final class VZplugin extends JavaPlugin {

@Override
public void onEnable()

{ this.getCommand("heal").setExecutor(new heal()); }

@Override
public void onDisable()

{ // Plugin shutdown logic }

}

``` 
main class
```java 

package pluginsUghhhh.vzplugin;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;

public class heal implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (command.getName().equalsIgnoreCase("heal"))

{ player.setHealth(player.getMaxHealth()); sender.sendMessage("u are healed(ggez)"); return true; }

} else

{ sender.sendMessage("BRUH"); }

return false;
}
}

```

command class

```yml

name: VZplugin
main: pluginsUghhhh.vzplugin.VZplugin
version: 1.0
commands:
heal:
description: heal urself
usage: /heal
api-version: 1.16.1

```

yml plugin


Version: 1.16.1
Guidelines Read: Yes

 Description   

(all my indentations are right it just didnt paste correctly), im getting an npe at onenable when setting executor 



 Comments   
Comment by abdelrahman rashwan [ 08/Jul/21 ]

oops ignore this

Generated at Tue Apr 15 09:41:49 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.