java.lang.Object com.realtime.crossfire.jxclient.skills.Skill
public class Skill
One skill of the character.
Field Summary | |
---|---|
private long |
experience
The skill experience. |
private int |
level
The skill level. |
private java.util.Collection<SkillListener> |
listeners
The listeners to inform of changes. |
private java.lang.String |
name
The skill name. |
Constructor Summary | |
---|---|
Skill(java.lang.String name)
Creates a new instance. |
Method Summary | |
---|---|
void |
addSkillListener(SkillListener listener)
Adds a listener to be notified of changes. |
private void |
fireAddSkill()
Notifies all listeners about a gained skill. |
private void |
fireDelSkill()
Notifies all listeners about a lost attribute. |
private void |
fireEvents(boolean oldKnown)
Notifies all listeners about changes. |
private void |
fireUpdSkill()
Notifies all listeners about an updated attribute. |
long |
getExperience()
Returns the skill experience. |
int |
getLevel()
Returns the skill level. |
private boolean |
isKnown()
Returns whether the skill is known. |
void |
removeSkillListener(SkillListener listener)
Removes a listener to be notified of changes. |
void |
set(int level,
long experience)
Updates the skill attributes. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private long experience
private int level
@NotNull private final java.util.Collection<SkillListener> listeners
@NotNull private final java.lang.String name
Constructor Detail |
---|
public Skill(@NotNull java.lang.String name)
name
- the skill nameMethod Detail |
---|
public void addSkillListener(@NotNull SkillListener listener)
listener
- the listener to addprivate void fireAddSkill()
private void fireDelSkill()
private void fireEvents(boolean oldKnown)
oldKnown
- whether the skill was known before the updateprivate void fireUpdSkill()
public long getExperience()
public int getLevel()
private boolean isKnown()
public void removeSkillListener(@NotNull SkillListener listener)
listener
- the listener to removepublic void set(int level, long experience)
level
- the new skill levelexperience
- the new skill experience@NotNull public java.lang.String toString()
toString
in class java.lang.Object