Rename & Repackage

This commit is contained in:
dark98
2021-03-11 00:21:56 +00:00
parent caa4625efa
commit 3bf473129d
1921 changed files with 2017 additions and 2010 deletions
@@ -0,0 +1,137 @@
package com.rs2.event;
/**
* The wrapper for our event
*
* @author Stuart <RogueX>
* @author Null++
*/
public class CycleEventContainer {
/**
* Event owner
*/
private final Object owner;
/**
* Is the event running or not
*/
private boolean isRunning;
/**
* The amount of cycles per event execution
*/
private int tick;
/**
* The actual event
*/
private final CycleEvent event;
/**
* The current amount of cycles passed
*/
private int cyclesPassed;
/**
* The event ID
*/
private final int eventID;
/**
* Sets the event containers details
*
* @param owner
* , the owner of the event
* @param event
* , the actual event to run
* @param tick
* , the cycles between execution of the event
*/
public CycleEventContainer(int id, Object owner, CycleEvent event, int tick) {
eventID = id;
this.owner = owner;
this.event = event;
isRunning = true;
cyclesPassed = 0;
this.tick = tick;
}
/**
* Execute the contents of the event
*/
public void execute() {
event.execute(this);
}
/**
* Stop the event from running
*/
public void stop() {
isRunning = false;
event.stop();
}
/**
* Does the event need to be ran?
*
* @return true yes false no
*/
public boolean needsExecution() {
if (!isRunning()) {
return false;
}
if (++cyclesPassed >= tick) {
cyclesPassed = 0;
return true;
}
return false;
}
/**
* Returns the owner of the event
*
* @return
*/
public Object getOwner() {
return owner;
}
/**
* Is the event running?
*
* @return true yes false no
*/
public boolean isRunning() {
return isRunning;
}
/**
* Returns the event id
*
* @return id
*/
public int getID() {
return eventID;
}
/**
* Returns the current cycle/tick.
*
* @return
*/
public int getTick() {
return tick;
}
/**
* Set the amount of cycles between the execution
*
* @param tick
*/
public void setTick(int tick) {
this.tick = tick;
}
}