hlmod / Shop-Core

Documentation
https://hlmod.github.io/Shop-Core/module/create/
GNU General Public License v3.0
28 stars 26 forks source link

Fixed repetitive calling of the message about loading player data and calling the Forward after each item loading out of turn. #148

Closed IL0co closed 2 years ago

IL0co commented 2 years ago

If you reload the plugin that registers some items in the shop after loading the core, then messages about loading the player's data will be spammed in the chat, and the Shop_OnAuthorized Forward will be called the same number of times.

iLoco‎ : !rcon sm plugins reload shop_test_mm
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
[Shop] You data of the shop has been loaded! Type !shop to open the shop!
R1KO commented 2 years ago

@IL0co Why is this happening?

IL0co commented 2 years ago

@IL0co Why is this happening?

This happens because after registering an item, Shop requests data about this item and the player from the database (current switch position, quantity, etc.), after receiving this data, the player is notified in the chat and the player load forward is also called, and since there is no limiter, it will spam after each item load. Why this does not happen after the kernel is loaded, when all the items are registered at once, I don’t know.

TiBarification commented 2 years ago

It is fine like a hotfix, but need to investigate why this happen, firstly need to authorize client (only once) and then load their items.