CubeRealm - Simple Join Command

Ajoute une commande /join <mode> <region> pour rejoindre un serveur CubeRealm

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         CubeRealm - Simple Join Command
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Ajoute une commande /join <mode> <region> pour rejoindre un serveur CubeRealm
// @match        https://cuberealm.io/*
// @match        https://www.cuberealm.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Fonction de redirection
    function joinServer(mode, region) {
        const url = `https://cuberealm.io/?mode=${encodeURIComponent(mode)}&region=${encodeURIComponent(region)}`;
        window.location.href = url;
    }

    // Détection du chat (nouveau système CubeRealm)
    document.addEventListener("keydown", function(e) {
        if (e.key !== "Enter") return;

        const input = document.querySelector("input[maxlength='100'], textarea");
        if (!input) return;

        const msg = input.value.trim();

        if (msg.startsWith("/join ")) {
            const parts = msg.split(" ");
            if (parts.length === 3) {
                const mode = parts[1];
                const region = parts[2];
                joinServer(mode, region);
            }
            input.value = "";
        }
    });
})();