[1.13-1.21] Bazaar Insta Buy/Sell, Create Sell/Buy Order, Cross Server icon

[1.13-1.21] Bazaar Insta Buy/Sell, Create Sell/Buy Order, Cross Server -----

Trade & build riches in the captivating vr Bazaar, where fortunes change hands in a dynamic realm



Please submit bugs, questions, issues and suggestions on Discord

Documentation: https://ancash.github.io/posts/bazaar/
The API is fully documented, the other features will be documented in the following days.

What is Bazaar?
The Bazaar is kind of like a real stock market, with supply and demand, and everyone can take part in it. This allows for people to flip items on the Bazaar, and make money. This is like Auction House flipping, except that the items will get sold eventually when the price that you wish to pay is given.

What is Flipping?
Flipping is the act of buying an item and then selling it for a higher price to make a profit, like getting a Carrot for 1,000 coins and then selling it for 1,500 coins, as you make a profit of 500 coins. With the Bazaar, you have to wait for the selling price to get higher than what you bought it for.

Buy Order:
A Buy Order signifies that a player is willing to buy a specific number of items at a specific price per unit or lower. Restrictions can be configure in the config.yml. Depending on the unit price, your Buy Order will be filled faster or slower (the higher the unit price, the faster it will be filled).

Sell Offer:
A Sell Offer signifies that a player is willing to sell a specific number of items at a specific price per unit or more. Restrictions can be configure in the config.yml. Depending on the unit price, your Sell Offer will be filled faster or slower (the lower the unit price, the faster it will be filled).


Features:
  • Sell Offers
  • Buy Orders
  • Cross Server Sync
  • Buy & Sell instantly
  • Number of categories only limited by integer size (2³²-1)
  • Category linking
  • Full custom item support (nbt, texture, enchantments,...)
  • Everything customizable (messages, menus, items, categories, ...)
  • Paged menus
  • DiscordSRV hook
  • PAPI hook
  • NPC handler to imitate player behaviour
NOTE: Only bazaar-x.y.z.jar in the downloaded ZIP File is a Minecraft plugin. Read below on how to use the other one. When using it for the first time, restart the server if the plugin does not load but you have all dependencies installed.


Video:



Text:

Download Sockets and put the jar file into a new folder.
Note that this is NOT a minecraft plugin but a executable jar file.
Run the jar with java -jar socket_server.jar and stop the server with the command stop.
A new folder called plugins will be created.
Unpack the Bazaar.zip file. Two new files will appear: Bazaar.jar and Bazaar-Socket.jar.
Move the BazaarSocketPlugin.jar into the plugins folder.
Start the server again with
java -jar socket_server.jar -h 127.0.0.1
Messages like Enabling Bazaar v?.?.?, Loading Enquiries from Files... & Loaded total of 0 Enquiries indicate that it was successfully loaded.
Now go to your minecraft server plugins folder and open the file config.yml in the Bazaar folder. Set socket-support to true. The serverName is for identification and debugging to show which server connected/disconnected. You now have to check the console of the server and look at the first few lines. There you will find a line containing Port. This value and the one in the config.yml file in the Bazaar folder in the mincraft server plugins folder have to match. address has to be set to your pc name or localhost (unless you specified it otherwise (f.e. if you have multiple machines)). Now start the minecraft server and you will see that new messages appear. It will try to connect to the socket server and if it's successfull you will see the following messages:
Code (Text):
[Bazaar] Connecting to server socket...
[Bazaar] Connected to ?:?
[Bazaar] Sending BazaarConnectPacket
[Bazaar] Connection accepted!
[Bazaar] Starting BazaarThreadPool

The last message indicates that it has connected to the server socket and everything is working. If an error occurs, make sure the server socket is running and the port and address match. If you still did not find the issue contact me on Discord


Bazaar Tutorial (outdated):


A Buy Order signifies that a player is willing to buy a specific number of items at a specific price per unit or lower. Restrictions can be configure in the config.yml or by using /bz edit (see section "Editing").
Depending on the unit price, your Buy Order will be filled faster or slower (the higher the unit price, the faster it will be filled).
There is one key difference between a Sell Offer and a Buy Order.
It is possibe for a Buy Order to be filled by a Sell Offer with an equal OR lower unit price.
If the unit price is NOT the same, there are unused coins, called remnants.
Only Buy Orders can have remnants.
The formula for remnants is straighforward:
(BuyOrder#unitPrice - SellOffer#unitPrice) * amount.

How to create a Buy Order
[​IMG]
How to fill a Buy Order
A Buy Order can either be filled by Instantly Selling the specific item at the specified unit price, or by a Sell Offer with a unit price equal to or lower than the Buy Order:
[​IMG]

Cancelling a Buy Order
See section "Cancel Enquiry"

A Sell Offer signifies that a player is willing to sell a specific number of items at a specific price per unit or more.
Restrictions can be configure in the config.yml or by using /bz edit (see section "Editing").
Depending on the unit price, your Sell Offer will be filled faster or slower (the lower the unit price, the faster it will be filled).

How to create a Sell Offer
[​IMG]
How to fill a Sell Offer
A Sell Offer can either be filled by Instantly Buying the specific item at the specified unit price, or by a Buy Order with a unit price equal to or higher than the Sell Offer:
[​IMG]

Cancelling a Sell Offer
See section "Cancel Enquiry"

In order to cancel an enquiry, all items or coins that can be collected from the enquiry must have been collected. If the enquiry is filled, it is not possible to cancel it.
To cancel an enquiry you have to open the bazaar, click on "Manage Enquiries" and right click the enquiry you want to cancel. You then have to confirm your actions.
If a Sell Offer is cancelled, the remaining items will be refunded. If your inventory cannot hold those items, cancelling is not possible. [​IMG]
If a Buy Order is cancelled, the unused coins will be refunded:
[​IMG]

It is possible to instantly sell items, without needing to wait for a Sell Offer to be filled.
The downside is that the unit price is generally lower compared to the unit price of a Sell Offer.
There also has to be atleast one Buy Order (the items have to go somewhere)
[​IMG]

It is possible to instantly buy items, without needing to wait for a Buy Order to be filled.
The downside is that the unit price is generally higher compared to the unit price of a Buy Order.
There also has to be atleast one Sell Offer (the items have to come from somewhere)
[​IMG]

[​IMG]
[​IMG]

Main menu
/bz edit replaces the unintuitive and faulty /bz set.
Permission: bazaar.edit
Executing the command opens a GUI with all Bazaar files that can be edited.
[​IMG] The files in the top row can also easily be edited with a normal text editor, thus are not the main interest of the command. These include category_settings.yml, config.yml, config_editor.yml, item_appendix.yml, graphs.yml and inventory.yml.
By clicking one, a new GUI opens and displays all the options that are present in the file. You can easily create, delete and add options as you wish.
[​IMG]


Edit category files
In the row below, all category files are listed (1 to 5). There are two ways to edit these files. By right clicking one, they can be edited the same way as the ones in the top row.
With a left click a seperate window opens, where the sub categories of the selected category are displayed.
[​IMG]


An already existing sub category can be deleted with a shift click.
A new one can be created by clicking the desired slot which corresponds to where the sub category will be placed in the Bazaar.
To edit a sub category, click the one you want to edit.
[​IMG]


A new GUI will open. There are similar slots as in the GUI before, except that they now represent a sub sub category.
To delete a sub sub category, shift click, to create one, click one of the empty slots and to edit one, click it.
In addition to that, a new item is at the top. This is the item that represents the this sub category. In the Bazaar it corresponds to the following item:
[​IMG]


The displayed lore is not the one that will be displayed to the user, as there are two possible lores (one for a sub category with only one sub sub category and one for one with multiple products). So editing the lore of this item has no effect, instead take a look at category_settings.yml#sub. However you can still edit various other properties such as the type, displayname, enchantments, item flags, custom model data and more.

Once you click a sub sub category you want to edit, a new GUI will open.
[​IMG]
The first option lets you edit the default price. That is the unit price that will be used during enquiry creation if there are no buy orders or sell offers available.
[​IMG]
The next option is the item that represents this sub sub category in it's parent sub category. Editing it's lore again has no effect, instead take a look at category_settings.yml#sub-sub. Editing other properties works. Note that this item will not be displayed if this is the only sub sub category in a sub category.
In the Bazaar it corresponds to the following item:
[​IMG]
And the last option is
[​IMG]


The last one is the original item, the one that will be used for transactions. With a left click you can edit it in an editor. With a right click you can select an item from your inventory to set as the original item.

To reload the plugin use /bz reload
This means that all configuration files will be read once again.
If socket support is enabled, the connection to the socket server is terminated and, if needed, a new one will be established.
Permission is: bazaar.reload

If bypass-bz-sub-cmds-list in the config.yml is set to false use
/bz
else use a command that does not exist such as
/bz aaa
Then a list of all sub commands /bz has will be displayed.

[​IMG]
[​IMG]
[​IMG]


When player interact with the Bazaar, certain actions trigger events such as EnquiryCreateEvent, EnquiryCancelEvent, SellInstantlyEvent and BuyInstantlyEvent.
These events can be logged in a Discord Text Channel. The following configuration file discordsrv.yml provides the necessary options to configure which events you want to log where.

Code (Text):
enquiry-event-channel: ""
instant-transaction-event-channel: ""
overview-channel: ""
The EnquiryCreateEvent and EnquiryCancelEvent will be logged in the enquiry-event-channel. The SellInstantlyEvent and BuyInstantlyEvent will be logged in the instant-transaction-event.

The overview-channel is a bit different.
Here, one embed message will sent and its' id will be saved in the discordsrv.yml file. It contains a short summary of all the available Enquiries.
Note that only the Sell and Buy Price will be displayed due to message length limitations.
The Buy Price will only be displayed if there is something to buy. Same goes for Sell Price.
Once any of the events above takes place, the overview-message will be updated to the current state of the Bazaar.
The time of the last updated will be saved in the message as well
[​IMG]
Note If the socket option is enabled, all events that happen on a server will be published to all other servers, thus only one Bazaar Instance on a MC Server needs to be configured to log events to Discord

Dependencies:
ILibrary: https://www.spigotmc.org/resources/ilibrary.89796/
Vault: https://www.spigotmc.org/resources/vault.34315/
NBTNexus: https://www.spigotmc.org/resources/nbtnexus.111041/
ProtocolLib: https://www.spigotmc.org/resources/protocollib.1997/
And an Economy Plugin (Thread Safe Economy Plugin recommended due to async tasks!)


Terms of Service:

  • You are not allowed to claim the source/binary code of the plugin as your own.
  • You are not allowed to decompile or modify this plugin without permission.
  • You are not allowed to share or resell this plugin.
  • You do not have a guaranteeing to receive any support for the plugin however I generally offer fast premium support.
  • Once you bought and downloaded the plugin it can't be refunded since it's a digital product.
  • I hold the right to adjust the price and terms of service whenever I want.
  • You automatically agree to the terms of service by purchasing the resource.
Resource Information
Author:
----------
Total Downloads: 211
First Release: Mar 3, 2021
Last Update: Yesterday at 5:43 PM
Category: ---------------
All-Time Rating:
16 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings