Class Level
java.lang.Object
tfagaming.projects.minecraft.homestead.models.Level
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddXp(long amount) longlongintgetLevel()double@Nullable RegionReturns the region by directly fetching with region ID from cache.longReturns the region name safely by directly fetching with region ID from cache.longlonglongstatic longgetXpForLevel(int level) longlonglongvoidremoveXp(long amount) voidreset()voidsetAutoUpdate(boolean autoUpdate) Toggle Auto-Update for caching.voidsetLevel(int level) voidsetRegionId(long regionId) voidsetXp(long experience)
-
Field Details
-
BASE
public static final double BASE- See Also:
-
COEFFICIENT
public static final double COEFFICIENT- See Also:
-
CONSTANT
public static final double CONSTANT- See Also:
-
-
Constructor Details
-
Level
public Level(long regionId) -
Level
public Level(long id, long regionId, int level, long experience, long totalExperience, long createdAt)
-
-
Method Details
-
getXpForLevel
public static long getXpForLevel(int level) -
setAutoUpdate
public void setAutoUpdate(boolean autoUpdate) Toggle Auto-Update for caching. Iftrue, any call for setters will automatically update the cache. Otherwise, only the instance of the class will be updated.- Parameters:
autoUpdate- Auto-Update toggle
-
getUniqueId
public long getUniqueId() -
getRegionId
public long getRegionId() -
setRegionId
public void setRegionId(long regionId) -
getRegion
Returns the region by directly fetching with region ID from cache.- Returns:
- The region if found,
nullotherwise.
-
getRegionName
Returns the region name safely by directly fetching with region ID from cache.- Returns:
- The region name if found,
"?"otherwise.
-
getLevel
public int getLevel() -
setLevel
public void setLevel(int level) -
getExperience
public long getExperience() -
getTotalExperience
public long getTotalExperience() -
getCreatedAt
public long getCreatedAt() -
getTotalXpForCurrentLevel
public long getTotalXpForCurrentLevel() -
getXpForNextLevel
public long getXpForNextLevel() -
getXpProgress
public long getXpProgress() -
getXpRemaining
public long getXpRemaining() -
getProgressPercentage
public double getProgressPercentage() -
addXp
public void addXp(long amount) -
setXp
public void setXp(long experience) -
removeXp
public void removeXp(long amount) -
reset
public void reset()
-