mirror of
https://github.com/songoda/UltimateTimber.git
synced 2024-12-01 22:33:23 +01:00
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:
parent
2773986039
commit
ee0f95cfbe
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>ultimatetimber</groupId>
|
<groupId>ultimatetimber</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>0.0.7</version>
|
<version>0.0.8</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -5,7 +5,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
public class DefaultConfig {
|
public class DefaultConfig {
|
||||||
|
@ -2,7 +2,6 @@ package com.songoda.ultimatetimber.treefall;
|
|||||||
|
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.configurations.DefaultConfig;
|
import com.songoda.ultimatetimber.configurations.DefaultConfig;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.ultimatetimber.treefall;
|
package com.songoda.ultimatetimber.treefall;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import com.songoda.ultimatetimber.utils.LogToLeafConverter;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
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
|
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()) &&
|
!validTreeMaterials.contains(thisBlock.getType()) &&
|
||||||
!forestMaterials.contains(thisBlock.getType()))
|
!forestMaterials.contains(thisBlock.getType()))
|
||||||
return null;
|
return null;
|
||||||
@ -170,8 +170,14 @@ public class TreeChecker {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
This adds blocks to later be felled
|
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);
|
allBlocks.add(thisBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.songoda.ultimatetimber.treefall;
|
|||||||
|
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.configurations.DefaultConfig;
|
import com.songoda.ultimatetimber.configurations.DefaultConfig;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
@ -24,6 +24,20 @@ public class TreeLoot {
|
|||||||
return;
|
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) ||
|
if (material.equals(Material.ACACIA_SAPLING) ||
|
||||||
material.equals(Material.BIRCH_SAPLING) ||
|
material.equals(Material.BIRCH_SAPLING) ||
|
||||||
material.equals(Material.DARK_OAK_SAPLING) ||
|
material.equals(Material.DARK_OAK_SAPLING) ||
|
||||||
@ -52,5 +66,4 @@ public class TreeLoot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
name: UltimateTimber
|
name: UltimateTimber
|
||||||
version: 0.0.7
|
version: 0.0.8
|
||||||
author: Songoda
|
author: Songoda
|
||||||
main: com.songoda.ultimatetimber.UltimateTimber
|
main: com.songoda.ultimatetimber.UltimateTimber
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: UltimateTimber
|
name: UltimateTimber
|
||||||
version: 0.0.6
|
version: 0.0.8
|
||||||
author: Songoda
|
author: Songoda
|
||||||
main: com.songoda.ultimatetimber.UltimateTimber
|
main: com.songoda.ultimatetimber.UltimateTimber
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
Loading…
Reference in New Issue
Block a user