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