RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.util.generic.GenericAttributes Class Reference

Holds generic attributes. More...

Package Functions

public< K, E > E get (K key)
 Gets a generic attribute.
public< K, E > E get (K key, Class<? extends E > type)
 Gets a generic attribute casted to a specific class type.
public< K > Object getObject (K key)
 Gets a generic attribute.
public< K > boolean has (K key)
 Checks if a key is in the list of generic attribute.
public< K > boolean is (K key)
 Gets the state of a key.
public< K, E > void modify (K key, E value)
 Modifies a generic attribute.
public< K, V > void put (K key, V value)
public< K > void remove (K key)
 Removes a generic attribute.
public< K, E > void set (K key, E attribute)
 Sets a generic attribute.

Private Attributes

final Map< Object, Object > genericAttributes = new HashMap<>()
 The map of generic attributes for an entity.

Detailed Description

Holds generic attributes.

Author
Michael | Chex

Definition at line 11 of file GenericAttributes.java.

Member Function Documentation

◆ get() [1/2]

public< K, E > E com.runehive.util.generic.GenericAttributes.get ( K key)
package

Gets a generic attribute.

Parameters
<K>The key type.
<E>The return value class type.
keyThe key.
Returns
The value associated with the key, or null.

Definition at line 85 of file GenericAttributes.java.

85 {
86 try {
87 return (E) genericAttributes.get(key);
88 } catch (Exception e) {
89 e.printStackTrace();
90 return null;
91 }
92 }

References genericAttributes, and get().

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.block(), com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.canAttack(), com.runehive.content.skill.impl.agility.obstacle.impl.WildernessDoorInteraction.canExecute(), com.runehive.content.skill.impl.construction.BuildableInterface.click(), com.runehive.content.teleport.TeleportHandler.click(), com.runehive.content.skill.impl.crafting.Crafting.clickButton(), com.runehive.content.skill.impl.fletching.Fletching.clickButton(), com.runehive.content.store.Store.closeShop(), com.runehive.content.skill.impl.crafting.Crafting.craft(), com.runehive.content.store.Store.exchange(), com.runehive.content.skill.impl.agility.obstacle.ObstacleInteraction.execute(), com.runehive.content.teleport.TeleportHandler.favorite(), com.runehive.content.skill.impl.fletching.Fletching.fletch(), com.runehive.content.skill.impl.smithing.SmithingArmour.forge(), get(), com.runehive.net.packet.in.ExaminePacketListener.handleInterfaceExamine(), com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.hitsplat(), com.runehive.content.skill.impl.agility.obstacle.impl.RopeSwingInteraction.onExecution(), com.runehive.content.DropDisplay.open(), com.runehive.content.teleport.TeleportHandler.open(), com.runehive.content.tittle.TitleManager.redeem(), com.runehive.content.skill.impl.slayer.SlayerTab.refresh(), com.runehive.content.tittle.TitleManager.refresh(), com.runehive.content.skill.impl.agility.obstacle.ObstacleInteraction.rewards(), com.runehive.content.dialogue.impl.ClanRankDialogue.sendDialogues(), com.runehive.net.packet.in.ItemContainerActionPacketListener.sixthAction(), and com.runehive.content.teleport.TeleportHandler.teleport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [2/2]

public< K, E > E com.runehive.util.generic.GenericAttributes.get ( K key,
Class<? extends E > type )
package

Gets a generic attribute casted to a specific class type.

Parameters
<K>The key type.
<E>The return value class type.
keyThe key.
typeThe class for the return type.
Returns
The value associated with the key, or null.

Definition at line 126 of file GenericAttributes.java.

126 {
127 Object attribute = genericAttributes.get(key);
128 try {
129 return type.cast(attribute);
130 } catch (Exception e) {
131 e.printStackTrace();
132 return null;
133 }
134 }

References genericAttributes.

◆ getObject()

public< K > Object com.runehive.util.generic.GenericAttributes.getObject ( K key)
package

Gets a generic attribute.

Parameters
<K>The key type.
keyThe key.
Returns
The value associated with the key, or null.

Definition at line 104 of file GenericAttributes.java.

104 {
105 try {
106 return genericAttributes.get(key);
107 } catch (Exception e) {
108 e.printStackTrace();
109 return null;
110 }
111 }

References genericAttributes, and getObject().

Referenced by com.runehive.content.skill.impl.crafting.Crafting.clickButton(), and getObject().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has()

public< K > boolean com.runehive.util.generic.GenericAttributes.has ( K key)
package

Checks if a key is in the list of generic attribute.

Parameters
<K>The key type.
keyThe key.
Returns
True if the generic attributes contains a value with this key.

Definition at line 69 of file GenericAttributes.java.

69 {
70 return genericAttributes.containsKey(key);
71 }

References genericAttributes.

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.block(), com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.canAttack(), com.runehive.content.skill.impl.crafting.Crafting.clickButton(), com.runehive.content.store.Store.closeShop(), com.runehive.content.store.Store.exchange(), com.runehive.game.world.entity.combat.strategy.player.special.melee.GraniteMaul.getAttackDelay(), com.runehive.net.packet.in.ExaminePacketListener.handleInterfaceExamine(), is(), and com.runehive.game.world.entity.combat.formula.MeleeFormula.modifyDamage().

Here is the caller graph for this function:

◆ is()

public< K > boolean com.runehive.util.generic.GenericAttributes.is ( K key)
package

Gets the state of a key.

Parameters
<K>The key type.
keyThe key to check.
Returns
True if the value of the key is equal to Boolean.TRUE.

Definition at line 146 of file GenericAttributes.java.

146 {
147 return has(key) && Boolean.TRUE == get(key, Boolean.class);
148 }

References has().

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.canAttack(), com.runehive.game.world.entity.combat.strategy.npc.boss.LizardShaman.canAttack(), and com.runehive.game.world.entity.combat.strategy.player.special.melee.GraniteMaul.start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ modify()

public< K, E > void com.runehive.util.generic.GenericAttributes.modify ( K key,
E value )
package

Modifies a generic attribute.

Parameters
<K>The key type.
<E>The return value class type.
keyThe key.
valueThe value to set.

Definition at line 43 of file GenericAttributes.java.

43 {
44 genericAttributes.replace(key, value);
45 }

References genericAttributes.

◆ put()

public< K, V > void com.runehive.util.generic.GenericAttributes.put ( K key,
V value )
package

Definition at line 16 of file GenericAttributes.java.

16 {
17 genericAttributes.put(key, value);
18 }

References genericAttributes.

Referenced by com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.block(), com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.canAttack(), and com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.hitsplat().

Here is the caller graph for this function:

◆ remove()

public< K > void com.runehive.util.generic.GenericAttributes.remove ( K key)
package

◆ set()

public< K, E > void com.runehive.util.generic.GenericAttributes.set ( K key,
E attribute )
package

Sets a generic attribute.

Parameters
<K>The key type.
<E>The return value class type.
keyThe key.
attributeThe value associated with this key.

Definition at line 32 of file GenericAttributes.java.

32 {
33 genericAttributes.put(key, attribute);
34 }

References genericAttributes.

Referenced by com.runehive.content.Obelisks.activate(), com.runehive.content.teleport.TeleportHandler.click(), com.runehive.content.tittle.TitleManager.click(), com.runehive.content.itemaction.impl.SerpentineHelm.dismantle(), com.runehive.content.skill.impl.construction.BuildableInterface.display(), com.runehive.content.teleport.TeleportHandler.display(), com.runehive.content.simulator.DropSimulator.drawList(), com.runehive.content.skill.impl.agility.obstacle.ObstacleInteraction.execute(), com.runehive.net.packet.in.ItemContainerActionPacketListener.fifthAction(), com.runehive.game.world.entity.combat.attack.listener.item.VeracListener.init(), com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.LavaAttack.lavaTask(), com.runehive.content.clanchannel.channel.ClanChannelHandler.manageMember(), com.runehive.content.Obelisks.open(), com.runehive.content.skill.impl.construction.BuildableInterface.open(), com.runehive.content.store.impl.DefaultStore.open(), com.runehive.content.store.impl.PersonalStore.open(), com.runehive.content.store.impl.RecipeForDisasterStore.open(), com.runehive.content.store.impl.SkillcapeStore.open(), com.runehive.content.teleport.TeleportHandler.open(), com.runehive.content.skill.impl.smithing.SmithingArmour.openInterface(), com.runehive.game.world.entity.combat.strategy.npc.boss.Hydra.poisonAttack(), com.runehive.game.world.entity.combat.strategy.npc.boss.Hydra.poisonTask(), com.runehive.content.StarterKit.refresh(), com.runehive.content.itemaction.impl.MagmaHelm.restore(), com.runehive.content.itemaction.impl.TanzaniteHelm.restore(), com.runehive.content.skill.impl.agility.obstacle.ObstacleInteraction.rewards(), com.runehive.content.DropDisplay.search(), com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.GhostAttack.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.Cerberus.LavaAttack.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.LizardShaman.MinionsAttack.start(), com.runehive.game.world.entity.combat.strategy.npc.boss.StoneGuardian.Transform.start(), com.runehive.content.skill.impl.crafting.Crafting.useItem(), and com.runehive.content.skill.impl.fletching.Fletching.useItem().

Here is the caller graph for this function:

Member Data Documentation

◆ genericAttributes

final Map<Object, Object> com.runehive.util.generic.GenericAttributes.genericAttributes = new HashMap<>()
private

The map of generic attributes for an entity.

Definition at line 14 of file GenericAttributes.java.

Referenced by get(), get(), getObject(), has(), modify(), put(), remove(), and set().


The documentation for this class was generated from the following file: