sex
This commit is contained in:
39
Packets/Network/SpeedRestoreRequestPacket.cs
Normal file
39
Packets/Network/SpeedRestoreRequestPacket.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using KCM.Attributes;
|
||||
using KCM.Packets.Game;
|
||||
using System;
|
||||
|
||||
namespace KCM.Packets.Network
|
||||
{
|
||||
[NoServerRelay]
|
||||
public class SpeedRestoreRequestPacket : Packet
|
||||
{
|
||||
public override ushort packetId => (ushort)Enums.Packets.SpeedRestoreRequest;
|
||||
|
||||
public string reason { get; set; }
|
||||
|
||||
public override void HandlePacketClient()
|
||||
{
|
||||
}
|
||||
|
||||
public override void HandlePacketServer()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!KCServer.IsRunning)
|
||||
return;
|
||||
|
||||
int speed = Main.LastNonZeroSpeedIndex;
|
||||
if (speed <= 0)
|
||||
speed = 1;
|
||||
|
||||
Main.helper.Log($"Speed restore requested by client {clientId} ({reason ?? string.Empty}); broadcasting speed {speed}");
|
||||
new SetSpeed { speed = speed }.SendToAll();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.helper.Log("Error handling SpeedRestoreRequestPacket on server");
|
||||
Main.helper.Log(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user