Update from Git Manager GUI

This commit is contained in:
2026-02-21 22:24:17 +01:00
parent 201d1855fc
commit 5f8e0d3c05
6 changed files with 44 additions and 16 deletions

View File

@@ -32,7 +32,9 @@ public class DatabaseManager {
saveLocal(); saveLocal();
// Debug-Ausgabe // Debug-Ausgabe
Elevator.getInstance().getLogger().info("Aufzug hinzugefügt: " + key + " | Public: true"); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("Aufzug hinzugefügt: " + key + " | Public: true");
}
} }
public void removeElevator(Location loc) { public void removeElevator(Location loc) {
@@ -64,20 +66,26 @@ public class DatabaseManager {
// Prüfe zuerst, ob der Aufzug überhaupt existiert // Prüfe zuerst, ob der Aufzug überhaupt existiert
if (!localConfig.contains(key)) { if (!localConfig.contains(key)) {
Elevator.getInstance().getLogger().warning("isPublic: Aufzug existiert nicht: " + key); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().warning("isPublic: Aufzug existiert nicht: " + key);
}
return true; return true;
} }
// Wenn der public-Schlüssel nicht existiert, setze ihn auf true (Standard) // Wenn der public-Schlüssel nicht existiert, setze ihn auf true (Standard)
if (!localConfig.contains(fullKey)) { if (!localConfig.contains(fullKey)) {
Elevator.getInstance().getLogger().info("isPublic: Schlüssel nicht gefunden, setze auf true: " + fullKey); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("isPublic: Schlüssel nicht gefunden, setze auf true: " + fullKey);
}
localConfig.set(fullKey, true); localConfig.set(fullKey, true);
saveLocal(); saveLocal();
return true; return true;
} }
boolean value = localConfig.getBoolean(fullKey, true); boolean value = localConfig.getBoolean(fullKey, true);
Elevator.getInstance().getLogger().info("isPublic: " + fullKey + " = " + value); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("isPublic: " + fullKey + " = " + value);
}
return value; return value;
} }
@@ -87,7 +95,9 @@ public class DatabaseManager {
// Prüfe, ob der Aufzug existiert // Prüfe, ob der Aufzug existiert
if (!localConfig.contains(key)) { if (!localConfig.contains(key)) {
Elevator.getInstance().getLogger().warning("setPublic: Aufzug existiert nicht: " + key); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().warning("setPublic: Aufzug existiert nicht: " + key);
}
return; return;
} }
@@ -98,7 +108,9 @@ public class DatabaseManager {
localConfig = YamlConfiguration.loadConfiguration(localFile); localConfig = YamlConfiguration.loadConfiguration(localFile);
boolean verification = localConfig.getBoolean(fullKey, true); boolean verification = localConfig.getBoolean(fullKey, true);
Elevator.getInstance().getLogger().info("setPublic: " + fullKey + " auf " + status + " gesetzt (Verifiziert: " + verification + ")"); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("setPublic: " + fullKey + " auf " + status + " gesetzt (Verifiziert: " + verification + ")");
}
} }
private String locToKey(Location l) { private String locToKey(Location l) {
@@ -110,7 +122,9 @@ public class DatabaseManager {
private void saveLocal() { private void saveLocal() {
try { try {
localConfig.save(localFile); localConfig.save(localFile);
Elevator.getInstance().getLogger().info("Datenbank gespeichert: " + localFile.getName()); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("Datenbank gespeichert: " + localFile.getName());
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -26,6 +26,7 @@ public class Elevator extends JavaPlugin implements Listener {
private DatabaseManager databaseManager; private DatabaseManager databaseManager;
private HologramManager hologramManager; private HologramManager hologramManager;
private String latestVersionFound; private String latestVersionFound;
private boolean debugMode;
private final int RESOURCE_ID = 132220; private final int RESOURCE_ID = 132220;
private final String releaseUrl = "https://www.spigotmc.org/resources/" + RESOURCE_ID; private final String releaseUrl = "https://www.spigotmc.org/resources/" + RESOURCE_ID;
@@ -34,7 +35,8 @@ public class Elevator extends JavaPlugin implements Listener {
public void onEnable() { public void onEnable() {
instance = this; instance = this;
saveDefaultConfig(); saveDefaultConfig();
// Debug-Modus aus config laden
this.debugMode = getConfig().getBoolean("settings.debug", false);
this.databaseManager = new DatabaseManager(); this.databaseManager = new DatabaseManager();
this.hologramManager = new HologramManager(); this.hologramManager = new HologramManager();
hologramManager.purgeAllHolograms(); hologramManager.purgeAllHolograms();
@@ -152,6 +154,7 @@ public class Elevator extends JavaPlugin implements Listener {
public static Elevator getInstance() { return instance; } public static Elevator getInstance() { return instance; }
public DatabaseManager getDatabaseManager() { return databaseManager; } public DatabaseManager getDatabaseManager() { return databaseManager; }
public HologramManager getHologramManager() { return hologramManager; } public HologramManager getHologramManager() { return hologramManager; }
public boolean isDebugMode() { return debugMode; }
public ItemStack createElevatorModuleItem() { public ItemStack createElevatorModuleItem() {
ItemStack item = new ItemStack(Material.DAYLIGHT_DETECTOR); ItemStack item = new ItemStack(Material.DAYLIGHT_DETECTOR);

View File

@@ -52,7 +52,9 @@ public class ElevatorCommand implements CommandExecutor {
// Debug-Ausgabe // Debug-Ausgabe
Location modLoc = moduleBlock.getLocation(); Location modLoc = moduleBlock.getLocation();
Elevator.getInstance().getLogger().info("Command: Modul gefunden bei X:" + modLoc.getBlockX() + " Y:" + modLoc.getBlockY() + " Z:" + modLoc.getBlockZ()); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info("Command: Modul gefunden bei X:" + modLoc.getBlockX() + " Y:" + modLoc.getBlockY() + " Z:" + modLoc.getBlockZ());
}
// Berechtigungs-Check (Besitzer oder Admin) // Berechtigungs-Check (Besitzer oder Admin)
if (!db.getOwner(moduleBlock.getLocation()).equals(p.getUniqueId()) && !p.hasPermission("elevator.admin")) { if (!db.getOwner(moduleBlock.getLocation()).equals(p.getUniqueId()) && !p.hasPermission("elevator.admin")) {
@@ -82,7 +84,9 @@ public class ElevatorCommand implements CommandExecutor {
// Verifizierung // Verifizierung
boolean currentStatus = db.isPublic(modLocation); boolean currentStatus = db.isPublic(modLocation);
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat")); if (Elevator.getInstance().isDebugMode()) {
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat"));
}
return true; return true;
} }
@@ -93,7 +97,9 @@ public class ElevatorCommand implements CommandExecutor {
// Verifizierung // Verifizierung
boolean currentStatus = db.isPublic(modLocation); boolean currentStatus = db.isPublic(modLocation);
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat")); if (Elevator.getInstance().isDebugMode()) {
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat"));
}
return true; return true;
} }

View File

@@ -56,10 +56,12 @@ public class ElevatorListener implements Listener {
boolean isAdmin = player.hasPermission("elevator.admin"); boolean isAdmin = player.hasPermission("elevator.admin");
// Debug-Ausgabe // Debug-Ausgabe
Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:"); if (Elevator.getInstance().isDebugMode()) {
Elevator.getInstance().getLogger().info(" -> Public: " + isPublic); Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:");
Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner); Elevator.getInstance().getLogger().info(" -> Public: " + isPublic);
Elevator.getInstance().getLogger().info(" -> IsAdmin: " + isAdmin); Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner);
Elevator.getInstance().getLogger().info(" -> IsAdmin: " + isAdmin);
}
if (!isPublic && !isOwner && !isAdmin) { if (!isPublic && !isOwner && !isAdmin) {
player.sendMessage("§8[§bElevator§8] §cDieser Aufzug ist privat!"); player.sendMessage("§8[§bElevator§8] §cDieser Aufzug ist privat!");

View File

@@ -2,6 +2,8 @@
# Elevator Config by M_Viper # Elevator Config by M_Viper
# ============================================================= # =============================================================
debug: false # Debug-Modus (true = Debug-Ausgaben)
# Datenbank-Einstellungen (SQLite wird standardmäßig genutzt, falls false) # Datenbank-Einstellungen (SQLite wird standardmäßig genutzt, falls false)
mysql: mysql:
enable: false enable: false
@@ -17,6 +19,7 @@ settings:
hologram-duration: 45 # Wie lange das Hologramm (in Ticks) sichtbar bleibt hologram-duration: 45 # Wie lange das Hologramm (in Ticks) sichtbar bleibt
cooldown: 500 # Wartezeit zwischen Teleports (in Millisekunden) cooldown: 500 # Wartezeit zwischen Teleports (in Millisekunden)
# Optische Effekte & Hologramme # Optische Effekte & Hologramme
visuals: visuals:
enable-particles: true enable-particles: true

View File

@@ -1,5 +1,5 @@
name: Elevator name: Elevator
version: 1.5 version: 1.6
main: de.mviper.elevator.Elevator main: de.mviper.elevator.Elevator
api-version: 1.20 api-version: 1.20
author: mviper author: mviper