Update from Git Manager GUI

This commit is contained in:
2026-01-24 17:03:48 +01:00
parent 4c847401a0
commit 1db87e81f0
13 changed files with 1077 additions and 265 deletions

View File

@@ -13,6 +13,7 @@ import de.nexuslobby.modules.settings.LobbySettingsModule;
import de.nexuslobby.modules.portal.PortalManager;
import de.nexuslobby.modules.portal.PortalCommand;
import de.nexuslobby.modules.servers.ServerSwitcherListener;
import de.nexuslobby.modules.servers.ServerChecker; // Hinzugefügt
import de.nexuslobby.modules.armorstandtools.*;
import de.nexuslobby.modules.gadgets.GadgetModule;
import de.nexuslobby.modules.hologram.HologramModule;
@@ -29,18 +30,23 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class NexusLobby extends JavaPlugin implements Listener {
@@ -56,17 +62,29 @@ public class NexusLobby extends JavaPlugin implements Listener {
private MapArtModule mapArtModule;
private IntroModule introModule;
private BorderModule borderModule;
private ConversationManager conversationManager;
private File visualsFile;
private FileConfiguration visualsConfig;
private boolean updateAvailable = false;
private String latestVersion = "";
private final Set<UUID> silentPlayers = new HashSet<>();
public static NexusLobby getInstance() {
return instance;
}
public Set<UUID> getSilentPlayers() {
return silentPlayers;
}
public ConversationManager getConversationManager() {
return conversationManager;
}
@Override
public void onEnable() {
instance = this;
@@ -76,12 +94,21 @@ public class NexusLobby extends JavaPlugin implements Listener {
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
moduleManager = new ModuleManager(this);
this.conversationManager = new ConversationManager(this);
ArmorStandGUI.init();
registerModules();
moduleManager.enableAll();
registerListeners();
// --- STATUS CHECKER START ---
ServerChecker.startGlobalChecker();
new ArmorStandLookAtModule();
startAutoConversationTimer();
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new NexusLobbyExpansion().register();
getLogger().info("NexusLobby PAPI Expansion registriert.");
@@ -93,24 +120,51 @@ public class NexusLobby extends JavaPlugin implements Listener {
getLogger().info("NexusLobby v" + getDescription().getVersion() + " wurde erfolgreich gestartet.");
}
private void checkUpdates() {
new UpdateChecker(this).getVersion(version -> {
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
this.updateAvailable = true;
this.latestVersion = version;
getLogger().warning("====================================================");
getLogger().warning("Update gefunden! v" + getDescription().getVersion() + " -> v" + version);
getLogger().warning("Autor: M_Viper");
getLogger().warning("====================================================");
} else {
getLogger().info("NexusLobby ist aktuell (v" + version + ").");
private void startAutoConversationTimer() {
new BukkitRunnable() {
@Override
public void run() {
if (conversationManager == null) return;
for (World world : Bukkit.getWorlds()) {
for (ArmorStand as : world.getEntitiesByClass(ArmorStand.class)) {
if (as.getScoreboardTags().stream().anyMatch(tag -> tag.startsWith("conv_id:"))) {
boolean playerNearby = false;
for (Entity nearby : as.getNearbyEntities(30, 30, 30)) {
if (nearby instanceof Player) {
playerNearby = true;
break;
}
}
if (playerNearby) {
String dialogId = null;
String partnerUUID = null;
for (String tag : as.getScoreboardTags()) {
if (tag.startsWith("conv_id:")) dialogId = tag.split(":")[1];
if (tag.startsWith("conv_partner:")) partnerUUID = tag.split(":")[1];
}
if (dialogId != null && partnerUUID != null) {
try {
UUID partnerId = UUID.fromString(partnerUUID);
conversationManager.playConversation(as.getUniqueId(), partnerId, dialogId);
} catch (Exception ignored) {}
}
}
}
}
}
}
});
}.runTaskTimer(this, 20L * 30, 20L * 90);
}
public void reloadPlugin() {
getLogger().info("Plugin Reload wird gestartet...");
Bukkit.getScheduler().cancelTasks(this);
if (moduleManager != null) {
moduleManager.disableAll();
}
@@ -119,8 +173,11 @@ public class NexusLobby extends JavaPlugin implements Listener {
visualsConfig = null;
reloadVisualsConfig();
Config.load();
if (conversationManager != null) {
conversationManager.setupFile();
}
// Border-Settings nach Config-Reload synchronisieren
if (borderModule != null) {
borderModule.reloadConfig();
}
@@ -128,15 +185,34 @@ public class NexusLobby extends JavaPlugin implements Listener {
if (portalManager != null) {
portalManager.loadPortals();
}
ArmorStandGUI.init();
if (moduleManager != null) {
moduleManager.enableAll();
}
ServerChecker.startGlobalChecker();
new ArmorStandLookAtModule();
startAutoConversationTimer();
getLogger().info("Plugin Reload abgeschlossen. Änderungen wurden übernommen.");
}
private void checkUpdates() {
new UpdateChecker(this).getVersion(version -> {
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
this.updateAvailable = true;
this.latestVersion = version;
getLogger().warning("====================================================");
getLogger().warning("Update gefunden! v" + getDescription().getVersion() + " -> v" + version);
getLogger().warning("====================================================");
} else {
getLogger().info("NexusLobby ist aktuell (v" + version + ").");
}
});
}
private void registerModules() {
moduleManager.registerModule(new ProtectionModule());
moduleManager.registerModule(new ScoreboardModule());
@@ -153,6 +229,8 @@ public class NexusLobby extends JavaPlugin implements Listener {
this.dynamicArmorStandModule = new DynamicArmorStandModule();
moduleManager.registerModule(this.dynamicArmorStandModule);
moduleManager.registerModule(new ArmorStandStatusModule());
this.mapArtModule = new MapArtModule();
moduleManager.registerModule(this.mapArtModule);
@@ -191,7 +269,6 @@ public class NexusLobby extends JavaPlugin implements Listener {
Player player = event.getPlayer();
event.setJoinMessage(null);
// Teleport zum Lobby-Spawn beim Beitreten
teleportToSpawn(player);
player.getInventory().clear();
@@ -214,7 +291,7 @@ public class NexusLobby extends JavaPlugin implements Listener {
TextComponent link = new TextComponent("§8» §6Klicke §e§l[HIER] §6zum Herunterladen.");
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://git.viper.ipv64.net/M_Viper/NexusLobby/releases"));
link.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder("§7Öffnet die Gitea Release-Seite").create()));
new ComponentBuilder("§7Öffnet die Release-Seite").create()));
player.spigot().sendMessage(link);
player.sendMessage(" ");
@@ -241,37 +318,26 @@ public class NexusLobby extends JavaPlugin implements Listener {
}
private void initCustomConfigs() {
if (!getDataFolder().exists()) {
getDataFolder().mkdirs();
}
if (!getDataFolder().exists()) getDataFolder().mkdirs();
File configFile = new File(getDataFolder(), "config.yml");
if (!configFile.exists()) {
saveResource("config.yml", false);
}
if (!configFile.exists()) saveResource("config.yml", false);
reloadConfig();
File settingsFile = new File(getDataFolder(), "settings.yml");
if (!settingsFile.exists()) {
saveResource("settings.yml", false);
}
if (!settingsFile.exists()) saveResource("settings.yml", false);
visualsFile = new File(getDataFolder(), "visuals.yml");
if (!visualsFile.exists()) {
saveResource("visuals.yml", false);
}
if (!visualsFile.exists()) saveResource("visuals.yml", false);
reloadVisualsConfig();
Config.load();
}
public void reloadVisualsConfig() {
if (visualsFile == null) {
visualsFile = new File(getDataFolder(), "visuals.yml");
}
if (visualsFile == null) visualsFile = new File(getDataFolder(), "visuals.yml");
visualsConfig = YamlConfiguration.loadConfiguration(visualsFile);
getLogger().info("visuals.yml erfolgreich geladen.");
}
public FileConfiguration getVisualsConfig() {
@@ -290,22 +356,19 @@ public class NexusLobby extends JavaPlugin implements Listener {
LobbyTabCompleter tabCompleter = new LobbyTabCompleter(portalManager, hologramModule);
NexusLobbyCommand nexusCommand = new NexusLobbyCommand();
PluginCommand portalCmd = this.getCommand("portal");
if (portalCmd != null) {
portalCmd.setExecutor(new PortalCommand(portalManager));
portalCmd.setTabCompleter(tabCompleter);
if (getCommand("portal") != null) {
getCommand("portal").setExecutor(new PortalCommand(portalManager));
getCommand("portal").setTabCompleter(tabCompleter);
}
PluginCommand holoCmd = this.getCommand("holo");
if (holoCmd != null) {
holoCmd.setExecutor(new HoloCommand(hologramModule));
holoCmd.setTabCompleter(tabCompleter);
if (getCommand("holo") != null) {
getCommand("holo").setExecutor(new HoloCommand(hologramModule));
getCommand("holo").setTabCompleter(tabCompleter);
}
PluginCommand maintenanceCmd = this.getCommand("maintenance");
if (maintenanceCmd != null) {
maintenanceCmd.setExecutor(new MaintenanceCommand());
maintenanceCmd.setTabCompleter(tabCompleter);
if (getCommand("maintenance") != null) {
getCommand("maintenance").setExecutor(new MaintenanceCommand());
getCommand("maintenance").setTabCompleter(tabCompleter);
}
if (getCommand("giveportalwand") != null) getCommand("giveportalwand").setExecutor(new GivePortalToolCommand(this));
@@ -322,32 +385,28 @@ public class NexusLobby extends JavaPlugin implements Listener {
getCommand("nexuscmd").setTabCompleter(tabCompleter);
}
// Haupt- und Spawn-Befehl Registrierung (NexusLobbyCommand verarbeitet beides)
PluginCommand nexusCmd = this.getCommand("nexuslobby");
if (nexusCmd != null) {
nexusCmd.setExecutor(nexusCommand);
nexusCmd.setTabCompleter(tabCompleter);
if (getCommand("nexuslobby") != null) {
getCommand("nexuslobby").setExecutor(nexusCommand);
getCommand("nexuslobby").setTabCompleter(tabCompleter);
}
PluginCommand spawnCmd = this.getCommand("spawn");
if (spawnCmd != null) {
spawnCmd.setExecutor(nexusCommand);
spawnCmd.setTabCompleter(tabCompleter);
if (getCommand("spawn") != null) {
getCommand("spawn").setExecutor(nexusCommand);
getCommand("spawn").setTabCompleter(tabCompleter);
}
if (getCommand("mapart") != null) getCommand("mapart").setTabCompleter(tabCompleter);
if (getCommand("intro") != null) getCommand("intro").setTabCompleter(tabCompleter);
PluginCommand borderCmd = this.getCommand("border");
if (borderCmd != null) {
borderCmd.setExecutor(new BorderCommand());
borderCmd.setTabCompleter(tabCompleter);
if (getCommand("border") != null) {
getCommand("border").setExecutor(new BorderCommand());
getCommand("border").setTabCompleter(tabCompleter);
}
}
public class NexusLobbyExpansion extends PlaceholderExpansion {
@Override public @NotNull String getIdentifier() { return "nexuslobby"; }
@Override public @NotNull String getAuthor() { return String.join(", ", NexusLobby.this.getDescription().getAuthors()); }
@Override public @NotNull String getAuthor() { return "M_Viper"; }
@Override public @NotNull String getVersion() { return NexusLobby.this.getDescription().getVersion(); }
@Override public boolean persist() { return true; }
@@ -357,15 +416,18 @@ public class NexusLobby extends JavaPlugin implements Listener {
if (params.equalsIgnoreCase("maintenance_status")) return MaintenanceListener.isMaintenance() ? "§cAktiv" : "§aDeaktiviert";
if (params.equalsIgnoreCase("version")) return NexusLobby.this.getDescription().getVersion();
if (params.equalsIgnoreCase("build_mode")) return BuildCommand.isInBuildMode(player) ? "§aAktiv" : "§cInaktiv";
if (params.equalsIgnoreCase("silent_join")) return silentPlayers.contains(player.getUniqueId()) ? "§aEin" : "§cAus";
return null;
}
}
public ModuleManager getModuleManager() { return moduleManager; }
public PortalManager getPortalManager() { return portalManager; } // Hinzugefügt/Wiederhergestellt
public TablistModule getTablistModule() { return tablistModule; }
public LobbySettingsModule getLobbySettingsModule() { return lobbySettingsModule; }
public ItemsModule getItemsModule() { return itemsModule; }
public GadgetModule getGadgetModule() { return gadgetModule; }
public HologramModule getHologramModule() { return hologramModule; }
public DynamicArmorStandModule getDynamicArmorStandModule() { return dynamicArmorStandModule; }
public MapArtModule getMapArtModule() { return mapArtModule; } // Wiederhergestellt
}