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;
import java.util.ArrayList;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
@ -12,6 +13,19 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class DiscoSheep extends JavaPlugin {
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);
// radius for random sheep spawns around player
private static int sheepSpawnRadius = 5;
@ -63,10 +77,10 @@ public final class DiscoSheep extends JavaPlugin {
getSheep().clear();
}
// Cycle colours of all sheep in the array
void cycleSheepColours() {
for (Sheep shep : getSheep()) {
//sheepArray.get(i) something something
// Set a random colour for all sheep in array
void randomizeSheepColours() {
for (Sheep sheep : getSheep()) {
sheep.setColor(discoColours[(int)Math.random() * discoColours.length]);
}
}

View File

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