Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f8e0d3c05 | |||
| 201d1855fc | |||
| e19de4b638 | |||
| 90d66b6e96 |
2
pom.xml
2
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.mviper</groupId>
|
||||
<artifactId>Elevator</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
|
||||
@@ -32,7 +32,9 @@ public class DatabaseManager {
|
||||
saveLocal();
|
||||
|
||||
// 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) {
|
||||
@@ -64,20 +66,26 @@ public class DatabaseManager {
|
||||
|
||||
// Prüfe zuerst, ob der Aufzug überhaupt existiert
|
||||
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;
|
||||
}
|
||||
|
||||
// Wenn der public-Schlüssel nicht existiert, setze ihn auf true (Standard)
|
||||
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);
|
||||
saveLocal();
|
||||
return 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;
|
||||
}
|
||||
|
||||
@@ -87,7 +95,9 @@ public class DatabaseManager {
|
||||
|
||||
// Prüfe, ob der Aufzug existiert
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -98,7 +108,9 @@ public class DatabaseManager {
|
||||
localConfig = YamlConfiguration.loadConfiguration(localFile);
|
||||
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) {
|
||||
@@ -110,7 +122,9 @@ public class DatabaseManager {
|
||||
private void saveLocal() {
|
||||
try {
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class Elevator extends JavaPlugin implements Listener {
|
||||
private DatabaseManager databaseManager;
|
||||
private HologramManager hologramManager;
|
||||
private String latestVersionFound;
|
||||
private boolean debugMode;
|
||||
|
||||
private final int RESOURCE_ID = 132220;
|
||||
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() {
|
||||
instance = this;
|
||||
saveDefaultConfig();
|
||||
|
||||
// Debug-Modus aus config laden
|
||||
this.debugMode = getConfig().getBoolean("settings.debug", false);
|
||||
this.databaseManager = new DatabaseManager();
|
||||
this.hologramManager = new HologramManager();
|
||||
hologramManager.purgeAllHolograms();
|
||||
@@ -152,6 +154,7 @@ public class Elevator extends JavaPlugin implements Listener {
|
||||
public static Elevator getInstance() { return instance; }
|
||||
public DatabaseManager getDatabaseManager() { return databaseManager; }
|
||||
public HologramManager getHologramManager() { return hologramManager; }
|
||||
public boolean isDebugMode() { return debugMode; }
|
||||
|
||||
public ItemStack createElevatorModuleItem() {
|
||||
ItemStack item = new ItemStack(Material.DAYLIGHT_DETECTOR);
|
||||
|
||||
@@ -52,7 +52,9 @@ public class ElevatorCommand implements CommandExecutor {
|
||||
|
||||
// Debug-Ausgabe
|
||||
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)
|
||||
if (!db.getOwner(moduleBlock.getLocation()).equals(p.getUniqueId()) && !p.hasPermission("elevator.admin")) {
|
||||
@@ -82,7 +84,9 @@ public class ElevatorCommand implements CommandExecutor {
|
||||
|
||||
// Verifizierung
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -93,7 +97,9 @@ public class ElevatorCommand implements CommandExecutor {
|
||||
|
||||
// Verifizierung
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,10 +56,12 @@ public class ElevatorListener implements Listener {
|
||||
boolean isAdmin = player.hasPermission("elevator.admin");
|
||||
|
||||
// Debug-Ausgabe
|
||||
Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:");
|
||||
Elevator.getInstance().getLogger().info(" -> Public: " + isPublic);
|
||||
Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner);
|
||||
Elevator.getInstance().getLogger().info(" -> IsAdmin: " + isAdmin);
|
||||
if (Elevator.getInstance().isDebugMode()) {
|
||||
Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:");
|
||||
Elevator.getInstance().getLogger().info(" -> Public: " + isPublic);
|
||||
Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner);
|
||||
Elevator.getInstance().getLogger().info(" -> IsAdmin: " + isAdmin);
|
||||
}
|
||||
|
||||
if (!isPublic && !isOwner && !isAdmin) {
|
||||
player.sendMessage("§8[§bElevator§8] §cDieser Aufzug ist privat!");
|
||||
@@ -277,9 +279,6 @@ public class ElevatorListener implements Listener {
|
||||
boolean isOwner = db.getOwner(loc).equals(p.getUniqueId());
|
||||
boolean isAdmin = p.hasPermission("elevator.admin");
|
||||
|
||||
// Debug
|
||||
Elevator.getInstance().getLogger().info("Permission-Check für " + p.getName() + ": Public=" + isPublic + ", Owner=" + isOwner + ", Admin=" + isAdmin);
|
||||
|
||||
return isPublic || isOwner || isAdmin;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Elevator Config by M_Viper
|
||||
# =============================================================
|
||||
|
||||
debug: false # Debug-Modus (true = Debug-Ausgaben)
|
||||
|
||||
# Datenbank-Einstellungen (SQLite wird standardmäßig genutzt, falls false)
|
||||
mysql:
|
||||
enable: false
|
||||
@@ -17,6 +19,7 @@ settings:
|
||||
hologram-duration: 45 # Wie lange das Hologramm (in Ticks) sichtbar bleibt
|
||||
cooldown: 500 # Wartezeit zwischen Teleports (in Millisekunden)
|
||||
|
||||
|
||||
# Optische Effekte & Hologramme
|
||||
visuals:
|
||||
enable-particles: true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Elevator
|
||||
version: 1.5
|
||||
version: 1.6
|
||||
main: de.mviper.elevator.Elevator
|
||||
api-version: 1.20
|
||||
author: mviper
|
||||
|
||||
Reference in New Issue
Block a user