Version 0.0.8

- Tweaked tree checker so it will only add blocks of the same tree type
- Added mushroom-specific loot
This commit is contained in:
MagmaGuy 2018-11-08 23:35:10 +00:00
parent 2773986039
commit ee0f95cfbe
9 changed files with 62 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<groupId>ultimatetimber</groupId>
<artifactId>UltimateTimber</artifactId>
<version>0.0.7</version>
<version>0.0.8</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -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 {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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 {
}
}

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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