Interface ReplicatedCounter

  • All Superinterfaces:
    ReplicatedData

    public interface ReplicatedCounter
    extends ReplicatedData
    A counter that can be incremented and decremented.
    • Method Detail

      • getValue

        long getValue()
        Get the current value of the counter.
        Returns:
        the current value of the counter
      • increment

        ReplicatedCounter increment​(long amount)
        Increment the counter.

        If amount is negative, then the counter will be decremented by that much instead.

        Parameters:
        amount - the amount to increment the counter by
        Returns:
        a new counter with incremented value
      • decrement

        ReplicatedCounter decrement​(long amount)
        Decrement the counter.

        If amount is negative, then the counter will be incremented by that much instead.

        Parameters:
        amount - the amount to decrement the counter by
        Returns:
        a new counter with decremented value