
VillageAI
Intelligent village defense system. Villages centered on bells automatically detect nearby villagers. Friendly players gain reputation by trading. Hostile players lose reputation by attacking villagers. When hostile players are nearby reputation drops belo
176
3
Список изменений
[3.1.0] - 2026-04-24 — Stability & Architecture Improvements
🐛 Bug Fixes
Critical
- Dangerous save command removed —
/villageai savepreviously calledonDisable()followed byonEnable(), which could corrupt game state. Now uses safe synchronous save without reloading the entire system. - Economy config ignored —
economy_config.ymlexisted but was never loaded. Fixed:VillageEconomy.analyzeVillageNeeds()now reads village needs fromvillage_needs.daily_needsandvillage_needs.daily_productionsections in economy config.
High
- Code duplication in trade logic — Trade execution was duplicated between
TradeGuiandEconomyCommand. Created newTradeServiceclass that centralizes all trade validation and execution logic. Both GUI and command handlers now use the shared service. - Hardcoded raid wave definitions — RaidWave.forWave() contained hardcoded mob types and counts. Config now supports raid wave customization.
Medium
- Missing validation in trade execution — Improved trade validation to check material availability more robustly before executing any trades.
🚀 Improvements
Architecture
- TradeService: Centralized trade validation and execution (replaces scattered logic in TradeGui and EconomyCommand)
executeTrade()— Validates items, emeralds, and executes trade atomicallyhasItems()— Unified item checking logicgetReputationMultiplier()— Centralized reputation tier calculation
Configuration
- Economy config loading: Village needs now fully loaded from
economy_config.yml- Daily needs section with material demands
- Daily production section with supply generation
- Emergency needs configuration for raids
- All hardcoded Material definitions removed from code
Code Quality
- Reduced God Class burden: Separated concerns with TradeService
- Eliminated code duplication: Single source of truth for trade logic
- Better separation of concerns: Services now handle specific domains
📊 Performance Notes
- No performance regression from 3.0.0
- Config loading happens once per economy update (not per trade)
- Trade validation still O(n) but with reduced overhead from centralization
📝 Migration Notes
For existing servers:
- The new
economy_config.ymlis auto-generated on server start - Existing village data is fully compatible
- No manual migration required
Файлы
VillageAI-3.1.0.jar(112.77 KiB)
ОсновнойМетаданные
Канал релиза
Release
Номер версии
3.1.0
Загрузчики
PaperPurpur
Версии игры
1.21–1.21.11
Загрузок
10
Дата публикации
1 нед. назад
