Package net.risingworld.api.objects
Klasse Clothes
java.lang.Object
net.risingworld.api.objects.Clothes
An object representing the current clothes of players and certain npcs.
This object contains all individual garments the player/npc is currently wearing.
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypKlasseBeschreibungstatic class
Represents a single piece of clothing. -
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
add
(short clothingID) Adds a new garment with the provided type ID.void
add
(short clothingID, int color, long infoID) boolean
deserialize
(byte[] bytes) Deserializes a byte array and applies all information stored in it to this Clothes object.get
(Clothing.Type type) Gets a garment the player/npc is wearing (depending on the provided type).getAll()
Gets all garments the player/npc is currently wearing.boolean
has
(short clothingID) Checks if the character is wearing a particular garment.boolean
hasSpecialGear
(Clothing.Function clothingFunction) Checks if the character is wearing any garment with a special function.boolean
hasType
(Clothing.Type type) boolean
isNpc()
Gets whether this clothes object belongs to an npc or to a player.boolean
remove
(short clothingID) boolean
remove
(Clothing.Type type) void
byte[]
Serializes the clothes, i.e turns all information into a byte array.
-
Konstruktordetails
-
Clothes
protected Clothes(long handle, boolean isNpc)
-
-
Methodendetails
-
isNpc
public boolean isNpc()Gets whether this clothes object belongs to an npc or to a player.- Gibt zurück:
- true if this is represents the clothes of an npc, false if it represents the clothes of a player.
-
add
public void add(short clothingID) Adds a new garment with the provided type ID.- Parameter:
clothingID
- the type ID of the garment.- Example: Give player a helmet
-
add
public void add(short clothingID, int color, long infoID) -
get
Gets a garment the player/npc is wearing (depending on the provided type).- Parameter:
type
- the clothing type (i.e which body areas are covered by this garment).- Gibt zurück:
- a new Garment object representing the clothing piece, or null if nothing was found.
-
getAll
Gets all garments the player/npc is currently wearing.- Gibt zurück:
- a new array containing all garments, or null if the player/npc is naked.
-
remove
public boolean remove(short clothingID) -
remove
-
removeAll
public void removeAll() -
has
public boolean has(short clothingID) Checks if the character is wearing a particular garment.- Parameter:
clothingID
- the clothing type id of the garment you're looking for.- Gibt zurück:
- true if the character is wearing such a garment, false if not.
- Example: Check if npc is wearing a horse saddle
-
hasType
-
hasSpecialGear
Checks if the character is wearing any garment with a special function.- Parameter:
clothingFunction
- the special function of the garment you're looking for.- Gibt zurück:
- true if any of the garments has such a function, false if not.
- Example: Check if player is wearing a lamp garment, e.g headlamp
-
serialize
public byte[] serialize()Serializes the clothes, i.e turns all information into a byte array.- Gibt zurück:
- a byte array representing the Clothes object.
- Example: Serialize and deserialize a clothes object
- Siehe auch:
-
deserialize
public boolean deserialize(byte[] bytes) Deserializes a byte array and applies all information stored in it to this Clothes object. Can be used in combination withserialize()
.- Parameter:
bytes
- the byte array representing the Clothes object.- Gibt zurück:
- true if the byte array was valid, i.e if it was successfully applied to this Clothes object, false if not.
-