actually fixed anti-breeding

This commit is contained in:
Charlie Wang 2013-06-30 22:08:49 -04:00
parent e23a269b8c
commit 5ecbb93091
3 changed files with 3 additions and 16 deletions

View File

@ -32,17 +32,4 @@ public class BaaBaaBlockSheepEvents implements Listener {
}
}
}
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent e) {
if (e.getEntity() instanceof Sheep &&
e.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.BREEDING)) {
for (DiscoParty party : parent.getParties()) {
if (party.getSheep().contains((Sheep) e.getEntity())) {
e.setCancelled(true);
}
}
}
}
}

View File

@ -55,7 +55,7 @@ public class DiscoParty {
newSheep.setHealth(10000);
newSheep.setColor(discoColours[(int) Math.round(Math.random() * (discoColours.length - 1))]);
newSheep.setTarget(player);
newSheep.setAgeLock(true);
newSheep.setBreed(false);
getSheep().add(newSheep);
}

View File

@ -10,12 +10,12 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class DiscoSheep extends JavaPlugin {
Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
private BaaBaaBlockSheepEvents deshear = new BaaBaaBlockSheepEvents(this);
private BaaBaaBlockSheepEvents blockEvents = new BaaBaaBlockSheepEvents(this);
@Override
public void onEnable() {
getCommand("ds").setExecutor(new DiscoSheepCommandExecutor(this));
getServer().getPluginManager().registerEvents(deshear, this);
getServer().getPluginManager().registerEvents(blockEvents, this);
}
@Override