mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Fix ClassCastException with trying to use Woodcutting on Mushrooms.
This commit is contained in:
		@@ -177,22 +177,14 @@ public final class TreeFeller {
 | 
			
		||||
 | 
			
		||||
            Material material = blockState.getType();
 | 
			
		||||
 | 
			
		||||
            switch (material) {
 | 
			
		||||
            case HUGE_MUSHROOM_1:
 | 
			
		||||
            case HUGE_MUSHROOM_2:
 | 
			
		||||
            if (material == Material.HUGE_MUSHROOM_1 || material == Material.HUGE_MUSHROOM_2) {
 | 
			
		||||
                xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
 | 
			
		||||
 | 
			
		||||
                for (ItemStack drop : blockState.getBlock().getDrops()) {
 | 
			
		||||
                    Misc.dropItem(blockState.getLocation(), drop);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (ModChecks.isCustomLogBlock(blockState)) {
 | 
			
		||||
            else if (ModChecks.isCustomLogBlock(blockState)) {
 | 
			
		||||
                Woodcutting.checkForDoubleDrop(player, blockState);
 | 
			
		||||
 | 
			
		||||
                CustomBlock customBlock = ModChecks.getCustomBlock(blockState);
 | 
			
		||||
@@ -211,21 +203,22 @@ public final class TreeFeller {
 | 
			
		||||
            else if (ModChecks.isCustomLeafBlock(blockState)) {
 | 
			
		||||
                Misc.randomDropItem(blockState.getLocation(), ModChecks.getCustomBlock(blockState).getItemDrop(), 10);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                Tree tree = (Tree) blockState.getData();
 | 
			
		||||
                switch (material) {
 | 
			
		||||
                case LOG:
 | 
			
		||||
                    Woodcutting.checkForDoubleDrop(player, blockState);
 | 
			
		||||
                    xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
 | 
			
		||||
                    Misc.dropItem(blockState.getLocation(), new ItemStack(Material.LOG, 1, tree.getSpecies().getData()));
 | 
			
		||||
                    break;
 | 
			
		||||
 | 
			
		||||
            Tree tree = (Tree) blockState.getData();
 | 
			
		||||
            switch (material) {
 | 
			
		||||
            case LOG:
 | 
			
		||||
                Woodcutting.checkForDoubleDrop(player, blockState);
 | 
			
		||||
                xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
 | 
			
		||||
                Misc.dropItem(blockState.getLocation(), new ItemStack(Material.LOG, 1, tree.getSpecies().getData()));
 | 
			
		||||
                break;
 | 
			
		||||
                case LEAVES:
 | 
			
		||||
                    Misc.randomDropItem(blockState.getLocation(), new ItemStack(Material.SAPLING, 1, tree.getSpecies().getData()), 10);
 | 
			
		||||
                    break;
 | 
			
		||||
 | 
			
		||||
            case LEAVES:
 | 
			
		||||
                Misc.randomDropItem(blockState.getLocation(), new ItemStack(Material.SAPLING, 1, tree.getSpecies().getData()), 10);
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            default:
 | 
			
		||||
                break;
 | 
			
		||||
                default:
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            blockState.setRawData((byte) 0x0);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.gmail.nossr50.skills.woodcutting;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.Sound;
 | 
			
		||||
import org.bukkit.block.BlockState;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
@@ -61,7 +62,11 @@ public final class Woodcutting {
 | 
			
		||||
        int xp = getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
 | 
			
		||||
 | 
			
		||||
        if (Permissions.doubleDrops(player, SkillType.WOODCUTTING)) {
 | 
			
		||||
            checkForDoubleDrop(player, blockState);
 | 
			
		||||
            Material blockType = blockState.getType();
 | 
			
		||||
 | 
			
		||||
            if (blockType != Material.HUGE_MUSHROOM_1 && blockType != Material.HUGE_MUSHROOM_2) {
 | 
			
		||||
                checkForDoubleDrop(player, blockState);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Users.getPlayer(player).beginXpGain(SkillType.WOODCUTTING, xp);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user