actually fixed anti-breeding
This commit is contained in:
parent
e23a269b8c
commit
5ecbb93091
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user