Commit graph

22 commits

Author SHA1 Message Date
ceb4c804b7 refactor: Java 21 support, config/API updates, GUI polish 2026-06-10 23:18:10 +02:00
bfdf197de4 fix: restore full WorldGuard flags support, default only block-break=allow 2026-06-01 11:52:19 +02:00
b80fefa6a4 fix: move example config to resources, simplify WG to block-break only, fix teleport for stuck players only, add messages.yml 2026-06-01 11:46:28 +02:00
f2be6d6ece feat: add example mine config, &#RRGGBB color support, up to 100 selection points 2026-06-01 11:38:53 +02:00
0f2735f171 feat: add multiple region support for mines 2026-06-01 11:26:54 +02:00
957468b6b6 feat: add info, teleport, and copy commands 2026-06-01 11:12:42 +02:00
f6cccbcd33 Restructure gui/mine/edit into subpackages: blocks/, reset/, rewards/ 2026-06-01 10:58:04 +02:00
5da488d2b2 Refactor: Split BlocksGui and ResetGui to keep files under 200 lines - Extract item creation to BlocksGuiItems and ResetGuiItems 2026-06-01 10:53:45 +02:00
11f31e5b7a Add Holograms integration and Sub-GUI editors
Holograms:
- HologramManager with auto-detection of HolographicDisplays/DecentHolograms
- HologramProvider interface and implementations
- HologramConfig for per-mine configuration
- /lm hologram <mine> [on|off] command
- Updates every second showing mine name, fill %, progress bar, and timer

Sub-GUI Editors:
- BlocksGui - edit block weights with +/- clicks
- BlockMaterialSelectionGui - paginated material picker
- ResetGui - configure reset interval, percent trigger, message, commands
- RewardsGui - manage reward entries
- All holders moved to gui/mine/holder/
- Editors moved to gui/mine/edit/
- Main GUI (MineEditGui) moved to gui/mine/main/

Package structure reorganized to maintain max 6 files per folder.
2026-06-01 10:38:00 +02:00
9a57a3e703 Restructure wand and util test packages - move GroupWand classes to wand/group/, move Selection tests to util/selection/ 2026-06-01 00:07:45 +02:00
1b85bc5329 Refactor: Restructure packages to follow KISS/SOLID principles - gui reorganized into mine/group/confirm/common, core into mine/service/common, command into admin/player/common, data/config/loader into block/entity/region/reward/system. All packages now follow max 6 files per folder rule. Extracted utility classes to reduce file sizes. 2026-06-01 00:04:56 +02:00
9692965a3e Add particle visualization for wand selection
- Add WandParticleService to show particles around selected wand areas
- Show green particles at corner 1 (pos1)
- Show cyan particles at corner 2 (pos2)
- Show yellow/green edge particles around the selected cuboid
- Show gray outline for other ready slots (lower intensity)
- Particles visible only to the player holding the wand
- Start particles when selection is made or wand is held
- Stop particles when player switches away or disconnects
2026-05-31 23:34:58 +02:00
8981214b18 Improve Tab completion and MineEditGui
Tab completion improvements:
- Add true/false suggestions for reset silent parameter
- Add smart leaderboard limits (5,10,15,20,25,50) for top command
- Fix permission mapping to match plugin.yml exactly
- Remove incorrect wand/group suggestions
- Add isNumericPartial() and filterStartsWith() helpers
- Reduce code from 200+ to 170 lines

MineEditGui improvements:
- Better item descriptions and lore formatting
- Show more useful information in each section
2026-05-31 23:21:33 +02:00
1daff28229 Add PlaceholderAPI integration
- Add LoMinesPlaceholderExpansion with placeholders for mines and player stats
- Available placeholders: mine_<name>_(name|blocks|total|percent|world|remaining|resettime)
- Player placeholders: player_(blocksmined|minesreset|playtime|rank)
- Global: lomines_count for total mines
- Update IntegrationManager to register/unregister expansion
- Remove Oraxen and ItemsAdder integration checks

Expansion auto-registers on initAll() and unregisters on shutdown()
2026-05-31 23:18:08 +02:00
cfaf638abf Add commands to set teleport and spawn locations from player position
New commands:
- /lm setteleport <mine> - sets teleport location to current player position
- /lm setspawn <mine> - sets safe spawn location for stuck players
- /lm clearspawn <mine> - removes spawn location, falls back to teleport

Features:
- All commands use player's current location (X, Y, Z, yaw, pitch, world)
- Auto-completion for mine names
- Separate permissions: lomines.admin.setteleport, lomines.admin.setspawn
- Permission lomines.admin includes all new permissions

Updates:
- AdminCommands.java - added three new command handlers
- Mines.java - added getFileManager() getter
- MineFileManager.java - added saveConfig() method
- LoMinesTabCompleter.java - added tab completion for new commands
- plugin.yml - added new permissions
- MineEditGui.java - shows spawn status and command hints in teleport item

Usage example:
1. Stand where you want players to teleport
2. Type: /lm setteleport mymine
3. Stand where stuck players should spawn
4. Type: /lm setspawn mymine
2026-05-31 23:11:20 +02:00
bb2e47a917 Add player-spawn config for stuck players and limit teleport height
- Add PlayerSpawnConfig for separate spawn location when players are stuck in blocks
- Add PlayerSpawnConfigLoader for YAML parsing
- Update MineConfig with playerSpawn section and getSpawnForStuckPlayer() helper
- Update ConfigLoader to include playerSpawn configuration
- Update MineFileManager to preserve playerSpawn when saving
- Update MineResetHandler.teleportPlayers() to use player-spawn location
- Update defaults.yml with player-spawn documentation

- Limit findSafeTeleportLocation() to max 3 blocks upward search
  - Priority: same level nearby, then up (max 3), then down, then diagonal
  - Prevents teleporting players too high in the air

If player-spawn is not configured, falls back to teleport.location for backward compatibility.
2026-05-31 23:03:40 +02:00
061246511b Fix ghost blocks and add safe teleport
- Add BlockUpdateUtil for sending block update packets to clients
  - sendBlockUpdate() - update single block for visible players
  - sendRegionUpdate() - batch update for cuboid regions
  - sendLocationsUpdate() - efficient update for specific positions
  - refreshChunks() - full chunk resync if needed
  - findSafeTeleportLocation() - prevents player suffocation

- Update BukkitBlockSetter to send block updates after placement
  - Prevents ghost blocks when setting many blocks quickly
  - Uses main thread for packet sending after async block placement

- Update MineResetHandler.teleportPlayers() to use safe teleport
  - Finds safe location near configured teleport destination
  - Prevents players from spawning inside blocks

Ghost blocks occur when server sets blocks without notifying clients,
causing invisible blocks or desync. Fixed by explicit packet updates.
2026-05-31 22:56:38 +02:00
3ba6f303f8 Add WorldGuard auto-region creation and split ConfigLoader
- Add WorldGuardConfig with template-based naming ({mine_name}_{random_4}, etc.)
- Add WorldGuardRegionService for creating/updating/deleting WG regions
- Add WorldGuardConfigLoader for parsing WG config from YAML
- Add configurable flags, owners, members for WG regions
- Update MineConfig to include worldGuard section
- Update Mines.java to create/delete WG regions on mine create/delete
- Update MineFileManager to load WG defaults from defaults.yml
- Split ConfigLoader into specialized loaders:
  - BlockConfigLoader, RegionConfigLoader, ResetConfigLoader
  - RewardConfigLoader, TeleportConfigLoader, UIConfigLoader
- Reduce ConfigLoader from 427 lines to 151 lines
- Update defaults.yml with WorldGuard configuration section
2026-05-31 22:39:01 +02:00
a9c8a0c323 feat(gui): add mine editor GUI system
New GUI classes:
- MineEditGui.java - main editor with navigation to sub-editors
- MineEditGuiHolder.java - inventory holder for editor
- ConfirmDeleteGui.java - confirmation dialog for mine deletion
- ConfirmDeleteGuiHolder.java - inventory holder for confirmation
- MineEditGuiListener.java - handles clicks in editor GUIs

Updated:
- AdminCommands.java - add /lm edit <mine> command
- RegistrationManager.java - register MineEditGuiListener
- plugin.yml - add lomines.admin.edit permission

Features:
- Visual editor showing mine configuration sections
- Blocks, Regions, Reset, Rewards, Teleport, UI sections
- Save and Delete actions with confirmation
- Info panel showing mine status (blocks, volume, percent)

Sub-editors (placeholder, to be implemented):
- BlockEditGui - edit block types and weights
- ResetEditGui - edit reset interval and triggers
- RewardEditGui - edit mining rewards
- TeleportEditGui - edit teleport on reset
- UIEditGui - edit action bar settings
2026-05-31 22:23:46 +02:00
8b8b9fee18 refactor(core): update all classes for new config system + add tab completion
BREAKING CHANGE: Core classes updated to use new section-based config

Updated classes:
- Mine.java - uses RegionConfig, BlockConfig, new FillMode
- Mines.java - uses new ConfigLoader.ConfigLoadException
- MineFileManager.java - creates configs with new system
- MineRepository.java - uses new ConfigLoader
- MaskScanService.java - uses BlockKey for markers
- BukkitBlockSetter.java - uses Map<BlockKey, Double>

Handlers updated:
- ActionBarHandler.java - uses UIConfig with MiniMessage
- MineBlockHandler.java - uses ResetConfig
- MineRewardHandler.java - uses RewardConfig
- MineResetHandler.java - uses new config sections

Commands updated:
- MaskCommands.java - updated exception handling

Added:
- LoMinesTabCompleter.java - Bukkit tab completion for all commands
- RegistrationManager.registerTabCompleter() - registers tab completer

Removed:
- Old ConfigLoaderTest.java (uses deprecated config system)

All classes now use:
- Type-safe BlockKey instead of String
- Section-based config (region, blocks, reset, rewards, ui, teleport)
- Duration-based intervals instead of ticks
- MiniMessage formatting for action bar
2026-05-31 22:13:50 +02:00
f1060f34d4 refactor(config): complete rewrite of configuration system
BREAKING CHANGE: New section-based configuration format

New Features:
- Type-safe BlockKey sealed interface (Vanilla, Oraxen, ItemsAdder)
- Section-based config: RegionConfig, BlockConfig, ResetConfig, RewardConfig, UIConfig, TeleportConfig
- Human-readable durations: 5m, 30s, 2h, 1d
- YAML inheritance from defaults.yml
- MiniMessage support for action bar and item names
- Immutable config records with validation

Removed:
- Legacy MineConfig (17-field god object)
- ConfigParser, ConfigValidator, ConfigSerializer split classes
- Legacy FillMode enum (replaced with better version)
- Old ConfigLoader with complex parsing logic

New Files:
- data/config/block/BlockKey.java - sealed interface for block types
- data/config/block/BlockConfig.java - type-safe block weights
- data/config/block/FillMode.java - fill strategies
- data/config/region/RegionConfig.java - region management
- data/config/reset/ResetConfig.java - reset behavior with Duration
- data/config/reward/RewardConfig.java - rewards with ItemReward
- data/config/teleport/TeleportConfig.java - teleport on reset
- data/config/ui/UIConfig.java - action bar and messages
- data/config/MineConfig.java - composed from sections
- data/config/ConfigLoader.java - clean loader with defaults inheritance
- defaults.yml - default configuration template

Tests:
- BlockKeyTest.java - serialization/deserialization
- BlockConfigTest.java - weight normalization, validation
- ResetConfigTest.java - duration parsing, defaults
- UIConfigTest.java - timer formatting, action bar
- MineConfigTest.java - builder, defaults, validation
2026-05-31 21:57:10 +02:00
f4e9458544 refactor: migrate package from com.loki to dev.loki
- Change base package from com.loki to dev.loki across all Java files
- Update plugin.yml main class path
- Fix ConfigParseException imports in test files
- Update build.gradle.kts relocate patterns
- Add missing imports in ConfigLoaderTest.java
- Update TODO.md with current status

BREAKING CHANGE: Package namespace changed from com.loki to dev.loki
2026-05-31 21:34:44 +02:00