Class User

All Implemented Interfaces:
IEntity, RPObjectChangeListener

public class User extends Player
This class identifies the user of this client.
Author:
durkham, hendrik
  • Constructor Details

    • User

      public User()
      creates a User object
  • Method Details

    • get

      public static User get()
      gets the User object
      Returns:
      user object
    • isNull

      public static boolean isNull()
      is the user object not set, yet?
      Returns:
      true, if the the user object is unknown; false if it is known
    • getCharacterName

      public static String getCharacterName()
      gets the name of the player's character
      Returns:
      charname or null
    • getPlayerLevel

      public static int getPlayerLevel()
      gets the level of the current user
      Returns:
      level
    • getServerRelease

      public static String getServerRelease()
      gets the server release version
      Returns:
      server release version or null
    • hasBuddy

      public static boolean hasBuddy(String name)
      is the specified charname a buddy of us?
      Parameters:
      name - charname to test
      Returns:
      true, if it is a buddy, false if it is not a buddy or the user object is unknown.
    • isAdmin

      public static boolean isAdmin()
      is this user an admin with an adminlevel equal or above 600?
      Returns:
      true, if the user is an admin; false otherwise
    • isGroupSharingLoot

      public static boolean isGroupSharingLoot()
      is the player in a group which shares the loot?
      Returns:
      true if this player is a group and it uses shared looting
    • isIgnoring

      public static boolean isIgnoring(String name)
      is the named player ignored?
      Parameters:
      name - name of player
      Returns:
      true, if the player should be ignored; false otherwise
    • isPlayerInGroup

      public static boolean isPlayerInGroup(String otherPlayer)
      checks if the specified player is in the same group as this player
      Parameters:
      otherPlayer - name of the other player
      Returns:
      true if the other player is in the same group
    • updateGroupStatus

      public static void updateGroupStatus(Collection<String> members, String lootmode)
      updates the group information
      Parameters:
      members - members
      lootmode - lootmode
    • findItem

      public int findItem(String slotName, String itemName)
      Returns the objectid for the named item.
      Parameters:
      slotName - name of slot to search
      itemName - name of item
      Returns:
      objectid or -1 in case there is no such item
    • hasPet

      public boolean hasPet()
      checks whether the user owns a pet
      Returns:
      true, if the user owns a pet; false otherwise
    • getPetID

      public int getPetID()
      gets the ID of a pet
      Returns:
      ID of pet
    • hasSheep

      public boolean hasSheep()
      checks whether the user owns a sheep
      Returns:
      true, if the user owns a sheep; false otherwise
    • getSheepID

      public int getSheepID()
      gets the ID of a sheep
      Returns:
      ID of sheep
    • getZoneName

      public String getZoneName()
      gets the zone name
      Returns:
      zone name
    • isUser

      public boolean isUser()
      Is this object the user of this client?
      Specified by:
      isUser in interface IEntity
      Overrides:
      isUser in class Entity
      Returns:
      true
    • onAway

      protected void onAway(String message)
      Description copied from class: Player
      An away message was set/cleared.
      Overrides:
      onAway in class Player
      Parameters:
      message - The away message, or null if no-longer away.
    • onChangedAdded

      public void onChangedAdded(RPObject object, RPObject changes)
      The object added/changed attribute(s).
      Specified by:
      onChangedAdded in interface RPObjectChangeListener
      Overrides:
      onChangedAdded in class Player
      Parameters:
      object - The base object.
      changes - The changes.
    • onChangedRemoved

      public void onChangedRemoved(RPObject base, RPObject diff)
      Description copied from class: Player
      The object removed attribute(s).
      Specified by:
      onChangedRemoved in interface RPObjectChangeListener
      Overrides:
      onChangedRemoved in class Player
      Parameters:
      base - The base object.
      diff - The changes.
    • onHealed

      public void onHealed(int amount)
      Description copied from class: RPEntity
      Called when the entity gets healed.
      Overrides:
      onHealed in class RPEntity
      Parameters:
      amount - amount healed
    • predictMovement

      public void predictMovement(Direction direction, boolean facing)
      Start movement towards a direction. This is for the client side movement prediction to start moving before the server responds to the move action.
      Parameters:
      direction - new direction
      facing - true if the player should just turn
    • processPositioning

      protected void processPositioning(RPObject base, RPObject diff)
      Description copied from class: ActiveEntity
      Process attribute changes that may affect positioning. This is needed because different entities may want to process coordinate changes more gracefully.
      Overrides:
      processPositioning in class ActiveEntity
      Parameters:
      base - The previous values.
      diff - The changes.
    • stopMovement

      public void stopMovement()
      Stop the user's movement.
    • addSounds

      protected void addSounds(String groupName, String categoryName, String... soundNames)
    • onPosition

      protected void onPosition(double x, double y)
      Description copied from class: Entity
      When the entity's position changed.
      Overrides:
      onPosition in class Entity
      Parameters:
      x - The new X coordinate.
      y - The new Y coordinate.
    • playRandomSoundFromCategory

      protected void playRandomSoundFromCategory(String groupName, String categoryName)
    • playRandomSoundFromGroup

      protected void playRandomSoundFromGroup(String groupName, String categoryName, long waitTimeInMilliSec)
    • playSoundFromCategory

      protected void playSoundFromCategory(String groupName, String categoryName)
    • playSoundFromCategory

      protected void playSoundFromCategory(String groupName, String categoryName, int index)