Shaun Siu

Can you create a skript that can limit how much combat stuff like exp bottles and gaps so like if you have more than like 120 it will get deleted unless put into chests and stuff and make it easily configurable and easy to add different items

Kodari AI
KodariFri at 2:54 pm 2
ItemLimitManager
A Minecraft Skript that enforces configurable item quantity limits for combat-related items like experience bottles and golden apples. Players exceeding the set threshold (default 120) will have excess items automatically deleted unless stored in chests or containers. Features a user-friendly configuration file where server admins can easily adjust limits per item type, add new items to restrict, and toggle the system on/off. Includes clear action bar messages warning players when approaching limits and automatic enforcement upon item pickup or inventory changes. Designed for simple setup with minimal commands required.

Place combat-limits.sk in plugins/Skript/scripts/, then run /sk reload combat-limits.

Change the limits in options, or add another limitCombatItem line to the function. Checks run every 10 seconds and only count items in player inventories—not chests or other containers. Excess items are deleted, so move them to storage before a check. Give combatlimits.bypass to exempt a player.

Shaun Siu

Does it give a warning and if so when and how long after will it get deleted

Kodari AI
KodariFri at 2:58 pm 1

No—the current script does not give a warning beforehand. It checks inventories every 10 seconds and immediately deletes any excess items it finds, then sends the player a message saying what was removed.

That means deletion can happen anywhere from almost immediately to 10 seconds after going over the limit.

Shaun Siu

Can you give a warning first and make it 60 seconds

Kodari AI
KodariFri at 2:59 pm 1

I’ll add a separate 60-second warning for each limited item, and cancel its countdown if the player gets back under the limit.

Updated combat-limits.sk to warn players before deleting excess items. They have at least 60 seconds after the warning to store or remove the excess; deletion happens on the next check, up to 10 seconds later.

Reload it with /sk reload combat-limits.

Shaun Siu

It doesn’t work also make it limit to 128 and limit breeze rods and cobwebs and limit tnt minecarts to 3

Kodari AI
KodariFri at 3:23 pm 1

I’ll fix the inventory counting and removal, set the general limits to 128, and add a separate limit of 3 for TNT minecarts.

Updated combat-limits.sk with limits of 128 each for experience bottles, golden apples, enchanted golden apples, breeze rods, and cobwebs, plus 3 TNT minecarts.

Players are warned first; excess items are removed on the first check at least 60 seconds later. Reload with /sk reload combat-limits.

If it still doesn’t work, send me the errors from the reload and your Minecraft and Skript versions.

Shaun Siu

Remove egaps

Kodari AI
KodariFri at 3:24 pm 1

Removed the enchanted golden apple limit. Reload with /sk reload combat-limits.

Shaun Siu

Make it apply for op ed people

Kodari AI
KodariFri at 3:31 pm 1

The limits now apply to everyone, including operators. The bypass permission has been removed.

Reload with /sk reload combat-limits.

Shaun Siu

Make it work for cart

Kodari AI
KodariFri at 3:52 pm 1

I’ll fix the removal check for TNT minecarts; the same slot check is shared by the other limits.

Fixed the inventory slot check used to remove excess TNT minecarts. The limit remains 3, with a 60-second warning.

Reload with /sk reload combat-limits. If it still fails, send the reload errors and your Skript version.

Shaun Siu

It doesn’t work for all of them now

Kodari AI
KodariFri at 4:03 pm 1

Fixed the count: it was counting stacks instead of individual items, so most limits never triggered.

Reload with /sk reload combat-limits. If it still fails, please send the reload errors and your Minecraft and Skript versions.

Shaun Siu

this is what it says

Kodari AI
KodariToday at 4:06 am 2

Updated the TNT minecart name and replaced the unsupported stack subtraction.

Reload with /sk reload combat-limits. If either error remains, send the new error message and your Skript version.

Kodari can make mistakes. Review important code before using.
Files
combat-limits.sk
Code
1 53
combat-limits.sk
options:
    prefix: &6[Combat Limits] &r
    check-interval: 10 seconds
    warning-time: 60 seconds
    experience-bottle-limit: 128
    golden-apple-limit: 128
    breeze-rod-limit: 128
    cobweb-limit: 128
    tnt-minecart-limit: 3

# Add another line here to limit a different item.
function checkCombatLimits(p: player):
    limitCombatItem({_p}, experience bottle, {@experience-bottle-limit}, "experience bottles")
    limitCombatItem({_p}, golden apple, {@golden-apple-limit}, "golden apples")
    limitCombatItem({_p}, breeze rod, {@breeze-rod-limit}, "breeze rods")
    limitCombatItem({_p}, cobweb, {@cobweb-limit}, "cobwebs")
    limitCombatItem({_p}, minecart with tnt, {@tnt-minecart-limit}, "TNT minecarts")

function limitCombatItem(p: player, item: item type, limit: integer, name: text):
    set {_amount} to 0
    loop all items in {_p}'s inventory:
        if type of loop-item is {_item}:
            add amount of loop-item to {_amount}
    if {_amount} > {_limit}:
        if {combatlimits.warning::%uuid of {_p}%::%{_name}%} is not set:
            set {combatlimits.warning::%uuid of {_p}%::%{_name}%} to now
            send "{@prefix}&cYou have more than %{_limit}% %{_name}%. Store the excess within {@warning-time} or it will be deleted." to {_p}
        else if difference between now and {combatlimits.warning::%uuid of {_p}%::%{_name}%} >= {@warning-time}:
            set {_excess} to {_amount} - {_limit}
            set {_remaining} to {_excess}
            loop integers from 0 to 40:
                if {_remaining} <= 0:
                    stop loop
                set {_stack} to slot loop-number of {_p}'s inventory
                if type of {_stack} is {_item}:
                    if amount of {_stack} <= {_remaining}:
                        subtract amount of {_stack} from {_remaining}
                        set slot loop-number of {_p}'s inventory to air
                    else:
                        set {_newAmount} to amount of {_stack} - {_remaining}
                        set slot loop-number of {_p}'s inventory to {_newAmount} of {_stack}
                        set {_remaining} to 0
            delete {combatlimits.warning::%uuid of {_p}%::%{_name}%}
            send "{@prefix}&cRemoved %{_excess}% excess %{_name}% from your inventory." to {_p}
    else:
        delete {combatlimits.warning::%uuid of {_p}%::%{_name}%}

every {@check-interval}:
    loop all players:
        checkCombatLimits(loop-player)

on quit:
    delete {combatlimits.warning::%uuid of player%::*}