diff --git a/src/gibstick/bukkit/discosheep/DiscoSheep.java b/src/gibstick/bukkit/discosheep/DiscoSheep.java index c60f144..888acd1 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheep.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheep.java @@ -14,6 +14,7 @@ import org.bukkit.plugin.java.JavaPlugin; public final class DiscoSheep extends JavaPlugin { private ArrayList sheepArray = new ArrayList(); + private ArrayList playerArray = new ArrayList(); private SheepDeshearer deshear = new SheepDeshearer(sheepArray); private static final DyeColor[] discoColours = { DyeColor.RED, @@ -50,6 +51,10 @@ public final class DiscoSheep extends JavaPlugin { ArrayList getSheep() { return sheepArray; } + + ArrayList getPlayers(){ + return this.playerArray; + } void spawnSheep(World world, Location loc) { Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); @@ -103,21 +108,23 @@ public final class DiscoSheep extends JavaPlugin { // Called after discosheep is stopped void cleanUp() { removeAllSheep(); + this.playerArray.clear(); } void scheduleUpdate() { - updater.runTaskLater((Plugin) updater, updater.frequency); + updater.runTaskLater(this, updater.frequency); } - void startDisco(int frequency, int duration, List players) { + void startDisco(int duration, List players) { + this.playerArray.addAll(players); for(Player player : players){ this.spawnSheep(player, this.defaultSheepAmount); } - updater.start(frequency, duration); + updater.start(duration,this.defaultFrequency); } void startDisco(List players) { - this.startDisco(this.defaultFrequency,this.defaultDuration,players); + this.startDisco(this.defaultDuration,players); } void stopDisco() { diff --git a/src/gibstick/bukkit/discosheep/DiscoUpdater.java b/src/gibstick/bukkit/discosheep/DiscoUpdater.java index 848f60f..d6b5d30 100644 --- a/src/gibstick/bukkit/discosheep/DiscoUpdater.java +++ b/src/gibstick/bukkit/discosheep/DiscoUpdater.java @@ -15,7 +15,7 @@ public class DiscoUpdater extends BukkitRunnable { this.duration = 0; parent.cleanUp(); } - + public void start(int duration, int frequency) { this.frequency = frequency; this.duration = duration;