Update all code styles

This commit is contained in:
Cooldude2606
2024-09-28 01:56:54 +01:00
parent 5e2a62ab27
commit 292c1a1b68
194 changed files with 9817 additions and 9703 deletions

View File

@@ -30,20 +30,20 @@ local function get_server_id(server)
end
if server_count > 1 then
return false, Commands.error{'expcom-connect.too-many-matching', concat(server_names, ', ')}
return false, Commands.error{ "expcom-connect.too-many-matching", concat(server_names, ", ") }
elseif server_count == 1 then
local server_id, server_details = next(servers)
local status = External.get_server_status(server_id)
if server_id == current_server.id then
return false, Commands.error{'expcom-connect.same-server', server_details.name}
elseif status == 'Offline' then
return false, Commands.error{'expcom-connect.offline', server_details.name}
return false, Commands.error{ "expcom-connect.same-server", server_details.name }
elseif status == "Offline" then
return false, Commands.error{ "expcom-connect.offline", server_details.name }
end
return true, server_id
elseif server_count_before > 0 then
return false, Commands.error{'expcom-connect.wrong-version', concat(server_names_before, ', ')}
return false, Commands.error{ "expcom-connect.wrong-version", concat(server_names_before, ", ") }
else
return false, Commands.error{'expcom-connect.none-matching'}
return false, Commands.error{ "expcom-connect.none-matching" }
end
end
@@ -51,57 +51,57 @@ end
-- @command connect
-- @tparam string server The address or name of the server to connect to
-- @tparam[opt=false] boolean is_address If an address was given for the server param
Commands.new_command('connect', {'expcom-connect.description'}, 'Connect to another server')
:add_param('server')
:add_param('is_address', true, 'boolean')
:add_alias('join', 'server')
:register(function(player, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
Commands.new_command("connect", { "expcom-connect.description" }, "Connect to another server")
:add_param("server")
:add_param("is_address", true, "boolean")
:add_alias("join", "server")
:register(function(player, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
Async(request_connection, player, server_id, true)
end)
Async(request_connection, player, server_id, true)
end)
--- Connect a player to a different server
-- @command connect-player
-- @tparam string address The address or name of the server to connect to
-- @tparam LuaPlayer player The player to connect to a different server
-- @tparam[opt=false] boolean is_address If an address was given for the server param
Commands.new_command('connect-player', {'expcom-connect.description-player'}, 'Send a player to a different server')
:add_param('player', 'player-role')
:add_param('server')
:add_param('is_address', true, 'boolean')
:register(function(_, player, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
Commands.new_command("connect-player", { "expcom-connect.description-player" }, "Send a player to a different server")
:add_param("player", "player-role")
:add_param("server")
:add_param("is_address", true, "boolean")
:register(function(_, player, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
External.request_connection(player, server_id)
end)
External.request_connection(player, server_id)
end)
--- Connect all players to a different server
-- @command connect-all
-- @tparam string address The address or name of the server to connect to
-- @tparam[opt=false] boolean is_address If an address was given for the server param
Commands.new_command('connect-all', {'expcom-connect.description-all'}, 'Connect all players to another server')
:add_param('server')
:add_param('is_address', true, 'boolean')
:register(function(_, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
Commands.new_command("connect-all", { "expcom-connect.description-all" }, "Connect all players to another server")
:add_param("server")
:add_param("is_address", true, "boolean")
:register(function(_, server, is_address)
local server_id = server
if not is_address and External.valid() then
local success, new_server_id = get_server_id(server)
if not success then return new_server_id end
server_id = new_server_id
end
for _, player in pairs(game.connected_players) do
External.request_connection(player, server_id)
end
end)
for _, player in pairs(game.connected_players) do
External.request_connection(player, server_id)
end
end)