Skip to content

Commit

Permalink
Workaround CraftBukkit bug causing BlockSpreadEvent to report air.
Browse files Browse the repository at this point in the history
  • Loading branch information
wizjany committed May 21, 2019
1 parent f516999 commit 4b320ab
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -563,9 +563,9 @@ public void onBlockSpread(BlockSpreadEvent event) {
return;
}

Material fromType = event.getSource().getType();
Material newType = event.getNewState().getType(); // craftbukkit randomly gives AIR as event.getSource even if that block is not air

if (Materials.isMushroom(fromType)) {
if (Materials.isMushroom(newType)) {
if (wcfg.disableMushroomSpread) {
event.setCancelled(true);
return;
Expand All @@ -577,7 +577,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
}
}

if (fromType == Material.GRASS_BLOCK) {
if (newType == Material.GRASS_BLOCK) {
if (wcfg.disableGrassGrowth) {
event.setCancelled(true);
return;
Expand All @@ -589,7 +589,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
}
}

if (fromType == Material.MYCELIUM) {
if (newType == Material.MYCELIUM) {
if (wcfg.disableMyceliumSpread) {
event.setCancelled(true);
return;
Expand All @@ -602,7 +602,7 @@ public void onBlockSpread(BlockSpreadEvent event) {
}
}

if (fromType == Material.VINE || fromType == Material.KELP) {
if (newType == Material.VINE || newType == Material.KELP) {
if (wcfg.disableVineGrowth) {
event.setCancelled(true);
return;
Expand Down

0 comments on commit 4b320ab

Please sign in to comment.