title: NullPointerException when registering a new command in main class
body: <p>I want to create a new command in a minecraft plugin im currenly developing.
  it should give a player an item. I registered the command in my main class and in the plugin.yml but when the server loads the plugin, it always throws a NullPointerException.</p>
  <p>i would really appreciate any help</p>
  <p>Thanks!</p>
  <p>Here is my main class:</p>
  <pre><code>
  package dungeonsremake.dungeonsremake;
  
  import dungeonsremake.dungeonsremake.commands.GiveCustomItem;
  import org.bukkit.plugin.java.JavaPlugin;
  
  public final class Main extends JavaPlugin {
  
      @Override
      public void onEnable() {
      
              this.getCommand(&quot;item&quot;).setExecutor(new GiveCustomItem());
      
      }
      
      @Override
      public void onDisable() {
          getLogger().info(&quot;Shutting down Plugin&quot;);
      }
  
  }
  </code></pre>
  <p>And here is my Command class:</p>
  <pre><code>
  package dungeonsremake.dungeonsremake.commands;
  
  import org.bukkit.Material;
  import org.bukkit.command.Command;
  import org.bukkit.command.CommandExecutor;
  import org.bukkit.command.CommandSender;
  import org.bukkit.entity.Player;
  import org.bukkit.inventory.ItemStack;
  
  public class GiveCustomItem implements CommandExecutor {
  
      @Override
      public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
          System.out.println(&quot;activated&quot;);
          if(!(sender instanceof Player)) {
              return true;
          }
          Player player = (Player) sender;
      
          if(command.getName().equalsIgnoreCase(&quot;item&quot;)) {
              ItemStack fot = new ItemStack(Material.LEGACY_RED_ROSE);
              fot.setAmount(1);
              player.getInventory().addItem(fot);
              return true;
          }
      
          return true;
      
      }
  
  }
  
  </code></pre>
  <p>and here my plugin.yml:</p>
  <pre><code>name: DungeonsRemake
  main: dungeonsremake.dungeonsremake.Main
  version: 1.0
  
  commands:
  item:
  usage: /&lt;command&gt;
  description: gives the player a custom item.
  aliases: [giveitem, item, customitem, ci, gci]
  </code></pre>
  <p>error message:</p>
  <pre><code>    java.lang.NullPointerException: Cannot invoke &quot;org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)&quot; because the return value of &quot;dungeonsremake.dungeonsremake.Main.getCommand(String)&quot; is null
      at dungeonsremake.dungeonsremake.Main.onEnable(Main.java:15) ~[?:?]
      at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
      at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
      at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.2-R0.1-SNAPSHOT.jar:?]
      at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:517) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:431) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:612) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:263) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1007) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3465-Spigot-ffceeae-3ec79a2]
      at java.lang.Thread.run(Thread.java:833) [?:?]
  
  </code></pre>