forked from 2009Scape/Server
Added code to customize logout timer. Set to 1 hour.
This commit is contained in:
parent
f4c51dbafe
commit
13e4a0b640
1 changed files with 18 additions and 2 deletions
|
|
@ -307,8 +307,24 @@ object PacketProcessor {
|
|||
pkt.player.interfaceManager.switchWindowMode(pkt.windowMode)
|
||||
}
|
||||
is Packet.TrackingAfkTimeout -> {
|
||||
//if (pkt.player.details.rights != Rights.ADMINISTRATOR)
|
||||
//pkt.player.packetDispatch.sendLogout()
|
||||
/* After 5 minutes idle, the client sends an afk packet every 10 seconds.
|
||||
*This code counts the number of afk packets recieved, resetting the count if they are more than 100 ticks apart.
|
||||
*This allows us to customize the afk logout timer
|
||||
*/
|
||||
if (pkt.player.details.rights != Rights.ADMINISTRATOR) {
|
||||
if (GameWorld.ticks - pkt.player.getAttribute("afk:lasttick", 0) > 100) {
|
||||
pkt.player.setAttribute("afk:count", 0)
|
||||
} else {
|
||||
pkt.player.setAttribute("afk:count", pkt.player.getAttribute("afk:count", 0) + 1)
|
||||
}
|
||||
pkt.player.setAttribute("afk:lasttick", GameWorld.ticks)
|
||||
if (pkt.player.getAttribute("afk:count", 0) == 300) {
|
||||
pkt.player.sendMessage("<col=990000>You have been idle for 55 minutes and will be logged out soon.</col>")
|
||||
}
|
||||
if (pkt.player.getAttribute("afk:count", 0) >= 330) {
|
||||
pkt.player.packetDispatch.sendLogout()
|
||||
}
|
||||
}
|
||||
}
|
||||
is Packet.TrackingCameraPos -> {
|
||||
//TODO Refactor the player monitor to be actually useful and log this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue