mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Remove debug messages
Allow plugins to read if position is being ignored
This commit is contained in:
parent
2e53a1390f
commit
3a72699e30
@ -265,13 +265,7 @@ namespace MCGalaxy.Network
|
|||||||
// Client-> server ping, immediately send reply.
|
// Client-> server ping, immediately send reply.
|
||||||
Send(Packet.TwoWayPing(false, data));
|
Send(Packet.TwoWayPing(false, data));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
bool debugIgnoredCached = Ping.IgnorePosition;
|
|
||||||
Ping.UnIgnorePosition(data);
|
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.
|
// Server -> client ping, set time received for reply.
|
||||||
Ping.Update(data);
|
Ping.Update(data);
|
||||||
}
|
}
|
||||||
@ -387,7 +381,6 @@ namespace MCGalaxy.Network
|
|||||||
if (!hasTwoWayPing || id != Entities.SelfID) { return; }
|
if (!hasTwoWayPing || id != Entities.SelfID) { return; }
|
||||||
ushort data = Ping.NextTwoWayPingData(true);
|
ushort data = Ping.NextTwoWayPingData(true);
|
||||||
SendTwoWayPing(data);
|
SendTwoWayPing(data);
|
||||||
player.Message("Now ignoring your position until {0}", data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SendRemoveEntity(byte id) {
|
public override void SendRemoveEntity(byte id) {
|
||||||
|
@ -38,14 +38,14 @@ namespace MCGalaxy.Network
|
|||||||
|
|
||||||
long ignorePositionData = -1;
|
long ignorePositionData = -1;
|
||||||
|
|
||||||
internal bool IgnorePosition {
|
public bool IgnorePosition {
|
||||||
get { return Interlocked.Read(ref ignorePositionData) >= 0; }
|
get { return Interlocked.Read(ref ignorePositionData) >= 0; }
|
||||||
}
|
}
|
||||||
public void UnIgnorePosition(ushort data) {
|
internal void UnIgnorePosition(ushort data) {
|
||||||
Interlocked.CompareExchange(ref ignorePositionData, -1, 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 pingValue = Interlocked.Increment(ref pingCounter);
|
||||||
int pingHead = (Interlocked.Increment(ref nextPingHead) - 1) % 10;
|
int pingHead = (Interlocked.Increment(ref nextPingHead) - 1) % 10;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace MCGalaxy.Network
|
|||||||
Entries[pingHead].TimeRecv = default(DateTime);
|
Entries[pingHead].TimeRecv = default(DateTime);
|
||||||
Entries[pingHead].TimeSent = DateTime.UtcNow;
|
Entries[pingHead].TimeSent = DateTime.UtcNow;
|
||||||
|
|
||||||
if (waitingForMovementAcknowledged) Interlocked.Exchange(ref ignorePositionData, pingValue);
|
if (startIgnoringPosition) Interlocked.Exchange(ref ignorePositionData, pingValue);
|
||||||
return (ushort)pingValue;
|
return (ushort)pingValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user