Skip to content

Commit

Permalink
Enable Op or mod override for breeding.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Dec 22, 2021
1 parent 38aa99b commit 0248c39
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,14 @@ public void onMinecart(VehicleCreateEvent e) {

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBreed(final EntityBreedEvent e) {
if (e.getBreeder() != null && e.getBreeder() instanceof Player p &&
!(p.isOp() || p.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(e.getEntity().getWorld()) + MOD_BYPASS))) {
if (!checkLimit(e, e.getEntity(), SpawnReason.BREEDING, false)) {
// Breeding not allowed so stop the love fest
if (e.getFather() instanceof Animals f && e.getMother() instanceof Animals m) {
f.setLoveModeTicks(0);
m.setLoveModeTicks(0);
}
}
if (addon.inGameModeWorld(e.getEntity().getWorld())
&& e.getBreeder() != null
&& e.getBreeder() instanceof Player p
&& !(p.isOp() || p.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(e.getEntity().getWorld()) + MOD_BYPASS))
&& !checkLimit(e, e.getEntity(), SpawnReason.BREEDING, false)
&& e.getFather() instanceof Animals f && e.getMother() instanceof Animals m) {
f.setLoveModeTicks(0);
m.setLoveModeTicks(0);
}
}

Expand All @@ -109,8 +108,9 @@ public void onCreatureSpawn(final CreatureSpawnEvent e) {
justSpawned.remove(e.getEntity().getUniqueId());
return;
}
if (e.getSpawnReason().equals(SpawnReason.SHOULDER_ENTITY)) {
if (e.getSpawnReason().equals(SpawnReason.SHOULDER_ENTITY) || e.getSpawnReason().equals(SpawnReason.BREEDING)) {
// Special case - do nothing - jumping around spawns parrots as they drop off player's shoulder
// Ignore breeding because it's handled in the EntityBreedEvent listener
return;
}
// Some checks can be done async, some not
Expand Down

0 comments on commit 0248c39

Please sign in to comment.