Reworked the relationship between SubSkill and Locale keys

This commit is contained in:
nossr50
2019-01-04 07:58:39 -08:00
parent 6dc75760d0
commit 01a7aa4d12
60 changed files with 2118 additions and 2322 deletions

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -99,6 +100,9 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ACROBATICS);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -105,6 +106,9 @@ public class AlchemyCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ALCHEMY);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -42,9 +43,9 @@ public class ArcheryCommand extends SkillCommand {
dazeChanceLucky = dazeStrings[1];
}
// ARCHERY_RETRIEVE
// ARCHERY_ARROW_RETRIEVAL
if (canRetrieve) {
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_RETRIEVE, isLucky);
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SubSkill.ARCHERY_ARROW_RETRIEVAL, isLucky);
retrieveChance = retrieveStrings[0];
retrieveChanceLucky = retrieveStrings[1];
}
@ -54,7 +55,7 @@ public class ArcheryCommand extends SkillCommand {
protected void permissionsCheck(Player player) {
canSkillShot = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_SKILL_SHOT);
canDaze = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_DAZE);
canRetrieve = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_RETRIEVE);
canRetrieve = Permissions.isSubSkillEnabled(player, SubSkill.ARCHERY_ARROW_RETRIEVAL);
}
@Override
@ -98,6 +99,9 @@ public class ArcheryCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.ARCHERY);
return textComponents;
}
}

View File

@ -3,10 +3,9 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -48,7 +47,7 @@ public class AxesCommand extends SkillCommand {
// CRITICAL HIT
if (canCritical) {
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SubSkill.AXES_CRITICAL_HIT, isLucky);
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SubSkill.AXES_CRITICAL_STRIKES, isLucky);
critChance = criticalHitStrings[0];
critChanceLucky = criticalHitStrings[1];
}
@ -62,7 +61,7 @@ public class AxesCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canSkullSplitter = Permissions.skullSplitter(player);
canCritical = Permissions.isSubSkillEnabled(player, SubSkill.AXES_CRITICAL_HIT);
canCritical = Permissions.isSubSkillEnabled(player, SubSkill.AXES_CRITICAL_STRIKES);
canAxeMastery = Permissions.isSubSkillEnabled(player, SubSkill.AXES_AXE_MASTERY);
canImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_ARMOR_IMPACT);
canGreaterImpact = Permissions.isSubSkillEnabled(player, SubSkill.AXES_GREATER_IMPACT);
@ -125,6 +124,9 @@ public class AxesCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.AXES);
return textComponents;
}
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -67,6 +68,9 @@ public class ExcavationCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.EXCAVATION);
return textComponents;
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
@ -207,6 +208,9 @@ public class FishingCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.FISHING);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.herbalism.Herbalism;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -167,6 +168,9 @@ public class HerbalismCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.HERBALISM);
return textComponents;
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -155,6 +156,9 @@ public class MiningCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.MINING);
return textComponents;
}
}

View File

@ -11,6 +11,7 @@ import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.RepairManager;
import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import com.gmail.nossr50.util.player.UserManager;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Material;
@ -160,6 +161,9 @@ public class RepairCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.REPAIR);
return textComponents;
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -81,6 +82,9 @@ public class SalvageCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SALVAGE);
return textComponents;
}
}

View File

@ -71,29 +71,24 @@ public abstract class SkillCommand implements TabExecutor {
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
}
if(skill == PrimarySkill.WOODCUTTING)
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
//Make JSON text components
List<TextComponent> subskillTextComponents = getTextComponents(player);
//Subskills Header
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.SubSkills")));
//Send JSON text components
for(TextComponent tc : subskillTextComponents)
{
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
//Make JSON text components
List<TextComponent> subskillTextComponents = getTextComponents(player);
//Subskills Header
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Effects.SubSkills")));
//Send JSON text components
for(TextComponent tc : subskillTextComponents)
{
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
}
//Stats
getStatMessages(player, isLucky, hasEndurance, skillValue);
} else {
displayOldSkillCommand(player, mcMMOPlayer, isLucky, hasEndurance, skillValue);
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
}
//Stats
getStatMessages(player, isLucky, hasEndurance, skillValue);
return true;
default:

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -122,6 +123,9 @@ public class SmeltingCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -48,9 +49,9 @@ public class SwordsCommand extends SkillCommand {
bleedChanceLucky = bleedStrings[1];
}
// SWORDS_COUNTER
// SWORDS_COUNTER_ATTACK
if (canCounter) {
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SWORDS_COUNTER, isLucky);
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SubSkill.SWORDS_COUNTER_ATTACK, isLucky);
counterChance = counterStrings[0];
counterChanceLucky = counterStrings[1];
}
@ -59,7 +60,7 @@ public class SwordsCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canBleed = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_BLEED);
canCounter = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_COUNTER);
canCounter = Permissions.isSubSkillEnabled(player, SubSkill.SWORDS_COUNTER_ATTACK);
canSerratedStrike = Permissions.serratedStrikes(player);
}
@ -107,6 +108,9 @@ public class SwordsCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.SWORDS);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@ -47,7 +48,7 @@ public class TamingCommand extends SkillCommand {
canBeastLore = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_BEAST_LORE);
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
canEnvironmentallyAware = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_ENVIRONMENTALLY_AWARE);
canFastFood = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_FAST_FOOD);
canFastFood = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_FAST_FOOD_SERVICE);
canGore = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_GORE);
canSharpenedClaws = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHARPENED_CLAWS);
canShockProof = Permissions.isSubSkillEnabled(player, SubSkill.TAMING_SHOCK_PROOF);
@ -173,6 +174,9 @@ public class TamingCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.TAMING);
return textComponents;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.SkillTextComponentFactory;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -49,9 +50,9 @@ public class UnarmedCommand extends SkillCommand {
disarmChanceLucky = disarmStrings[1];
}
// UNARMED_DEFLECT
// UNARMED_ARROW_DEFLECT
if (canDeflect) {
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_DEFLECT, isLucky);
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SubSkill.UNARMED_ARROW_DEFLECT, isLucky);
deflectChance = deflectStrings[0];
deflectChanceLucky = deflectStrings[1];
}
@ -72,8 +73,8 @@ public class UnarmedCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canBerserk = Permissions.berserk(player);
canIronArm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_ARM);
canDeflect = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_DEFLECT);
canIronArm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_ARM_STYLE);
canDeflect = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_ARROW_DEFLECT);
canDisarm = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_DISARM);
canIronGrip = Permissions.isSubSkillEnabled(player, SubSkill.UNARMED_IRON_GRIP);
// TODO: Apparently we forgot about block cracker?
@ -137,6 +138,9 @@ public class UnarmedCommand extends SkillCommand {
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.UNARMED);
return textComponents;
}
}

View File

@ -129,30 +129,10 @@ public class WoodcuttingCommand extends SkillCommand {
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
if (canTreeFell) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_TREE_FELLER, 0, 1));
}
if (canLeafBlow) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_LEAF_BLOWER, 2, 3));
}
if (canDoubleDrop) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_HARVEST_LUMBER, 4, 5));
}
if (canSplinter) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_SPLINTER, 6, 7));
}
if(canBarkSurgeon) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_BARK_SURGEON, 8, 9));
}
if(canNaturesBounty) {
textComponents.add(SkillTextComponentFactory.getSubSkillTextComponent(player, SubSkill.WOODCUTTING_NATURES_BOUNTY, 10, 11));
}
SkillTextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkill.WOODCUTTING);
return textComponents;
}
}