Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47f35d77e8 | ||
|
|
f3f7afab4d | ||
|
|
a7bd93fd40 | ||
|
|
bb5f93d23f | ||
|
|
52ad98a643 |
@@ -6,20 +6,22 @@
|
||||
|
||||
<groupId>de.serverpulse</groupId>
|
||||
<artifactId>ServerPulse</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ServerPulse</name>
|
||||
<description>Monitoring & Analytics Suite – Spigot + Paper + BungeeCord (unified JAR)</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<!-- Bytecode bleibt auf 17 -> Jar läuft weiterhin auf älteren Servern (1.21.x).
|
||||
Zum Kompilieren wird aber JDK 25 benötigt, da die paper-api 26.2 Klassen
|
||||
mit Class-File-Version 25 ausliefert (siehe PaperMC Project-Setup Docs). -->
|
||||
<maven.compiler.release>17</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<!-- PaperMC: Paper API + BungeeCord API 26.1 -->
|
||||
<!-- PaperMC: Paper API (aktuell 26.2) + BungeeCord API -->
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
@@ -35,16 +37,25 @@
|
||||
<!-- ══════════════════════════════════════
|
||||
SPIGOT / PAPER API (provided)
|
||||
══════════════════════════════════════ -->
|
||||
<!-- Ab 26.1 nutzt Paper ein neues Versionsschema (Jahr.Release statt 1.xx-R0.1-SNAPSHOT).
|
||||
Der Range-Ausdruck holt sich automatisch den neuesten 26.2-Build.
|
||||
Zum Fixieren auf einen konkreten Build stattdessen z.B. 26.2.build.60-beta eintragen. -->
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<version>[26.2.build,)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- ══════════════════════════════════════
|
||||
BUNGEECORD API (provided)
|
||||
══════════════════════════════════════ -->
|
||||
<!-- TODO prüfen: ob/wann net.md-5 eine bungeecord-api 26.2-R0.1-SNAPSHOT im
|
||||
hub.spigotmc.org Snapshot-Repo veröffentlicht. Aktuell bleibt 26.1 eingetragen,
|
||||
da ich das von hier aus nicht gegen das Repo verifizieren konnte (Netzwerkzugriff
|
||||
auf hub.spigotmc.org ist mir nicht möglich). BungeeCord-Server laden Plugins auch
|
||||
ohne exakt passende API-Version, das Bungee-Modul sollte also trotzdem auf einem
|
||||
26.2-Proxy laufen - bitte einmal real testen. -->
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
@@ -148,11 +159,32 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<release>${maven.compiler.release}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Bricht den Build sofort mit klarer Meldung ab, falls nicht mit JDK 25
|
||||
gebaut wird (paper-api 26.2 Klassen haben Class-File-Version 69). -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-jdk-25</id>
|
||||
<goals><goal>enforce</goal></goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireJavaVersion>
|
||||
<version>[25,26)</version>
|
||||
<message>Dieses Projekt braucht JDK 25 zum Bauen (paper-api 26.2 Class-File-Version 69). JAVA_HOME auf JDK 25 setzen und erneut versuchen.</message>
|
||||
</requireJavaVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -25,6 +25,10 @@ public class AlertManager {
|
||||
// Standard-Cooldown: 5 Minuten
|
||||
private static final long DEFAULT_COOLDOWN_MS = 5 * 60 * 1000;
|
||||
|
||||
// Startup-Grace-Period
|
||||
private final long pluginStartTimeMs = System.currentTimeMillis();
|
||||
private final long startupGracePeriodMs;
|
||||
|
||||
// Zähler für kritische Ereignisse (für Auto-Diagnose)
|
||||
private int criticalEventCount = 0;
|
||||
|
||||
@@ -33,6 +37,7 @@ public class AlertManager {
|
||||
|
||||
public AlertManager(ServerPulse plugin) {
|
||||
this.plugin = plugin;
|
||||
this.startupGracePeriodMs = plugin.getConfigManager().getStartupCheckDelayMinutes() * 60_000L;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────
|
||||
@@ -44,6 +49,12 @@ public class AlertManager {
|
||||
*/
|
||||
public void triggerAlert(String alertType, AlertSeverity severity, String worldName,
|
||||
String message, Double currentValue, Double threshold) {
|
||||
// Startup-Grace-Period prüfen
|
||||
if (isStartupGracePeriodActive()) {
|
||||
plugin.debug("Startup-Delay aktiv: Alert unterdrückt (" + alertType + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Cooldown prüfen
|
||||
String cooldownKey = alertType + (worldName != null ? "_" + worldName : "");
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -211,4 +222,8 @@ public class AlertManager {
|
||||
public int getCriticalEventCount() {
|
||||
return criticalEventCount;
|
||||
}
|
||||
|
||||
private boolean isStartupGracePeriodActive() {
|
||||
return System.currentTimeMillis() - pluginStartTimeMs < startupGracePeriodMs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class BungeeAlertManager {
|
||||
|
||||
private final BungeePlugin plugin;
|
||||
private final long pluginStartTimeMs;
|
||||
private final long startupGracePeriodMs;
|
||||
private final Map<String, Long> cooldowns = new ConcurrentHashMap<>();
|
||||
private static final long COOLDOWN_MS = 5 * 60 * 1000L;
|
||||
|
||||
public BungeeAlertManager(BungeePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginStartTimeMs = System.currentTimeMillis();
|
||||
this.startupGracePeriodMs = plugin.getBungeeConfig().getStartupCheckDelayMinutes() * 60_000L;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +75,11 @@ public class BungeeAlertManager {
|
||||
|
||||
private void trigger(String cooldownKey, String severity,
|
||||
String serverName, String alertType, String message) {
|
||||
if (isStartupGracePeriodActive()) {
|
||||
plugin.debug("Startup-Delay aktiv: Alert unterdrückt (" + alertType + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (cooldowns.containsKey(cooldownKey)
|
||||
&& now - cooldowns.get(cooldownKey) < COOLDOWN_MS) return;
|
||||
@@ -82,4 +91,8 @@ public class BungeeAlertManager {
|
||||
plugin.getDiscordWebhook().sendServerAlert(serverName, alertType, severity, message);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStartupGracePeriodActive() {
|
||||
return System.currentTimeMillis() - pluginStartTimeMs < startupGracePeriodMs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class BungeeConfig {
|
||||
// ── General ──────────────────────────────
|
||||
public boolean isDebugMode() { return config.getBoolean("general.debug", false); }
|
||||
public int getPollInterval() { return config.getInt("general.poll-interval", 30); }
|
||||
public int getStartupCheckDelayMinutes() { return Math.max(0, config.getInt("general.startup-check-delay-minutes", 5)); }
|
||||
|
||||
// ── Discord ──────────────────────────────
|
||||
public boolean isDiscordEnabled() { return config.getBoolean("discord.enabled", false); }
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.Map;
|
||||
public class AlertManager {
|
||||
|
||||
private final SpigotPlugin plugin;
|
||||
private final long pluginStartTimeMs;
|
||||
private final long startupGracePeriodMs;
|
||||
|
||||
// Cooldown: alertType -> letzter Trigger-Zeitpunkt (ms)
|
||||
private final Map<String, Long> alertCooldowns = new HashMap<>();
|
||||
@@ -33,6 +35,8 @@ public class AlertManager {
|
||||
|
||||
public AlertManager(SpigotPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginStartTimeMs = System.currentTimeMillis();
|
||||
this.startupGracePeriodMs = plugin.getSpigotConfig().getStartupCheckDelayMinutes() * 60_000L;
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────
|
||||
@@ -44,6 +48,11 @@ public class AlertManager {
|
||||
*/
|
||||
public void triggerAlert(String alertType, AlertSeverity severity, String worldName,
|
||||
String message, Double currentValue, Double threshold) {
|
||||
if (isStartupGracePeriodActive()) {
|
||||
plugin.debug("Startup-Delay aktiv: Alert unterdrückt (" + alertType + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Cooldown prüfen
|
||||
String cooldownKey = alertType + (worldName != null ? "_" + worldName : "");
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -216,4 +225,8 @@ public class AlertManager {
|
||||
public int getCriticalEventCount() {
|
||||
return criticalEventCount;
|
||||
}
|
||||
|
||||
private boolean isStartupGracePeriodActive() {
|
||||
return System.currentTimeMillis() - pluginStartTimeMs < startupGracePeriodMs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ public class MsgUtil {
|
||||
// '─' (U+2500) ist in Minecraft's Standard-Schrift ca. 6px breit.
|
||||
// Der Chat ist ~320px breit → ~53 Zeichen.
|
||||
// Mit Prefix "[ServerPulse] " (~14 Zeichen) bleiben ~39 Zeichen übrig.
|
||||
// Wir setzen LINE_LEN daher auf 38 damit es mit Prefix in eine Zeile passt.
|
||||
private static final int LINE_LEN = 38;
|
||||
// In der Praxis wirkt die Zeile mit den Farbformatierungen etwas breiter.
|
||||
// 34 ergibt hier eine saubere Breite ohne Umbruch.
|
||||
private static final int LINE_LEN = 34;
|
||||
private static final char LINE_CHAR = '─';
|
||||
|
||||
private MsgUtil() {}
|
||||
@@ -78,22 +79,18 @@ public class MsgUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Zentrierter Header.
|
||||
* Zentrierter, symmetrischer Header.
|
||||
* Beispiel: ───── ServerPulse Status ─────
|
||||
*
|
||||
* Die Striche werden so berechnet, dass Titel + Striche = LINE_LEN ergibt.
|
||||
* Wenn der Titel zu lang ist, werden mindestens 3 Striche pro Seite gesetzt.
|
||||
*/
|
||||
public static String header(String title) {
|
||||
int available = LINE_LEN - title.length() - 2; // -2 für Leerzeichen
|
||||
int left = Math.max(3, available / 2);
|
||||
int right = Math.max(3, available - left);
|
||||
int available = Math.max(6, LINE_LEN - title.length() - 2); // -2 für Leerzeichen
|
||||
int side = Math.max(3, available / 2);
|
||||
|
||||
String l = String.valueOf(LINE_CHAR);
|
||||
return colorize(
|
||||
"&8" + l.repeat(left) +
|
||||
"&8" + l.repeat(side) +
|
||||
" &b&l" + title +
|
||||
" &8" + l.repeat(right)
|
||||
" &8" + l.repeat(side)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public class SpigotConfig {
|
||||
public boolean isDebugMode() { return cfg.getBoolean("general.debug", false); }
|
||||
public int getMetricsInterval() { return Math.max(10, cfg.getInt("general.metrics-interval", 30)); }
|
||||
public int getEntityInterval() { return Math.max(10, cfg.getInt("general.entity-interval", 60)); }
|
||||
public int getStartupCheckDelayMinutes() { return Math.max(0, cfg.getInt("general.startup-check-delay-minutes", 5)); }
|
||||
public int getDataRetentionDays() { return cfg.getInt("general.data-retention-days", 90); }
|
||||
public boolean isDatabaseEnabled() { return cfg.getBoolean("database.enabled", true); }
|
||||
public String getDbHost() { return cfg.getString("database.host", "localhost"); }
|
||||
|
||||
@@ -48,6 +48,10 @@ public class ConfigManager {
|
||||
return config.getInt("general.data-retention-days", 90);
|
||||
}
|
||||
|
||||
public int getStartupCheckDelayMinutes() {
|
||||
return Math.max(0, config.getInt("general.startup-check-delay-minutes", 5));
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────
|
||||
// DATENBANK
|
||||
// ──────────────────────────────────────────
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: ServerPulse
|
||||
version: '1.0.0'
|
||||
version: '1.0.1'
|
||||
main: de.serverpulse.bungee.BungeePlugin
|
||||
author: ServerPulse-Team
|
||||
description: ServerPulse BungeeCord Module (unified JAR)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ╔══════════════════════════════════════════╗
|
||||
# ║ ServerPulse v1.0.0 Configuration ║
|
||||
# ║ ServerPulse v1.0.2 Configuration ║
|
||||
# ║ Unified JAR – Spigot / Paper / Bungee ║
|
||||
# ╚══════════════════════════════════════════╝
|
||||
#
|
||||
@@ -11,6 +11,7 @@
|
||||
# ──────────────────────────────────────────
|
||||
general:
|
||||
debug: false
|
||||
startup-check-delay-minutes: 5 # Verzögerung nach Start, bevor Alerts/Prüfungen ausgelöst werden
|
||||
metrics-interval: 30 # Sekunden (Spigot: Performance-Erfassung)
|
||||
entity-interval: 60 # Sekunden (Spigot: Entity-Erfassung)
|
||||
poll-interval: 30 # Sekunden (BungeeCord: Daten-Weiterleitung)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
name: ServerPulse
|
||||
version: '1.0.0'
|
||||
version: '1.0.2'
|
||||
main: de.serverpulse.spigot.SpigotPlugin
|
||||
api-version: '1.21'
|
||||
api-version: '1.21' # bewusst niedrig gehalten (gültiger Bereich 1.13-26.2) -> Plugin lädt
|
||||
# auf 1.21.x GENAUSO wie auf 26.1/26.2-Servern, kein separater Build nötig
|
||||
description: Monitoring & Analytics Suite (Spigot/Paper/BungeeCord unified)
|
||||
authors: [ M_Viper ]
|
||||
prefix: ServerPulse
|
||||
|
||||
Reference in New Issue
Block a user