Remove debug messages

Allow plugins to read if position is being ignored
This commit is contained in:
Goodlyay 2024-02-27 22:13:06 -08:00
parent 2e53a1390f
commit 3a72699e30
2 changed files with 4 additions and 11 deletions

View File

@ -265,13 +265,7 @@ namespace MCGalaxy.Network
// Client-> server ping, immediately send reply.
Send(Packet.TwoWayPing(false, data));
} else {
bool debugIgnoredCached = Ping.IgnorePosition;
Ping.UnIgnorePosition(data);
if (debugIgnoredCached == true && !Ping.IgnorePosition) {
player.Message("Position no longer being ignored, received {0}", data);
}
// Server -> client ping, set time received for reply.
Ping.Update(data);
}
@ -387,7 +381,6 @@ namespace MCGalaxy.Network
if (!hasTwoWayPing || id != Entities.SelfID) { return; }
ushort data = Ping.NextTwoWayPingData(true);
SendTwoWayPing(data);
player.Message("Now ignoring your position until {0}", data);
}
public override void SendRemoveEntity(byte id) {

View File

@ -38,14 +38,14 @@ namespace MCGalaxy.Network
long ignorePositionData = -1;
internal bool IgnorePosition {
public bool IgnorePosition {
get { return Interlocked.Read(ref ignorePositionData) >= 0; }
}
public void UnIgnorePosition(ushort data) {
internal void UnIgnorePosition(ushort data) {
Interlocked.CompareExchange(ref ignorePositionData, -1, data);
}
public ushort NextTwoWayPingData(bool waitingForMovementAcknowledged = false) {
public ushort NextTwoWayPingData(bool startIgnoringPosition = false) {
int pingValue = Interlocked.Increment(ref pingCounter);
int pingHead = (Interlocked.Increment(ref nextPingHead) - 1) % 10;
@ -53,7 +53,7 @@ namespace MCGalaxy.Network
Entries[pingHead].TimeRecv = default(DateTime);
Entries[pingHead].TimeSent = DateTime.UtcNow;
if (waitingForMovementAcknowledged) Interlocked.Exchange(ref ignorePositionData, pingValue);
if (startIgnoringPosition) Interlocked.Exchange(ref ignorePositionData, pingValue);
return (ushort)pingValue;
}