Class Farmer

java.lang.Object
xyz.geik.farmer.model.Farmer
All Implemented Interfaces:
Cloneable

public class Farmer extends Object implements Cloneable
Main farmer object
  • Constructor Details

    • Farmer

      public Farmer(int id, String regionID, Set<User> users, FarmerInv inv, FarmerLevel level, int state)
      First constructor of farmer which already created before and loads it again.
      Parameters:
      id - of farmer
      regionID - of farmer
      users - of farmer
      inv - of farmer
      level - of farmer
      state - of farmer
    • Farmer

      public Farmer(String regionID, int level)
      Second constructor of farmer which creates fresh farmer.
      Parameters:
      regionID - id of region
      level - level of farmer
  • Method Details

    • getAttributeStatus

      public boolean getAttributeStatus(String attribute)
      Gets attribute from Farmer
      Parameters:
      attribute - of farmer module
      Returns:
      status of attribute
    • changeAttribute

      public boolean changeAttribute(String attribute)
      Change attribute
      Parameters:
      attribute - of farmer module
      Returns:
      current status of attribute
    • getOwnerUUID

      public UUID getOwnerUUID()
      Gets owner uuid of farmer
      Returns:
      UUID of owner
    • getUsersWithoutOwner

      public Set<User> getUsersWithoutOwner()
      Gets users without owner
      Returns:
      player set of farmer without owner
    • addUser

      public void addUser(UUID uuid, String name)
      Adds user to farmer with DEFAULT ROLE
      Parameters:
      uuid - of player
      name - of player
    • addUser

      public void addUser(UUID uuid, String name, FarmerPerm perm)
      Adds user to farmer with desired role
      Parameters:
      uuid - uuid of player
      name - name of player
      perm - perm of player
    • removeUser

      public boolean removeUser(@NotNull @NotNull User user)
      Delete user from farmer
      Parameters:
      user - of farmer
      Returns:
      is remove success or not
    • saveFarmerAsync

      public void saveFarmerAsync()
      Saves farmer async
    • saveFarmer

      public void saveFarmer()
      Saves farmer sync
    • clone

      public Farmer clone()
      Clones farmer object
      Overrides:
      clone in class Object
      Returns:
      Farmer object