Custom Validators
Validators act as the gatekeepers for equipment slots. They dictate whether a specific ItemStack is legally allowed to be equipped into a given slot by a specific LivingEntity.
By default, every slot uses the relique:tag validator, which restricts items based on the AbyssalLib tag system. However, developers can easily create and register their own custom validation logic (e.g., level requirements, class restrictions, or soulbound mechanics).
For Developers: Creating a Validator
To create a custom validator, you must implement the RelicValidator functional interface. This interface requires a single method: isValid(String slotId, ItemStack item, LivingEntity entity).
Because Relique utilizes AbyssalLib's registry system, you register your custom validators using a DeferredRegistry targeted at RelicRegistries.VALIDATORS.
Example: Level Requirement Validator
Below is an example of creating a validator that restricts players from equipping an item unless they have at least 30 experience levels.
For Server Owners: Using Custom Validators
Once a developer has registered a custom validator, server owners can assign it to any slot using the slot's JSON configuration file.
To apply the validator, simply add its namespaced key (the plugin's namespace + the validator's registered name) to the validators array.
JSON Example
Applying our newly created my_addon:level_requirement validator to the default ring slot:
How Multiple Validators Work: If a slot contains multiple validators, an item must pass ALL of them to be equipped. In the example above, the item must belong to the relique:ring tag AND the player must be level 30 or higher.