Limited Items
This page explains about the limited items feature which comes with the premium version of EconomyShopGUI
You can use limited stock aswell as sell limits on the same item.
Limited stock
Limited stock for specific items could be usefull if you have a special item on your server which you want to be limited for a few players on your server only for example.
The feature comes with two options where you can limit the item:
Global stock = Limited stock for a specific item where the whole server(each player) can purchase a specified amount of items.
Player stock = Limited stock for a specific item where each player individually can purchase a specified amount of items.
You can also specify a restock time, if specified when the item gets out of stock it will automatically count down and restock the item for the player or globally.
The data for this feature will be saved inside a SQLite database so that it will be consistant over server restarts.
When using the item option 'refill-stock', the stock limit for an item on a global or player setting will refill when the items are sold back to shop.
Global stock:
Using the stock-limit-global item option, it is possible to specify a amount of stock that the item will have.
All players will have the same amount of stock for the item, if someone purchases for example 5 items, the stock will drop with 5 for every player on the server.
Restocking global stock:
Using the auto-restock-global-stock item option, a item can be set to restock after X amount of time.
Using the auto-restock-global-frequency item option, a item can be set to stock after a specified interval.
Player stock:
Using the stock-limit-player
setting on the item you can specify a amount of stock that every player individually will have for the item.
Each player will start with the same amount of stock for the item(which was specified) and can purchase the amount of items that there are in stock till it runs out for each player individually.
So for example when using the option stock-limit-player: 5
on a item, each player would be able to purchase the item 5 times.
Restocking player stock:
Using the auto-restock-player item option, a item can be set to restore its stock limit after X amount of time for a specific player.
Keep in mind that unlike the fixed frequency, only the player reaching its sell limit will be restored to the original quantity configured inside the config.
Using the auto-restock-player-frequency item option, a item can be set to restock after a specified interval.
Keep in mind that unlike the restock time, when a item gets restocked it will happen for all players on the server.
Sell limits
Items using a sell limit, like you may have guessed, are only sell-able for a certain amount. This feature can be used together or seperatly on items with limited stock.
There are two modes which can be used to limit a item per player or globally:
Global sell limits = Limited amount of items which can be sold spread over the whole server.
Player sell limits = Limited amount of items which can be sold for each player seperatly.
Global sell limits:
Using the sell-limit-global item option, it is possible to set a sell limit for the specific item for all players on the server.
Global sell limits will make it so players can buy the same amount over the whole server. For example a player sells 10 items while the global sell limit is set to 10, no other player will be able to sell the same item again untill its restocked.
Restoring global sell limits:
Using the auto-restock-global-sell item option, a item can be set to restore its sell limit after X amount of time.
Using the auto-restock-global-sell-frequency item option, a item can be set to restore its sell limit after a specified interval.
Player sell limits:
Using the sell-limit-player item option, it is possible to specify a per player based sell limit. For example when a player sell limit of 64 has been set, each player will be able to sell 64 of that item.
Restoring player sell limits:
Using the auto-restock-player-sell item option, a item can be set to restore its sell limit after X amount of time for a specific player.
Keep in mind that unlike the fixed frequency, only the player reaching its sell limit will be restored to the original quantity configured inside the config.
Using the auto-restock-player-sell-frequency item option, a item can be set to restore its sell limit after a specified interval.
Keep in mind that unlike the restock time, when a item gets its sell limit restocked it will happen for all players on the server.
Restocking stock/limit types:
Currently there are two options for restocking items/limits.
Restock time: A specific duration after the item's stock/limit has reached 0.
Fixed frequency: A set interval which triggers a restock at a specific time stamps.
A restock duration/interval is optional, making it possible to make a one time sell-able/buy-able item.
Restock time:
The item is able to restock its stock/limit automatically after a specified time.
It is important to keep in mind that this duration only starts counting down when the stock/limit has reached 0.
So for example:
If there was a stock limit of 50 on a item and when the auto-restock-global/player: 10m
option was specified, the 10 minutes count down will only start when the stock/limit has fully reached 0 and will restock the item to its original amount after 10 minutes.
Fixed frequency:
Using a fixed time it allows us to specify a frequency to restock for example each hour at 25 minutes or rather each Sunday at 7PM.
Unlike the restock time, this frequency will happen every x time specified even if there is still stock/limits available for the item.
Unlike some other cron schedulers we use the populair java Quartz Cron Scheduler which has a slightly different context as some others. The following is how a valid cron schedule should look like: auto-restock-player-frequency: 0 0 0 ? * *
.
A valid schedule format exists of 6 or 7 values: seconds, minutes, hours, day of month, month, day of week and the optional Year. See the following screenshot for more info:
To give you some cron schedule examples using the auto-restock-player-frequency:
option:
auto-restock-player-frequency: 0 0 0 ? * *
Restock player stock every day at 00:00 noon
auto-restock-global-frequency: 0 0 12 * * ?
Restock global stock every day at 12 PM noon
auto-restock-global-frequency: 0 30 11 ? * MON-FRI
Restock global stock every Monday, Tuesday, Wednesday, Thursday and Friday at 11:30 AM
auto-restock-player-sell-frequency: 0 30 16 ? * FRI
Refill player sell limits every Friday at 4:30 PM
auto-restock-player-global-frequency: 59 29 * ? * *
Refill global sell limits every hour at 29 minutes and 59 seconds
auto-restock-global-frequency: 0 0 12 * * ? 2023-2025
Restock global stock every day at 12 PM noon aslong as it is either Year 2023, 2024 or 2025
See more examples on the official Quartz docs here: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html
Last updated