diff --git a/data/config.example.lua b/data/config.example.lua index 974844f..fba274f 100644 --- a/data/config.example.lua +++ b/data/config.example.lua @@ -20,6 +20,9 @@ -- The scale you want on your monitor. 1 is normal size, 0.5 is half the sise. Defaults to 0.5. monScale = 0.5, + -- If the storage should be refreshed once there comes in a purchase. This will slow down your shop. Only use this if you are inserting items into the storage without reloading manually. + refreshCacheBeforePurchase = false, + -- A tablearray of storage units. This is parsed by AbstractInvLib. Required. storage = { "" diff --git a/src/backend.lua b/src/backend.lua index 0b87eae..44b287e 100644 --- a/src/backend.lua +++ b/src/backend.lua @@ -148,10 +148,14 @@ end function handleTransaction(transaction) - logger:debug("Handle Transaction... Reloading storage to be sure") - os.queueEvent("kstUpdateProducts") - os.pullEvent("kristify:storageRefreshed") - logger:debug("Storage refreshed!") + logger:debug("Handle Transaction...") + + if config.refreshCacheBeforePurchase == true or config.refreshCacheBeforePurchase == nil then + os.queueEvent("kstUpdateProducts") + os.pullEvent("kristify:storageRefreshed") + logger:debug("Storage refreshed!") + end + local product = utils.getProduct(products, transaction.sent_metaname) if product == false or product == nil then