Files
src
build.gradle
manifest.kod
README.md
Code
13 1,394
src/main/java/com/aibotplayer/AIBotPlayer.java
package com.aibotplayer;
import com.aibotplayer.bot.BotManager;
import com.aibotplayer.command.AIBotCommand;
import com.aibotplayer.ai.ChatGPTClient;
import com.aibotplayer.listener.BotListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class AIBotPlayer extends JavaPlugin {
private BotManager botManager;
private ChatGPTClient chatGPTClient;
private ConfigManager configManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.botManager = new BotManager(this);
this.chatGPTClient = new ChatGPTClient(this);
AIBotCommand commandHandler = new AIBotCommand(this);
getCommand("aibot").setExecutor(commandHandler);
getCommand("aibot").setTabCompleter(commandHandler);
getServer().getPluginManager().registerEvents(new BotListener(this), this);
botManager.startBotTasks();
getLogger().info("AIBotPlayer успешно загружен!");
getLogger().info("Плагин AI-ботов с продвинутым PvP активирован!");
}
@Override
public void onDisable() {
if (botManager != null) {
botManager.removeAllBots();
botManager.stopBotTasks();
}
getLogger().info("AIBotPlayer выключен. Все боты удалены.");
}
public String getMessage(String path) {
return configManager.getMessage(path);
}
public String getMessage(String path, String placeholder, String value) {
return configManager.getMessage(path).replace("{" + placeholder + "}", value);
}
}