Hi! at my server most items replaced to mmoitems analog , and this script replace plain items if they somehow get into the player's inventory.
The problem is in the structure of the script itself, at the moment it takes about 800 MS (0.8 sec) to load it
I am afraid that in the future this time will grow to several tens of seconds, and this is already a significant time.
Mi_items_replacer:
Above is only 12% of the script, this is for understanding the structure of the script.
How can this be optimized?
server version: 1.20.4
Skript addons: Skbee, skquery, skrayfall, skutiles, skript-reflect
The problem is in the structure of the script itself, at the moment it takes about 800 MS (0.8 sec) to load it
I am afraid that in the future this time will grow to several tens of seconds, and this is already a significant time.
Mi_items_replacer:
Code:
on inventory slot change:
if event-item is a plain stick:
wait 1 tick
set {_amount} to item amount of event-item
replace all plain stick with air in player's inventory
execute console command "/mi give MATERIAL STICK %event-player% %{_amount}%"
if event-item is a plain wooden pickaxe:
wait 1 tick
set {_amount} to item amount of event-item
replace all plain wooden pickaxe with air in player's inventory
execute console command "/mi give TOOL WOODEN_PICKAXE %event-player% %{_amount}%"
if event-item is a plain wooden shovel:
wait 1 tick
set {_amount} to item amount of event-item
replace all plain wooden shovel with air in player's inventory
execute console command "/mi give TOOL WOODEN_SHOVEL %event-player% %{_amount}%"
if event-item is a plain wooden hoe:
wait 1 tick
set {_amount} to item amount of event-item
replace all plain wooden hoe with air in player's inventory
execute console command "/mi give TOOL WOODEN_HOE %event-player% %{_amount}%"
if event-item is a plain wooden sword:
wait 1 tick
set {_amount} to item amount of event-item
replace all plain wooden sword with air in player's inventory
execute console command "/mi give SWORD WOODEN_SWORD %event-player% %{_amount}%"
Above is only 12% of the script, this is for understanding the structure of the script.
How can this be optimized?
server version: 1.20.4
Skript addons: Skbee, skquery, skrayfall, skutiles, skript-reflect