Merge branch 'development'

This commit is contained in:
Brianna 2021-06-16 00:30:46 -05:00
commit 24a556eacf
8 changed files with 22 additions and 12 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
UltimateTimber/.DS_Store vendored Normal file

Binary file not shown.

BIN
UltimateTimber/Core/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>UltimateTimber</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
<relativePath>../../</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>UltimateTimber</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
<relativePath>../../</relativePath>
</parent>
@ -48,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.0-SNAPSHOT</version>
<executions>
<execution>
<id>shaded</id>
@ -94,12 +94,17 @@
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.2</version>
<version>1.17</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,6 +1,7 @@
package com.songoda.ultimatetimber.manager;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.animation.TreeAnimation;
import com.songoda.ultimatetimber.animation.TreeAnimationCrumble;
@ -58,12 +59,14 @@ public class TreeAnimationManager extends Manager implements Listener, Runnable
Set<ITreeBlock<FallingBlock>> groundedBlocks = new HashSet<>();
for (ITreeBlock<FallingBlock> fallingTreeBlock : treeAnimation.getFallingTreeBlocks().getAllTreeBlocks()) {
FallingBlock fallingBlock = fallingTreeBlock.getBlock();
if (fallingBlock.isDead())
if (fallingBlock.isDead() || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_17) && fallingBlock.isOnGround())
groundedBlocks.add(fallingTreeBlock);
}
for (ITreeBlock<FallingBlock> fallingBlock : groundedBlocks) {
this.runFallingBlockImpact(treeAnimation, fallingBlock);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_17))
fallingBlock.getBlock().remove();
treeAnimation.getFallingTreeBlocks().remove(fallingBlock);
}
}

View File

@ -5,6 +5,7 @@ import com.songoda.core.hooks.JobsHook;
import com.songoda.core.hooks.LogManager;
import com.songoda.core.hooks.McMMOHook;
import com.songoda.core.utils.ItemUtils;
import com.songoda.core.world.SItemStack;
import com.songoda.ultimatetimber.UltimateTimber;
import com.songoda.ultimatetimber.events.TreeFallEvent;
import com.songoda.ultimatetimber.events.TreeFellEvent;
@ -24,6 +25,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Random;
import java.util.stream.Collectors;
public class TreeFallManager extends Manager implements Listener {
@ -115,7 +117,7 @@ public class TreeFallManager extends Manager implements Listener {
if (!treeDefinitionManager.isToolValidForTreeDefinition(detectedTree.getTreeDefinition(), tool))
return;
int toolDamage = this.getToolDamage(detectedTree.getDetectedTreeBlocks(), tool.containsEnchantment(Enchantment.SILK_TOUCH));
short toolDamage = this.getToolDamage(detectedTree.getDetectedTreeBlocks(), tool.containsEnchantment(Enchantment.SILK_TOUCH));
if (!ConfigurationManager.Setting.PROTECT_TOOL.getBoolean() && !ItemUtils.hasEnoughDurability(tool, toolDamage))
return;
@ -141,7 +143,7 @@ public class TreeFallManager extends Manager implements Listener {
boolean isCreative = player.getGameMode().equals(GameMode.CREATIVE);
if (!isCreative)
ItemUtils.addDamage(player, tool, toolDamage);
new SItemStack(tool).addDamage(player, toolDamage);
if (ConfigurationManager.Setting.HOOKS_APPLY_EXPERIENCE.getBoolean()) {
McMMOHook.addWoodcutting(player, detectedTree.getDetectedTreeBlocks().getAllTreeBlocks().stream()
@ -180,14 +182,14 @@ public class TreeFallManager extends Manager implements Listener {
}
}
private int getToolDamage(TreeBlockSet<Block> treeBlocks, boolean hasSilkTouch) {
private short getToolDamage(TreeBlockSet<Block> treeBlocks, boolean hasSilkTouch) {
if (!ConfigurationManager.Setting.REALISTIC_TOOL_DAMAGE.getBoolean())
return 1;
if (ConfigurationManager.Setting.APPLY_SILK_TOUCH_TOOL_DAMAGE.getBoolean() && hasSilkTouch) {
return treeBlocks.size();
return (short) treeBlocks.size();
} else {
return treeBlocks.getLogBlocks().size();
return (short) treeBlocks.getLogBlocks().size();
}
}

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateTimber</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>