kall_yt48

I want a Minecraft plugin in which I can set the maximum strength or the maximum strength of any item. Like if I ban the strength potion, then if a player uses the strength potion, it will display that the strength potion is banned. Similarly, as soon as I ban Protection 3, Crystal PvP is banned, then it will display that Crystal PvP or Protection 3 is banned. I want such a plugin.

Kodari AI
KodariJun 20 at 6:41 pm 19
ItemRestrict
A Minecraft plugin for restricting potions and enchantment levels server-wide. Admins can ban specific potions (by type and minimum level) and cap enchantments at a max allowed level. When a player tries to drink a banned potion or equip armor with a forbidden enchantment level, a fully customizable message is shown and the action is cancelled. Supports action-bar display, bypass permission, and persistent config storage.

Plan:

  1. plugin.yml + config.yml — structure and defaults

  2. PotionRestriction + EnchantRestriction — data classes

  3. ConfigManager — load/save restrictions

  4. RestrictionListener — potion consume, armor equip, join check

  5. RestrictCommand — ban/unban/list/reload subcommands

  6. ItemRestrictPlugin — wires everything together


How to use:

Command
What it does
/ir banpotion STRENGTH
Bans all Strength potions
/ir banpotion STRENGTH 2 &cStrength II is banned!
Bans only Strength II (level 2+) with a custom message
/ir banenchant PROTECTION 2 &cCrystal PvP is banned!
Allows Prot I-II, bans Prot III+ with your message
/ir banenchant SHARPNESS 0
Bans Sharpness at every level
/ir unbanpotion STRENGTH
Removes the Strength ban
/ir unbanenchant PROTECTION
Removes the Protection cap
/ir list
Shows all active restrictions
/ir reload
Reloads config from disk

Permission nodes:

  • itemrestrict.admin — access to all commands (default: op)

  • itemrestrict.bypass — skip all restriction checks (default: false)

Enforcement points: potions are blocked on drink, armor with banned enchants is blocked on equip (direct click, shift-click, and right-click auto-equip), and players are warned on join if they’re already wearing restricted gear.

Kodari can make mistakes. Review important code before using.
Files
src
Code
8 746
src/main/java/com/kodari/itemrestrict/ItemRestrictPlugin.java
package com.kodari.itemrestrict;

import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class ItemRestrictPlugin extends JavaPlugin {

    @Getter
    private ConfigManager configManager;

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

        configManager = new ConfigManager(this);
        configManager.load();

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

        getCommand("itemrestrict").setExecutor(new RestrictCommand(this));
        getCommand("itemrestrict").setTabCompleter(new RestrictCommand(this));

        getLogger().info("ItemRestrict enabled.");
    }

    @Override
    public void onDisable() {
        getLogger().info("ItemRestrict disabled.");
    }
}