-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add javadoc to restore events and RestorationAuthoritySystem #17
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,6 +15,7 @@ | |||||
*/ | ||||||
package org.terasology.logic.health.event; | ||||||
|
||||||
import org.terasology.entitySystem.entity.EntityRef; | ||||||
import org.terasology.entitySystem.event.Event; | ||||||
|
||||||
/** | ||||||
|
@@ -23,13 +24,20 @@ | |||||
public class DoRestoreEvent implements Event { | ||||||
/** The amount of health points being restored. */ | ||||||
private int amount; | ||||||
/** The instigator of restoration */ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny suggestion: rather than use
Suggested change
|
||||||
private EntityRef instigator; | ||||||
|
||||||
/** | ||||||
* Constructor for event providing amount of restoration. | ||||||
* @param amount The amount of restoration. | ||||||
*/ | ||||||
public DoRestoreEvent(int amount) { | ||||||
this(amount, EntityRef.NULL); | ||||||
} | ||||||
|
||||||
public DoRestoreEvent(int amount, EntityRef entity) { | ||||||
this.amount = amount; | ||||||
this.instigator = entity; | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -39,4 +47,12 @@ public DoRestoreEvent(int amount) { | |||||
public int getAmount() { | ||||||
return amount; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Method to get the instigator of restoration. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally I'd excuse setters & getters from Javadoc unless there is any potential for confusion somehow. |
||||||
* @return EntityRef of instigator. | ||||||
*/ | ||||||
public EntityRef getInstigator() { | ||||||
return instigator; | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,29 @@ | |
|
||
import org.terasology.entitySystem.entity.EntityRef; | ||
|
||
/** | ||
* This event is sent after the entity is restored. Final event of restoration logic. | ||
*/ | ||
public class OnRestoredEvent extends HealthChangedEvent { | ||
/** | ||
* The amount by which the entity is restored. | ||
*/ | ||
private int amount; | ||
|
||
/** | ||
* Constructor for creating the event. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another edge case: should plain constructors have javadoc? In this case maybe if the wording is a slight bit more meaningful (we already know by the constructors presence that it will create the event, so the text doesn't really add anything). I'm not sure if there's really any other meaning to add in this case. |
||
* @param amount The amount of restoration. | ||
* @param instigator EntityRef of cause of restoration. | ||
*/ | ||
public OnRestoredEvent(int amount, EntityRef instigator) { | ||
super(instigator, amount); | ||
this.amount = amount; | ||
} | ||
|
||
/** | ||
* Method to get the amount of restoration. | ||
* @return amount of restoration. | ||
*/ | ||
public int getRegenAmount() { | ||
return amount; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too big to consider as part of this PR (since the same word is in use many other places) but I wonder if
do
is a good term in general for the starting phase of an event chain like this one. "Do" to me very much means that the thing is happening right now. Maybe "Perform" would give a better impression that it is more like an action that is being performed, almost like a stage play might be going through several phases to arrive at an action :-)This could be overly subjective as interpreting these kinds of words may differ subtly between individuals.