Skript

Skript

743k Downloads

Heavy event %off hand item% contain

WarnDa opened this issue ยท 5 comments

commented

Skript/Server Version

[13:55:53 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[13:55:53 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[13:55:53 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[13:55:53 INFO]: [Skript] Server Version: git-UniverseSpigot-"3e1e308" (MC: 1.20.4)
[13:55:53 INFO]: [Skript] Skript Version: 2.8.7 (skriptlang-github)
[13:55:53 INFO]: [Skript] Installed Skript Addons: 
[13:55:53 INFO]: [Skript]  - SkBee v3.5.4 (https://github.com/ShaneBeee/SkBee)
[13:55:53 INFO]: [Skript]  - ItemsAdder v3.6.4-release-3 (devs.beer)
[13:55:53 INFO]: [Skript] Installed dependencies: 
[13:55:53 INFO]: [Skript]  - Vault v1.7.3-b${env.TRAVIS_BUILD_NUMBER}
[13:55:53 INFO]: [Skript]  - WorldGuard v7.1.0-SNAPSHOT-MISTER+0a9eb44

(didn't use newer version as I had an issue so didn't try to update)

Bug Description

I use this tiny skript :

on inventory slot change:
    if "%off hand item%" contain "fishing":
        add off hand item to player's inventory
        set off hand item to air
        send "No you can't !"

But it consumes 0.6% just for this...
https://spark.lucko.me/QFFSWpSlMZ
image

Expected Behavior

Shouldn't use that much just for an inventory switch

Steps to Reproduce

Use the skript with "a lot" of players

Errors or Screenshots

No response

Other

Maybe there is a better way to do this ?
I just want to block fishing_rod in off hand

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

you should update to 2.9.3 and if its still broken let us know

commented

Updated on test server without issue, so will update tomorrow and see

commented

Stop stringifying the item. It's not cheap. Get the type of the item instead. It'd also be better to check the indices of the slots first. Player slot change event is called VERY often, so this isn't exactly a surprise or a bug.

commented

Stop stringifying the item. It's not cheap. Get the type of the item instead. It'd also be better to check the indices of the slots first. Player slot change event is called VERY often, so this isn't exactly a surprise or a bug.

I don't really know how to do this, I already spent half an hour searching for a working things.
Would be cool to share your solution so I could edit my skript please !

commented

The skUnity discord is a good place for help in writing scripts! discord.gg/skript