Skip to content

Commit ebef249

Browse files
committed
Fixed support for new egg types in 1.21.5 and later versions
1 parent 96d2183 commit ebef249

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,16 +1310,18 @@ public void onInteract(PlayerInteractEvent event) {
13101310
}
13111311
}
13121312
}
1313+
// 1.21.5 (Spring to Life) introduced brown_egg and blue_egg.
1314+
// This new variable detects all current and future eggs.
1315+
// It could be replaced with an Item Tag or the exact Material in the future.
1316+
final boolean isEgg = type.toString().toLowerCase().endsWith("egg");
13131317
if (PaperLib.isPaper()) {
1314-
if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) {
1315-
eventType = PlayerBlockEventType.SPAWN_MOB;
1316-
break;
1317-
}
1318-
} else {
1319-
if (type.toString().toLowerCase().endsWith("egg")) {
1318+
if (MaterialTags.SPAWN_EGGS.isTagged(type) || isEgg) {
13201319
eventType = PlayerBlockEventType.SPAWN_MOB;
13211320
break;
13221321
}
1322+
} else if (isEgg) {
1323+
eventType = PlayerBlockEventType.SPAWN_MOB;
1324+
break;
13231325
}
13241326
if (type.isEdible()) {
13251327
//Allow all players to eat while also allowing the block place event to be fired

0 commit comments

Comments
 (0)