Class PacketTracker

java.lang.Object
com.viaversion.viaversion.api.protocol.packet.PacketTracker

public class PacketTracker extends Object
  • Constructor Details

  • 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 for incrementReceived() 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)