2019-03-30 04:59:10 +01:00
|
|
|
package com.songoda.ultimatetimber.animation;
|
2019-03-28 05:22:13 +01:00
|
|
|
|
2019-03-30 10:34:27 +01:00
|
|
|
import com.songoda.ultimatetimber.UltimateTimber;
|
|
|
|
import com.songoda.ultimatetimber.manager.ConfigurationManager;
|
|
|
|
import com.songoda.ultimatetimber.manager.TreeDefinitionManager;
|
2019-03-29 23:52:17 +01:00
|
|
|
import com.songoda.ultimatetimber.tree.DetectedTree;
|
2019-03-30 07:46:13 +01:00
|
|
|
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
2019-04-01 12:22:08 +02:00
|
|
|
import com.songoda.ultimatetimber.tree.TreeBlock;
|
2020-10-30 21:00:23 +01:00
|
|
|
import com.songoda.ultimatetimber.utils.ParticleUtils;
|
|
|
|
import com.songoda.ultimatetimber.utils.SoundUtils;
|
2019-03-28 07:42:22 +01:00
|
|
|
import org.bukkit.block.Block;
|
2019-03-29 23:52:17 +01:00
|
|
|
import org.bukkit.entity.Player;
|
2019-03-28 05:22:13 +01:00
|
|
|
|
|
|
|
public class TreeAnimationNone extends TreeAnimation {
|
2019-03-30 07:46:13 +01:00
|
|
|
public TreeAnimationNone(DetectedTree detectedTree, Player player) {
|
|
|
|
super(TreeAnimationType.NONE, detectedTree, player);
|
2019-03-28 05:22:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-03-30 07:46:13 +01:00
|
|
|
public void playAnimation(Runnable whenFinished) {
|
2019-03-30 10:34:27 +01:00
|
|
|
TreeDefinitionManager treeDefinitionManager = UltimateTimber.getInstance().getTreeDefinitionManager();
|
|
|
|
|
|
|
|
if (ConfigurationManager.Setting.USE_CUSTOM_SOUNDS.getBoolean())
|
2020-10-30 21:00:23 +01:00
|
|
|
SoundUtils.playFallingSound(this.detectedTree.getDetectedTreeBlocks().getInitialLogBlock());
|
2019-03-28 05:22:13 +01:00
|
|
|
|
2019-03-30 10:34:27 +01:00
|
|
|
if (ConfigurationManager.Setting.USE_CUSTOM_PARTICLES.getBoolean())
|
2019-03-30 22:56:22 +01:00
|
|
|
for (ITreeBlock<Block> treeBlock : this.detectedTree.getDetectedTreeBlocks().getAllTreeBlocks())
|
2020-10-30 21:00:23 +01:00
|
|
|
ParticleUtils.playFallingParticles(treeBlock);
|
2019-03-30 10:34:27 +01:00
|
|
|
|
|
|
|
for (ITreeBlock<Block> treeBlock : this.detectedTree.getDetectedTreeBlocks().getAllTreeBlocks()) {
|
2019-05-01 12:01:34 +02:00
|
|
|
treeDefinitionManager.dropTreeLoot(this.detectedTree.getTreeDefinition(), treeBlock, this.player, this.hasSilkTouch, false);
|
|
|
|
this.replaceBlock((TreeBlock) treeBlock);
|
2019-03-30 07:46:13 +01:00
|
|
|
}
|
2019-04-01 12:22:08 +02:00
|
|
|
|
|
|
|
whenFinished.run();
|
2019-03-28 05:22:13 +01:00
|
|
|
}
|
|
|
|
}
|