Enchantments Limiter 2.0 Recode
release19 января 2026 г.EnchantmentsLimiter v2.0 - Complete Recode
🔄 Recode Highlights
- Complete architectural redesign - Rewrote entire codebase from scratch with modern Java patterns
- Performance optimized - Config caching eliminates repeated file I/O on every enchantment check
- Memory leak prevention - Automatic cleanup of message cooldown data
- Zero breaking changes - Automatic config migration ensures seamless updates
✨ New Features
Per-Item Enchantment Limits
- Set different limits for specific materials
- Example: Allow Sharpness 5 on Netherite Sword but only 4 on Diamond Sword
- Overrides global limits when configured
per_item:
DIAMOND_SWORD:
SHARPNESS: 4
NETHERITE_SWORD:
SHARPNESS: 5
Action Mode System
- DOWNGRADE - Reduces enchantment level to maximum allowed (default)
- REMOVE - Completely removes enchantments that exceed limits
- Configurable per-server preference
action_mode: DOWNGRADE # or REMOVE
Anvil Support
- Now catches enchantment combinations in anvils before they're created
- Prevents players from bypassing limits through anvil merging
- Runs at LOWEST priority to catch combinations early
Enhanced Player Feedback
- Icon system - Visual icons for enchantment types (⚔️ 🛡 🔥 💎 ⚡)
- Detailed changes - Shows exact modifications: "⚔️ Sharpness V → IV"
- Configurable display:
- Toggle between ActionBar and Chat messages
- Enable/disable detailed change information
Automatic Config Migration
- Detects old v1.x config format automatically
- Converts to new structure without manual intervention
- Preserves all existing enchantment limits
- Never breaks servers - Zero downtime updates
Bypass Permission
enchantmentslimiter.bypass- Skip all enchantment checks- Useful for staff testing or special events
- Works across all events (enchanting, anvil, pickup, inventory)
Namespace Support
- Accepts both formats:
SHARPNESSandminecraft:sharpness - Compatible with custom enchantments from other plugins
- Proper NamespacedKey handling for 1.21+ compatibility
🔧 Technical Improvements
Architecture Redesign
| Component | Purpose |
|---|---|
ConfigManager | Single source of truth for all configuration data |
EnchantmentRule | Data model for global + per-item limits |
EnchantmentRuleManager | Business logic for enchantment processing |
EnchantmentListener | Event handling with proper priority |
ModificationResult | Immutable state tracking for changes |
ActionMode | Type-safe enum for action strategies |
Performance Optimizations
- Config caching - Rules loaded once, cached in HashMap (O(1) lookup)
- Async operations - Update checker and cooldown cleanup run async
- Early returns - Bypass permission checked first in all events
- Smart inventory sync - Only syncs when items actually modified
Memory Management
- Cooldown cleanup - Removes old entries every 5 minutes
- ConcurrentHashMap - Thread-safe cooldown tracking
- No memory leaks - Automatic garbage collection of stale data
Event Coverage
| Event | v1.x | v2.0 | Notes |
|---|---|---|---|
| EnchantItemEvent | ✓ | ✓ | Now returns modified map directly |
| PrepareAnvilEvent | ✗ | ✓ | NEW - Catches anvil combinations |
| EntityPickupItemEvent | ✓ | ✓ | Better feedback system |
| InventoryClickEvent | ✓ | ✓ | Simplified logic, eliminated 24-case switch |
🔄 Changed
Command System
- Renamed command from
/enchantmentslimiterto/elimit - Tab completion for subcommand
- Better error messages with usage hints
Config Structure
# OLD (v1.x)
enchantment_limits:
PROTECTION: 3
SHARPNESS: 4
# NEW (v2.0)
enchantment_limits:
global:
PROTECTION: 3
per_item:
DIAMOND_SWORD:
SHARPNESS: 4
Display Settings
- Moved message settings to dedicated
displaysection - ActionBar now default (was Chat in v1.x)
Message Cooldown
- Reduced from 5 seconds to 3 seconds
- Better player experience without spam
- More responsive feedback
🐛 Fixed
Critical Fixes
- Memory leak - Old version never cleaned up cooldown map
- Config hot-reload - Properly clears cached rules on
/elimit reload - Anvil bypass - Players could combine enchantments to bypass limits
- Race conditions - Thread-safe cooldown map prevents concurrent modification
Logic Improvements
- Armor detection removed - Relied on hardcoded 24-material switch case
- Event priority - Now uses correct priorities (HIGH for enchanting, LOWEST for anvil)
- Inventory desync - Added proper client-server sync after modifications
- Null safety - Comprehensive null checks for items and enchantments
SpigotMC Update Checker
- Automatic update notifications
- Admin notification on join when updates available
📝 Migration Guide
Automatic Migration
- Replace old JAR with v2.0
- Start server
- Plugin detects old config automatically
- Converts to new format
- Saves migrated config
- Old structure removed
🎯 Compatibility
- Minecraft: 1.21+ (api-version: 1.21)
- Server: Spigot, Paper, Purpur, Pufferfish
- Dependencies: None required
🔒 Permissions
enchantmentslimiter.admin:
description: Access to /elimit reload
default: op
enchantmentslimiter.bypass:
description: Bypass all enchantment limits
default: false
🙏 Notes
- Backwards compatible - Existing configs work automatically
- No data loss - All enchantment limits preserved during migration
- Open for feedback - Report issues on Discord
📥 Download
- Modrinth: https://modrinth.com/plugin/enchantments-limiter
- SpigotMC: https://www.spigotmc.org/resources/121865/
- Support: discord.gg/lusik
Совместимость
Ссылки
Создатели
Детали
Лицензия:LicenseRef-All-Rights-Reserved
Опубликован:2 месяца назад
Обновлён:2 месяца назад

