Misc fixes for DiscoUpdater
This commit is contained in:
parent
61dcce06dd
commit
8533b007e3
@ -1,33 +1,37 @@
|
|||||||
public class DiscoUpdater extends BukkitRunnable{
|
package gibstick.bukkit.discosheep;
|
||||||
|
|
||||||
|
import gibstick.bukkit.DiscoSheep.DiscoSheep;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class DiscoUpdater extends BukkitRunnable {
|
||||||
|
|
||||||
private final int defaultDuration = 1000;// ticks
|
private final int defaultDuration = 1000;// ticks
|
||||||
private final int defaultFrequency = 20;// ticks per state change
|
private final int defaultFrequency = 20;// ticks per state change
|
||||||
|
int frequency = 0, duration = 0;
|
||||||
int frequency=0,duration=0;
|
|
||||||
|
|
||||||
private DiscoSheep parent;
|
private DiscoSheep parent;
|
||||||
|
|
||||||
public DiscoUpdater(DiscoSheep parent){
|
public DiscoUpdater(DiscoSheep parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop(){
|
public void stop() {
|
||||||
this.duration = 0;
|
this.duration = 0;
|
||||||
parent.cleanUp();
|
parent.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start(int duration, int frequency){
|
public void start(int duration, int frequency) {
|
||||||
this.frequency = this.defaultFrequency;
|
this.frequency = this.defaultFrequency;
|
||||||
this.durtion = this.defaultDuration;
|
this.duration = this.defaultDuration;
|
||||||
parent.scheduleUpdate();
|
parent.scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(){
|
@Override
|
||||||
if(duration > 0){
|
public void run() {
|
||||||
cycleSheepColours();
|
if (duration > 0) {
|
||||||
playSounds();
|
parent.cycleSheepColours();
|
||||||
|
parent.playSounds();
|
||||||
duration -= frequency;
|
duration -= frequency;
|
||||||
parent.scheduleUpdate(this);
|
parent.scheduleUpdate();
|
||||||
} else {
|
} else {
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user