Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion LANBroadcaster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@


function Initialize(a_Plugin)
local port = 25565
local SettingsIni = cIniFile()
if not(SettingsIni:ReadFile("settings.ini")) then
LOGWARNING("LANBroadcaster: Could not read settings.ini! Using default port " .. port)
else
ini_port = SettingsIni:GetValue("Server", "Port")
if (ini_port == "") then
LOGWARNING("LANBroadcaster: Could not find port in settings.ini! Using default port " .. port)
else
port = ini_port
end
end

-- Open the UDP endpoint:
-- Not interested in any callbacks, we're just sending data
local Endpoint = cNetwork:CreateUDPEndpoint(0, {})
Expand All @@ -27,7 +40,7 @@ function Initialize(a_Plugin)
IsScheduled = true
-- Schedule the broadcast
local Server = cRoot:Get():GetServer()
local DatagramData = "[MOTD]" .. Server:GetDescription() .. "[/MOTD][AD]25565[/AD]"
local DatagramData = "[MOTD]" .. Server:GetDescription() .. "[/MOTD][AD]" .. port .. "[/AD]"
local Task -- Must be defined before assigning, because the function refers to itself
Task = function ()
-- Send the datagram:
Expand Down