Farming Skill, Orb Charging, Battle Staff Creation, etc (#377)

- Farming Skill Added
- Orb charging implemented
- Battle staff creation implemented
- Cleaned up some code
- Stuck command will now tele you from further out in wildy if you are not in combat
- Fixed an issue with amulet of glory
- Added forcechats for npcs at Gnome Agility Course, and for Cows, Ducks and Sheeps just like in actual osrs
- Added base for God Book preaching
This commit is contained in:
Mr Extremez
2020-02-19 07:46:00 -06:00
committed by GitHub
parent 9b220ec47c
commit ef6968b283
71 changed files with 12165 additions and 541 deletions
@@ -0,0 +1,59 @@
package com.rebotted.tick;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;
/**
* A class which schedules the execution of {@link Tick}s.
*
* @author Graham
*/
public final class Scheduler {
/**
* A list of active ticks.
*/
private final List<Tick> ticks = new ArrayList<Tick>();
/**
* A queue of ticks that still need to be added.
*/
private final Queue<Tick> newTicks = new ArrayDeque<Tick>();
/**
* Schedules the specified tick.
*
* @param tick
* The tick to schedule.
*/
public void schedule(final Tick tick) {
synchronized (newTicks) {
newTicks.add(tick);
}
}
/**
* This method is called every cycle and executes, adds and removes
* {@link Tick}s.
*/
public void process() {
synchronized (newTicks) {
Tick tick;
while ((tick = newTicks.poll()) != null)
ticks.add(tick);
}
for (Iterator<Tick> it = ticks.iterator(); it.hasNext();) {
Tick tick = it.next();
try {
if (!tick.tick())
it.remove();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}