CivClassic / ItemExchange

ItemExchange is a Minecraft plugin that allows players to make shops to physically buy and sell items. Built for Paper 1.16.5
Other
0 stars 10 forks source link

ItemExchange

ItemExchange is a Minecraft server plugin that allows players to up in-world shops, which can be setup to have multiple exchanges and donations if so desired.

Video tutorial of the basics

Browsing

You can browse by punching a shop block. You will then be presented with exchange information. You can cycle through the exchanges with individual punches to the shop. If you wish to purchase or donate, punch the shop with the input item in hand. It's recommended that you cycle through exchanges with an empty hand, otherwise you may inadvertantly purchase something that happens to have the input you had in your hand.

Image showing the message a shop displays when you left click it.

(The sign in the image is not necessary for the shop to work, nor is it created by the shop)

Creating a shop

Shops allow you to sell items and request donations. You do this by creating exchange rules that define the inputs and outputs of exchanges, or just inputs for donations, will match with items.

An ItemExchange shop is any chest or dispenser with exchange rules inside. Exchange rules consist of stone buttons that Item Exchange has attached extra information to. Anyone can use Item Exchange to generate these buttons, to make their own shop with.

An exchange rule shows (almost) all of its information in its tooltip. To increase usability, the English displayed name is used in place of the Bukkit material name and durability value, wherever possible.

A single exchange rule is either an input rule, defining items that the shop accepts, or an output rule, defining items that the shop gives in return. A single exchange consists of one input rule and one output rule. These are paired by the order that they're held in the shop's inventory; the first input rule is matched to the first output rule and so on.

Image showing an input exchange rule tooltip in a shop inventory. Image showing an output exchange rule tooltip in a shop inventory.

The stone button items that represent the exchange rules are created using the /iecreate (or /iec) command. There are three ways of doing this.

For the second and third options, you need to make sure you have both an input and an output exchange rule, then place them in a suitable container to form an exchange. By adding more input and output rules, you can add more exchanges to your shop, but keep in mind how they are paired.

Remember to reinforce your shop!

Editing an exchange rule

An existing exchange rule can be edited using the /ieset (or /ies) command. This is the only way to access some advanced features. Using this command will edit the exchange rule held in hand.

The amount of an item specified in an exchange rule can also be increased or decreased by shift left clicking or shift right clicking on the exchange rule respectively.

Bulk exchange rules

It is possible to merge multiple exchange rules into one item by putting them in a crafting grid together. This will create a bulk exchange rule. Bulk exchange rules can have more exchange rules merged into them, including other bulk exchange rules. This means any number of exchanges can be stored in a single item, which in turn allows a shop to hold any number of exchanges while only using one inventory slot.

The order of all exchange rules inside a bulk exchange rule is determined by how the components were placed on the crafting grid. When merging bulk exchange rules, one is essentially appended to the other.

When forming input and output pairs, all exchange rules in the shop are considered, regardless of whether the rule is part of a bulk exchange rule or not. The first input rule is matched to the first output rule, the second to the second and so on, even if they are not in the same bulk exchange rule.

As an example of that, a chest containing only an input rule for 1 stone, and a bulk rule that contains an input rule for 1 wood and an output rule for 1 charcoal, in that order, will have an exchange selling charcoal for stone. The wood input rule cannot be matched to anything, and won't be a part of any exchange.

When a bulk exchange rule is dropped onto the ground, it splits into its component exchange rules.

Redstone support

If there is a button attached to the block behind the chest, it will emit a redstone signal on a successful transaction. This currently only works for chests. Image showing a button on a block behind a chest. Another image showing a button on a block behind a chest.