mirror of
https://github.com/songoda/UltimateTimber.git
synced 2025-02-13 18:21:27 +01:00
Merge branch 'development'
This commit is contained in:
commit
24a556eacf
BIN
UltimateTimber/.DS_Store
vendored
Normal file
BIN
UltimateTimber/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
UltimateTimber/Core/.DS_Store
vendored
Normal file
BIN
UltimateTimber/Core/.DS_Store
vendored
Normal file
Binary file not shown.
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>2.2.5</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>2.2.5</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>shaded</id>
|
<id>shaded</id>
|
||||||
@ -94,12 +94,17 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>apache.snapshots</id>
|
||||||
|
<url>https://repository.apache.org/snapshots/</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.16.2</version>
|
<version>1.17</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.songoda.ultimatetimber.manager;
|
package com.songoda.ultimatetimber.manager;
|
||||||
|
|
||||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||||
|
import com.songoda.core.compatibility.ServerVersion;
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.animation.TreeAnimation;
|
import com.songoda.ultimatetimber.animation.TreeAnimation;
|
||||||
import com.songoda.ultimatetimber.animation.TreeAnimationCrumble;
|
import com.songoda.ultimatetimber.animation.TreeAnimationCrumble;
|
||||||
@ -58,12 +59,14 @@ public class TreeAnimationManager extends Manager implements Listener, Runnable
|
|||||||
Set<ITreeBlock<FallingBlock>> groundedBlocks = new HashSet<>();
|
Set<ITreeBlock<FallingBlock>> groundedBlocks = new HashSet<>();
|
||||||
for (ITreeBlock<FallingBlock> fallingTreeBlock : treeAnimation.getFallingTreeBlocks().getAllTreeBlocks()) {
|
for (ITreeBlock<FallingBlock> fallingTreeBlock : treeAnimation.getFallingTreeBlocks().getAllTreeBlocks()) {
|
||||||
FallingBlock fallingBlock = fallingTreeBlock.getBlock();
|
FallingBlock fallingBlock = fallingTreeBlock.getBlock();
|
||||||
if (fallingBlock.isDead())
|
if (fallingBlock.isDead() || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_17) && fallingBlock.isOnGround())
|
||||||
groundedBlocks.add(fallingTreeBlock);
|
groundedBlocks.add(fallingTreeBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ITreeBlock<FallingBlock> fallingBlock : groundedBlocks) {
|
for (ITreeBlock<FallingBlock> fallingBlock : groundedBlocks) {
|
||||||
this.runFallingBlockImpact(treeAnimation, fallingBlock);
|
this.runFallingBlockImpact(treeAnimation, fallingBlock);
|
||||||
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_17))
|
||||||
|
fallingBlock.getBlock().remove();
|
||||||
treeAnimation.getFallingTreeBlocks().remove(fallingBlock);
|
treeAnimation.getFallingTreeBlocks().remove(fallingBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.songoda.core.hooks.JobsHook;
|
|||||||
import com.songoda.core.hooks.LogManager;
|
import com.songoda.core.hooks.LogManager;
|
||||||
import com.songoda.core.hooks.McMMOHook;
|
import com.songoda.core.hooks.McMMOHook;
|
||||||
import com.songoda.core.utils.ItemUtils;
|
import com.songoda.core.utils.ItemUtils;
|
||||||
|
import com.songoda.core.world.SItemStack;
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.events.TreeFallEvent;
|
import com.songoda.ultimatetimber.events.TreeFallEvent;
|
||||||
import com.songoda.ultimatetimber.events.TreeFellEvent;
|
import com.songoda.ultimatetimber.events.TreeFellEvent;
|
||||||
@ -24,6 +25,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TreeFallManager extends Manager implements Listener {
|
public class TreeFallManager extends Manager implements Listener {
|
||||||
@ -115,7 +117,7 @@ public class TreeFallManager extends Manager implements Listener {
|
|||||||
if (!treeDefinitionManager.isToolValidForTreeDefinition(detectedTree.getTreeDefinition(), tool))
|
if (!treeDefinitionManager.isToolValidForTreeDefinition(detectedTree.getTreeDefinition(), tool))
|
||||||
return;
|
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))
|
if (!ConfigurationManager.Setting.PROTECT_TOOL.getBoolean() && !ItemUtils.hasEnoughDurability(tool, toolDamage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -141,7 +143,7 @@ public class TreeFallManager extends Manager implements Listener {
|
|||||||
boolean isCreative = player.getGameMode().equals(GameMode.CREATIVE);
|
boolean isCreative = player.getGameMode().equals(GameMode.CREATIVE);
|
||||||
|
|
||||||
if (!isCreative)
|
if (!isCreative)
|
||||||
ItemUtils.addDamage(player, tool, toolDamage);
|
new SItemStack(tool).addDamage(player, toolDamage);
|
||||||
|
|
||||||
if (ConfigurationManager.Setting.HOOKS_APPLY_EXPERIENCE.getBoolean()) {
|
if (ConfigurationManager.Setting.HOOKS_APPLY_EXPERIENCE.getBoolean()) {
|
||||||
McMMOHook.addWoodcutting(player, detectedTree.getDetectedTreeBlocks().getAllTreeBlocks().stream()
|
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())
|
if (!ConfigurationManager.Setting.REALISTIC_TOOL_DAMAGE.getBoolean())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (ConfigurationManager.Setting.APPLY_SILK_TOUCH_TOOL_DAMAGE.getBoolean() && hasSilkTouch) {
|
if (ConfigurationManager.Setting.APPLY_SILK_TOUCH_TOOL_DAMAGE.getBoolean() && hasSilkTouch) {
|
||||||
return treeBlocks.size();
|
return (short) treeBlocks.size();
|
||||||
} else {
|
} else {
|
||||||
return treeBlocks.getLogBlocks().size();
|
return (short) treeBlocks.getLogBlocks().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>2.2.5</version>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user