Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Goat;
import org.bukkit.entity.Villager;
import org.bukkit.inventory.EquipmentSlot;

import java.util.UUID;
Expand Down Expand Up @@ -187,6 +188,26 @@ public static void register() {
object.getLivingEntity().damageItemStack(slot.asEnum(EquipmentSlot.class), amount.asInt());
});

if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_21)) {

// <--[mechanism]
// @object EntityTag
// @name restock_trades
// @input None
// @Plugin Paper
// @group paper
// @description
// Restocks a villager's trades.
// Note: this mechanism will fire the <@link event villager replenishes trade> event for every trade the villager is offering. This mechanism also update the villager's demand for offers, which may cause item trade prices to rise or fall.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split this into two lines between the sentences.

// -->
EntityTag.registerSpawnedOnlyMechanism("restock_trades", false, (object, mechanism) -> {
if (!(object.getBukkitEntity() instanceof Villager villager)) {
return;
}
villager.restock();
});
}

// <--[mechanism]
// @object EntityTag
// @name shear
Expand Down