2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands.skills;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.config.AdvancedConfig;
|
2019-01-13 08:54:53 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
2019-01-09 04:52:52 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2019-01-09 04:52:52 +01:00
|
|
|
import com.gmail.nossr50.util.TextComponentFactory;
|
2019-01-15 11:43:44 +01:00
|
|
|
import com.gmail.nossr50.util.skills.RankUtils;
|
2019-01-02 17:06:18 +01:00
|
|
|
import net.md_5.bungee.api.chat.TextComponent;
|
2013-10-29 20:38:20 +01:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2019-01-15 07:11:58 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class WoodcuttingCommand extends SkillCommand {
|
|
|
|
private String treeFellerLength;
|
|
|
|
private String treeFellerLengthEndurance;
|
|
|
|
private String doubleDropChance;
|
|
|
|
private String doubleDropChanceLucky;
|
|
|
|
|
|
|
|
private boolean canTreeFell;
|
|
|
|
private boolean canLeafBlow;
|
|
|
|
private boolean canDoubleDrop;
|
2018-12-31 19:10:00 +01:00
|
|
|
private boolean canSplinter;
|
|
|
|
private boolean canBarkSurgeon;
|
|
|
|
private boolean canNaturesBounty;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public WoodcuttingCommand() {
|
2019-01-13 08:54:53 +01:00
|
|
|
super(PrimarySkillType.WOODCUTTING);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
2013-03-01 06:52:01 +01:00
|
|
|
// TREE FELLER
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canTreeFell) {
|
2013-10-29 20:38:20 +01:00
|
|
|
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
|
2013-03-12 21:25:42 +01:00
|
|
|
treeFellerLength = treeFellerStrings[0];
|
|
|
|
treeFellerLengthEndurance = treeFellerStrings[1];
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
// DOUBLE DROPS
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2019-01-15 11:43:44 +01:00
|
|
|
setDoubleDropClassicChanceStrings(skillValue, isLucky);
|
2013-03-12 21:25:42 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 19:10:00 +01:00
|
|
|
private void setDoubleDropClassicChanceStrings(float skillValue, boolean isLucky) {
|
2019-01-09 04:52:52 +01:00
|
|
|
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SubSkillType.WOODCUTTING_HARVEST_LUMBER, isLucky);
|
2018-12-31 19:10:00 +01:00
|
|
|
doubleDropChance = doubleDropStrings[0];
|
|
|
|
doubleDropChanceLucky = doubleDropStrings[1];
|
|
|
|
}
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected void permissionsCheck(Player player) {
|
2019-01-15 12:39:06 +01:00
|
|
|
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
|
|
|
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && !skill.getDoubleDropsDisabled() && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
|
|
|
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
|
|
|
canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER);
|
|
|
|
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
|
|
|
|
canNaturesBounty = canUseSubskill(player, SubSkillType.WOODCUTTING_NATURES_BOUNTY);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> effectsDisplay() {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
if (canTreeFell) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.0"), LocaleLoader.getString("Woodcutting.Effect.1")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canLeafBlow) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.2"), LocaleLoader.getString("Woodcutting.Effect.3")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.4"), LocaleLoader.getString("Woodcutting.Effect.5")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2018-12-31 19:10:00 +01:00
|
|
|
if (canSplinter) {
|
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.6"), LocaleLoader.getString("Woodcutting.Effect.7")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(canBarkSurgeon) {
|
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.8"), LocaleLoader.getString("Woodcutting.Effect.9")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(canNaturesBounty) {
|
|
|
|
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Woodcutting.Effect.10"), LocaleLoader.getString("Woodcutting.Effect.11")));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-29 20:38:20 +01:00
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-29 20:38:20 +01:00
|
|
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
|
|
|
List<String> messages = new ArrayList<String>();
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
if (canLeafBlow) {
|
2019-01-17 17:46:10 +01:00
|
|
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1")));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2013-03-12 21:25:42 +01:00
|
|
|
if (canDoubleDrop) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Woodcutting.Ability.Chance.DDrop", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (canTreeFell) {
|
2013-10-29 20:38:20 +01:00
|
|
|
messages.add(LocaleLoader.getString("Woodcutting.Ability.Length", treeFellerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", treeFellerLengthEndurance) : ""));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2013-10-29 20:38:20 +01:00
|
|
|
|
|
|
|
return messages;
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2019-01-02 17:06:18 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected List<TextComponent> getTextComponents(Player player) {
|
|
|
|
List<TextComponent> textComponents = new ArrayList<>();
|
|
|
|
|
2019-01-13 08:54:53 +01:00
|
|
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
|
2019-01-02 17:06:18 +01:00
|
|
|
|
|
|
|
return textComponents;
|
|
|
|
}
|
2019-01-04 16:58:39 +01:00
|
|
|
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|