Package xyz.geik.farmer.model
Class Farmer
java.lang.Object
xyz.geik.farmer.model.Farmer
- All Implemented Interfaces:
Cloneable
Main farmer object
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds user to farmer with DEFAULT ROLEvoid
addUser
(UUID uuid, String name, FarmerPerm perm) Adds user to farmer with desired roleboolean
changeAttribute
(String attribute) Change attributeclone()
Clones farmer objectboolean
getAttributeStatus
(String attribute) Gets attribute from FarmerGets owner uuid of farmerGets users without ownerboolean
removeUser
(@NotNull User user) Delete user from farmervoid
Saves farmer syncvoid
Saves farmer async
-
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 farmerregionID
- of farmerusers
- of farmerinv
- of farmerlevel
- of farmerstate
- of farmer
-
Farmer
Second constructor of farmer which creates fresh farmer.- Parameters:
regionID
- id of regionlevel
- level of farmer
-
-
Method Details
-
getAttributeStatus
Gets attribute from Farmer- Parameters:
attribute
- of farmer module- Returns:
- status of attribute
-
changeAttribute
Change attribute- Parameters:
attribute
- of farmer module- Returns:
- current status of attribute
-
getOwnerUUID
Gets owner uuid of farmer- Returns:
- UUID of owner
-
getUsersWithoutOwner
Gets users without owner- Returns:
- player set of farmer without owner
-
addUser
Adds user to farmer with DEFAULT ROLE- Parameters:
uuid
- of playername
- of player
-
addUser
Adds user to farmer with desired role- Parameters:
uuid
- uuid of playername
- name of playerperm
- perm of player
-
removeUser
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
Clones farmer object
-