Fix issue where Tree Feller wouldn't work on the base of a

player-planted tree. Fixes #524
This commit is contained in:
GJ 2013-01-16 16:15:50 -05:00
parent 51777dbe85
commit 734d691e00

View File

@ -2,11 +2,16 @@ package com.gmail.nossr50.listeners;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import org.bukkit.TreeType;
import org.bukkit.block.BlockState;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.event.world.WorldUnloadEvent;
@ -16,6 +21,21 @@ import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionMain
public class WorldListener implements Listener { public class WorldListener implements Listener {
ArrayList<BlockStoreConversionMain> converters = new ArrayList<BlockStoreConversionMain>(); ArrayList<BlockStoreConversionMain> converters = new ArrayList<BlockStoreConversionMain>();
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onStructureGrow(StructureGrowEvent event) {
TreeType species = event.getSpecies();
if (species == TreeType.BROWN_MUSHROOM || species == TreeType.RED_MUSHROOM) {
return;
}
List<BlockState> blocks = event.getBlocks();
for (BlockState block : blocks) {
mcMMO.placeStore.setFalse(block.getBlock());
}
}
@EventHandler @EventHandler
public void onWorldInit(WorldInitEvent event) { public void onWorldInit(WorldInitEvent event) {
File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data"); File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data");