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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.mviper</groupId>
|
<groupId>de.mviper</groupId>
|
||||||
<artifactId>Elevator</artifactId>
|
<artifactId>Elevator</artifactId>
|
||||||
<version>1.5</version>
|
<version>1.6</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ public class DatabaseManager {
|
|||||||
saveLocal();
|
saveLocal();
|
||||||
|
|
||||||
// Debug-Ausgabe
|
// Debug-Ausgabe
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("Aufzug hinzugefügt: " + key + " | Public: true");
|
Elevator.getInstance().getLogger().info("Aufzug hinzugefügt: " + key + " | Public: true");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void removeElevator(Location loc) {
|
public void removeElevator(Location loc) {
|
||||||
localConfig.set(locToKey(loc), null);
|
localConfig.set(locToKey(loc), null);
|
||||||
@@ -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)) {
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().warning("isPublic: Aufzug existiert nicht: " + key);
|
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)) {
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("isPublic: Schlüssel nicht gefunden, setze auf true: " + fullKey);
|
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);
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("isPublic: " + fullKey + " = " + value);
|
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)) {
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().warning("setPublic: Aufzug existiert nicht: " + key);
|
Elevator.getInstance().getLogger().warning("setPublic: Aufzug existiert nicht: " + key);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +108,10 @@ public class DatabaseManager {
|
|||||||
localConfig = YamlConfiguration.loadConfiguration(localFile);
|
localConfig = YamlConfiguration.loadConfiguration(localFile);
|
||||||
boolean verification = localConfig.getBoolean(fullKey, true);
|
boolean verification = localConfig.getBoolean(fullKey, true);
|
||||||
|
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("setPublic: " + fullKey + " auf " + status + " gesetzt (Verifiziert: " + verification + ")");
|
Elevator.getInstance().getLogger().info("setPublic: " + fullKey + " auf " + status + " gesetzt (Verifiziert: " + verification + ")");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String locToKey(Location l) {
|
private String locToKey(Location l) {
|
||||||
// Wichtig: Nutze getBlockX/Y/Z für konsistente Koordinaten
|
// Wichtig: Nutze getBlockX/Y/Z für konsistente Koordinaten
|
||||||
@@ -110,7 +122,9 @@ public class DatabaseManager {
|
|||||||
private void saveLocal() {
|
private void saveLocal() {
|
||||||
try {
|
try {
|
||||||
localConfig.save(localFile);
|
localConfig.save(localFile);
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("Datenbank gespeichert: " + localFile.getName());
|
Elevator.getInstance().getLogger().info("Datenbank gespeichert: " + localFile.getName());
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ public class ElevatorCommand implements CommandExecutor {
|
|||||||
|
|
||||||
// Debug-Ausgabe
|
// Debug-Ausgabe
|
||||||
Location modLoc = moduleBlock.getLocation();
|
Location modLoc = moduleBlock.getLocation();
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("Command: Modul gefunden bei X:" + modLoc.getBlockX() + " Y:" + modLoc.getBlockY() + " Z:" + modLoc.getBlockZ());
|
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);
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat"));
|
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);
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat"));
|
p.sendMessage("§8[Debug] Aktueller Status nach Änderung: " + (currentStatus ? "§aÖffentlich" : "§cPrivat"));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
if (Elevator.getInstance().isDebugMode()) {
|
||||||
Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:");
|
Elevator.getInstance().getLogger().info("Spieler " + player.getName() + " interagiert mit Aufzug:");
|
||||||
Elevator.getInstance().getLogger().info(" -> Public: " + isPublic);
|
Elevator.getInstance().getLogger().info(" -> Public: " + isPublic);
|
||||||
Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner);
|
Elevator.getInstance().getLogger().info(" -> IsOwner: " + isOwner);
|
||||||
Elevator.getInstance().getLogger().info(" -> IsAdmin: " + isAdmin);
|
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!");
|
||||||
@@ -277,9 +279,6 @@ public class ElevatorListener implements Listener {
|
|||||||
boolean isOwner = db.getOwner(loc).equals(p.getUniqueId());
|
boolean isOwner = db.getOwner(loc).equals(p.getUniqueId());
|
||||||
boolean isAdmin = p.hasPermission("elevator.admin");
|
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;
|
return isPublic || isOwner || isAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user