fixed anti-breeding

This commit is contained in:
Charlie Wang 2013-06-30 21:57:32 -04:00
parent 8acf96fc34
commit e23a269b8c
3 changed files with 108 additions and 107 deletions

View File

@ -14,11 +14,11 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
* *
* @author Mauve * @author Mauve
*/ */
public class SheepDeshearer implements Listener { public class BaaBaaBlockSheepEvents implements Listener {
DiscoSheep parent; DiscoSheep parent;
public SheepDeshearer(DiscoSheep parent) { public BaaBaaBlockSheepEvents(DiscoSheep parent) {
this.parent = parent; this.parent = parent;
} }
@ -40,6 +40,7 @@ public class SheepDeshearer implements Listener {
for (DiscoParty party : parent.getParties()) { for (DiscoParty party : parent.getParties()) {
if (party.getSheep().contains((Sheep) e.getEntity())) { if (party.getSheep().contains((Sheep) e.getEntity())) {
e.setCancelled(true); e.setCancelled(true);
} }
} }
} }

View File

@ -55,6 +55,7 @@ public class DiscoParty {
newSheep.setHealth(10000); newSheep.setHealth(10000);
newSheep.setColor(discoColours[(int) Math.round(Math.random() * (discoColours.length - 1))]); newSheep.setColor(discoColours[(int) Math.round(Math.random() * (discoColours.length - 1))]);
newSheep.setTarget(player); newSheep.setTarget(player);
newSheep.setAgeLock(true);
getSheep().add(newSheep); getSheep().add(newSheep);
} }
@ -100,7 +101,7 @@ public class DiscoParty {
if(this.state%3 == 0){ if(this.state%3 == 0){
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1.0f, 1.0f); player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1.0f, 1.0f);
} }
player.playSound(player.getLocation(), Sound.BURP, frequency, (float) Math.random() + 1); player.playSound(player.getLocation(), Sound.BURP, 0.5f, (float) Math.random() + 1);
} }
void update() { void update() {

View File

@ -10,8 +10,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class DiscoSheep extends JavaPlugin { public final class DiscoSheep extends JavaPlugin {
Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>(); Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
private SheepDeshearer deshear = new SheepDeshearer(this); private BaaBaaBlockSheepEvents deshear = new BaaBaaBlockSheepEvents(this);
// array of accetable disco colours (order not important)
@Override @Override
public void onEnable() { public void onEnable() {