Commit graph

4 commits

Author SHA1 Message Date
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
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
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
Renamed from src/main/java/com/loki/lomines/handler/MineResetHandler.java (Browse further)