PlayerLevel

  • PlayerLevel is a data object representing a player's level in a game's metagame.

  • A PlayerLevel is defined by a numeric value and a range of XP, specifically from a minimum XP (inclusive) up to a maximum XP (exclusive).

  • Players are considered to be a given level if their current XP falls within the level's defined XP range.

  • The class includes methods to retrieve the level number, the minimum XP for the level, and the maximum XP for the level.

public final classPlayerLevel extendsObject
implementsParcelable

Data object representing a level a player can obtain in the metagame.

APlayerLevel has three components: a numeric value, and a range of XP totals it represents. A player is considered a given level if they haveat leastgetMinXp() andless thangetMaxXp().

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_WRITE_RETURN_VALUE

Field Summary

public static finalCreator<PlayerLevel> CREATOR

Public Method Summary

boolean
int
getLevelNumber()
Returns the number for this level, e.g.
long
getMaxXp()
Returns the maximum XP value represented by this level, exclusive.
long
getMinXp()
Returns the minimum XP value needed to attain this level, inclusive.
int
String
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
From interface android.os.Parcelable
abstract int
describeContents()
abstract void
writeToParcel(Parcel arg0, int arg1)

Fields

public static finalCreator<PlayerLevel>CREATOR

Public Methods

public booleanequals(Object obj)

public intgetLevelNumber()

Returns the number for this level, e.g. "level 10".

This is the level that this object represents. For a player to be considered as being of this level, the value given by PlayerLevelInfo.getCurrentXpTotal() must fall in the range [getMinXp(),getMaxXp()).

Returns
  • The level number for this level.

public longgetMaxXp()

Returns the maximum XP value represented by this level, exclusive.

public longgetMinXp()

Returns the minimum XP value needed to attain this level, inclusive.

public inthashCode()

publicStringtoString()

public voidwriteToParcel(Parcel out, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-10 UTC.