diff --git a/pom.xml b/pom.xml
index 9b85cf2..05fb1c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
ultimatetimber
UltimateTimber
- 0.0.7
+ 0.0.8
UTF-8
diff --git a/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java b/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java
index ccfc33d..e462b8e 100644
--- a/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java
+++ b/src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java
@@ -5,7 +5,6 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.Configuration;
-import java.util.Arrays;
import java.util.Collections;
public class DefaultConfig {
diff --git a/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java b/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java
index 46f23eb..61b3e09 100644
--- a/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java
+++ b/src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java
@@ -2,7 +2,6 @@ package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
-import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
diff --git a/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java b/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java
index 7591f3b..b2ff8ad 100644
--- a/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java
+++ b/src/main/java/com/songoda/ultimatetimber/treefall/TreeChecker.java
@@ -1,6 +1,6 @@
package com.songoda.ultimatetimber.treefall;
-import org.bukkit.Bukkit;
+import com.songoda.ultimatetimber.utils.LogToLeafConverter;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -162,7 +162,7 @@ public class TreeChecker {
/*
Exclude anything that isn't a part of a tree or a forest to avoid destroying houses
*/
- if (!thisBlock.getType().equals(originalMaterial) &&
+ if (!validMaterials.contains(thisBlock.getType()) &&
!validTreeMaterials.contains(thisBlock.getType()) &&
!forestMaterials.contains(thisBlock.getType()))
return null;
@@ -170,8 +170,14 @@ public class TreeChecker {
/*
This adds blocks to later be felled
+ Only take blocks of the same tree type
*/
- if (validMaterials.contains(thisBlock.getType()) || validTreeMaterials.contains(thisBlock.getType())) {
+ if (originalMaterial.equals(thisBlock.getType()) ||
+ (LogToLeafConverter.convert(originalMaterial) != null &&
+ LogToLeafConverter.convert(originalMaterial).equals(thisBlock.getType())) ||
+ (originalMaterial.equals(Material.MUSHROOM_STEM) &&
+ (thisBlock.getType().equals(Material.RED_MUSHROOM_BLOCK) ||
+ thisBlock.getType().equals(Material.BROWN_MUSHROOM_BLOCK)))) {
allBlocks.add(thisBlock);
}
diff --git a/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java b/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java
index c9b6f52..3dcb737 100644
--- a/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java
+++ b/src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java
@@ -2,7 +2,6 @@ package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.configurations.DefaultConfig;
-import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.enchantments.Enchantment;
diff --git a/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java b/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java
index 7be0c23..a6746f5 100644
--- a/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java
+++ b/src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java
@@ -24,6 +24,20 @@ public class TreeLoot {
return;
}
+ if (material.equals(Material.BROWN_MUSHROOM_BLOCK)) {
+ fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(Material.BROWN_MUSHROOM, 1));
+ return;
+ }
+
+ if (material.equals(Material.RED_MUSHROOM_BLOCK)) {
+ fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(Material.RED_MUSHROOM, 1));
+ return;
+ }
+
+ if (material.equals(Material.MUSHROOM_STEM)) {
+ return;
+ }
+
if (material.equals(Material.ACACIA_SAPLING) ||
material.equals(Material.BIRCH_SAPLING) ||
material.equals(Material.DARK_OAK_SAPLING) ||
@@ -52,5 +66,4 @@ public class TreeLoot {
}
-
}
diff --git a/src/main/java/com/songoda/ultimatetimber/utils/LogToLeafConverter.java b/src/main/java/com/songoda/ultimatetimber/utils/LogToLeafConverter.java
new file mode 100644
index 0000000..da1fdf6
--- /dev/null
+++ b/src/main/java/com/songoda/ultimatetimber/utils/LogToLeafConverter.java
@@ -0,0 +1,36 @@
+package com.songoda.ultimatetimber.utils;
+
+import org.bukkit.Material;
+
+public class LogToLeafConverter {
+
+ public static Material convert(Material material) {
+
+ switch (material) {
+
+ case ACACIA_LOG:
+ case STRIPPED_ACACIA_LOG:
+ return Material.ACACIA_LEAVES;
+ case BIRCH_LOG:
+ case STRIPPED_BIRCH_LOG:
+ return Material.BIRCH_LEAVES;
+ case DARK_OAK_LOG:
+ case STRIPPED_DARK_OAK_LOG:
+ return Material.DARK_OAK_LEAVES;
+ case JUNGLE_LOG:
+ case STRIPPED_JUNGLE_LOG:
+ return Material.JUNGLE_LEAVES;
+ case OAK_LOG:
+ case STRIPPED_OAK_LOG:
+ return Material.OAK_LEAVES;
+ case SPRUCE_LOG:
+ case STRIPPED_SPRUCE_LOG:
+ return Material.SPRUCE_LEAVES;
+ default:
+ return null;
+
+ }
+
+ }
+
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 27bc13f..7715962 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: UltimateTimber
-version: 0.0.7
+version: 0.0.8
author: Songoda
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13
diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml
index 4c024c5..7715962 100644
--- a/target/classes/plugin.yml
+++ b/target/classes/plugin.yml
@@ -1,5 +1,5 @@
name: UltimateTimber
-version: 0.0.6
+version: 0.0.8
author: Songoda
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13