TradeControl

Automatically control or modify the trades that are offered by villagers. This plugin is intended for server owners who want to make sure that their players cannot exploit the trading system. This way, trading can stay enabled and provide a challenging and exciting experience that is fair to everyone.

Note The exploit that this plugin attempts to fix was fixed or at least considerably nerfed in Minecraft version 1.4. TradeControl still works however, and can be used to modify villager trades.

Preamble

Villager trading as introduced with Minecraft 1.3 has a couple of widely known exploits. The result is that players are able to produce great amounts of emeralds and trade them for valuable goods, thus breaking the game. TradeControl aims at filtering the existing trades of villagers and changing them in a configurable way.

The exploit

The exploit has three components

  • The possibility to trade materials that are farmable with little to no effort for emeralds. The focus is on deals including paper.
  • The unlimited availability of any trade. This is possible because players can continue a single trade without limitations by leaving the trading menu open.
  • The possibility to trade emeralds for goods. Minecraft offers trades for food, glowstone, diamond tools and enchantments. This breaks the game.

The solution

TradeControl can filter the available trades of existing villagers and modify the undesirable ones by either deleting them or replacing them with other ones. Both filters and replacements are configurable.

Features

  • Automatically modify naturally spawned villagers in an existing world.
  • Define your own trades to replace existing ones you don't like.
  • Get statistics of trades that are available in your world to make sure you don't miss anything.
  • Performance-savvy: Villagers are by default only checked when a player interacts with them.

Shortcomings

  • There is no trading API in Bukkit, so this plugin uses the CraftBukkit and Minecraft interfaces will break with most releases.
  • Enchantments are currently ignored and cannot be specified. I can add this if people are interested.

Permissions

  • tradecontrol.cmd Access to the /tradecontrol (or /tc) command. This should be given to no one but admins.
  • tradecontrol.notify Receive a message whenever TradeControl modifies a villager.

Command

TradeControl has one ingame command: /tradecontrol or /tc with the following subcommands:

  • /tc help Display help.
  • /tc reload Reload the configuration file.
  • /tc scan Scan all the villagers on your server and filter their trades. This may cause one lag spike.
  • /tc list Display a list of all trades TradeControl has discovered on your server since the last boot.
  • /tc dump Write the list of available trades to disk for later review.

Configuration

The default configuration replaces the emerald deals for paper and written books and replaces them with a large amount of books. Trading many books for emeralds is not considered exploitable since the leather takes some effort to farm, other than the sugar cane, the process of which can be fully automated. It also makes the deals for wheat a little more expensive since wheat is fairly easy to farm.

# TradeControl configuration file
#
# Sections:
#   filters: A list of trade filters
#     buy: A list patterns of items the villager buys. Must be one or two.
#          Only matching patterns will be processed.
#       type: The item type as in org.bukkit.Material.
#       damage: The item damage or data value.
#       minAmount: The minimum item amount to match.
#       minAmount: The maximum item amount to match.
#       amount: The exact amount to match.
#     sell: The pattern of the item the villager sells.
#           Details see filters.buy.
#     action: Either "delete" or "replace".
#     replacements: A list of replacements by name as specified in trades.
#                   Only valid if action equals "replace".
#   trades: Named trade patterns for replacements.
#           Details see filters.buy.
filters:
- trade:
    buy:
    - type: paper
    sell:
      type: emerald
  action: replace
  replacements: [ manybooks ]
- trade:
    buy:
    - type: written_book
    sell:
      type: emerald
  action: replace
  replacements: [ manybooks ]
- trade:
    buy:
    - type: wheat
      maxamount: 23
    sell:
      type: emerald
  action: replace
  replacements: [ muchwheat ]
trades:
  manybooks:
    buy:
    - type: book
      minamount: 32
      maxamount: 64
    sell:
      type: emerald
      amount: 1
  muchwheat:
    buy:
    - type: wheat
      minamount: 24
      maxamount: 64
    sell:
      type: emerald
      amount: 1

Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files