Skip to content

Commit

Permalink
Allow bees to work in locked beehives (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
rymiel authored Dec 23, 2024
1 parent 1a0f27b commit b671991
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.NamespacedKey;
import org.bukkit.Tag;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -611,6 +612,10 @@ public void onEntityChangeBlock(final EntityChangeBlockEvent e) {
if (protection == null) {
return;
}
// This event is called if a bee in a nest produces honey. We don't want to block that.
if (e.getEntity().getType() == EntityType.BEE && e.getBlock().getType() == e.getTo() && (e.getTo().equals(Material.BEE_NEST) || e.getTo().equals(Material.BEEHIVE))) {
return;
}
// This event is called for decorated pots broken by an arrow. WATER is needed for waterlogged decorated pots.
final boolean broken = e.getTo().equals(Material.AIR) || e.getTo().equals(Material.WATER);
if (!(getDamagerSource(e.getEntity()) instanceof final Player player) || !plugin.canAccess(protection, player, broken ? Permission.DESTROY : Permission.INTERACT)) {
Expand Down

0 comments on commit b671991

Please sign in to comment.