Version 0.0.5

- Made the plugin compatible with mushrooms
- Added a little leeway to allow for 1-2 blocks of dirt/coarse dirt/grass (in height) to be placed adjacent to the trees (covers vanilla world generation for the most part)
This commit is contained in:
MagmaGuy 2018-11-06 22:08:46 +00:00
parent a235d3d803
commit e349e54a03
5 changed files with 54 additions and 13 deletions

View File

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

View File

@ -25,7 +25,8 @@ public class TreeChecker {
Material.OAK_LOG,
Material.STRIPPED_OAK_LOG,
Material.SPRUCE_LOG,
Material.STRIPPED_SPRUCE_LOG
Material.STRIPPED_SPRUCE_LOG,
Material.MUSHROOM_STEM
));
/*
@ -38,7 +39,9 @@ public class TreeChecker {
Material.JUNGLE_LEAVES,
Material.OAK_LEAVES,
Material.SPRUCE_LEAVES,
Material.COCOA_BEANS
Material.COCOA_BEANS,
Material.BROWN_MUSHROOM_BLOCK,
Material.RED_MUSHROOM_BLOCK
));
public static ArrayList<Block> parseTree(Block block) {
@ -90,6 +93,14 @@ public class TreeChecker {
!thisBlock.getType().equals(Material.RED_TULIP) &&
!thisBlock.getType().equals(Material.POPPY) &&
!thisBlock.getType().equals(Material.WHITE_TULIP) &&
!thisBlock.getType().equals(Material.OXEYE_DAISY) &&
!thisBlock.getType().equals(Material.AZURE_BLUET) &&
!thisBlock.getType().equals(Material.BLUE_ORCHID) &&
!thisBlock.getType().equals(Material.ALLIUM) &&
!thisBlock.getType().equals(Material.DANDELION) &&
!thisBlock.getType().equals(Material.DANDELION_YELLOW) &&
!thisBlock.getType().equals(Material.LILAC) &&
!thisBlock.getType().equals(Material.PEONY) &&
!thisBlock.getType().equals(Material.TALL_GRASS) &&
!thisBlock.getType().equals(Material.FERN) &&
!thisBlock.getType().equals(Material.LARGE_FERN) &&
@ -104,13 +115,20 @@ public class TreeChecker {
!thisBlock.getType().equals(Material.BIRCH_SAPLING) &&
!thisBlock.getType().equals(Material.DARK_OAK_SAPLING) &&
!thisBlock.getType().equals(Material.VOID_AIR) &&
!thisBlock.getType().equals(Material.CAVE_AIR))
!thisBlock.getType().equals(Material.CAVE_AIR) &&
(!thisBlock.getType().equals(Material.DIRT) &&
!thisBlock.getType().equals(Material.COARSE_DIRT) &&
!thisBlock.getType().equals(Material.GRASS_BLOCK) &&
(i == 0 || i == 1)))
return null;
if (validSurroundingMaterials.contains(thisBlock.getType()))
containsSecondaryBlock = true;
if (!thisBlock.getType().equals(Material.AIR))
if (!thisBlock.getType().equals(Material.AIR) &&
!thisBlock.getType().equals(Material.DIRT) &&
!thisBlock.getType().equals(Material.COARSE_DIRT) &&
!thisBlock.getType().equals(Material.GRASS_BLOCK))
blocks.add(thisBlock);
zOffset++;

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.Material;
import org.bukkit.Particle;
import org.bukkit.block.Block;
@ -119,10 +118,7 @@ public class TreeFallAnimation implements Listener {
player.getInventory().getItemInMainHand().getType().equals(Material.STONE_AXE) ||
player.getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE))
if (player.getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.SILK_TOUCH))
{
setHasSilkTouch(true);
Bukkit.getLogger().warning("test");
}
else
setHasSilkTouch(false);
else
@ -198,10 +194,11 @@ public class TreeFallAnimation implements Listener {
UltimateTimber plugin = UltimateTimber.getInstance();
new BukkitRunnable() {
int counter = 0;
@Override
public void run() {
if (!fallingBlock.isValid()){
if (!fallingBlock.isValid()) {
cancel();
return;
}
@ -209,7 +206,7 @@ public class TreeFallAnimation implements Listener {
/*
Safeguard to prevent errors that come from glitchy Minecraft behavior
*/
if (counter > 20 * 3 ) {
if (counter > 20 * 3) {
runFallingBlockImpact(fallingBlock);
cancel();
}
@ -240,7 +237,7 @@ public class TreeFallAnimation implements Listener {
}
private void runFallingBlockImpact(FallingBlock fallingBlock){
private void runFallingBlockImpact(FallingBlock fallingBlock) {
TreeFallAnimation treeFallAnimation = getTreeFallAnimation(fallingBlock);
treeFallAnimation.unregisterFallingBlock(fallingBlock);

View File

@ -1,5 +1,5 @@
name: UltimateTimber
version: 0.0.4
version: 0.0.5
author: Songoda
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13

26
target/classes/plugin.yml Normal file
View File

@ -0,0 +1,26 @@
name: UltimateTimber
version: 0.0.4
author: Songoda
main: com.songoda.ultimatetimber.UltimateTimber
api-version: 1.13
commands:
ultimatetimber:
description: Reloads the configuration file
usage: /ultimatetimber reload
aliases: [ut]
permissions:
ultimatetimber.*:
description: Inherits all plugin permissions
children:
ultimatetimber.chop: true
ultimatetimber.bonusloot: true
ultimatetimber.reload: true
ultimatetimber.chop:
description: Allows players to trigger the trees toppling down effect
default: op
ultimatetimber.bonusloot:
description: Doubles the loot obtained from trees
default: op
ultimatetimber.reload:
description: Reloads the configuration file
default: op