S

mache ein plugin das wen eins ausgeht automatisch mit /plugman reloade neu startet und wenn das gemavcht wird wird eine warung an alles gesndet das das system neu geladen wird 1.21.5 paper

Kodari AI
KodariMay 11 at 11:55 am 6,759 (v2)

I’ll create a plugin watchdog that automatically reloads crashed plugins using PlugMan.

PluginWatchdog
Automatically monitors and reloads plugins that crash or stop unexpectedly using PlugMan integration. When a monitored plugin goes down, the system broadcasts a warning to all players and automatically attempts to reload the plugin. Features configurable plugin monitoring lists, customizable warning messages, reload delays, and admin commands for manual control. Designed for Paper 1.21.5 servers.

PluginWatchdog erstellt!

Das Plugin überwacht automatisch andere Plugins und startet sie mit PlugMan neu, wenn sie abstürzen:

Features:

  • ✅ Erkennt automatisch wenn überwachte Plugins deaktiviert werden

  • ✅ Sendet Warnungen an alle Spieler vor dem Reload

  • ✅ Führt /plugman reload <plugin> automatisch aus

  • ✅ Konfigurierbare Plugin-Liste zur Überwachung

  • ✅ Deutsche Nachrichten mit Farb-Codes

  • ✅ Admin-Befehle zur Verwaltung

Befehle:

  • /watchdog list - Zeigt überwachte Plugins

  • /watchdog add <plugin> - Plugin zur Überwachung hinzufügen

  • /watchdog remove <plugin> - Plugin entfernen

  • /watchdog toggle - System an/ausschalten

  • /watchdog reload <plugin> - Manueller Reload

Wichtig: Das Plugin benötigt PlugMan als Dependency! Füge überwachte Plugins in der config.yml unter monitored-plugins hinzu.

Kodari can make mistakes. Review important code before using.
Files
src
.gitignore
build.gradle
settings.gradle
Code
9 424
src/main/java/com/pluginwatchdog/PluginWatchdog.java
package com.pluginwatchdog;

import com.pluginwatchdog.command.WatchdogCommand;
import com.pluginwatchdog.listener.PluginMonitorListener;
import com.pluginwatchdog.manager.ReloadManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class PluginWatchdog extends JavaPlugin {
    
    private ReloadManager reloadManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.reloadManager = new ReloadManager(this);
        
        getServer().getPluginManager().registerEvents(new PluginMonitorListener(this), this);
        
        if (getCommand("watchdog") != null) {
            getCommand("watchdog").setExecutor(new WatchdogCommand(this));
        }
        
        getLogger().info("PluginWatchdog wurde aktiviert!");
        
        if (getServer().getPluginManager().getPlugin("PlugMan") == null) {
            getLogger().warning("PlugMan wurde nicht gefunden! Plugin-Reloads werden nicht funktionieren.");
        }
    }
    
    @Override
    public void onDisable() {
        getLogger().info("PluginWatchdog wurde deaktiviert!");
    }
    
    public String getMessage(String key) {
        String prefix = getConfig().getString("messages.prefix", "&8[&6Watchdog&8]&r");
        String message = getConfig().getString("messages." + key, key);
        return colorize(prefix + " " + message);
    }
    
    public String getMessageRaw(String key) {
        String message = getConfig().getString("messages." + key, key);
        return colorize(message);
    }
    
    public String colorize(String text) {
        return text.replace("&", "§");
    }
}