Mangrove trees are now properly marked natural from growth

Fixes #4810
This commit is contained in:
nossr50 2022-08-07 15:54:22 -07:00
parent 032a407c8a
commit fb738d85f6
2 changed files with 17 additions and 10 deletions

View File

@ -844,13 +844,14 @@ public class PlayerListener implements Listener {
if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) { if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
//TODO: Is this code to set false from bone meal even needed? I'll have to double check later. //TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
if (heldItem.getType() == Material.BONE_MEAL) { if (heldItem.getType() == Material.BONE_MEAL) {
switch (blockState.getType()) { switch (blockState.getType().toString()) {
case BEETROOTS: case "BEETROOTS":
case CARROT: case "CARROT":
case COCOA: case "COCOA":
case WHEAT: case "WHEAT":
case NETHER_WART_BLOCK: case "NETHER_WART_BLOCK":
case POTATO: case "POTATO":
case "MANGROVE_PROPAGULE":
mcMMO.getPlaceStore().setFalse(blockState); mcMMO.getPlaceStore().setFalse(blockState);
break; break;
} }

View File

@ -1,7 +1,10 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -10,6 +13,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class WorldListener implements Listener { public class WorldListener implements Listener {
private final mcMMO plugin; private final mcMMO plugin;
@ -29,9 +33,11 @@ public class WorldListener implements Listener {
if(WorldBlacklist.isWorldBlacklisted(event.getWorld())) if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
return; return;
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, () -> {
for (BlockState blockState : event.getBlocks()) { for (BlockState blockState : event.getBlocks()) {
mcMMO.getPlaceStore().setFalse(blockState); mcMMO.getPlaceStore().setFalse(blockState);
} }
}, 1);
} }
/** /**