PluginMIT
SharedCure
SharedCure is a server plugin built on the Paper API that utilizes a 'Tagging + Lazy Loading' mechanism to ensure that villagers cured by any player provide the maximum discount to all players on the server.
27
Downloads
0
Followers
4 months ago
Updated
📦
1
Versions
📖About SharedCure
SharedCure
English | 简体中文
SharedCure is a Paper plugin that implements server-wide villager discount sharing using a small tag (PDC) and Just-In-Time reputation injection approach. When a villager has been cured by any player, this plugin ensures other players who interact with that villager receive the highest trade discount (MAJOR_POSITIVE) without requiring bulk updates across all players.
Features
- PDC three-state management: Each villager receives a
discount_statustag (PDC) indicatingUNKNOWN,NOT_CURED, orCUREDto minimize server-wide operations. - Instant Reputation Injection: When a player interacts with a villager in the
CUREDstate, the plugin will, if necessary, instantly injectMAJOR_POSITIVEreputation for the player's UUID, ensuring that the discount is immediately reflected in the trading interface. This only affects the cured reputation (MAJOR_POSITIVE) and does not impact other types of reputation. - Legacy villager backfill: On plugin load and chunk load, villagers that lack the plugin tag are deep-checked for existing reputations (gossip) and tagged accordingly to support older worlds.
- Cure capture: The plugin listens for
EntityTransformEventand marks zombie villager conversions asCUREDinstantly.
Architecture Overview
| Module | Event | Purpose |
|---|---|---|
| Existing villager initialization | ChunkLoadEvent + startup scan |
Tag existing villagers and deep-check gossip/inventory for unknown states. |
| New villager tagging | CreatureSpawnEvent |
Tag newly spawned villagers NOT_CURED. |
| Cure capture | EntityTransformEvent |
Mark newly cured villagers as CURED. |
| JIT injection | PlayerInteractEntityEvent |
Inject MAJOR_POSITIVE reputation for the interacting player when villager is CURED. |