-
Notifications
You must be signed in to change notification settings - Fork 4
Callbacks
Ligustah edited this page Mar 15, 2011
·
9 revisions
Called for each packet arriving.
global function onPacket(packet)
{
switch(packet.packetID)
{
case PacketID.Login:
writefln $ "mapSeed: {}", packet.mapSeed
break
case PacketID.Handshake:
writeln $ "received handshake"
break;
default:
break;
}
}
Called when a connection to a server is established.
global function onConnect(host, port)
{
writefln $ "i am connected to {}:{}", host, port
}
Called when the connection is closed.
global function onDisconnect()
{
writeln $ "damn, i got disconnected"
}