Skip to content
Permalink
Browse files

Tweak TreeLopper to explicitly call update on the Sapling state. Seem…

…s Spigot now requires it. From the people I've asked, it appears to be a bug - however I'm calling it for now as it's required.
  • Loading branch information...
me4502 committed Dec 29, 2016
1 parent b2becad commit 76d802ec3c0c94136bb05d6a020430df3639af02
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/main/java/com/sk89q/craftbook/mechanics/TreeLopper.java
@@ -8,6 +8,7 @@
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -121,10 +122,7 @@ else if (data instanceof Tree)
}
block.breakNaturally(event.getPlayer().getItemInHand());
if(species != null && planted < maxSaplings(species)) {
block.setType(Material.SAPLING);
Sapling sapling = (Sapling) block.getState().getData();
sapling.setSpecies(species);
block.getState().setData(sapling);
Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), new SaplingPlanter(block, species), 2);
planted ++;
}
visitedLocations.add(block.getLocation());
@@ -185,9 +183,12 @@ public void loadConfiguration (YAMLProcessor config, String path) {
@Override
public void run () {
usedBlock.setType(Material.SAPLING);
Sapling sapling = (Sapling) usedBlock.getState().getData();
BlockState state = usedBlock.getState();
Sapling sapling = (Sapling) state.getData();
System.out.println(fspecies.name());
sapling.setSpecies(fspecies);
usedBlock.getState().setData(sapling);
state.setData(sapling);
state.update();
}

}

0 comments on commit 76d802e

Please sign in to comment.
You can’t perform that action at this time.