mirror of
https://github.com/songoda/UltimateTimber.git
synced 2024-12-01 22:33:23 +01:00
Merge branch 'development'
This commit is contained in:
commit
ff862c56d4
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.0.8</version>
|
<version>2.0.9</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.Damageable;
|
import org.bukkit.inventory.meta.Damageable;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.event.player.PlayerItemBreakEvent;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -79,8 +80,11 @@ public class CurrentAdapter implements VersionAdapter {
|
|||||||
damageable.setDamage(damageable.getDamage() + actualDamage);
|
damageable.setDamage(damageable.getDamage() + actualDamage);
|
||||||
tool.setItemMeta((ItemMeta) damageable);
|
tool.setItemMeta((ItemMeta) damageable);
|
||||||
|
|
||||||
if (!this.hasEnoughDurability(tool, 1))
|
if (!this.hasEnoughDurability(tool, 1)) {
|
||||||
|
PlayerItemBreakEvent breakEvent = new PlayerItemBreakEvent(player, tool);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(breakEvent);
|
||||||
this.removeItemInHand(player);
|
this.removeItemInHand(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.0.8</version>
|
<version>2.0.9</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>CoreProtect</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net</groupId>
|
|
||||||
<artifactId>coreprotect</artifactId>
|
|
||||||
<version>2.17.5</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import com.songoda.ultimatetimber.utils.NMSUtil;
|
|
||||||
import net.coreprotect.CoreProtect;
|
|
||||||
import net.coreprotect.CoreProtectAPI;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CoreProtectHook implements TimberHook {
|
|
||||||
|
|
||||||
private CoreProtectAPI api;
|
|
||||||
private boolean useDeprecatedMethod = NMSUtil.getVersionNumber() <= 12;
|
|
||||||
|
|
||||||
public CoreProtectHook() {
|
|
||||||
this.api = CoreProtect.getInstance().getAPI();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (!this.api.isEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (ITreeBlock<Block> treeBlock : treeBlocks.getAllTreeBlocks()) {
|
|
||||||
if (this.useDeprecatedMethod) {
|
|
||||||
this.api.logRemoval(player.getName(), treeBlock.getLocation(), treeBlock.getBlock().getType(), treeBlock.getBlock().getData());
|
|
||||||
} else {
|
|
||||||
this.api.logRemoval(player.getName(), treeBlock.getLocation(), treeBlock.getBlock().getType(), treeBlock.getBlock().getBlockData());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>Jobs</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gamingmesh</groupId>
|
|
||||||
<artifactId>jobs</artifactId>
|
|
||||||
<version>4.13.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
|
||||||
import com.gamingmesh.jobs.actions.BlockActionInfo;
|
|
||||||
import com.gamingmesh.jobs.container.ActionType;
|
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
|
||||||
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class JobsHook implements TimberHook {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
|
||||||
if (jPlayer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (ITreeBlock<Block> treeBlock : treeBlocks.getLogBlocks()) {
|
|
||||||
Block block = treeBlock.getBlock();
|
|
||||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
|
||||||
Jobs.action(jPlayer, bInfo, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>McMMO</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gmail.nossr50</groupId>
|
|
||||||
<artifactId>mcmmo</artifactId>
|
|
||||||
<version>2.1.50</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.api.AbilityAPI;
|
|
||||||
import com.gmail.nossr50.api.ExperienceAPI;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class McMMOHook implements TimberHook {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ArrayList<BlockState> blockStates = new ArrayList<>();
|
|
||||||
treeBlocks.getLogBlocks().forEach(x -> blockStates.add(x.getBlock().getState()));
|
|
||||||
ExperienceAPI.addXpFromBlocksBySkill(blockStates, UserManager.getPlayer(player), PrimarySkillType.WOODCUTTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
if (PrimarySkillType.WOODCUTTING.getDoubleDropsDisabled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return Permissions.isSubSkillEnabled(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
|
||||||
&& RankUtils.hasReachedRank(1, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
|
||||||
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.WOODCUTTING_HARVEST_LUMBER, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return AbilityAPI.treeFellerEnabled(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>McMMOClassic12</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.12.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gmail.nossr50</groupId>
|
|
||||||
<artifactId>mcmmo</artifactId>
|
|
||||||
<version>1.5.10</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.api.AbilityAPI;
|
|
||||||
import com.gmail.nossr50.api.ExperienceAPI;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
|
|
||||||
public class McMMOClassic12Hook implements TimberHook {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int xp = 0;
|
|
||||||
for (ITreeBlock<Block> treeBlock : treeBlocks.getLogBlocks()) {
|
|
||||||
Block block = treeBlock.getBlock();
|
|
||||||
MaterialData materialData = block.getState().getData();
|
|
||||||
xp += ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, materialData);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExperienceAPI.addXP(player, "woodcutting", xp, "pve");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
if (player == null || !player.hasMetadata("mcMMO: Player Data") || SkillType.WOODCUTTING.getDoubleDropsDisabled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int skillLevel = UserManager.getPlayer(player).getSkillLevel(SkillType.WOODCUTTING);
|
|
||||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.WOODCUTTING);
|
|
||||||
return Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS)
|
|
||||||
&& SkillUtils.activationSuccessful(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, player, skillLevel, activationChance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return AbilityAPI.treeFellerEnabled(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>McMMOClassic13</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.15</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gmail.nossr50</groupId>
|
|
||||||
<artifactId>mcmmo</artifactId>
|
|
||||||
<version>1.6.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,53 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.api.AbilityAPI;
|
|
||||||
import com.gmail.nossr50.api.ExperienceAPI;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class McMMOClassic13Hook implements TimberHook {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int xp = 0;
|
|
||||||
for (ITreeBlock<Block> treeBlock : treeBlocks.getLogBlocks()) {
|
|
||||||
Block block = treeBlock.getBlock();
|
|
||||||
BlockData blockData = block.getBlockData();
|
|
||||||
xp += ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, blockData);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExperienceAPI.addXP(player, "woodcutting", xp, "pve");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
if (player == null || !player.hasMetadata("mcMMO: Player Data") || SkillType.WOODCUTTING.getDoubleDropsDisabled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int skillLevel = UserManager.getPlayer(player).getSkillLevel(SkillType.WOODCUTTING);
|
|
||||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.WOODCUTTING);
|
|
||||||
return Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS)
|
|
||||||
&& SkillUtils.activationSuccessful(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, player, skillLevel, activationChance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return AbilityAPI.treeFellerEnabled(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.songoda</groupId>
|
|
||||||
<artifactId>UltimateTimber</artifactId>
|
|
||||||
<version>2.0.8</version>
|
|
||||||
<relativePath>../../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>McMMOClassic8</artifactId>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.spigotmc</groupId>
|
|
||||||
<artifactId>spigot</artifactId>
|
|
||||||
<version>1.8.8</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.gmail.nossr50</groupId>
|
|
||||||
<artifactId>mcmmo</artifactId>
|
|
||||||
<version>1.5.04</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,52 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.api.AbilityAPI;
|
|
||||||
import com.gmail.nossr50.api.ExperienceAPI;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class McMMOClassic8Hook implements TimberHook {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyExperience(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (player.getGameMode().equals(GameMode.CREATIVE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int xp = 0;
|
|
||||||
for (ITreeBlock<Block> treeBlock : treeBlocks.getLogBlocks()) {
|
|
||||||
Block block = treeBlock.getBlock();
|
|
||||||
Material material = block.getType();
|
|
||||||
xp += ExperienceConfig.getInstance().getXp(SkillType.WOODCUTTING, material);
|
|
||||||
}
|
|
||||||
|
|
||||||
ExperienceAPI.addXP(player, "woodcutting", xp, "pve");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldApplyDoubleDrops(Player player) {
|
|
||||||
if (player == null || !player.hasMetadata("mcMMO: Player Data") || SkillType.WOODCUTTING.getDoubleDropsDisabled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int skillLevel = UserManager.getPlayer(player).getSkillLevel(SkillType.WOODCUTTING);
|
|
||||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.WOODCUTTING);
|
|
||||||
return Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS)
|
|
||||||
&& SkillUtils.activationSuccessful(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, player, skillLevel, activationChance);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUsingAbility(Player player) {
|
|
||||||
return AbilityAPI.treeFellerEnabled(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.0.8</version>
|
<version>2.0.9</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.hook;
|
|
||||||
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public interface TimberHook {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies experience to a player for a fallen tree
|
|
||||||
*
|
|
||||||
* @param player The player
|
|
||||||
* @param treeBlocks The tree blocks that were broken
|
|
||||||
*/
|
|
||||||
void applyExperience(Player player, TreeBlockSet<Block> treeBlocks);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if double drops should be applied
|
|
||||||
*
|
|
||||||
* @param player The player
|
|
||||||
* @return True if double drops should be applied, otherwise false
|
|
||||||
*/
|
|
||||||
boolean shouldApplyDoubleDrops(Player player);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a player is using an ability
|
|
||||||
*
|
|
||||||
* @param player The player
|
|
||||||
* @return True if an ability is being used, otherwise false
|
|
||||||
*/
|
|
||||||
boolean isUsingAbility(Player player);
|
|
||||||
|
|
||||||
}
|
|
@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.0.8</version>
|
<version>2.0.9</version>
|
||||||
<relativePath>../../</relativePath>
|
<relativePath>../../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -101,41 +101,5 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>CoreProtect</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>Jobs</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>McMMO</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>McMMOClassic8</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>McMMOClassic12</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>McMMOClassic13</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -390,7 +390,7 @@ trees:
|
|||||||
leaves:
|
leaves:
|
||||||
- WARPED_WART_BLOCK
|
- WARPED_WART_BLOCK
|
||||||
- SHROOMLIGHT
|
- SHROOMLIGHT
|
||||||
sapling: CRIMSON_FUNGUS
|
sapling: WARPED_FUNGUS
|
||||||
plantable-soil:
|
plantable-soil:
|
||||||
- WARPED_NYLIUM
|
- WARPED_NYLIUM
|
||||||
max-log-distance-from-trunk: 27
|
max-log-distance-from-trunk: 27
|
||||||
|
@ -3,7 +3,7 @@ version: maven-version-number
|
|||||||
authors: [Songoda, Esophose]
|
authors: [Songoda, Esophose]
|
||||||
main: com.songoda.ultimatetimber.UltimateTimber
|
main: com.songoda.ultimatetimber.UltimateTimber
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend: [mcMMO, Jobs]
|
softdepend: [mcMMO, Jobs, CoreProtect]
|
||||||
commands:
|
commands:
|
||||||
ut:
|
ut:
|
||||||
description: Reloads the configuration file
|
description: Reloads the configuration file
|
||||||
|
@ -4,6 +4,7 @@ import com.songoda.core.SongodaCore;
|
|||||||
import com.songoda.core.SongodaPlugin;
|
import com.songoda.core.SongodaPlugin;
|
||||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||||
import com.songoda.core.configuration.Config;
|
import com.songoda.core.configuration.Config;
|
||||||
|
import com.songoda.core.hooks.LogManager;
|
||||||
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
||||||
import com.songoda.ultimatetimber.adapter.current.CurrentAdapter;
|
import com.songoda.ultimatetimber.adapter.current.CurrentAdapter;
|
||||||
import com.songoda.ultimatetimber.adapter.legacy.LegacyAdapter;
|
import com.songoda.ultimatetimber.adapter.legacy.LegacyAdapter;
|
||||||
@ -28,7 +29,6 @@ public class UltimateTimber extends SongodaPlugin {
|
|||||||
private VersionAdapter versionAdapter;
|
private VersionAdapter versionAdapter;
|
||||||
private ChoppingManager choppingManager;
|
private ChoppingManager choppingManager;
|
||||||
private ConfigurationManager configurationManager;
|
private ConfigurationManager configurationManager;
|
||||||
private HookManager hookManager;
|
|
||||||
private com.songoda.core.commands.CommandManager commandManager;
|
private com.songoda.core.commands.CommandManager commandManager;
|
||||||
private PlacedBlockManager placedBlockManager;
|
private PlacedBlockManager placedBlockManager;
|
||||||
private SaplingManager saplingManager;
|
private SaplingManager saplingManager;
|
||||||
@ -51,6 +51,9 @@ public class UltimateTimber extends SongodaPlugin {
|
|||||||
// Run Songoda Updater
|
// Run Songoda Updater
|
||||||
SongodaCore.registerPlugin(this, 18, CompatibleMaterial.IRON_AXE);
|
SongodaCore.registerPlugin(this, 18, CompatibleMaterial.IRON_AXE);
|
||||||
|
|
||||||
|
// Load hooks
|
||||||
|
LogManager.load();
|
||||||
|
|
||||||
// Setup plugin commands
|
// Setup plugin commands
|
||||||
this.commandManager = new com.songoda.core.commands.CommandManager(this);
|
this.commandManager = new com.songoda.core.commands.CommandManager(this);
|
||||||
this.commandManager.addMainCommand("ut")
|
this.commandManager.addMainCommand("ut")
|
||||||
@ -62,7 +65,6 @@ public class UltimateTimber extends SongodaPlugin {
|
|||||||
this.managers = new HashSet<>();
|
this.managers = new HashSet<>();
|
||||||
this.choppingManager = this.registerManager(ChoppingManager.class);
|
this.choppingManager = this.registerManager(ChoppingManager.class);
|
||||||
this.configurationManager = new ConfigurationManager(this);
|
this.configurationManager = new ConfigurationManager(this);
|
||||||
this.hookManager = this.registerManager(HookManager.class);
|
|
||||||
this.placedBlockManager = this.registerManager(PlacedBlockManager.class);
|
this.placedBlockManager = this.registerManager(PlacedBlockManager.class);
|
||||||
this.saplingManager = this.registerManager(SaplingManager.class);
|
this.saplingManager = this.registerManager(SaplingManager.class);
|
||||||
this.treeAnimationManager = this.registerManager(TreeAnimationManager.class);
|
this.treeAnimationManager = this.registerManager(TreeAnimationManager.class);
|
||||||
@ -80,6 +82,10 @@ public class UltimateTimber extends SongodaPlugin {
|
|||||||
this.disable();
|
this.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDataLoad() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigReload() {
|
public void onConfigReload() {
|
||||||
this.configurationManager.reload();
|
this.configurationManager.reload();
|
||||||
@ -156,15 +162,6 @@ public class UltimateTimber extends SongodaPlugin {
|
|||||||
return this.configurationManager;
|
return this.configurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the hook manager
|
|
||||||
*
|
|
||||||
* @return The HookManager instance
|
|
||||||
*/
|
|
||||||
public HookManager getHookManager() {
|
|
||||||
return this.hookManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the placed block manager
|
* Gets the placed block manager
|
||||||
*
|
*
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
package com.songoda.ultimatetimber.manager;
|
|
||||||
|
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
|
||||||
import com.songoda.ultimatetimber.adapter.VersionAdapterType;
|
|
||||||
import com.songoda.ultimatetimber.hook.CoreProtectHook;
|
|
||||||
import com.songoda.ultimatetimber.hook.JobsHook;
|
|
||||||
import com.songoda.ultimatetimber.hook.McMMOClassic12Hook;
|
|
||||||
import com.songoda.ultimatetimber.hook.McMMOClassic13Hook;
|
|
||||||
import com.songoda.ultimatetimber.hook.McMMOClassic8Hook;
|
|
||||||
import com.songoda.ultimatetimber.hook.McMMOHook;
|
|
||||||
import com.songoda.ultimatetimber.hook.TimberHook;
|
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
|
||||||
import com.songoda.ultimatetimber.utils.NMSUtil;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
public class HookManager extends Manager {
|
|
||||||
|
|
||||||
private Set<TimberHook> hooks;
|
|
||||||
|
|
||||||
public HookManager(UltimateTimber ultimateTimber) {
|
|
||||||
super(ultimateTimber);
|
|
||||||
this.hooks = new HashSet<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reload() {
|
|
||||||
this.hooks.clear();
|
|
||||||
|
|
||||||
this.tryHook("Jobs", JobsHook.class);
|
|
||||||
this.tryHook("CoreProtect", CoreProtectHook.class);
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
|
||||||
if (this.plugin.getVersionAdapter().getVersionAdapterType().equals(VersionAdapterType.CURRENT)) {
|
|
||||||
Plugin mcMMO = Bukkit.getPluginManager().getPlugin("mcMMO");
|
|
||||||
if (mcMMO != null) {
|
|
||||||
String version = mcMMO.getDescription().getVersion();
|
|
||||||
if (version.startsWith("2")) {
|
|
||||||
this.tryHook("mcMMO", McMMOHook.class);
|
|
||||||
} else {
|
|
||||||
this.tryHook("mcMMO", McMMOClassic13Hook.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (NMSUtil.getVersionNumber() == 12) {
|
|
||||||
this.tryHook("mcMMO", McMMOClassic12Hook.class);
|
|
||||||
} else if (NMSUtil.getVersionNumber() == 8) {
|
|
||||||
this.tryHook("mcMMO", McMMOClassic8Hook.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
|
||||||
this.hooks.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to hook into a compatible plugin
|
|
||||||
*
|
|
||||||
* @param pluginName The name of the plugin
|
|
||||||
* @param hookClass The hook class
|
|
||||||
*/
|
|
||||||
private void tryHook(String pluginName, Class<? extends TimberHook> hookClass) {
|
|
||||||
if (!Bukkit.getPluginManager().isPluginEnabled(pluginName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.hooks.add(hookClass.newInstance());
|
|
||||||
Bukkit.getConsoleSender().sendMessage(String.format("Hooks: Hooked into %s!", pluginName));
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(String.format("Hooks: Unable to hook with %s, the version installed is not supported!", pluginName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies experience to the loaded hooks
|
|
||||||
*
|
|
||||||
* @param player The player to apply experience to
|
|
||||||
* @param treeBlocks The blocks of the tree that were broken
|
|
||||||
*/
|
|
||||||
public void applyExperienceHooks(Player player, TreeBlockSet<Block> treeBlocks) {
|
|
||||||
if (!ConfigurationManager.Setting.HOOKS_APPLY_EXPERIENCE.getBoolean())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (TimberHook hook : this.hooks)
|
|
||||||
hook.applyExperience(player, treeBlocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if double drops should be applied from the loaded hooks
|
|
||||||
*
|
|
||||||
* @param player The player to check
|
|
||||||
*/
|
|
||||||
public boolean shouldApplyDoubleDropsHooks(Player player) {
|
|
||||||
if (!ConfigurationManager.Setting.HOOKS_APPLY_EXTRA_DROPS.getBoolean())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (TimberHook hook : this.hooks)
|
|
||||||
if (hook.shouldApplyDoubleDrops(player))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a player is using an ability from the loaded hooks
|
|
||||||
*
|
|
||||||
* @param player The player to check
|
|
||||||
*/
|
|
||||||
public boolean isUsingAbilityHooks(Player player) {
|
|
||||||
if (!ConfigurationManager.Setting.HOOKS_REQUIRE_ABILITY_ACTIVE.getBoolean() || this.hooks.isEmpty())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (TimberHook hook : this.hooks)
|
|
||||||
if (hook.isUsingAbility(player))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package com.songoda.ultimatetimber.manager;
|
package com.songoda.ultimatetimber.manager;
|
||||||
|
|
||||||
|
import com.songoda.core.hooks.McMMOHook;
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.adapter.IBlockData;
|
import com.songoda.ultimatetimber.adapter.IBlockData;
|
||||||
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
||||||
@ -246,7 +247,6 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
*/
|
*/
|
||||||
public void dropTreeLoot(TreeDefinition treeDefinition, ITreeBlock treeBlock, Player player, boolean hasSilkTouch, boolean isForEntireTree) {
|
public void dropTreeLoot(TreeDefinition treeDefinition, ITreeBlock treeBlock, Player player, boolean hasSilkTouch, boolean isForEntireTree) {
|
||||||
VersionAdapter versionAdapter = this.plugin.getVersionAdapter();
|
VersionAdapter versionAdapter = this.plugin.getVersionAdapter();
|
||||||
HookManager hookManager = this.plugin.getHookManager();
|
|
||||||
|
|
||||||
boolean addToInventory = ConfigurationManager.Setting.ADD_ITEMS_TO_INVENTORY.getBoolean();
|
boolean addToInventory = ConfigurationManager.Setting.ADD_ITEMS_TO_INVENTORY.getBoolean();
|
||||||
boolean hasBonusChance = player.hasPermission("ultimatetimber.bonusloot");
|
boolean hasBonusChance = player.hasPermission("ultimatetimber.bonusloot");
|
||||||
@ -260,7 +260,7 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
toTry.addAll(this.globalEntireTreeLoot);
|
toTry.addAll(this.globalEntireTreeLoot);
|
||||||
} else {
|
} else {
|
||||||
if (ConfigurationManager.Setting.APPLY_SILK_TOUCH.getBoolean() && hasSilkTouch) {
|
if (ConfigurationManager.Setting.APPLY_SILK_TOUCH.getBoolean() && hasSilkTouch) {
|
||||||
if (hookManager.shouldApplyDoubleDropsHooks(player))
|
if (McMMOHook.hasWoodcuttingDoubleDrops(player))
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
} else {
|
} else {
|
||||||
@ -269,7 +269,7 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
toTry.addAll(treeDefinition.getLogLoot());
|
toTry.addAll(treeDefinition.getLogLoot());
|
||||||
toTry.addAll(this.globalLogLoot);
|
toTry.addAll(this.globalLogLoot);
|
||||||
if (treeDefinition.shouldDropOriginalLog()) {
|
if (treeDefinition.shouldDropOriginalLog()) {
|
||||||
if (hookManager.shouldApplyDoubleDropsHooks(player))
|
if (McMMOHook.hasWoodcuttingDoubleDrops(player))
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
toTry.addAll(treeDefinition.getLeafLoot());
|
toTry.addAll(treeDefinition.getLeafLoot());
|
||||||
toTry.addAll(this.globalLeafLoot);
|
toTry.addAll(this.globalLeafLoot);
|
||||||
if (treeDefinition.shouldDropOriginalLeaf()) {
|
if (treeDefinition.shouldDropOriginalLeaf()) {
|
||||||
if (hookManager.shouldApplyDoubleDropsHooks(player))
|
if (McMMOHook.hasWoodcuttingDoubleDrops(player))
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
lootedItems.addAll(versionAdapter.getBlockDrops(treeDefinition, treeBlock));
|
||||||
}
|
}
|
||||||
@ -295,13 +295,13 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (treeLoot.hasItem()) {
|
if (treeLoot.hasItem()) {
|
||||||
if (hookManager.shouldApplyDoubleDropsHooks(player))
|
if (McMMOHook.hasWoodcuttingDoubleDrops(player))
|
||||||
lootedItems.add(treeLoot.getItem());
|
lootedItems.add(treeLoot.getItem());
|
||||||
lootedItems.add(treeLoot.getItem());
|
lootedItems.add(treeLoot.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (treeLoot.hasCommand()) {
|
if (treeLoot.hasCommand()) {
|
||||||
if (hookManager.shouldApplyDoubleDropsHooks(player))
|
if (McMMOHook.hasWoodcuttingDoubleDrops(player))
|
||||||
lootedCommands.add(treeLoot.getCommand());
|
lootedCommands.add(treeLoot.getCommand());
|
||||||
lootedCommands.add(treeLoot.getCommand());
|
lootedCommands.add(treeLoot.getCommand());
|
||||||
}
|
}
|
||||||
@ -359,5 +359,4 @@ public class TreeDefinitionManager extends Manager {
|
|||||||
double chance = configurationSection.getDouble("chance");
|
double chance = configurationSection.getDouble("chance");
|
||||||
return new TreeLoot(treeBlockType, item, command, chance);
|
return new TreeLoot(treeBlockType, item, command, chance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package com.songoda.ultimatetimber.manager;
|
package com.songoda.ultimatetimber.manager;
|
||||||
|
|
||||||
|
import com.songoda.core.hooks.JobsHook;
|
||||||
|
import com.songoda.core.hooks.LogManager;
|
||||||
|
import com.songoda.core.hooks.McMMOHook;
|
||||||
import com.songoda.ultimatetimber.UltimateTimber;
|
import com.songoda.ultimatetimber.UltimateTimber;
|
||||||
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
import com.songoda.ultimatetimber.adapter.VersionAdapter;
|
||||||
import com.songoda.ultimatetimber.events.TreeFallEvent;
|
import com.songoda.ultimatetimber.events.TreeFallEvent;
|
||||||
import com.songoda.ultimatetimber.events.TreeFellEvent;
|
import com.songoda.ultimatetimber.events.TreeFellEvent;
|
||||||
import com.songoda.ultimatetimber.misc.OnlyToppleWhile;
|
import com.songoda.ultimatetimber.misc.OnlyToppleWhile;
|
||||||
import com.songoda.ultimatetimber.tree.DetectedTree;
|
import com.songoda.ultimatetimber.tree.DetectedTree;
|
||||||
|
import com.songoda.ultimatetimber.tree.ITreeBlock;
|
||||||
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
import com.songoda.ultimatetimber.tree.TreeBlockSet;
|
||||||
|
import com.songoda.ultimatetimber.tree.TreeBlockType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -19,6 +24,8 @@ 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.stream.Collectors;
|
||||||
|
|
||||||
public class TreeFallManager extends Manager implements Listener {
|
public class TreeFallManager extends Manager implements Listener {
|
||||||
|
|
||||||
public TreeFallManager(UltimateTimber ultimateTimber) {
|
public TreeFallManager(UltimateTimber ultimateTimber) {
|
||||||
@ -44,7 +51,6 @@ public class TreeFallManager extends Manager implements Listener {
|
|||||||
ChoppingManager choppingManager = this.plugin.getChoppingManager();
|
ChoppingManager choppingManager = this.plugin.getChoppingManager();
|
||||||
SaplingManager saplingManager = this.plugin.getSaplingManager();
|
SaplingManager saplingManager = this.plugin.getSaplingManager();
|
||||||
VersionAdapter versionAdapter = this.plugin.getVersionAdapter();
|
VersionAdapter versionAdapter = this.plugin.getVersionAdapter();
|
||||||
HookManager hookManager = this.plugin.getHookManager();
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
@ -85,7 +91,8 @@ public class TreeFallManager extends Manager implements Listener {
|
|||||||
if (!treeDefinitionManager.isToolValidForAnyTreeDefinition(tool))
|
if (!treeDefinitionManager.isToolValidForAnyTreeDefinition(tool))
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
if (!hookManager.isUsingAbilityHooks(player))
|
if (ConfigurationManager.Setting.HOOKS_REQUIRE_ABILITY_ACTIVE.getBoolean()
|
||||||
|
&& McMMOHook.isUsingTreeFeller(player))
|
||||||
isValid = false;
|
isValid = false;
|
||||||
|
|
||||||
boolean alwaysReplantSapling = ConfigurationManager.Setting.ALWAYS_REPLANT_SAPLING.getBoolean();
|
boolean alwaysReplantSapling = ConfigurationManager.Setting.ALWAYS_REPLANT_SAPLING.getBoolean();
|
||||||
@ -131,7 +138,15 @@ public class TreeFallManager extends Manager implements Listener {
|
|||||||
if (!player.getGameMode().equals(GameMode.CREATIVE))
|
if (!player.getGameMode().equals(GameMode.CREATIVE))
|
||||||
versionAdapter.applyToolDurability(player, toolDamage);
|
versionAdapter.applyToolDurability(player, toolDamage);
|
||||||
|
|
||||||
hookManager.applyExperienceHooks(player, detectedTree.getDetectedTreeBlocks());
|
McMMOHook.addWoodcutting(player, detectedTree.getDetectedTreeBlocks().getAllTreeBlocks().stream()
|
||||||
|
.map(ITreeBlock::getBlock).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
for (ITreeBlock<Block> treeBlock : detectedTree.getDetectedTreeBlocks().getAllTreeBlocks()) {
|
||||||
|
if (JobsHook.isEnabled() && treeBlock.getTreeBlockType() == TreeBlockType.LOG)
|
||||||
|
JobsHook.breakBlock(player, block);
|
||||||
|
LogManager.logRemoval(player, treeBlock.getBlock());
|
||||||
|
}
|
||||||
|
|
||||||
treeAnimationManager.runAnimation(detectedTree, player);
|
treeAnimationManager.runAnimation(detectedTree, player);
|
||||||
treeDefinitionManager.dropTreeLoot(detectedTree.getTreeDefinition(), detectedTree.getDetectedTreeBlocks().getInitialLogBlock(), player, false, true);
|
treeDefinitionManager.dropTreeLoot(detectedTree.getTreeDefinition(), detectedTree.getDetectedTreeBlocks().getInitialLogBlock(), player, false, true);
|
||||||
|
|
||||||
|
8
pom.xml
8
pom.xml
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>UltimateTimber</artifactId>
|
<artifactId>UltimateTimber</artifactId>
|
||||||
<version>2.0.8</version>
|
<version>2.0.9</version>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
@ -11,12 +11,6 @@
|
|||||||
<module>UltimateTimber/Plugin</module>
|
<module>UltimateTimber/Plugin</module>
|
||||||
<module>UltimateTimber-Adapter/Current</module>
|
<module>UltimateTimber-Adapter/Current</module>
|
||||||
<module>UltimateTimber-Adapter/Legacy</module>
|
<module>UltimateTimber-Adapter/Legacy</module>
|
||||||
<module>UltimateTimber-Hook/Jobs</module>
|
|
||||||
<module>UltimateTimber-Hook/McMMO</module>
|
|
||||||
<module>UltimateTimber-Hook/McMMOClassic13</module>
|
|
||||||
<module>UltimateTimber-Hook/McMMOClassic12</module>
|
|
||||||
<module>UltimateTimber-Hook/McMMOClassic8</module>
|
|
||||||
<module>UltimateTimber-Hook/CoreProtect</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
Loading…
Reference in New Issue
Block a user