VTL ~ VillagerTradeLimiter [1.14.1 - 1.20.1] icon

VTL ~ VillagerTradeLimiter [1.14.1 - 1.20.1] -----

~ Fix those pesky OP villager discounts! ~




Hello, friends! This update brings support for Minecraft 1.20 and 1.20.1 versions.

Please reach out to me on Discord if you have any suggestions or issues.
----------, Jun 29, 2023

Today's update brings a couple changes:
1. Disabled items and disabled professions in config.yml are no longer case-sensitive. Adding "Librarian", "librarian", or "LIBRARIAN" will all work now.

2. Added left/right/both side matching for trade overrides, so you can apply an override to trades that only have an item on the left or right side of a trade. For example, flint can be sold to or bought from fletcher villagers, so you can have different settings for each of those trades like this:

Code (Text):
Overrides:
  flint_left:
    MaxUses: 8
  flint_right:
    MaxUses: 1
----------, Mar 20, 2023

This update brings support for 1.19.4 servers.
----------, Mar 16, 2023

Hello, friends! Today's update brings two new features thanks to a request from @SolaceNetwork

1. Disable professions:
This feature prevents villagers from acquiring the professions that you specify in config.yml. Example config:
Code (Text):
DisableProfessions:
- librarian
- cartographer
2. Disable items:
This feature completely removes certain items from a villager's trade offers. The change cannot be undone. It can be used to prevent server crashes on custom worlds. For example, a cartographer sells woodland mansion and ocean monument maps, which can cause the server to crash in a custom world where mansions and monuments don't exist. Removing "filled_map" from villager trades will solve this kind of issue. Example config:
Code (Text):
DisableItems:
- filled_map
----------, Mar 10, 2023

Hello friends! This update brings compatibility fixes for other plugins that deal with entity interactions (other villager plugins, quest plugins, etc). Specifically, it fixes an issue with the VILLAGER_TRADE quest type in ODailyQuests.
----------, Feb 18, 2023

A rewrite of version 2.0.0 is in progress, but in the meantime, here's a stable version with 1.19.3 support!
----------, Jan 2, 2023

Thanks to mis on Discord for reporting this bug and being patient while we rooted out the cause! This update brings a temporary workaround to a bug, where discounts aren't applied to some/all trades on some servers. You may not have this problem, but if you do, see the new "TradeDelay" option in config.yml.

This issue was likely caused by a race condition inside the Spigot API's implementation of the new MerchantRecipe#setSpecialPrice method. It seems the order in which the special price is applied to the recipe (before or after opening the trading window) depends on the server's hardware or software. I will work on a proper fix in the next update.

I also added another new config option in config.yml to allow multiple players to trade with the same villager at the same time.
----------, Sep 10, 2022

BEFORE UPDATING, MAKE A BACKUP OF CONFIG.YML!

I have rewritten much of this plugin, and added several features, so there will likely be bugs. It is recommended to test this on a separate server first, if possible, and report any bugs on Discord.

This version (2.0.0) and any future versions will only work on 1.18.1+ servers.


OVERVIEW:
Happy September! :D
After 2 months of work, rewriting the plugin, and hearing your suggestions on Discord, I am pleased to finally release this update. Thank you for your suggestions, bug reports, and reviews! This wouldn't be possible without you.


NEW FEATURES :
1. Permission group settings:
Most of the settings are now configurable for different permission groups! This version comes with 3 new config files in the /plugins/VillagerTradeLimiter/groups/ folder: default.yml, example.yml, and op.yml. Whatever settings you put in default.yml will apply to ALL players that don't have a set permission. ​

You can change the settings for a player by giving them a "villagertradelimiter.group.<group>" permission with your permissions plugin, replacing "<group>" with a filename.

For example, giving a player the "villagertradelimiter.group.example" permission will give them the settings from example.yml, while "villagertradelimiter.group.op" will give them the settings from op.yml.

You can create and delete any group config files in the /plugins/VillagerTradeLimiter/groups/ folder, but DO NOT delete default.yml.

2. Full trade replacement:
Until now, replacing certain trades with custom items was extremely limited. With this update, you can now fully customize the ingredients and results of any trade. This includes, names, lore, amounts, materials, enchantments, item flags, and custom model data.

Names and lore also now have HEX color support. For a good example of the full trade replacement, see the custom name tag override in /plugins/VillagerTradeLimiter/groups/example.yml:
Code (Text):
Overrides:
  name_tag:
    Item1:
      Material: glowstone_dust
      Amount: 64
    Item2:
      Material: book
      Amount: 1
    Result:
      Material: book
      Amount: 1
      Unbreakable: true
      Name: <#FFCC00>Forbidden Tome
      Lore:
      - '&7An ancient tome'
      - '&7thought to have been'
      - '&7lost to the ages...'
      - '&7'
      - <#993333>Doomed are those who
      - <#993333>dare read these
      - <#993333>cursed pages.
      Enchantments:
      - binding_curse_1
      Flags:
      - hide_enchants
      - hide_unbreakable
The last trade of every master librarian would now look like this: [​IMG]

3. Faster villager restocks:
You can now make villagers restock faster than vanilla by setting Restock in config.yml to a smaller time interval.

For example, this will force villagers to restock within 2 minutes:
Code (Text):
Restock: 2m
Also, the restock interval and per-player cooldowns have been smoothed out, so that they work as expected.

4. Disable trading for certain professions:
You can now prevent players from trading with any villagers that have one of the professions listed under "DisableProfessions" in config.yml

For example, the following setting will prevent players from trading with any librarians or clerics.
Code (Text):
DisableProfessions:
- librarian
- cleric

5. Reversible changes:
Changes to villager trades are now only temporary. They revert back to vanilla while players aren't trading. This allows the vanilla trades to be restored after disabling or uninstalling VTL. This should also prevent corruption of villager data.​
----------, Sep 4, 2022

Happy 4th of July weekend! This update brings a config option to disable VTL in certain worlds, which leaves vanilla trading mechanics for those worlds. You can use this new feature by adding world names to the new DisableWorlds list in config.yml. Thanks to UserGO on Discord for the suggestion!
----------, Jul 3, 2022

Today, I have updated the NBT-API dependency to support using 1.19 items in custom villager trades (Item1, Item2, and Result in config)! This includes the blocks and items for the new mangrove swamp and deep dark biomes.
----------, Jun 15, 2022

This update adds two items to the IgnoreHeldItems list by default in config.yml:
1. "name_tag" fixes an issue with using a nametag on a villager.
2. "ghast_spawn_egg" adds support for SafariNet.

Thanks to Turjoy9 on GitHub for adding these!

As always, if you have any issues or suggestions,
join our Discord for quick and friendly support!​
----------, May 21, 2022

FIX ~ When increasing the MaxUses and making the same trade at least 1500 times over a short period of time, the demand for multiple trades suddenly skyrockets to a large number (like 9 million), and the prices of those trades jump to 64. This issue has now been fixed, thanks to ZaraZarazua on Discord for reporting the bug!
----------, May 1, 2022

Again thanks to blyatcyka on Discord, fixed the IgnoreHeldItems feature.
----------, Apr 24, 2022

There was a typo in the code that prevented the IgnoreHeldItems feature from working. This is now fixed, thanks to blyatcyka on Discord for the report!
----------, Apr 23, 2022

Happy Easter weekend! Today, this update provides support for plugins that have non-vanilla behavior when interacting with villagers. I would like to thank Taner and blyatcyka on Discord for reporting the conflict! This includes:
  • GriefPrevention
  • WorldGuard
  • SafariNet
  • And many more!
If the villager trading menu opens when it's not supposed to (for example, when using a spawn egg to capture a villager in SafariNet), you can add item types to the IgnoreHeldItems list in config.yml. This will prevent VTL from overriding other plugins when the player is holding a special item in their hand.

As always, if you have any questions or issues, join us on Discord for quick and friendly support!
----------, Apr 17, 2022

Hello! This update brings support for 1.18.2 servers. As always, if you have any issues or suggestions, join our Discord for quick support!
----------, Mar 5, 2022

In this update, I have added support for the Shopkeepers plugin! Shopkeeper villagers are no longer affected by this plugin, so now you'll always see the shopkeeper's trades instead of the vanilla villager's trades. Citizens NPCs were already (and continue to be supported) in the same way. Thanks to Aysel_ on Discord for reporting the conflict!

The following new settings in config.yml toggle whether to ignore Citizens and Shopkeepers NPCs in this plugin:
Code (Text):
# Ignore Citizens NPCs, and/or Shopkeepers NPCs if true
IgnoreCitizens: true
IgnoreShopkeepers: true
----------, Jan 22, 2022

Hello, everyone! I've got a big update for all of you :) As always, if you have any issues or suggestions, join our Discord server or use the Discussions tab for quick support! The many changes in this update are:

FIX ~ Fixed a villager inventory dupe bug, where opening a villager's trading menu would multiply the villager's inventory contents 16 times. ( Thanks to @xlxLoi )


FIX ~ Smoothed out the Hero of the Village limiter, so the player doesn't lose their HotV effect after trading, but the discount is still limited correctly.


FEATURE ~ Added a /vtl invsee command, which allows you to see the inventory of a villager. Like /vtl see <player>, look at the villager you want to see the inventory for, and enter the command into chat. The permission to use the command is villagertradelimiter.invsee, which is also given to OP players by default.


FEATURE ~ Added a /vtl see <player> command, which allows you to see a villager's trade prices for another (offline or online) player. Just look at the villager you want to see trade prices for, and enter the command into chat! The permission to use the command is villagertradelimiter.see, which is given to OP players by default. (Thanks to Seema on Discord)


FEATURE ~ Added customizable help, success, and error messages, which can be configured in messages.yml in your plugin folder.


FEATURE ~ Added a configurable result slot, like Item1 and Item2, but for the result slot, so you can now set the item type and amount for all 3 parts of any trade. Example:
Code (Text):
Overrides:
  name_tag:
    Item1:
      Material: paper
      Amount: 64
    Item2:
      Material: ink_sac
      Amount: 32
    Result:
      Material: name_tag
      Amount: 2

FEATURE ~ Added per-player trading cooldowns, in real-world time (Thanks to sonoffoe on Discord). These cooldowns limit how often a player can make a certain trade with ANY villager in seconds (s), minutes (m), hours (h), days (d), or weeks (w). The following example will only allow a player to get 1 mending book every 7 days, no matter how many mending villagers they have:
Code (Text):
Overrides:
  mending_1:
    MaxUses: 1
    Cooldown: 7d

FEATURE ~ Added per-villager restock cooldowns, in real-world time (Thanks again to sonoffoe on Discord). These cooldowns limit how often a villager can restock a certain trade, which affects ALL players who trade with the villager. Like the per-player cooldowns, the per-villager cooldowns can be in seconds (s), minutes (m), hours (h), days (d), or weeks (w). The following example will only allow a villager to restock mending books once every 7 days, no matter how many players trade with the villager:
Code (Text):
Overrides:
  mending_1:
    Restock: 7d
----------, Jan 15, 2022

FEATURE ~ Now you can increase the villager curing discount (further reduce prices) by setting MaxDiscount to any number greater than 1.0 in config.yml. This can be done globally, for all trades, or for individual trades. Thank you, pudg on Discord, for suggesting this feature!

For example, the following config setting will increase the discount on paper, so the discounted price will change from about 18 paper-per-emerald down to 1 paper-per-emerald:
Code (Text):
Overrides:
  paper:
    MaxDiscount: 5.5
~~~
Happy holidays and thank you for using VTL!
~~~
----------, Dec 23, 2021

FEATURE ~ Added a global setting for MaxUses, which sets the maximum number of times a player can make a trade before the villager runs out of stock on that trade. Thanks to Kid on Discord for the suggestion!

NOTE: A villager can restock twice per Minecraft day.
NOTE: The vanilla value of MaxUses for some trades (bows, diamond armor and tools, etc.) is 3. You can find the default vanilla value of MaxUses for every possible trade here.
----------, Dec 21, 2021

FIX ~ A villager trade that contains a 1.17+ item caused an error for servers on 1.16.5 and below. This has been fixed, and support has been fully tested on all versions from 1.14 to 1.18.1. Sorry for all the back-to-back updates!
----------, Dec 17, 2021

NOTE: This version is for 1.17+ only

FIX
~ A glitch would sometimes occur when a trade is disabled and a player opens the trade menu repeatedly back-to-back. The disabled trade could randomly reappear, and the player could get kicked from the server with an error. This has now been fixed. Thanks to stefn on discord for reporting the glitch!
----------, Dec 16, 2021

Thank you for your patience as I was finishing exams!
This update provides support for 1.18 and 1.18.1, as well as a couple new features and bug fixes.
I would like to thank @Jowcey for making a pull request where he added these features and 1.18 support!



FIX ~ Config updater was broken, and would mess up config.yml when people update to a new plugin version. This has been fixed, thanks to the code provided by tchristofferson on Github.



FEATURE 1 ~ Set the maximum number of uses for a trade, which is the number of times a player can make a trade before it is out of stock, with MaxUses. The following example will limit players to only buying 1 mending book per restock (2 per day):
Code (YAML):
Overrides:
  mending_1
:
    MaxUses
: 1


FEATURE 2 ~ Set the price and currency for the cost of a trade, which is configurable for both ingredients (left and middle items shown in a trade). The currency can be set for each item using Item1.Material and Item2.Material, and the price can be set for each item using Item1.Amount and Item2.Amount in config.yml. The following example will change the cost of mending book trades to 64 diamonds + 32 books:
Code (YAML):
Overrides:
  mending_1
:
    Item1
:
      Material
: "diamond"
      Amount
: 64
    Item2
:
      Material
: "book"
      Amount
: 32

~~~
Happy holidays and THANK YOU for using VTL!
~~~
----------, Dec 15, 2021

Hello everybody! It has been awhile, and I am very excited to share these 2 highly requested features with you! Much thanks goes to @ValenGamerXD, @TorusManO_O, and @Houdeeny for suggesting these features and helping improve VTL for everyone.

1. Per-world disabled trading allows you to completely disable ALL villager trades in a specific world, or in multiple worlds. In config.yml, the DisableTrading: setting controls this feature. Here are the options:
  • Code (Text):
    DisableTrading: true
    ~ disables all villager trading in all worlds
  • Code (Text):
    DisableTrading: false
    ~ disables the feature, so all villager trading is enabled in all worlds
  • Code (Text):
    DisableTrading:
      - world_nether
    ~ disables all villager trading in the nether
  • Code (Text):
    DisableTrading:
      - world_nether
      - world_the_end
    ~ disables all villager trading in both the nether and the end
You can add as many worlds here as you wish, but I don't think it supports Multiverse worlds at this time. I can add Multiverse world support upon request.

2. Per-item disabled trading allows you to remove certain trades from all villagers' available trade offers. Don't worry, the disabled trades will be restored if you change your mind! To disable a trade, in config.yml, add Disabled: true to any of the per-item overrides at the bottom. Here are some options:
  • Code (Text):
    Overrides:
      mending_1:
        Disabled: true
    ~ removes Mending books from all villager trades
  • Code (Text):
    Overrides:
      depth_strider_3:
        MaxDiscount: 0.6
    ~ doesn't remove depth strider 3 books, but sets the maximum discount to 60% of the base price
  • Code (Text):
    Overrides:
      name_tag:
        Disabled: false
        MaxDiscount: -1.0
        MaxDemand: 60
    ~ doesn't remove name tags from villager trades, but disables the MaxDiscount feature for it, and sets the MaxDemand to 60 trades.
You can add as many items as you want. It works for items on either the left side or right side of a trade. For example, configuring paper will apply to Paper -> Emerald trades, and configuring clocks will apply to Emerald -> Clock trades. Be careful here, as all trades that have the configured item on the left side and all trades that have the item on the right side will be affected!
----------, Sep 16, 2021

FIX ~ NullPointerException when using "/vtl reload" from the console
----------, Jun 27, 2021

WARNING: You will need to change your permissions!

NEW ~ COMPATIBILITY:

Code (Text):
VillagerTradeLimiter now supports spigot, paper, and similar 1.17 servers!

NEW ~ COMMANDS:
Code (Text):
* Replaced /vtlreload command to /vtl reload
* Added /vtl command that shows a help message

NEW ~ PERMISSIONS:
Code (Text):
* Replaced vtl.reload with villagertradelimiter.reload
* Added villagertradelimiter.use and villagertradelimiter.*
Join my discord if you need any help!
----------, Jun 27, 2021

WARNING: You will need to change your permissions!

NEW ~ COMPATIBILITY:

Code (Text):
VillagerTradeLimiter now supports spigot, paper, and similar 1.17 servers!

NEW ~ COMMANDS:
Code (Text):
* Replaced /vtlreload command to /vtl reload
* Added /vtl command that shows a help message

NEW ~ PERMISSIONS:
Code (Text):
* Replaced vtl.reload with villagertradelimiter.reload
* Added villagertradelimiter.use and villagertradelimiter.*
Join my discord if you need any help!
----------, Jun 27, 2021

FIX ~ A duplication glitch, caused by VTL, was found by @Darutan. Each time a player traded with a villager that had items in its inventory, the villager's inventory was doubled. This allowed players to easily get infinite carrots, potatoes, beetroots, and bread! The issue has now been fixed in this version.
----------, Apr 18, 2021

FIX ~ Fixed a "NullPointerException" error that occurred when interacting with custom villagers (Citizens, etc.) (thanks to @Houdeeny )

Also improved performance of NBT tag loading and saving even further!
----------, Jan 17, 2021

Just some performance improvements for loading and saving NBT data :)
----------, Jan 15, 2021

Fixed an error that occurred when right clicking on a nitwit villager.

Fixed server versions 1.14 to 1.16.3 not working with this plugin. I tested on each version, so it should work as advertised now!!!
----------, Jan 9, 2021

Fixed another error, "java.lang.NoSuchMethodError: java.lang.String.isBlank()Z" caused by having an older Java version than Java 11 (thanks to @SirAussieman)
----------, Jan 8, 2021

Fixed an error, "java.lang.NoSuchMethodError: java.lang.String.strip()Ljava/lang/String...", caused by having an older Java version (thanks to @DarkoR12)
----------, Jan 5, 2021

Fixed an error, "Could not pass PlayerInteractEntityEvent to VillagerTradeLimiter...", that occurred when right-clicking on villagers with no profession (thanks to @hitewaer)
----------, Jan 5, 2021

config.yml wouldn't completely update if there were any blank lines that had spaces in them. Fixed in this version. If you already installed version 1.1.0, just remove the 2 spaces under "Overrides:" in your config.yml, and then use /vtlreload
----------, Jan 4, 2021

Starting with this version, your config.yml will update automatically every time you update the plugin! But don't worry, it won't overwrite your current settings.

Also, you can now override the global settings (MaxDiscount and MaxDemand) on a per-item basis. Just copy and edit the settings under "Overrides" in config.yml!

Thank you for using VTL! :)
----------, Jan 4, 2021

1.0.3 ~ I removed the unrelated command /gamerules from this plugin, and moved it to a new plugin, which you can find HERE
----------, Jan 1, 2021

1.0.2 ~ Added bStats to keep track of server, java, and minecraft versions being used with this plugin.

To update your config.yml, compare with the new default config that's posted in the plugin overview.
----------, Dec 30, 2020

Resource Information
Author:
----------
Total Downloads: 13,199
First Release: Dec 29, 2020
Last Update: Jun 29, 2023
Category: ---------------
All-Time Rating:
32 ratings
Find more info at github.com...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings