Refactoring + adding a new skillranks config (not functional yet)

This commit is contained in:
nossr50
2019-01-12 23:54:53 -08:00
parent 0beabbf1ec
commit 6f77bb206d
117 changed files with 1149 additions and 855 deletions

View File

@@ -9,7 +9,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -21,7 +21,7 @@ public class AcrobaticsCommand extends SkillCommand {
private boolean canRoll;
public AcrobaticsCommand() {
super(PrimarySkill.ACROBATICS);
super(PrimarySkillType.ACROBATICS);
}
@Override
@@ -82,7 +82,7 @@ public class AcrobaticsCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ACROBATICS);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -28,7 +28,7 @@ public class AlchemyCommand extends SkillCommand {
private boolean canConcoctions;
public AlchemyCommand() {
super(PrimarySkill.ALCHEMY);
super(PrimarySkillType.ALCHEMY);
}
protected String[] calculateAbilityDisplayValues(Player player, boolean isLucky) {
@@ -107,7 +107,7 @@ public class AlchemyCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ALCHEMY);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -25,7 +25,7 @@ public class ArcheryCommand extends SkillCommand {
private boolean canRetrieve;
public ArcheryCommand() {
super(PrimarySkill.ARCHERY);
super(PrimarySkillType.ARCHERY);
}
@Override
@@ -100,7 +100,7 @@ public class ArcheryCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ARCHERY);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -28,7 +28,7 @@ public class AxesCommand extends SkillCommand {
private boolean canGreaterImpact;
public AxesCommand() {
super(PrimarySkill.AXES);
super(PrimarySkillType.AXES);
}
@Override
@@ -125,7 +125,7 @@ public class AxesCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.AXES);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
return textComponents;
}

View File

@@ -3,12 +3,12 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
@@ -20,7 +20,7 @@ public class ExcavationCommand extends SkillCommand {
private boolean canTreasureHunt;
public ExcavationCommand() {
super(PrimarySkill.EXCAVATION);
super(PrimarySkillType.EXCAVATION);
}
@Override
@@ -69,7 +69,7 @@ public class ExcavationCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.EXCAVATION);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
return textComponents;
}

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.fishing.Fishing;
@@ -46,7 +46,7 @@ public class FishingCommand extends SkillCommand {
private boolean canIceFish;
public FishingCommand() {
super(PrimarySkill.FISHING);
super(PrimarySkillType.FISHING);
}
@Override
@@ -209,7 +209,7 @@ public class FishingCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.FISHING);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING);
return textComponents;
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.herbalism.Herbalism;
@@ -36,7 +36,7 @@ public class HerbalismCommand extends SkillCommand {
private boolean canShroomThumb;
public HerbalismCommand() {
super(PrimarySkill.HERBALISM);
super(PrimarySkillType.HERBALISM);
}
@Override
@@ -169,7 +169,7 @@ public class HerbalismCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.HERBALISM);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
return textComponents;
}

View File

@@ -3,13 +3,13 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.BlastMining;
import com.gmail.nossr50.skills.mining.BlastMining.Tier;
@@ -37,7 +37,7 @@ public class MiningCommand extends SkillCommand {
private boolean canDemoExpert;
public MiningCommand() {
super(PrimarySkill.MINING);
super(PrimarySkillType.MINING);
}
@Override
@@ -157,7 +157,7 @@ public class MiningCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.MINING);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
return textComponents;
}

View File

@@ -1,11 +1,10 @@
package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -35,7 +34,7 @@ public class MmoInfoCommand implements TabExecutor {
return false;
//Real skill
if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkill.SUBSKILL_NAMES.contains(args[0]))
if(InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0]))
{
displayInfo(player, args[0]);
return true;
@@ -52,7 +51,7 @@ public class MmoInfoCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PrimarySkill.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkill.SUBSKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkillType.SUBSKILL_NAMES.size()));
default:
return ImmutableList.of();
}

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.ArcaneForging;
@@ -43,7 +43,7 @@ public class RepairCommand extends SkillCommand {
private int stoneLevel;
public RepairCommand() {
super(PrimarySkill.REPAIR);
super(PrimarySkillType.REPAIR);
}
@Override
@@ -162,7 +162,7 @@ public class RepairCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.REPAIR);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -20,7 +20,7 @@ public class SalvageCommand extends SkillCommand {
private boolean canArcaneSalvage;
public SalvageCommand() {
super(PrimarySkill.SALVAGE);
super(PrimarySkillType.SALVAGE);
}
@Override
@@ -83,7 +83,7 @@ public class SalvageCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SALVAGE);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
return textComponents;
}

View File

@@ -4,7 +4,7 @@ import java.text.DecimalFormat;
import java.util.List;
import java.util.Set;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
@@ -30,7 +30,7 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
public abstract class SkillCommand implements TabExecutor {
protected PrimarySkill skill;
protected PrimarySkillType skill;
private String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%");
@@ -38,7 +38,7 @@ public abstract class SkillCommand implements TabExecutor {
private CommandExecutor skillGuideCommand;
public SkillCommand(PrimarySkill skill) {
public SkillCommand(PrimarySkillType skill) {
this.skill = skill;
skillName = skill.getName();
skillGuideCommand = new SkillGuideCommand(skill);
@@ -143,10 +143,10 @@ public abstract class SkillCommand implements TabExecutor {
//LEVEL
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
Set<PrimarySkill> parents = FamilyTree.getParents(skill);
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
//TODO: Add JSON here
for (PrimarySkill parent : parents) {
for (PrimarySkillType parent : parents) {
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
}
}
@@ -161,9 +161,9 @@ public abstract class SkillCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue));
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
Set<PrimarySkill> parents = FamilyTree.getParents(skill);
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
for (PrimarySkill parent : parents) {
for (PrimarySkillType parent : parents) {
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
}
}

View File

@@ -3,11 +3,11 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.Arrays;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
@@ -17,7 +17,7 @@ public class SkillGuideCommand implements CommandExecutor {
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
public SkillGuideCommand(PrimarySkill skill) {
public SkillGuideCommand(PrimarySkillType skill) {
header = LocaleLoader.getString("Guides.Header", skill.getName());
guide = getGuide(skill);
}
@@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor {
return allStrings;
}
private ArrayList<String> getGuide(PrimarySkill skill) {
private ArrayList<String> getGuide(PrimarySkillType skill) {
ArrayList<String> guide = new ArrayList<String>();
for (int i = 0; i < 10; i++) {

View File

@@ -3,13 +3,13 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.smelting.Smelting;
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
@@ -29,7 +29,7 @@ public class SmeltingCommand extends SkillCommand {
private boolean canVanillaXPBoost;
public SmeltingCommand() {
super(PrimarySkill.SMELTING);
super(PrimarySkillType.SMELTING);
}
@Override
@@ -124,7 +124,7 @@ public class SmeltingCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SMELTING);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -28,7 +28,7 @@ public class SwordsCommand extends SkillCommand {
private boolean canBleed;
public SwordsCommand() {
super(PrimarySkill.SWORDS);
super(PrimarySkillType.SWORDS);
}
@Override
@@ -109,7 +109,7 @@ public class SwordsCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -31,7 +31,7 @@ public class TamingCommand extends SkillCommand {
private boolean canHolyHound;
public TamingCommand() {
super(PrimarySkill.TAMING);
super(PrimarySkillType.TAMING);
}
@Override
@@ -175,7 +175,7 @@ public class TamingCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.TAMING);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.TAMING);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -31,7 +31,7 @@ public class UnarmedCommand extends SkillCommand {
private boolean canIronGrip;
public UnarmedCommand() {
super(PrimarySkill.UNARMED);
super(PrimarySkillType.UNARMED);
}
@Override
@@ -139,7 +139,7 @@ public class UnarmedCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.UNARMED);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
return textComponents;
}

View File

@@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.util.TextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
@@ -27,7 +27,7 @@ public class WoodcuttingCommand extends SkillCommand {
private boolean canNaturesBounty;
public WoodcuttingCommand() {
super(PrimarySkill.WOODCUTTING);
super(PrimarySkillType.WOODCUTTING);
}
@Override
@@ -129,7 +129,7 @@ public class WoodcuttingCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.WOODCUTTING);
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
return textComponents;
}