API
QuickShop API
I'm going to keep this short and simple.
Events
QuickShop throws 3 types of events:
- ShopPreCreateEvent (3.6.2+) when a player clicks on a chest with an item. There is no Shop object to use here.
- ShopCreateEvent when a player enters the price per item in chat
- ShopPurchaseEvent when a player purchases an item from a shop.
Shop.java
A shop can be changed, such as shop.setPrice(50). However, this will not change it in the database, to do that you should use shop.update(). Using another thread, QuickShop will update the database records in the near future after doing that. The shop object stored in memory will be updated immediately. This is to save on queries if multiple changes are made.
ShopManager.java
This object is the controller for all shops. It stores every shop, with methods for accessing them (Surprisingly difficult).
Iteration
Iteration through all shops is rather complicated, so here's an example: http://dev.bukkit.org/paste/7023/
Comments