itz_optimus5

Make me a Minecraft Spigot/Paper plugin called CreativeItemLock.

What it should do:

Stop players from taking items out of the Creative Mode inventory (the "give yourself items" menu) unless they have a permission node.

Permission node: creativeitemlock.use (default: op only, but can be given to any player/rank).

Players without the permission who try to grab an item from creative get blocked and see a message like: "You don't have permission to take items from the creative inventory." This should work even for OP players — only the permission matters, not OP status.

Features:

Config file to customize the permission node and the deny message.

Option in config to also block the /give command for players without permission.

Option to log blocked attempts to console.

A reload command: /creativeitemlock reload (own permission: creativeitemlock.admin).

Works on modern Minecraft versions (1.20+), Paper or Spigot.

Clean, simple, well-commented code.

Kodari AI
KodariAug 28 at 11:58 am 1
CreativeItemLock
A Spigot/Paper plugin that restricts access to the Creative Mode inventory menu. Players without the required permission node are blocked from taking items and see a customizable deny message. Features include configurable permission node and message, optional /give command blocking, console logging of denied attempts, and a reload command with its own admin permission. Works on Minecraft 1.20+ with clean, well-commented code.
  1. Create the Gradle project and plugin metadata for Spigot/Paper 1.20+.

  2. Implement permission-driven creative-inventory blocking and optional /give blocking.

  3. Add configurable messages/logging and the /creativeitemlock reload admin command.

  1. Created the Gradle-based CreativeItemLock plugin for Spigot/Paper 1.20+.

  2. Added permission-controlled Creative inventory blocking using creativeitemlock.use.

  3. Added configurable denial message, permission node, /give blocking, and console logging.

  4. Added /creativeitemlock reload with creativeitemlock.admin permission.

  5. Included plugin metadata and default configuration.

itz_optimus5

Continue

Kodari AI
KodariAug 28 at 12:05 pm 1

The CreativeItemLock plugin is already implemented with:

  • Creative inventory item blocking via InventoryCreativeEvent

  • Configurable permission and denial message

  • Optional /give blocking

  • Optional console logging

  • /creativeitemlock reload and /cil reload

  • Separate creativeitemlock.use and creativeitemlock.admin permissions

  • Spigot/Paper 1.20+ compatibility

Build the plugin with:

Shell
./gradlew build

The resulting JAR will be located at:

Plain Text
build/libs/CreativeItemLock-1.0.0.jar

Copy that JAR into your server’s plugins folder and restart the server.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 198
src/main/java/com/kodari/creativeitemlock/CreativeItemLock.java
package com.kodari.creativeitemlock;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class CreativeItemLock extends JavaPlugin {

    private static final String DEFAULT_PERMISSION = "creativeitemlock.use";
    private static final String DEFAULT_DENY_MESSAGE = "&cYou don't have permission to take items from the creative inventory.";

    @Override
    public void onEnable() {
        saveDefaultConfig();

        getServer().getPluginManager().registerEvents(new CreativeItemLockListener(this), this);

        if (getCommand("creativeitemlock") != null) {
            getCommand("creativeitemlock").setExecutor(new CreativeItemLockCommand(this));
        }
    }

    public boolean hasUsePermission(Player player) {
        return player.hasPermission(getPermissionNode());
    }

    public String getPermissionNode() {
        String permission = getConfig().getString("permission", DEFAULT_PERMISSION);
        return permission == null || permission.isBlank() ? DEFAULT_PERMISSION : permission;
    }

    public boolean shouldBlockGiveCommand() {
        return getConfig().getBoolean("block-give-command", false);
    }

    public void notifyBlocked(Player player, String source) {
        String message = getConfig().getString("deny-message", DEFAULT_DENY_MESSAGE);
        if (message == null || message.isBlank()) {
            message = DEFAULT_DENY_MESSAGE;
        }
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', message));

        if (getConfig().getBoolean("log-blocked-attempts", false)) {
            getLogger().warning(player.getName() + " was blocked from using " + source + ".");
        }
    }
}