UltimateTimber/src/main/java/com/songoda/ultimatetimber/animation/TreeAnimationNone.java

38 lines
1.7 KiB
Java
Raw Normal View History

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;
import com.songoda.ultimatetimber.tree.DetectedTree;
2019-03-30 07:46:13 +01:00
import com.songoda.ultimatetimber.tree.ITreeBlock;
import com.songoda.ultimatetimber.tree.TreeBlock;
import com.songoda.ultimatetimber.utils.ParticleUtils;
import com.songoda.ultimatetimber.utils.SoundUtils;
import org.bukkit.block.Block;
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())
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())
ParticleUtils.playFallingParticles(treeBlock);
2019-03-30 10:34:27 +01:00
for (ITreeBlock<Block> treeBlock : this.detectedTree.getDetectedTreeBlocks().getAllTreeBlocks()) {
treeDefinitionManager.dropTreeLoot(this.detectedTree.getTreeDefinition(), treeBlock, this.player, this.hasSilkTouch, false);
this.replaceBlock((TreeBlock) treeBlock);
2019-03-30 07:46:13 +01:00
}
whenFinished.run();
2019-03-28 05:22:13 +01:00
}
}