diff --git a/Minecraft-BungeeCord-Status/minecraft-bungeecord-status.php b/Minecraft-BungeeCord-Status/minecraft-bungeecord-status.php index 77381c4..3ab9d24 100644 --- a/Minecraft-BungeeCord-Status/minecraft-bungeecord-status.php +++ b/Minecraft-BungeeCord-Status/minecraft-bungeecord-status.php @@ -1,9 +1,9 @@ '#000000', // Black + '1' => '#0000AA', // Dark Blue + '2' => '#00AA00', // Dark Green + '3' => '#00AAAA', // Dark Aqua + '4' => '#AA0000', // Dark Red + '5' => '#AA00AA', // Dark Purple + '6' => '#FFAA00', // Gold + '7' => '#AAAAAA', // Gray + '8' => '#555555', // Dark Gray + '9' => '#5555FF', // Blue + 'a' => '#55FF55', // Green + 'b' => '#55FFFF', // Aqua + 'c' => '#FF5555', // Red + 'd' => '#FF55FF', // Light Purple + 'e' => '#FFFF55', // Yellow + 'f' => '#FFFFFF' // White + ]; + + // Base Wrapper + $formatted = ''; // Standard Grau + + // Ersetze Farben: &c -> + foreach ($color_map as $char => $hex) { + $text = str_replace("&" . $char, "", $text); + } + + // Formatierungen + $text = str_replace("&l", "", $text); // Bold + $text = str_replace("&o", "", $text); // Italic + $text = str_replace("&n", "", $text); // Underline + $text = str_replace("&m", "", $text); // Strikethrough + $text = str_replace("&r", "", $text); // Reset to Gray + + $formatted .= $text . ''; + return $formatted; +} + +/* ---------------- AUTO UPDATE (MCSS) ---------------- */ +if ( ! class_exists( 'MCSS_Auto_Update' ) ) { + class MCSS_Auto_Update { + + private $plugin_file; + private $repo_owner = 'M_Viper'; + private $repo_name = 'Minecraft-BungeeCord-Status'; + private $api_url; + private $transient_key; + + public function __construct( $plugin_file ) { + $this->plugin_file = $plugin_file; + $this->api_url = 'https://git.viper.ipv64.net/api/v1/repos/' . rawurlencode( $this->repo_owner ) . '/' . rawurlencode( $this->repo_name ) . '/releases'; + $this->transient_key = 'mcss_update_check_' . md5( $this->repo_owner . '/' . $this->repo_name ); + + if ( is_admin() ) { + add_action( 'admin_init', array( $this, 'check_for_update' ) ); + } + } + + public function check_for_update() { + if ( ! function_exists( 'get_file_data' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + + $current = get_file_data( $this->plugin_file, array( 'Version' => 'Version' ), 'plugin' ); + $current_version = isset( $current['Version'] ) ? $current['Version'] : '0.0.0'; + + $latest = $this->get_latest_release_info(); + + if ( $latest && ! empty( $latest['version'] ) && ! empty( $latest['url'] ) ) { + if ( version_compare( $latest['version'], $current_version, '>' ) ) { + add_action( 'admin_notices', function() use ( $latest, $current_version ) { + ?> +
+ Minecraft BungeeCord Status – Update verfügbar
+ Neue Version:
+ Installiert:
+ Direkter Download (ZIP)
+ Releases ansehen
+
- Final: Expliziter `border: none` im Inline-Style für Wartungsmodus. + Wichtig: Bitte das Plugin StatusAPI.jar im Bungeecord Installieren.