chore: update .gitignore and build.gradle.kts for local server testing
- Added entries to .gitignore for local Paper test server and API documentation. - Included the run-paper plugin in build.gradle.kts for local server execution. - Configured runServer task with Minecraft version 1.21.4 for testing.
This commit is contained in:
parent
d1d2b93742
commit
2d79d2a91d
260 changed files with 4808 additions and 3847 deletions
|
|
@ -1,20 +1,14 @@
|
|||
package com.loki.lochat;
|
||||
|
||||
import com.loki.lochat.api.service.IgnoreService;
|
||||
import com.loki.lochat.api.service.MuteService;
|
||||
import com.loki.lochat.api.service.NickService;
|
||||
import com.loki.lochat.commands.*;
|
||||
import com.loki.lochat.api.service.PunishmentService;
|
||||
import com.loki.lochat.commands.CommandManager;
|
||||
import com.loki.lochat.config.ConfigManager;
|
||||
import com.loki.lochat.config.MessageConfig;
|
||||
import com.loki.lochat.core.PluginInitializer;
|
||||
import com.loki.lochat.core.PluginShutdown;
|
||||
import com.loki.lochat.core.registry.ServiceRegistry;
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.integrations.DiscordIntegration;
|
||||
import com.loki.lochat.integrations.LibertyBansHook;
|
||||
import com.loki.lochat.integrations.PlaceholderAPIHook;
|
||||
import com.loki.lochat.core.filter.AdvancedMessageFilter;
|
||||
import com.loki.lochat.listener.ChatEventListener;
|
||||
import com.loki.lochat.listener.DiscordEventListener;
|
||||
import com.loki.lochat.listener.PlayerEventListener;
|
||||
import com.loki.lochat.managers.AutoMessageManager;
|
||||
import com.loki.lochat.managers.CustomCommandManager;
|
||||
import org.bukkit.Bukkit;
|
||||
|
|
@ -27,6 +21,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||
public final class LoChat extends JavaPlugin {
|
||||
|
||||
private static LoChat instance;
|
||||
|
||||
// Основные компоненты
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private ConfigManager configManager;
|
||||
private MessageConfig messageConfig;
|
||||
|
|
@ -35,115 +31,51 @@ public final class LoChat extends JavaPlugin {
|
|||
private CustomCommandManager customCommandManager;
|
||||
private DiscordIntegration discordIntegration;
|
||||
private CommandManager commandManager;
|
||||
private AdvancedMessageFilter advancedMessageFilter;
|
||||
|
||||
// Геттеры
|
||||
public static LoChat getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// Вспомогательные классы
|
||||
private PluginInitializer initializer;
|
||||
private PluginShutdown shutdown;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
getLogger().info("Загрузка LoChat v" + getPluginMeta().getVersion() + " для Paper/Folia " + Bukkit.getMinecraftVersion() + "...");
|
||||
|
||||
// Инициализация
|
||||
initializer = new PluginInitializer(this);
|
||||
shutdown = new PluginShutdown(this);
|
||||
|
||||
// Конфиги
|
||||
configManager = new ConfigManager(this);
|
||||
messageConfig = new MessageConfig(this);
|
||||
|
||||
// Service Registry (SOLID DI) - с зависимостями
|
||||
serviceRegistry = ServiceRegistry.createWithDeps(this, configManager, messageConfig);
|
||||
getLogger().info("ServiceRegistry инициализирован (SOLID DI)");
|
||||
|
||||
configManager = initializer.initConfigs();
|
||||
messageConfig = initializer.initMessageConfig();
|
||||
|
||||
// Service Registry (SOLID DI)
|
||||
serviceRegistry = initializer.initServiceRegistry(configManager, messageConfig);
|
||||
|
||||
// Менеджеры
|
||||
customCommandManager = CustomCommandManager.create(this);
|
||||
autoMessageManager = new AutoMessageManager(this);
|
||||
|
||||
customCommandManager = initializer.initCustomCommandManager();
|
||||
autoMessageManager = initializer.initAutoMessageManager();
|
||||
|
||||
// Интеграции
|
||||
initIntegrations();
|
||||
|
||||
discordIntegration = initializer.initDiscordIntegration();
|
||||
gradientModule = initializer.initGradientModule();
|
||||
initializer.initIntegrations(discordIntegration, gradientModule);
|
||||
|
||||
// Команды и слушатели
|
||||
commandManager = new CommandManager(this);
|
||||
commandManager.registerCommands();
|
||||
registerListeners();
|
||||
registerPluginChannels();
|
||||
|
||||
initializer.registerListeners(serviceRegistry, discordIntegration);
|
||||
initializer.registerPluginChannels();
|
||||
|
||||
// Автосообщения
|
||||
autoMessageManager.start();
|
||||
|
||||
|
||||
getLogger().info("LoChat успешно запущен!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (autoMessageManager != null) autoMessageManager.stop();
|
||||
|
||||
// Сохраняем статистику
|
||||
com.loki.lochat.api.service.PlayerDataService pds = serviceRegistry.get(com.loki.lochat.api.service.PlayerDataService.class);
|
||||
if (pds != null) pds.saveAll();
|
||||
|
||||
// Сохранение данных через сервисы
|
||||
IgnoreService ignoreService = serviceRegistry.get(IgnoreService.class);
|
||||
if (ignoreService != null) ignoreService.save();
|
||||
|
||||
MuteService muteService = serviceRegistry.get(MuteService.class);
|
||||
if (muteService != null) muteService.save();
|
||||
|
||||
NickService nickService = serviceRegistry.get(NickService.class);
|
||||
if (nickService != null) nickService.save();
|
||||
|
||||
// Останавливаем Discord executor
|
||||
if (discordIntegration != null) discordIntegration.shutdown();
|
||||
|
||||
if (gradientModule != null) gradientModule.shutdown();
|
||||
getLogger().info("LoChat отключен!");
|
||||
}
|
||||
|
||||
private void initIntegrations() {
|
||||
// Discord интеграция
|
||||
discordIntegration = new DiscordIntegration(this);
|
||||
|
||||
// Gradient модуль
|
||||
gradientModule = new GradientModule(this);
|
||||
if (gradientModule.init()) {
|
||||
getLogger().info("Gradient модуль (LoPreff) загружен!");
|
||||
}
|
||||
|
||||
// LibertyBans
|
||||
new LibertyBansHook(this);
|
||||
|
||||
// PlaceholderAPI
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
new PlaceholderAPIHook(this).register();
|
||||
getLogger().info("PlaceholderAPI подключен!");
|
||||
}
|
||||
}
|
||||
|
||||
// Старый метод регистрации команд - заменен на CommandManager
|
||||
/*
|
||||
private void registerCommands() {
|
||||
// Код перенесен в CommandManager для лучшей организации
|
||||
}
|
||||
*/
|
||||
|
||||
private void registerListeners() {
|
||||
// Создаём один экземпляр фильтра и передаём в оба листенера — flood/spam трекеры общие
|
||||
advancedMessageFilter = new AdvancedMessageFilter(getConfig(), this);
|
||||
getServer().getPluginManager().registerEvents(new ChatEventListener(this, serviceRegistry, advancedMessageFilter), this);
|
||||
getServer().getPluginManager().registerEvents(new PlayerEventListener(serviceRegistry, advancedMessageFilter), this);
|
||||
|
||||
// Discord listener
|
||||
if (discordIntegration.isEnabled()) {
|
||||
getServer().getPluginManager().registerEvents(new DiscordEventListener(discordIntegration), this);
|
||||
getLogger().info("Discord event listener registered");
|
||||
}
|
||||
|
||||
getLogger().info("Слушатели зарегистрированы (новая архитектура)");
|
||||
}
|
||||
|
||||
private void registerPluginChannels() {
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
getLogger().info("BungeeCord plugin messaging channel registered");
|
||||
shutdown.shutdown(serviceRegistry, autoMessageManager, discordIntegration, gradientModule);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
|
|
@ -153,6 +85,17 @@ public final class LoChat extends JavaPlugin {
|
|||
if (gradientModule != null) gradientModule.reload();
|
||||
if (customCommandManager != null) customCommandManager.reload();
|
||||
if (discordIntegration != null) discordIntegration.reload();
|
||||
if (serviceRegistry != null) {
|
||||
try {
|
||||
serviceRegistry.get(PunishmentService.class).save();
|
||||
} catch (IllegalStateException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Геттеры
|
||||
public static LoChat getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public ServiceRegistry getServiceRegistry() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue