mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-06 07:58:12 +01:00
More cleanup to Woodcutting.
This commit is contained in:
parent
9e7209ff47
commit
be4abefd55
@ -7,6 +7,7 @@ import org.bukkit.TreeSpecies;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.Tree;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -48,7 +49,7 @@ public class WoodCutting {
|
|||||||
* @param PP The PlayerProfile of the player
|
* @param PP The PlayerProfile of the player
|
||||||
*/
|
*/
|
||||||
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) {
|
private static void removeBlocks(ArrayList<Block> toBeFelled, Player player, PlayerProfile PP) {
|
||||||
if(toBeFelled.size() > LoadProperties.treeFellerThreshold) {
|
if (toBeFelled.size() > LoadProperties.treeFellerThreshold) {
|
||||||
player.sendMessage(mcLocale.getString("Skills.Woodcutting.TreeFellerThreshold"));
|
player.sendMessage(mcLocale.getString("Skills.Woodcutting.TreeFellerThreshold"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -82,7 +83,8 @@ public class WoodCutting {
|
|||||||
for (Block x : toBeFelled) {
|
for (Block x : toBeFelled) {
|
||||||
if (m.blockBreakSimulate(x, player, true)) {
|
if (m.blockBreakSimulate(x, player, true)) {
|
||||||
if (x.getType() == Material.LOG) {
|
if (x.getType() == Material.LOG) {
|
||||||
TreeSpecies species = TreeSpecies.getByData(x.getData());
|
Tree tree = (Tree) x.getState().getData();
|
||||||
|
TreeSpecies species = tree.getSpecies();
|
||||||
|
|
||||||
switch (species) {
|
switch (species) {
|
||||||
case GENERIC:
|
case GENERIC:
|
||||||
@ -140,9 +142,7 @@ public class WoodCutting {
|
|||||||
else if (x.getType() == Material.LEAVES) {
|
else if (x.getType() == Material.LEAVES) {
|
||||||
final int SAPLING_DROP_CHANCE = 90;
|
final int SAPLING_DROP_CHANCE = 90;
|
||||||
|
|
||||||
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() - 8)); //Drop the right type of sapling
|
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling
|
||||||
|
|
||||||
if(Math.random() * 100 <= 90)
|
|
||||||
m.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
m.mcRandomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||||
|
|
||||||
//Remove the block
|
//Remove the block
|
||||||
|
Loading…
Reference in New Issue
Block a user