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
61 lines
2.3 KiB
Java
61 lines
2.3 KiB
Java
package dev.loki.lomines;
|
|
|
|
import dev.loki.lomines.command.AdminCommands;
|
|
import dev.loki.lomines.command.LoMinesTabCompleter;
|
|
import dev.loki.lomines.command.MaskCommands;
|
|
import dev.loki.lomines.command.PlayerCommands;
|
|
import dev.loki.lomines.command.StatsCommands;
|
|
import dev.loki.lomines.integration.IntegrationManager;
|
|
import dev.loki.lomines.listener.BlockBreakListener;
|
|
import dev.loki.lomines.listener.GroupGuiListener;
|
|
import dev.loki.lomines.listener.PlayerInteractListener;
|
|
import dev.loki.lomines.listener.PlayerJoinListener;
|
|
import dev.lolib.commands.CommandManager;
|
|
|
|
/**
|
|
* Handles registration of commands, listeners, and integrations.
|
|
*/
|
|
final class RegistrationManager {
|
|
|
|
private final LoMinesPlugin plugin;
|
|
|
|
RegistrationManager(LoMinesPlugin plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
void registerCommands(CommandManager commandManager) {
|
|
commandManager.register(new AdminCommands(plugin));
|
|
commandManager.register(new PlayerCommands(plugin));
|
|
commandManager.register(new StatsCommands(plugin));
|
|
commandManager.register(new MaskCommands(plugin));
|
|
|
|
plugin.loLogger().info("Commands registered");
|
|
}
|
|
|
|
void registerTabCompleter() {
|
|
LoMinesTabCompleter tabCompleter = new LoMinesTabCompleter(plugin);
|
|
plugin.getCommand("lm").setTabCompleter(tabCompleter);
|
|
plugin.getCommand("lomines").setTabCompleter(tabCompleter);
|
|
plugin.getCommand("mine").setTabCompleter(tabCompleter);
|
|
plugin.getCommand("mines").setTabCompleter(tabCompleter);
|
|
|
|
plugin.loLogger().info("Tab completer registered");
|
|
}
|
|
|
|
void registerListeners() {
|
|
plugin.getServer().getPluginManager().registerEvents(new BlockBreakListener(plugin), plugin);
|
|
plugin.getServer().getPluginManager().registerEvents(new PlayerInteractListener(plugin), plugin);
|
|
plugin.getServer().getPluginManager().registerEvents(new GroupGuiListener(plugin), plugin);
|
|
|
|
if (plugin.getConfig().getBoolean("statistics-enabled", true)) {
|
|
plugin.getServer().getPluginManager().registerEvents(new PlayerJoinListener(plugin), plugin);
|
|
}
|
|
|
|
plugin.loLogger().info("Event listeners registered");
|
|
}
|
|
|
|
void initializeIntegrations(IntegrationManager integrationManager) {
|
|
integrationManager.initAll();
|
|
plugin.loLogger().info("Integrations initialized");
|
|
}
|
|
}
|