Changed access of sheep, added ShepDeshearer.

This commit is contained in:
RangerMauve 2013-06-30 16:00:26 -04:00
commit 9dba2a1be3
2 changed files with 19 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package gibstick.bukkit.discosheep; package gibstick.bukkit.discosheep;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -12,6 +13,19 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class DiscoSheep extends JavaPlugin { public final class DiscoSheep extends JavaPlugin {
private ArrayList<Sheep> sheepArray = new ArrayList<Sheep>(); private ArrayList<Sheep> sheepArray = new ArrayList<Sheep>();
private static final DyeColor[] discoColours = {
DyeColor.RED,
DyeColor.ORANGE,
DyeColor.YELLOW,
DyeColor.GREEN,
DyeColor.BLUE,
DyeColor.LIGHT_BLUE,
DyeColor.PINK,
DyeColor.MAGENTA,
DyeColor.LIME,
DyeColor.CYAN,
DyeColor.PURPLE
}; // array of accetable disco colours (order not important)
private DiscoUpdater updater = new DiscoUpdater(this); private DiscoUpdater updater = new DiscoUpdater(this);
// radius for random sheep spawns around player // radius for random sheep spawns around player
private static int sheepSpawnRadius = 5; private static int sheepSpawnRadius = 5;
@ -63,10 +77,10 @@ public final class DiscoSheep extends JavaPlugin {
getSheep().clear(); getSheep().clear();
} }
// Cycle colours of all sheep in the array // Set a random colour for all sheep in array
void cycleSheepColours() { void randomizeSheepColours() {
for (Sheep shep : getSheep()) { for (Sheep sheep : getSheep()) {
//sheepArray.get(i) something something sheep.setColor(discoColours[(int)Math.random() * discoColours.length]);
} }
} }

View File

@ -27,7 +27,7 @@ public class DiscoUpdater extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (duration > 0) { if (duration > 0) {
parent.cycleSheepColours(); parent.randomizeSheepColours();
parent.playSounds(); parent.playSounds();
duration -= frequency; duration -= frequency;
parent.scheduleUpdate(); parent.scheduleUpdate();