Class PacketTracker
java.lang.Object
com.viaversion.viaversion.api.protocol.packet.PacketTracker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks for packet flood with the packets sent in the last second.long
long
long
int
long
long
int
boolean
Used for incrementing the number of packets received from the client.void
Used for incrementing the number of packets sent to the client.boolean
void
setIntervalPackets
(long intervalPackets) void
setPacketLimiterEnabled
(boolean packetLimiterEnabled) void
setPacketsPerSecond
(long packetsPerSecond) void
setReceivedPackets
(long receivedPackets) void
setSecondsObserved
(int secondsObserved) void
setSentPackets
(long sentPackets) void
setStartTime
(long startTime) void
setWarnings
(int warnings)
-
Constructor Details
-
PacketTracker
-
-
Method Details
-
incrementSent
public void incrementSent()Used for incrementing the number of packets sent to the client. -
incrementReceived
public boolean incrementReceived()Used for incrementing the number of packets received from the client.- Returns:
- true if the interval has reset and can now be checked for the packets sent
-
exceedsMaxPPS
public boolean exceedsMaxPPS()Checks for packet flood with the packets sent in the last second. ALWAYS check forincrementReceived()
before using this method.- Returns:
- true if the packet should be cancelled
- See Also:
-
getSentPackets
public long getSentPackets() -
setSentPackets
public void setSentPackets(long sentPackets) -
getReceivedPackets
public long getReceivedPackets() -
setReceivedPackets
public void setReceivedPackets(long receivedPackets) -
getStartTime
public long getStartTime() -
setStartTime
public void setStartTime(long startTime) -
getIntervalPackets
public long getIntervalPackets() -
setIntervalPackets
public void setIntervalPackets(long intervalPackets) -
getPacketsPerSecond
public long getPacketsPerSecond() -
setPacketsPerSecond
public void setPacketsPerSecond(long packetsPerSecond) -
getSecondsObserved
public int getSecondsObserved() -
setSecondsObserved
public void setSecondsObserved(int secondsObserved) -
getWarnings
public int getWarnings() -
setWarnings
public void setWarnings(int warnings) -
isPacketLimiterEnabled
public boolean isPacketLimiterEnabled() -
setPacketLimiterEnabled
public void setPacketLimiterEnabled(boolean packetLimiterEnabled)
-