setExecutor throwing NullPointerException

setExecutor is throwing a NullPointerException, I’ve been searching the internet for hours and I still have no clue why.

Plugin context: It’s for a joke where I’m going to “speedrun” but use a command to give myself everything I need.

Here is my main class called Meme:



import java.util.Objects;

public final class Meme extends JavaPlugin {

    public void onEnable() {
        System.out.println("Meme plugin loaded!");

        this.getCommand("hacks").setExecutor(new HackCommand());

    public void onDisable() {
        // Plugin shutdown logic

Here is my command:


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.Inventory;
import org.bukkit.inventory.ItemStack;

public class HackCommand implements CommandExecutor {

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            Inventory playerInv = player.getInventory();

            ItemStack[] items = {
                    new ItemStack(Material.NETHERITE_SWORD, 1),

            for (int i = 0; i < items.length; i++) {
        } else {
            return false;

        return true;

Here is my plugin.yml:

name: Meme
version: ${project.version}
api-version: 1.16
authors: [ heroku ]
description: An assortment of meme features.
    description: Gives the player OP items.
    usage: /<command>
  1. You should be using Bukkit.getLogger() for logging.
  2. JavaPlugin (Paper-API 1.16.5-R0.1-SNAPSHOT API) says the command will only return null if it doesn’t exist, could you post the full stacktrace just to make sure (