lobbyconfig.sk

Created by iCodeDreams

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

options:
    Noperms: &cYou do not have permission to that command!




#===============================================================================#
import:
    java.util.Arrays
    org.bukkit.event.server.TabCompleteEvent
#===============================================================================#
effect set completions to %strings% at %string%:
    trigger:
        if expression-2 is "":
            event.setCompletions(Arrays.asList(expressions-1))
        else:
            set {_completions::*} to expressions-1
            loop expression-2.length() times:
                loop {_completions::*}:
                    if {_completions::%loop-index%}.substring(loop-number - 1, and loop-number) isn't expression-2.substring(loop-number - 1, and loop-number):
                        clear {_completions::%loop-index%} 
            event.setCompletions(Arrays.asList({_completions::*}))
#===============================================================================#
expression tabbed command:
    get:
        set {_text} to first element out of split event.getBuffer() at " "
        return "/%{_text}%" if event.getSender() is CONSOLE else {_text}
#===============================================================================#
expression tab arg[ument]( |-)%*number%:
    get:
        set {_l::*} to split event.getBuffer() at " "
        clear {_l::1}
        set {_l::*} to {_l::*}
        return {_l::%expr 1%}
#===============================================================================#
expression buffer:
    get:
        return event.getBuffer()
#===============================================================================#
on TabCompleteEvent:
    if tabbed command is "/lobby" or "/hub":
        if tab arg 2 isn't set:
            set completions to "reload" or "info" at tab arg 1

on join:
    if {Lobby::JoinMessage} is not "":
        set {_temp} to {Lobby::JoinMessage}
        replace all "[PLAYER]" with "%player%" in {_temp}
        set join message to "%{_temp}%" 
    teleport player to location at {Lobby::X}, {Lobby::Y}, {Lobby::Z} in world {Lobby::World}
    if {Lobby::PrivateMessage::1} is not "":
        send colored {Lobby::PrivateMessage}
    if {Lobby::JoinTitle} is not "":
        wait 8 seconds
        if {Lobby::JoinSubtitle} is not "":
            send title "%{Lobby::JoinTitle}%" with subtitle "%{Lobby::JoinSubtitle}%" to player for 5 seconds
        else:
            send title "%{Lobby::JoinTitle}%" to player for 5 seconds


on quit:
    if {Lobby::QuitMessage} is not "":
        set {_temp} to {Lobby::QuitMessage}
        replace all "[PLAYER]" with "%player%" in {_temp}
        set quit message to "%{_temp}%"


command sendallhub:
    description: Sends Everyone to the Server Hub!
    usage: /sendallhub
    permission: command.sendallhub
    permission message: {@Noperms}
    executable by: players and console
    trigger:
        send "%{Lobby::SendAllHub}%" to player
        wait 0.5 second
        if {debug.mode.lobby} is true:
            send "&r[&aDebug&r] &6Lobby: &rTeleporting &eALL PLAYERS &rto Server Lobby! &9(%{Lobby::X}%&9, %{Lobby::Y}%&9, %{Lobby::Z}%&9 in world %{Lobby::World}%&9)" to console
        loop all players:
            teleport loop-players to location at {Lobby::X}, {Lobby::Y}, {Lobby::Z} in world {Lobby::World}
            send "%{Lobby::Teleport}%" to loop-player

command sendhub [<offline player>]:
    description: Sends the Specified Player to the Server Hub!
    usage: /sendhub [Player]
    permission: command.sendhub
    permission message: {@Noperms}
    executable by: players and console
    trigger:
        if arg-1 is not set:
            send "&c[Error] &7Correct Usage: &e/sendhub [player]"
        if arg-1 is set:
            if arg-1 is offline player:
                teleport arg-1 to location at {Lobby::X}, {Lobby::Y}, {Lobby::Z} in world {Lobby::World}
                send "%{Lobby::Teleport}%" to arg-1 
                replace all "[PLAYER]" with "%arg-1%" in {Lobby::SendPlayerHub}
                send "%{Lobby::SendPlayerHub}%"
                if {debug.mode.lobby} is true:
                    send "&r[&aDebug&r] &6Lobby: &rTeleporting &e%arg-1% &rto Server Lobby! &9(%{Lobby::X}%&9, %{Lobby::Y}%&9, %{Lobby::Z}%&9 in world %{Lobby::World}%&9)" to console
            else:
                send "&7That player has never joined!"

command lobby [<text>] [<text>]:
    usage: /lobby [Reload / Info]
    permission: command.lobby
    permission message: {@Noperms}
    executable by: players and console
    aliases: lobby, hub, spawn
    trigger:
        if arg-1 is set:
            if player has permission "command.lobby.admin":
                if arg-1 is "Reload":
                    if file "plugins/iCodeDevelopment" is missing:
                        create directory "plugins/iCodeDevelopment/"
                    if file "plugins/iCodeDevelopment/Lobby" is missing:
                        create directory "plugins/iCodeDevelopment/Lobby"
                    if {ServerID} is not set:
                        set {ServerID} to random 20 char string from charset `a-zA-Z0-9`

                    if file "plugins/iCodeDevelopment/Lobby/config.json" is missing:
                        download file from "https://raw.githubusercontent.com/iCodeDreamsMC/Lobby/master/config.json" to file "plugins/iCodeDevelopment/Lobby/config.json"
                    wait 2 ticks
                    set line 3 in file "plugins/iCodeDevelopment/Lobby/config.json" to "    ""Version"": ""1.0"","
                    set line 4 in file "plugins/iCodeDevelopment/Lobby/config.json" to "    ""ServerID"": ""%{ServerID}%"","

                

                    set {_contents::*} to file contents of "plugins/iCodeDevelopment/Lobby/config.json"
                    set {_content} to concat {_contents::*} with nl
                    set {_input} to {_content}
                    copy json {_input} to {_output::*}
                    set {Lobby::Prefix} to colored {_output::Prefix} 
                    set {Lobby::Version} to {_output::Version}
                    set {Lobby::ServerID} to {_output::ServerID}
                    set {Lobby::AdminID} to {_output::AdminID}
                    set {Lobby::Debug} to {_output::Debug}
                    if {Lobby::Debug} is true:
                        set {debug.mode.lobby} to true
                    if {Lobby::Debug} is false:
                        set {debug.mode.lobby} to false

                    set {Lobby::Rank-Placeholder} to {_output::Rank-Placeholder}
                    set {Lobby::X} to {_output::Lobby::X}
                    set {Lobby::Y} to {_output::Lobby::Y}
                    set {Lobby::Z} to {_output::Lobby::Z}
                    set {Lobby::Yaw} to {_output::Lobby::YAW} parsed as number
                    set {Lobby::Pitch} to {_output::Lobby::PITCH} parsed as number
                    set {Lobby::World} to "%{_output::Lobby::WORLD}%" parsed as world
                    
                    set {Lobby::JoinMessage} to colored {_output::PlayerJoin::Message}

                    set {Lobby::PrivateMessage::*} to {_output::PlayerJoin::PrivateMessage::*}
                    set {Lobby::PrivateMessage} to concat {Lobby::PrivateMessage::*}  with formatted nl

                    set {Lobby::JoinTitle} to colored {_output::PlayerJoin::Title}
                    set {Lobby::JoinSubtitle} to colored {_output::PlayerJoin::Subtitle}

                    set {Lobby::QuitMessage} to colored {_output::PlayerQuit::Message}

                    set {Lobby::Reload-Message} to colored {_output::Messages::Reload} 
                    set {Lobby::Teleport} to colored {_output::Messages::Teleport} 

                    set {Lobby::SendPlayerHub} to colored {_output::Messages::SendPlayerHub} 
                    set {Lobby::SendAllHub} to colored {_output::Messages::SendAllHub} 

                    send "%{Lobby::Prefix}%%{Lobby::Reload-Message}%" to player
                    send "%{Lobby::Prefix}%%{Lobby::Reload-Message}%" to console


                if arg-1 is "Info":
                    set {_contents1::*} to contents from url "https://raw.githubusercontent.com/iCodeDreamsMC/Lobby/master/api.json"
                    set {_content1} to concat {_contents1::*} with nl
                    set {_input1} to {_content1}
                    copy json {_input1} to {_output1::*}
                    set {_output1::LatestVersion} to {_output1::LatestVersion}
                    send "&3&m&l======================&b&m&l======================"
                    send ""
                    send "                             &b&lLOBBY &3&lSKRIPT"
                    send "                   &8Created by: %{_output1::Author}%"
                    send ""
                    send "             &7Server: &r%bukkit version% (%skript version%)"
                    if {_output1::LatestVersion} = {Lobby::Version}:
                        send "                               &7Version: &r%{Lobby::Version}%"
                    else:
                        send "             &7Version: &r%{Lobby::Version}% &c&lOUTDATED! &8(New Version %{_output1::LatestVersion}%&8)"
                    send ""
                    send "&b&m&l======================&3&m&l======================"

                        
                else if arg-1 is not "Reload" or "Info":
                    send "&c[Error] &7Correct Usage: &e/lobby [Reload / Info]"
            else:
                send "&cYou do not have permission to run this command!"
        else:
            teleport player to location at {Lobby::X}, {Lobby::Y}, {Lobby::Z} in world {Lobby::World}
            send "%{Lobby::Teleport}%"
            if {debug.mode.lobby} is true:
                send "&r[&aDebug&r] &6Lobby: &rTeleporting &e%player% &rto Server Lobby! &9(%{Lobby::X}%&9, %{Lobby::Y}%&9, %{Lobby::Z}%&9 in world %{Lobby::World}%&9)" to console