Skip to content

AStages Enchant Restriction

Kessy edited this page Jun 13, 2025 · 2 revisions

AStages Enchant Restriction

Overview

Enchant Restrictions automatically remove forbidden enchantments from items that enter the player's inventory, hide them from the enchanting table, and prevent the use of restricted enchanted books in the anvil.


Methods

Method Description Parameters Returns
AStages.addRestrictionForEnchant(id, stage, enchantment) Create and add generic enchant restriction. id: arbitrary string used as identifier.
stage: progression stage.
enchantment : enchant to be restricted.
AEnchantRestriction
AStages.addRestrictionForEnchant(id, stage, enchantment, compareCondition, level) Create and add more concisely enchant restriction. id: arbitrary string used as identifier.
stage: progression stage.
enchantment: enchant to be restricted.
compareCondition: condition to be applied for level checking.
level: level to be checked.
AEnchantRestriction

Examples

Tip

To define in a more precise way some restriction, you can use ACompareCondition enum provided by AStages to lock, for instance, the enchantment will be restricted only if its level is under 4. ACompareCondition could be: "equal", "less", "less_equal", "great", "great_equal".

Basic Usage

// Server Script Folder -> file.js (arbitrary file name).
AStages.addRestrictionForEnchant("astages/crop1", "stage_crop", "minecraft:protection")
AStages.addRestrictionForEnchant("astages/crop2", "stage_crop", "minecraft:protection", "less", 4)

Documentation:

  1. Home

  2. Stages
    - Usage
    - Utils

  3. Restrictions
    - Crop
    - Dimension
    - Effect
    - Enchant
    - Item (Old)
    - Loot
    - Mob
    - Ore
    - Pet
    - Recipe
    - Region
    - Screen
    - Structure

  4. Addons
    - Curios API
    - Pufferfish Skill's

  5. Simple Restrictions (via commands)
    Brand new and intuitive way to add restriction!

  6. Developers
    - Plugin
    - Restrictions
    - Simple Restrictions
    - Stage System
    - Utils

  7. Q&A
    A place where questions are on the agenda!

  8. Changelogs
    Changelogs since 0.6.0 version!

  9. Version Comparisons

  10. What's Happened? (FLOP!)
    New code formatting is coming!

Clone this wiki locally