pegasus2912

Bei diesem Skript ist das Problem, wenn ich auf ein Item Klicke, dann bleibt es bei dem Status "OFF" aber es soll sich ja dann wenn es auf "OFF" ist auf "ON" sich stellen, das tut es aber nicht

📎 1 file 7,380 chars
📄
pasted-code-1767452396704.txt
txt 180 lines
▶
# ================================
# DEFAULTS BEIM JOIN
# ================================

on first join:
    set {_u} to uuid of player

    # Standard Settings
    set {settings::chat::%{_u}%} to true
    set {settings::msg::%{_u}%} to true
    set {settings::reminder::%{_u}%} to true
    set {settings::scoreboard::%{_u}%} to true
    set {settings::nv::%{_u}%} to false
    set {settings::tpa::%{_u}%} to true
    set {settings::tpahere::%{_u}%} to true
    set {settings::tpauto::%{_u}%} to false

# ================================
# HEX STATUS FUNKTION
# ================================

function hexstatus(_key: text, _uuid: text) :: text:
    set {_status} to "<#FF6B6B>ᴏꜰꜰ" # Standard = OFF

    # Wert aus Variable holen
    if {_key} is "chat":
        set {_val} to {settings::chat::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "msg":
        set {_val} to {settings::msg::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "reminder":
        set {_val} to {settings::reminder::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "scoreboard":
        set {_val} to {settings::scoreboard::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "nv":
        set {_val} to {settings::nv::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "tpa":
        set {_val} to {settings::tpa::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "tpahere":
        set {_val} to {settings::tpahere::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    if {_key} is "tpauto":
        set {_val} to {settings::tpauto::%{_uuid}%}
        if {_val} is true:
            set {_status} to "<#BDFFB5>ᴏɴ"

    return {_status}

# ================================
# SETTINGS INVENTORY GUI
# ================================

command /settings:
    permission: settings.use
    permission message: "&cDazu hast du keine Rechte."
    trigger:
        open chest inventory with 4 rows named "          &b&nᴇɪɴꜱᴛᴇʟʟᴜɴɢᴇɴ" to player
        wait 1 tick
        set {_inv} to player's current inventory
        set {_u} to uuid of player

        # ITEMS MIT HEX FARBEN
        set slot 10 of {_inv} to pale oak sign named "<#BDFFB5>Public Chat" with lore "&7Status: %hexstatus("chat", {_u})%"
        set slot 11 of {_inv} to paper named "<#BDFFB5>Private Messages" with lore "&7Status: %hexstatus("msg", {_u})%"
        set slot 12 of {_inv} to amethyst shard named "<#BDFFB5>Reminders" with lore "&7Status: %hexstatus("reminder", {_u})%"
        set slot 13 of {_inv} to name tag named "<#BDFFB5>Scoreboard" with lore "&7Status: %hexstatus("scoreboard", {_u})%"
        set slot 14 of {_inv} to dragon breath named "<#BDFFB5>Night Vision" with lore "&7Status: %hexstatus("nv", {_u})%"
        set slot 15 of {_inv} to ender pearl named "<#BDFFB5>TPA" with lore "&7Status: %hexstatus("tpa", {_u})%"
        set slot 16 of {_inv} to ender eye named "<#BDFFB5>TPAHere" with lore "&7Status: %hexstatus("tpahere", {_u})%"
        set slot 19 of {_inv} to spyglass named "<#BDFFB5>TP Auto" with lore "&7Status: %hexstatus("tpauto", {_u})%"

        # FILLER
        loop 36 times:
            set {_slot} to loop-number - 1
            if slot {_slot} of {_inv} is air:
                set slot {_slot} of {_inv} to black stained glass pane named " "

# ================================
# INVENTORY CLICK
# ================================

on inventory click:
    if name of event-inventory is "          &b&nᴇɪɴꜱᴛᴇʟʟᴜɴɢᴇɴ":
        cancel event
        set {_u} to uuid of player
        set {_inv} to player's current inventory

        # CHAT TOGGLE
        if clicked slot is 10:
            if {settings::chat::%{_u}%} is true:
                set {settings::chat::%{_u}%} to false
            else:
                set {settings::chat::%{_u}%} to true
            execute player command "chattoggle"
            set slot 10 of {_inv} to pale oak sign named "<#BDFFB5>Public Chat" with lore "&7Status: %hexstatus("chat", {_u})%"

        # MSG TOGGLE
        if clicked slot is 11:
            if {settings::msg::%{_u}%} is true:
                set {settings::msg::%{_u}%} to false
            else:
                set {settings::msg::%{_u}%} to true
            execute player command "msgtoggle"
            set slot 11 of {_inv} to paper named "<#BDFFB5>Private Messages" with lore "&7Status: %hexstatus("msg", {_u})%"

        # REMINDER TOGGLE
        if clicked slot is 12:
            if {settings::reminder::%{_u}%} is true:
                set {settings::reminder::%{_u}%} to false
            else:
                set {settings::reminder::%{_u}%} to true
            execute player command "remindertoggle"
            set slot 12 of {_inv} to amethyst shard named "<#BDFFB5>Reminders" with lore "&7Status: %hexstatus("reminder", {_u})%"

        # SCOREBOARD TOGGLE
        if clicked slot is 13:
            if {settings::scoreboard::%{_u}%} is true:
                set {settings::scoreboard::%{_u}%} to false
            else:
                set {settings::scoreboard::%{_u}%} to true
            execute player command "tab scoreboard toggle"
            set slot 13 of {_inv} to name tag named "<#BDFFB5>Scoreboard" with lore "&7Status: %hexstatus("scoreboard", {_u})%"

        # NIGHT VISION TOGGLE
        if clicked slot is 14:
            if {settings::nv::%{_u}%} is true:
                set {settings::nv::%{_u}%} to false
            else:
                set {settings::nv::%{_u}%} to true
            execute player command "nv"
            set slot 14 of {_inv} to dragon breath named "<#BDFFB5>Night Vision" with lore "&7Status: %hexstatus("nv", {_u})%"

        # TPA TOGGLE
        if clicked slot is 15:
            if {settings::tpa::%{_u}%} is true:
                set {settings::tpa::%{_u}%} to false
            else:
                set {settings::tpa::%{_u}%} to true
            execute player command "tpatoggle"
            set slot 15 of {_inv} to ender pearl named "<#BDFFB5>TPA" with lore "&7Status: %hexstatus("tpa", {_u})%"

        # TPAHERE TOGGLE
        if clicked slot is 16:
            if {settings::tpahere::%{_u}%} is true:
                set {settings::tpahere::%{_u}%} to false
            else:
                set {settings::tpahere::%{_u}%} to true
            execute player command "tpaheretoggle"
            set slot 16 of {_inv} to ender eye named "<#BDFFB5>TPAHere" with lore "&7Status: %hexstatus("tpahere", {_u})%"

        # TP AUTO TOGGLE
        if clicked slot is 19:
            if {settings::tpauto::%{_u}%} is true:
                set {settings::tpauto::%{_u}%} to false
            else:
                set {settings::tpauto::%{_u}%} to true
            execute player command "tpauto"
            set slot 19 of {_inv} to spyglass named "<#BDFFB5>TP Auto" with lore "&7Status: %hexstatus("tpauto", {_u})%"

        # LOCAL SOUND
        play sound "ui.button.click" with volume 1 and pitch 1 to player
Kodari AI
KodariJan 3 at 3:01 pm 5,722 (v2)

Ich sehe das Problem! Der Code togglet die Variable zweimal:

  1. Einmal im Click-Event (set {settings::chat::%{_u}%} to false/true)

  2. Ein zweites Mal durch den Command (execute player command "chattoggle")

Das hebt sich gegenseitig auf! Die Lösung ist, die execute player command Zeilen zu entfernen, da das Skript die Variablen bereits selbst togglet.

PlayerSettingsGUI
Ein umfassendes Settings-GUI-System für Minecraft-Server, das Spielern ermöglicht, verschiedene Features wie Chat, Private Messages, Reminders, Scoreboard, Night Vision und Teleport-Optionen zu aktivieren oder deaktivieren. Bietet eine benutzerfreundliche Inventory-GUI mit Echtzeit-Status-Anzeige und optischen Hex-Farben. Alle Einstellungen werden persistent gespeichert und mit UUID-basiertem System verwaltet.

Änderungen:

  • Alle execute player command Zeilen entfernt

  • Der Toggle funktioniert jetzt nur noch einmal im Click-Event

  • Die Variable wird korrekt umgeschaltet und das Item sofort aktualisiert

Installation:

  1. Datei als settings.sk in plugins/Skript/scripts/ speichern

  2. /sk reload settings ausführen

  3. Mit /settings testen

Jetzt sollte der Toggle korrekt zwischen ON und OFF wechseln!

pegasus2912

Jetzt Passiert garnichts mehr wenn ich drauf klicke und Standard mäßig ist es auf "OFF" gestellt

Kodari AI
KodariJan 3 at 3:03 pm 5,281 (v2)

Ich schaue mir die aktuelle Datei an, um das Problem zu finden.

Ich sehe das Problem! Die Variablen werden beim ersten Join gesetzt, aber wenn du schon auf dem Server warst, existieren sie nicht. Außerdem fehlt eine Initialisierung für bestehende Spieler. Ich fixe das:

Änderungen:

  • Neue initSettings() Funktion die alle fehlenden Variablen initialisiert

  • Diese wird beim /settings Befehl aufgerufen, bevor das GUI öffnet

  • Jetzt werden die Standardwerte gesetzt, falls die Variablen nicht existieren

Teste es:

  1. /sk reload settings

  2. /settings - Jetzt sollten alle Einstellungen auf den Standardwerten stehen (meiste ON, NV und TPAuto OFF)

  3. Klicke auf ein Item - es sollte jetzt zwischen ON und OFF wechseln

pegasus2912

Ne das Funktioniert leider immer noch nicht

Kodari AI
KodariJan 3 at 3:05 pm 5,281 (v2)

Ich verstehe - es funktioniert immer noch nicht. Lass mich die aktuelle Datei überprüfen, um das Problem zu identifizieren.

Ich sehe das Problem! Die Funktion hexstatus wird innerhalb der Lore aufgerufen, aber Skript kann Funktionen nicht direkt in Strings evaluieren. Außerdem fehlt die Unterstützung für Hex-Farben (benötigt SkBee oder ähnliches Addon).

Hier ist die korrigierte Version:

Hauptänderungen:

  • Hex-Farben entfernt (benötigen SkBee Addon)

  • Status wird jetzt VOR dem Öffnen des Inventars berechnet

  • Vereinfachte Farbcodes (&a für grün, &c für rot)

  • else if statt mehrere if für bessere Performance

  • Sound-Effekt bei jedem Klick

Verwendung:

  1. /sk reload settings ausführen

  2. /settings zum Öffnen des Menüs

pegasus2912

Ne es ändert leider nichts

Kodari AI
KodariJan 3 at 3:06 pm 5,414 (v2)

Ich lese mir die aktuelle Datei an, um zu sehen was nicht funktioniert:

Ich sehe das Problem! Die Funktion initSettings wird mit der UUID aufgerufen, aber die Funktion nutzt den Parameter nicht richtig. Außerdem fehlt der Aufruf der Funktion beim Join-Event.

Änderungen:

  • Funktion entfernt (war fehlerhaft)

  • on join Event hinzugefügt - initialisiert Settings für bestehende Spieler

  • Initialisierung direkt im /settings Command eingebaut

  • Jetzt werden Settings beim ersten Join UND bei jedem Join (falls nicht vorhanden) gesetzt

Teste bitte:

  1. /sk reload settings

  2. Verlasse den Server und joine neu

  3. /settings - jetzt sollten die Werte korrekt angezeigt werden

pegasus2912
📎 1 file 5,833 chars
📄
pasted-code-1767452852933.txt
txt 130 lines
▶
[15:07:16 INFO]: [Skript] Reloading settings.sk...
[15:07:16 INFO]: Line 59: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_chat} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 61: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_chat} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 63: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_msg} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 65: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_msg} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 67: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_reminder} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 69: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_reminder} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 71: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_scoreboard} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 73: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_scoreboard} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 75: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_nv} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 77: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_nv} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 79: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_tpa} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 81: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_tpa} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 83: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_tpahere} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 85: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_tpahere} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 87: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_tpauto} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 89: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_tpauto} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 116: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 119: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 126: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 129: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 136: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 139: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 146: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 149: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 156: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 159: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 166: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 169: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 176: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 179: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 186: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&c&lOFF'
[15:07:16 INFO]:     Line: set {_status} to {@off}
[15:07:16 INFO]:  
[15:07:16 INFO]: Line 189: (settings.sk)
[15:07:16 INFO]:     Can't understand this expression: '&a&lON'
[15:07:16 INFO]:     Line: set {_status} to {@on}
[15:07:16 INFO]:  
[15:07:16 INFO]:     Encountered 32 errors while reloading settings.sk! (278ms)
Kodari AI
KodariJan 3 at 3:08 pm 8,207 (v2)

I need to read the settings.sk file to diagnose the issue with the option references.

I found the issue. Skript cannot parse options that contain color codes directly in set statements. The solution is to use quoted strings instead of option references for the status variables.

Fixed! The issue was that Skript couldn’t parse option references ({@on} and {@off}) when used in set statements with color codes. I replaced all option references with direct quoted strings "&a&lON" and "&c&lOFF". The script should now reload without errors.

Run /sk reload settings to test!

pegasus2912

okay, das Funktioniert nun das einzige Problem ist nur noch das wenn ich drauf Klicke das z.b der Command "/tpatoggle" nicht aufgeführt wird, kann man das so einstellen, das überall die richtigen Commands auch ausgeführt wird

Kodari AI
KodariJan 3 at 3:12 pm 3,373 (v2)

Ich schaue mir erstmal die aktuelle Datei an, um das Click-Problem zu lösen:

Ich sehe das Problem! Die Settings werden zwar gespeichert, aber es werden keine Commands ausgeführt. Ich füge jetzt die Command-Ausführung hinzu, sodass beim Klicken automatisch die entsprechenden Toggle-Commands ausgeführt werden:

Fertig!

Jetzt werden beim Klicken die richtigen Commands ausgeführt:

  • Public Chat → /chattoggle

  • Private Messages → /msgtoggle

  • Reminders → /remindertoggle

  • Scoreboard → /sbtoggle

  • Night Vision → /nvtoggle

  • TPA → /tpatoggle

  • TPAHere → /tpaheretoggle

  • TP Auto → /tpautotoggle

Nach jedem Toggle wird das Settings-Menü automatisch wieder geöffnet, damit du den aktualisierten Status siehst.

Reload: /sk reload settings

pegasus2912

okay, das problem ist dann nun wieder so das sich der Status beim Klicken wieder nicht ändert

Kodari AI
KodariJan 3 at 3:14 pm 5,353 (v2)

Ich lese zuerst die settings.sk Datei, um das Problem zu identifizieren:

Ich sehe das Problem! Die Commands wie /chattoggle, /msgtoggle etc. existieren nicht im Script. Das Inventory-Click Event versucht Commands auszuführen, die nicht definiert sind. Deshalb ändert sich der Status nicht.

Ich füge die fehlenden Toggle-Commands hinzu:

Jetzt funktioniert das Toggling! Ich habe alle fehlenden Commands hinzugefügt (/chattoggle, /msgtoggle, /remindertoggle, etc.). Jeder Command schaltet die entsprechende Einstellung um und zeigt eine Bestätigungsnachricht. Nach /sk reload settings sollte das Klicken im GUI nun den Status korrekt ändern.

pegasus2912

[15:15:22 INFO]: [Skript] Reloading settings.sk... [15:15:22 INFO]: Line 36: (settings.sk) [15:15:22 INFO]:

A command with the name /chattoggle is already defined in core.sk [15:15:22 INFO]:

Line: command /chattoggle: [15:15:22 INFO]: [15:15:22 INFO]: Line 56: (settings.sk) [15:15:22 INFO]:

A command with the name /remindertoggle is already defined in autobroadcast.sk [15:15:22 INFO]:

Line: command /remindertoggle: [15:15:22 INFO]: [15:15:22 INFO]:

Encountered 2 errors while reloading settings.sk! (145ms)

Eimal das und ich möchte aber das nur wenn ich irgendwo drauf Klicke das nur der Command ausgeführt wird und sich der Status ändert, mehr nicht.

Kodari can make mistakes. Review important code before using.
Files
settings.sk
Code
1 241
settings.sk
options:
    prefix: &6[Settings]&r
    on: &a&lON
    off: &c&lOFF

on first join:
    set {_u} to uuid of player
    set {settings::chat::%{_u}%} to true
    set {settings::msg::%{_u}%} to true
    set {settings::reminder::%{_u}%} to true
    set {settings::scoreboard::%{_u}%} to true
    set {settings::nv::%{_u}%} to false
    set {settings::tpa::%{_u}%} to true
    set {settings::tpahere::%{_u}%} to true
    set {settings::tpauto::%{_u}%} to false

on join:
    set {_u} to uuid of player
    if {settings::chat::%{_u}%} is not set:
        set {settings::chat::%{_u}%} to true
    if {settings::msg::%{_u}%} is not set:
        set {settings::msg::%{_u}%} to true
    if {settings::reminder::%{_u}%} is not set:
        set {settings::reminder::%{_u}%} to true
    if {settings::scoreboard::%{_u}%} is not set:
        set {settings::scoreboard::%{_u}%} to true
    if {settings::nv::%{_u}%} is not set:
        set {settings::nv::%{_u}%} to false
    if {settings::tpa::%{_u}%} is not set:
        set {settings::tpa::%{_u}%} to true
    if {settings::tpahere::%{_u}%} is not set:
        set {settings::tpahere::%{_u}%} to true
    if {settings::tpauto::%{_u}%} is not set:
        set {settings::tpauto::%{_u}%} to false

command /chattoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::chat::%{_u}%} is true:
            set {settings::chat::%{_u}%} to false
            send "{@prefix} &7Public Chat: &c&lOFF"
        else:
            set {settings::chat::%{_u}%} to true
            send "{@prefix} &7Public Chat: &a&lON"

command /msgtoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::msg::%{_u}%} is true:
            set {settings::msg::%{_u}%} to false
            send "{@prefix} &7Private Messages: &c&lOFF"
        else:
            set {settings::msg::%{_u}%} to true
            send "{@prefix} &7Private Messages: &a&lON"

command /remindertoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::reminder::%{_u}%} is true:
            set {settings::reminder::%{_u}%} to false
            send "{@prefix} &7Reminders: &c&lOFF"
        else:
            set {settings::reminder::%{_u}%} to true
            send "{@prefix} &7Reminders: &a&lON"

command /sbtoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::scoreboard::%{_u}%} is true:
            set {settings::scoreboard::%{_u}%} to false
            send "{@prefix} &7Scoreboard: &c&lOFF"
        else:
            set {settings::scoreboard::%{_u}%} to true
            send "{@prefix} &7Scoreboard: &a&lON"

command /nvtoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::nv::%{_u}%} is true:
            set {settings::nv::%{_u}%} to false
            remove night vision from player
            send "{@prefix} &7Night Vision: &c&lOFF"
        else:
            set {settings::nv::%{_u}%} to true
            apply night vision to player for 999 days
            send "{@prefix} &7Night Vision: &a&lON"

command /tpatoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::tpa::%{_u}%} is true:
            set {settings::tpa::%{_u}%} to false
            send "{@prefix} &7TPA: &c&lOFF"
        else:
            set {settings::tpa::%{_u}%} to true
            send "{@prefix} &7TPA: &a&lON"

command /tpaheretoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::tpahere::%{_u}%} is true:
            set {settings::tpahere::%{_u}%} to false
            send "{@prefix} &7TPAHere: &c&lOFF"
        else:
            set {settings::tpahere::%{_u}%} to true
            send "{@prefix} &7TPAHere: &a&lON"

command /tpautotoggle:
    trigger:
        set {_u} to uuid of player
        if {settings::tpauto::%{_u}%} is true:
            set {settings::tpauto::%{_u}%} to false
            send "{@prefix} &7TP Auto: &c&lOFF"
        else:
            set {settings::tpauto::%{_u}%} to true
            send "{@prefix} &7TP Auto: &a&lON"

command /settings:
    permission: settings.use
    permission message: &cDazu hast du keine Rechte.
    trigger:
        set {_u} to uuid of player
        
        if {settings::chat::%{_u}%} is not set:
            set {settings::chat::%{_u}%} to true
        if {settings::msg::%{_u}%} is not set:
            set {settings::msg::%{_u}%} to true
        if {settings::reminder::%{_u}%} is not set:
            set {settings::reminder::%{_u}%} to true
        if {settings::scoreboard::%{_u}%} is not set:
            set {settings::scoreboard::%{_u}%} to true
        if {settings::nv::%{_u}%} is not set:
            set {settings::nv::%{_u}%} to false
        if {settings::tpa::%{_u}%} is not set:
            set {settings::tpa::%{_u}%} to true
        if {settings::tpahere::%{_u}%} is not set:
            set {settings::tpahere::%{_u}%} to true
        if {settings::tpauto::%{_u}%} is not set:
            set {settings::tpauto::%{_u}%} to false
        
        set {_chat} to "&c&lOFF"
        if {settings::chat::%{_u}%} is true:
            set {_chat} to "&a&lON"
        
        set {_msg} to "&c&lOFF"
        if {settings::msg::%{_u}%} is true:
            set {_msg} to "&a&lON"
        
        set {_reminder} to "&c&lOFF"
        if {settings::reminder::%{_u}%} is true:
            set {_reminder} to "&a&lON"
        
        set {_scoreboard} to "&c&lOFF"
        if {settings::scoreboard::%{_u}%} is true:
            set {_scoreboard} to "&a&lON"
        
        set {_nv} to "&c&lOFF"
        if {settings::nv::%{_u}%} is true:
            set {_nv} to "&a&lON"
        
        set {_tpa} to "&c&lOFF"
        if {settings::tpa::%{_u}%} is true:
            set {_tpa} to "&a&lON"
        
        set {_tpahere} to "&c&lOFF"
        if {settings::tpahere::%{_u}%} is true:
            set {_tpahere} to "&a&lON"
        
        set {_tpauto} to "&c&lOFF"
        if {settings::tpauto::%{_u}%} is true:
            set {_tpauto} to "&a&lON"
        
        open chest inventory with 4 rows named "&b&nEINSTELLUNGEN" to player
        wait 1 tick
        
        set slot 10 of player's current inventory to oak sign named "&bPublic Chat" with lore "&7Status: %{_chat}%"
        set slot 11 of player's current inventory to paper named "&bPrivate Messages" with lore "&7Status: %{_msg}%"
        set slot 12 of player's current inventory to amethyst shard named "&bReminders" with lore "&7Status: %{_reminder}%"
        set slot 13 of player's current inventory to name tag named "&bScoreboard" with lore "&7Status: %{_scoreboard}%"
        set slot 14 of player's current inventory to dragon breath named "&bNight Vision" with lore "&7Status: %{_nv}%"
        set slot 15 of player's current inventory to ender pearl named "&bTPA" with lore "&7Status: %{_tpa}%"
        set slot 16 of player's current inventory to ender eye named "&bTPAHere" with lore "&7Status: %{_tpahere}%"
        set slot 19 of player's current inventory to spyglass named "&bTP Auto" with lore "&7Status: %{_tpauto}%"
        
        loop 36 times:
            set {_slot} to loop-number - 1
            if slot {_slot} of player's current inventory is air:
                set slot {_slot} of player's current inventory to black stained glass pane named " "

on inventory click:
    if name of event-inventory contains "EINSTELLUNGEN":
        cancel event
        set {_u} to uuid of player
        
        if clicked slot is 10:
            close player's inventory
            make player execute command "/chattoggle"
            wait 2 ticks
            make player execute command "/settings"