Class PlayerActivityEntity

All Implemented Interfaces:
UseListener, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
CoalSource, FishSource, GoldSource, WaterSpringSource, WellSource

public abstract class PlayerActivityEntity extends UseableEntity
An entity that performs some activity for a player. The activity takes some time to perform and can succeed or fail. The player must be standing next to the entity when it finished to succeed. The activity must finish before being initiated again.
  • Constructor Details

    • PlayerActivityEntity

      public PlayerActivityEntity()
      Create a player activity entity.
  • Method Details

    • activityDone

      protected void activityDone(Player player)
      Process the results of the activity.
      Parameters:
      player - The player that performed the activity.
    • getDuration

      protected abstract int getDuration()
      Get the time it takes to perform this activity.
      Returns:
      The time to perform the activity (in seconds).
    • isPrepared

      protected abstract boolean isPrepared(Player player)
      Decides if the activity can be done.
      Parameters:
      player - for whom to perform the activity
      Returns:
      true if can be done
    • isSuccessful

      protected abstract boolean isSuccessful(Player player)
      Decides if the activity was successful.
      Parameters:
      player - for whom to perform the activity
      Returns:
      true if successful.
    • onFinished

      protected abstract void onFinished(Player player, boolean successful)
      Called when the activity has finished.
      Parameters:
      player - The player that did the activity.
      successful - If the activity was successful.
    • onStarted

      protected abstract void onStarted(Player player)
      Called when the activity has started.
      Parameters:
      player - The player starting the activity.
    • isPenalized

      protected boolean isPenalized(Player player)
      Check for excessive usage
      Parameters:
      player - The player starting the activity.
      Returns:
      true if the usage was excessive
    • onUsed

      public boolean onUsed(RPEntity entity)
      Is called when a player initiates the activity.
      Parameters:
      entity - The initiating entity.
      Returns:
      true if the entity was used.