mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01:00 
			
		
		
		
	Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows
This commit is contained in:
		@@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
 | 
			
		||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -89,8 +89,8 @@ public class AcrobaticsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.skills.alchemy.AlchemyManager;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -92,8 +92,8 @@ public class AlchemyCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.skills.archery.Archery;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.CombatUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -84,8 +84,8 @@ public class ArcheryCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.CombatUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -104,8 +104,8 @@ public class AxesCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.skills.excavation.ExcavationManager;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -65,8 +65,8 @@ public class ExcavationCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
@@ -166,8 +166,8 @@ public class FishingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
@@ -141,8 +141,8 @@ public class HerbalismCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -110,8 +110,8 @@ public class MiningCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
@@ -120,8 +120,8 @@ public class RepairCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.skills.salvage.Salvage;
 | 
			
		||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -63,8 +63,8 @@ public class SalvageCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@ import com.gmail.nossr50.util.skills.PerksUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import com.google.common.collect.ImmutableList;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import net.md_5.bungee.api.ChatColor;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import org.bukkit.command.Command;
 | 
			
		||||
@@ -84,7 +85,7 @@ public abstract class SkillCommand implements TabExecutor {
 | 
			
		||||
            sendSkillCommandHeader(player, mmoPlayer, (int) skillValue);
 | 
			
		||||
 | 
			
		||||
            //Make JSON text components
 | 
			
		||||
            List<TextComponent> subskillTextComponents = getTextComponents(player);
 | 
			
		||||
            List<Component> subskillTextComponents = getTextComponents(player);
 | 
			
		||||
 | 
			
		||||
            //Subskills Header
 | 
			
		||||
            player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul")));
 | 
			
		||||
@@ -282,7 +283,7 @@ public abstract class SkillCommand implements TabExecutor {
 | 
			
		||||
 | 
			
		||||
    protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
 | 
			
		||||
 | 
			
		||||
    protected abstract List<TextComponent> getTextComponents(Player player);
 | 
			
		||||
    protected abstract List<Component> getTextComponents(Player player);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if a player can use a skill
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -87,8 +87,8 @@ public class SmeltingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.CombatUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -109,8 +109,8 @@ public class SwordsCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.skills.taming.Taming;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.EntityType;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
@@ -92,8 +92,8 @@ public class TamingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.CombatUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -123,8 +123,8 @@ public class UnarmedCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -83,8 +83,8 @@ public class WoodcuttingCommand extends SkillCommand {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<TextComponent> getTextComponents(Player player) {
 | 
			
		||||
        List<TextComponent> textComponents = new ArrayList<>();
 | 
			
		||||
    protected List<Component> getTextComponents(Player player) {
 | 
			
		||||
        List<Component> textComponents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
 | 
			
		||||
import com.gmail.nossr50.util.skills.SkillUtils;
 | 
			
		||||
import com.gmail.nossr50.util.sounds.SoundManager;
 | 
			
		||||
import com.gmail.nossr50.util.sounds.SoundType;
 | 
			
		||||
import net.kyori.adventure.text.TextComponent;
 | 
			
		||||
import net.md_5.bungee.api.chat.ComponentBuilder;
 | 
			
		||||
import org.bukkit.Location;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
@@ -114,7 +115,7 @@ public class Roll extends AcrobaticsSubSkill {
 | 
			
		||||
     * @param player target player
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void addStats(ComponentBuilder componentBuilder, Player player) {
 | 
			
		||||
    public void addStats(TextComponent.Builder componentBuilder, Player player) {
 | 
			
		||||
        String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
 | 
			
		||||
 | 
			
		||||
        /* Values related to the player */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.gmail.nossr50.datatypes.skills.subskills.interfaces;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
 | 
			
		||||
import net.kyori.adventure.text.TextComponent;
 | 
			
		||||
import net.md_5.bungee.api.chat.ComponentBuilder;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
@@ -61,7 +62,7 @@ public interface SubSkill extends Skill {
 | 
			
		||||
     * @param componentBuilder target component builder
 | 
			
		||||
     * @param player owner of this skill
 | 
			
		||||
     */
 | 
			
		||||
    void addStats(ComponentBuilder componentBuilder, Player player);
 | 
			
		||||
    void addStats(TextComponent.Builder componentBuilder, Player player);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Whether or not this subskill is enabled
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
package com.gmail.nossr50.events.skills;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
 | 
			
		||||
import net.md_5.bungee.api.ChatMessageType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import com.gmail.nossr50.util.McMMOMessageType;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.event.Cancellable;
 | 
			
		||||
import org.bukkit.event.Event;
 | 
			
		||||
@@ -22,12 +22,12 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
 | 
			
		||||
    private boolean isMessageAlsoBeingSentToChat;
 | 
			
		||||
 | 
			
		||||
    private static final HandlerList handlers = new HandlerList();
 | 
			
		||||
    protected ChatMessageType chatMessageType;
 | 
			
		||||
    protected McMMOMessageType chatMessageType;
 | 
			
		||||
 | 
			
		||||
    protected TextComponent notificationTextComponent;
 | 
			
		||||
    protected Component notificationTextComponent;
 | 
			
		||||
    protected final NotificationType notificationType;
 | 
			
		||||
 | 
			
		||||
    public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, TextComponent notificationTextComponent, ChatMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
 | 
			
		||||
    public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, Component notificationTextComponent, McMMOMessageType chatMessageType, boolean isMessageAlsoBeingSentToChat) {
 | 
			
		||||
        super(false);
 | 
			
		||||
        this.notificationType = notificationType;
 | 
			
		||||
        this.notificationTextComponent = notificationTextComponent;
 | 
			
		||||
@@ -48,19 +48,19 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
 | 
			
		||||
        isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TextComponent getNotificationTextComponent() {
 | 
			
		||||
    public Component getNotificationTextComponent() {
 | 
			
		||||
        return notificationTextComponent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setNotificationTextComponent(TextComponent notificationTextComponent) {
 | 
			
		||||
    public void setNotificationTextComponent(Component notificationTextComponent) {
 | 
			
		||||
        this.notificationTextComponent = notificationTextComponent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ChatMessageType getChatMessageType() {
 | 
			
		||||
    public McMMOMessageType getChatMessageType() {
 | 
			
		||||
        return chatMessageType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setChatMessageType(ChatMessageType chatMessageType) {
 | 
			
		||||
    public void setChatMessageType(McMMOMessageType chatMessageType) {
 | 
			
		||||
        this.chatMessageType = chatMessageType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -126,10 +126,8 @@ public class BlockListener implements Listener {
 | 
			
		||||
        Block movedBlock;
 | 
			
		||||
 | 
			
		||||
        for (Block b : event.getBlocks()) {
 | 
			
		||||
            if (BlockUtils.shouldBeWatched(b.getState())) {
 | 
			
		||||
                movedBlock = b.getRelative(direction);
 | 
			
		||||
                mcMMO.getPlaceStore().setTrue(movedBlock);
 | 
			
		||||
            }
 | 
			
		||||
            movedBlock = b.getRelative(direction);
 | 
			
		||||
            mcMMO.getPlaceStore().setTrue(movedBlock);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -189,7 +187,6 @@ public class BlockListener implements Listener {
 | 
			
		||||
        if(ExperienceConfig.getInstance().preventStoneLavaFarming())
 | 
			
		||||
        {
 | 
			
		||||
            if(event.getNewState().getType() != Material.OBSIDIAN
 | 
			
		||||
                    && BlockUtils.shouldBeWatched(event.getNewState())
 | 
			
		||||
                    && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, event.getNewState().getBlockData()))
 | 
			
		||||
            {
 | 
			
		||||
                mcMMO.getPlaceStore().setTrue(event.getNewState());
 | 
			
		||||
@@ -204,9 +201,16 @@ public class BlockListener implements Listener {
 | 
			
		||||
     */
 | 
			
		||||
    @EventHandler(priority = EventPriority.MONITOR)
 | 
			
		||||
    public void onBlockPlace(BlockPlaceEvent event) {
 | 
			
		||||
        BlockState blockState = event.getBlock().getState();
 | 
			
		||||
 | 
			
		||||
        /* Check if the blocks placed should be monitored so they do not give out XP in the future */
 | 
			
		||||
//      if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
 | 
			
		||||
        mcMMO.getPlaceStore().setTrue(blockState);
 | 
			
		||||
 | 
			
		||||
        /* WORLD BLACKLIST CHECK */
 | 
			
		||||
        if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
 | 
			
		||||
        if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Player player = event.getPlayer();
 | 
			
		||||
 | 
			
		||||
@@ -214,15 +218,6 @@ public class BlockListener implements Listener {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        BlockState blockState = event.getBlock().getState();
 | 
			
		||||
 | 
			
		||||
        /* Check if the blocks placed should be monitored so they do not give out XP in the future */
 | 
			
		||||
        if (BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
            // Don't count de-barking wood
 | 
			
		||||
            if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
 | 
			
		||||
                mcMMO.getPlaceStore().setTrue(blockState);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        McMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(player);
 | 
			
		||||
 | 
			
		||||
        if(mmoPlayer == null)
 | 
			
		||||
@@ -243,24 +238,23 @@ public class BlockListener implements Listener {
 | 
			
		||||
     */
 | 
			
		||||
    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 | 
			
		||||
    public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
 | 
			
		||||
        /* WORLD BLACKLIST CHECK */
 | 
			
		||||
        if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        Player player = event.getPlayer();
 | 
			
		||||
 | 
			
		||||
        if (!mcMMO.getUserManager().hasPlayerDataKey(player)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (BlockState replacedBlockState : event.getReplacedBlockStates())
 | 
			
		||||
        {
 | 
			
		||||
            BlockState blockState = replacedBlockState.getBlock().getState();
 | 
			
		||||
 | 
			
		||||
            /* Check if the blocks placed should be monitored so they do not give out XP in the future */
 | 
			
		||||
            if (BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
                mcMMO.getPlaceStore().setTrue(blockState);
 | 
			
		||||
            }
 | 
			
		||||
            mcMMO.getPlaceStore().setTrue(blockState);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /* WORLD BLACKLIST CHECK */
 | 
			
		||||
        if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Player player = event.getPlayer();
 | 
			
		||||
 | 
			
		||||
        if (!mcMMO.getUserManager().hasPlayerDataKey(player)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -273,9 +267,9 @@ public class BlockListener implements Listener {
 | 
			
		||||
 | 
			
		||||
        BlockState blockState = event.getBlock().getState();
 | 
			
		||||
 | 
			
		||||
        if (!BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
//        if (!BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
//            return;
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
        mcMMO.getPlaceStore().setFalse(blockState);
 | 
			
		||||
    }
 | 
			
		||||
@@ -305,9 +299,9 @@ public class BlockListener implements Listener {
 | 
			
		||||
        BlockState blockState = event.getBlock().getState();
 | 
			
		||||
        Location location = blockState.getLocation();
 | 
			
		||||
 | 
			
		||||
        if (!BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
//        if (!BlockUtils.shouldBeWatched(blockState)) {
 | 
			
		||||
//            return;
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
        /* ALCHEMY - Cancel any brew in progress for that BrewingStand */
 | 
			
		||||
        if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(location)) {
 | 
			
		||||
@@ -323,8 +317,11 @@ public class BlockListener implements Listener {
 | 
			
		||||
        McMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(player);
 | 
			
		||||
 | 
			
		||||
        //Check if profile is loaded
 | 
			
		||||
        if(mmoPlayer == null)
 | 
			
		||||
        if(mmoPlayer == null) {
 | 
			
		||||
            /* Remove metadata from placed watched blocks */
 | 
			
		||||
            mcMMO.getPlaceStore().setFalse(blockState);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ItemStack heldItem = player.getInventory().getItemInMainHand();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,40 @@
 | 
			
		||||
//package com.gmail.nossr50.listeners;
 | 
			
		||||
//
 | 
			
		||||
//import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 | 
			
		||||
//import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
 | 
			
		||||
//import com.gmail.nossr50.mcMMO;
 | 
			
		||||
//import com.gmail.nossr50.util.player.UserManager;
 | 
			
		||||
//import com.gmail.nossr50.util.skills.SkillUtils;
 | 
			
		||||
//import org.bukkit.Bukkit;
 | 
			
		||||
//import org.bukkit.entity.Player;
 | 
			
		||||
//import org.bukkit.event.EventHandler;
 | 
			
		||||
//import org.bukkit.event.EventPriority;
 | 
			
		||||
//import org.bukkit.event.Listener;
 | 
			
		||||
//import org.bukkit.event.player.PlayerCommandPreprocessEvent;
 | 
			
		||||
//
 | 
			
		||||
//public class CommandListener implements Listener {
 | 
			
		||||
//
 | 
			
		||||
//    private final mcMMO pluginRef;
 | 
			
		||||
//
 | 
			
		||||
//    public CommandListener(mcMMO plugin) {
 | 
			
		||||
//        this.pluginRef = plugin;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
 | 
			
		||||
//    public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
 | 
			
		||||
//        Player player = event.getPlayer();
 | 
			
		||||
//
 | 
			
		||||
//        SkillUtils.removeAbilityBoostsFromInventory(player);
 | 
			
		||||
//
 | 
			
		||||
//        McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
 | 
			
		||||
//
 | 
			
		||||
//        if(mmoPlayer == null)
 | 
			
		||||
//            return;
 | 
			
		||||
//
 | 
			
		||||
//        Bukkit.getServer().getScheduler().runTaskLater(pluginRef, () -> {
 | 
			
		||||
//            if(mmoPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER) || mmoPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) {
 | 
			
		||||
//                SkillUtils.handleAbilitySpeedIncrease(player);
 | 
			
		||||
//            }
 | 
			
		||||
//        }, 5);
 | 
			
		||||
//    }
 | 
			
		||||
//}
 | 
			
		||||
@@ -46,6 +46,7 @@ import com.gmail.nossr50.util.skills.SmeltingTracker;
 | 
			
		||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
 | 
			
		||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
 | 
			
		||||
import com.google.common.base.Charsets;
 | 
			
		||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
 | 
			
		||||
import net.shatteredlands.shatt.backup.ZipLibrary;
 | 
			
		||||
import org.bstats.bukkit.Metrics;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
@@ -80,6 +81,9 @@ public class mcMMO extends JavaPlugin {
 | 
			
		||||
    private static UserManager userManager;
 | 
			
		||||
    private static PartyManager partyManager;
 | 
			
		||||
 | 
			
		||||
    /* Adventure */
 | 
			
		||||
    private static BukkitAudiences audiences;
 | 
			
		||||
 | 
			
		||||
    /* Blacklist */
 | 
			
		||||
    private static WorldBlacklist worldBlacklist;
 | 
			
		||||
 | 
			
		||||
@@ -272,6 +276,7 @@ public class mcMMO extends JavaPlugin {
 | 
			
		||||
 | 
			
		||||
        //Init Player Data Manager
 | 
			
		||||
        userManager = new UserManager();
 | 
			
		||||
        audiences = BukkitAudiences.create(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static PlayerLevelUtils getPlayerLevelUtils() {
 | 
			
		||||
@@ -534,6 +539,7 @@ public class mcMMO extends JavaPlugin {
 | 
			
		||||
        pluginManager.registerEvents(new InventoryListener(this), this);
 | 
			
		||||
        pluginManager.registerEvents(new SelfListener(this), this);
 | 
			
		||||
        pluginManager.registerEvents(new WorldListener(this), this);
 | 
			
		||||
//        pluginManager.registerEvents(new CommandListener(this), this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -653,4 +659,8 @@ public class mcMMO extends JavaPlugin {
 | 
			
		||||
    public static PartyManager getPartyManager() {
 | 
			
		||||
        return partyManager;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static BukkitAudiences getAudiences() {
 | 
			
		||||
        return audiences;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -67,7 +67,11 @@ public final class BlockUtils {
 | 
			
		||||
     * @return true if the block awards XP, false otherwise
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean shouldBeWatched(BlockState blockState) {
 | 
			
		||||
        return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || isLog(blockState);
 | 
			
		||||
        return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || isLog(blockState)
 | 
			
		||||
                || Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType())
 | 
			
		||||
                || Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.EXCAVATION, blockState.getType())
 | 
			
		||||
                || Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, blockState.getType())
 | 
			
		||||
                || Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, blockState.getType());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -330,16 +330,18 @@ public class EventUtils {
 | 
			
		||||
            for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
 | 
			
		||||
                String skillName = primarySkillType.toString();
 | 
			
		||||
                int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType);
 | 
			
		||||
                int threshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
 | 
			
		||||
                if(playerSkillLevel > threshold) {
 | 
			
		||||
                    playerProfile.modifySkill(primarySkillType, Math.max(threshold, playerSkillLevel - levelChanged.get(skillName)));
 | 
			
		||||
                    playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName));
 | 
			
		||||
 | 
			
		||||
                playerProfile.modifySkill(primarySkillType, Math.max(Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(), playerSkillLevel - levelChanged.get(skillName)));
 | 
			
		||||
                playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName));
 | 
			
		||||
                    if (playerProfile.getSkillXpLevel(primarySkillType) < 0) {
 | 
			
		||||
                        playerProfile.setSkillXpLevel(primarySkillType, 0);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                if (playerProfile.getSkillXpLevel(primarySkillType) < 0) {
 | 
			
		||||
                    playerProfile.setSkillXpLevel(primarySkillType, 0);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (playerProfile.getSkillLevel(primarySkillType) < 0) {
 | 
			
		||||
                    playerProfile.modifySkill(primarySkillType, 0);
 | 
			
		||||
                    if (playerProfile.getSkillLevel(primarySkillType) < 0) {
 | 
			
		||||
                        playerProfile.modifySkill(primarySkillType, 0);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								src/main/java/com/gmail/nossr50/util/McMMOMessageType.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/main/java/com/gmail/nossr50/util/McMMOMessageType.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
package com.gmail.nossr50.util;
 | 
			
		||||
 | 
			
		||||
import java.util.function.BiConsumer;
 | 
			
		||||
import net.kyori.adventure.audience.Audience;
 | 
			
		||||
import net.kyori.adventure.audience.MessageType;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
 | 
			
		||||
public enum McMMOMessageType {
 | 
			
		||||
    ACTION_BAR(Audience::sendActionBar),
 | 
			
		||||
    SYSTEM((audience, message) -> audience.sendMessage(message, MessageType.SYSTEM));
 | 
			
		||||
 | 
			
		||||
    private final BiConsumer<Audience, Component> sender;
 | 
			
		||||
 | 
			
		||||
    McMMOMessageType(final BiConsumer<Audience, Component> sender) {
 | 
			
		||||
        this.sender = sender;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void send(final Audience audience, final Component message) {
 | 
			
		||||
      this.sender.accept(audience, message);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -9,10 +9,20 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
 | 
			
		||||
import com.gmail.nossr50.listeners.InteractionManager;
 | 
			
		||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
			
		||||
import com.gmail.nossr50.mcMMO;
 | 
			
		||||
import com.gmail.nossr50.util.skills.RankUtils;
 | 
			
		||||
import net.md_5.bungee.api.ChatColor;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicReference;
 | 
			
		||||
import net.kyori.adventure.audience.Audience;
 | 
			
		||||
import net.kyori.adventure.audience.MessageType;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import net.kyori.adventure.text.ComponentBuilder;
 | 
			
		||||
import net.kyori.adventure.text.TextComponent;
 | 
			
		||||
import net.kyori.adventure.text.event.ClickEvent;
 | 
			
		||||
import net.kyori.adventure.text.event.HoverEvent;
 | 
			
		||||
import net.kyori.adventure.text.format.NamedTextColor;
 | 
			
		||||
import net.kyori.adventure.text.format.TextColor;
 | 
			
		||||
import net.kyori.adventure.text.format.TextDecoration;
 | 
			
		||||
import net.md_5.bungee.api.ChatMessageType;
 | 
			
		||||
import net.md_5.bungee.api.chat.*;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
@@ -33,24 +43,23 @@ public class TextComponentFactory {
 | 
			
		||||
    public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
 | 
			
		||||
    {
 | 
			
		||||
        String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
 | 
			
		||||
        TextComponent msg = new TextComponent(preColoredString);
 | 
			
		||||
        return new TextComponent(msg);
 | 
			
		||||
        return TextComponent.of(preColoredString);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static TextComponent getNotificationTextComponentFromLocale(String localeKey)
 | 
			
		||||
    public static Component getNotificationTextComponentFromLocale(String localeKey)
 | 
			
		||||
    {
 | 
			
		||||
        return getNotificationTextComponent(LocaleLoader.getString(localeKey));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static TextComponent getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel)
 | 
			
		||||
    public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel)
 | 
			
		||||
    {
 | 
			
		||||
        return new TextComponent(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
 | 
			
		||||
        return TextComponent.of(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static TextComponent getNotificationTextComponent(String text)
 | 
			
		||||
    {
 | 
			
		||||
        //textComponent.setColor(getNotificationColor(notificationType));
 | 
			
		||||
        return new TextComponent(text);
 | 
			
		||||
        return TextComponent.of(text);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
 | 
			
		||||
@@ -58,225 +67,225 @@ public class TextComponentFactory {
 | 
			
		||||
        if(!Config.getInstance().getUrlLinksEnabled())
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        Player.Spigot spigotPlayer = player.spigot();
 | 
			
		||||
 | 
			
		||||
        TextComponent wikiLinkComponent = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
 | 
			
		||||
        wikiLinkComponent.setUnderlined(true);
 | 
			
		||||
        TextComponent.Builder wikiLinkComponent = TextComponent.builder(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
 | 
			
		||||
        wikiLinkComponent.decoration(TextDecoration.UNDERLINED, true);
 | 
			
		||||
 | 
			
		||||
        String wikiUrl = "https://mcmmo.org/wiki/"+subskillformatted;
 | 
			
		||||
 | 
			
		||||
        wikiLinkComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, wikiUrl));
 | 
			
		||||
        wikiLinkComponent.clickEvent(ClickEvent.openUrl(wikiUrl));
 | 
			
		||||
 | 
			
		||||
        ComponentBuilder componentBuilder = new ComponentBuilder(subskillformatted).append("\n").append(wikiUrl).color(ChatColor.GRAY).italic(true);
 | 
			
		||||
        TextComponent.Builder componentBuilder = TextComponent.builder(subskillformatted).append("\n").append(wikiUrl).color(NamedTextColor.GRAY).decoration(TextDecoration.ITALIC, true);
 | 
			
		||||
 | 
			
		||||
        wikiLinkComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, componentBuilder.create()));
 | 
			
		||||
        wikiLinkComponent.hoverEvent(HoverEvent.showText(componentBuilder.build()));
 | 
			
		||||
 | 
			
		||||
        spigotPlayer.sendMessage(ChatMessageType.SYSTEM, wikiLinkComponent);
 | 
			
		||||
        mcMMO.getAudiences().audience(player).sendMessage(wikiLinkComponent, MessageType.SYSTEM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void sendPlayerUrlHeader(Player player) {
 | 
			
		||||
        Player.Spigot spigotPlayer = player.spigot();
 | 
			
		||||
 | 
			
		||||
        TextComponent prefix = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
 | 
			
		||||
        TextComponent prefix = TextComponent.of(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
 | 
			
		||||
        /*prefix.setColor(ChatColor.DARK_AQUA);*/
 | 
			
		||||
        TextComponent suffix = new TextComponent(" "+LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
 | 
			
		||||
        TextComponent suffix = TextComponent.of(" "+LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Suffix"));
 | 
			
		||||
        /*suffix.setColor(ChatColor.DARK_AQUA);*/
 | 
			
		||||
 | 
			
		||||
        TextComponent emptySpace = new TextComponent(" ");
 | 
			
		||||
        TextComponent emptySpace = TextComponent.space();
 | 
			
		||||
 | 
			
		||||
        BaseComponent[] baseComponents = {new TextComponent(prefix),
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
 | 
			
		||||
                emptySpace,
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.DISCORD),
 | 
			
		||||
                emptySpace,
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.PATREON),
 | 
			
		||||
                emptySpace,
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.WIKI),
 | 
			
		||||
                emptySpace,
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
 | 
			
		||||
                emptySpace,
 | 
			
		||||
                getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
 | 
			
		||||
                new TextComponent(suffix)};
 | 
			
		||||
 | 
			
		||||
        spigotPlayer.sendMessage(baseComponents);
 | 
			
		||||
        mcMMO.getAudiences().audience(player).sendMessage(TextComponent.ofChildren(
 | 
			
		||||
          prefix,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
 | 
			
		||||
          emptySpace,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.DISCORD),
 | 
			
		||||
          emptySpace,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.PATREON),
 | 
			
		||||
          emptySpace,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.WIKI),
 | 
			
		||||
          emptySpace,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
 | 
			
		||||
          emptySpace,
 | 
			
		||||
          getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
 | 
			
		||||
          suffix
 | 
			
		||||
        ), MessageType.SYSTEM);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void sendPlayerSubSkillList(Player player, List<TextComponent> textComponents)
 | 
			
		||||
    public static void sendPlayerSubSkillList(Player player, List<Component> textComponents)
 | 
			
		||||
    {
 | 
			
		||||
        TextComponent emptySpace = new TextComponent(" ");
 | 
			
		||||
        TextComponent emptySpace = TextComponent.space();
 | 
			
		||||
 | 
			
		||||
        ArrayList<BaseComponent> bulkMessage = new ArrayList<>();
 | 
			
		||||
        AtomicReference<Component> messageToSend = new AtomicReference<>();
 | 
			
		||||
        int newLineCount = 0; //Hacky solution to wordwrap problems
 | 
			
		||||
 | 
			
		||||
        for (TextComponent textComponent : textComponents) {
 | 
			
		||||
        final Audience audience = mcMMO.getAudiences().audience(player);
 | 
			
		||||
        for (Component textComponent : textComponents) {
 | 
			
		||||
            //Don't send more than 3 subskills per line to avoid MOST wordwrap problems
 | 
			
		||||
            if(newLineCount > 2)
 | 
			
		||||
            {
 | 
			
		||||
                TextComponent[] bulkArray = new TextComponent[bulkMessage.size()];
 | 
			
		||||
                bulkArray = bulkMessage.toArray(bulkArray);
 | 
			
		||||
                Component toSend = messageToSend.get();
 | 
			
		||||
                if (toSend != null) {
 | 
			
		||||
                    audience.sendMessage(toSend.append(emptySpace));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                player.spigot().sendMessage(bulkArray);
 | 
			
		||||
                bulkMessage = new ArrayList<>();
 | 
			
		||||
                messageToSend.set(null);
 | 
			
		||||
                newLineCount = 0;
 | 
			
		||||
            }
 | 
			
		||||
            //Style the skills into @links
 | 
			
		||||
            final String originalTxt = textComponent.getText();
 | 
			
		||||
            final String originalTxt = textComponent instanceof TextComponent ? ((TextComponent) textComponent).content() : "";
 | 
			
		||||
 | 
			
		||||
            TextComponent stylizedText = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolSkills"));
 | 
			
		||||
            TextComponent.Builder stylizedText = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolSkills"));
 | 
			
		||||
            addChild(stylizedText, originalTxt);
 | 
			
		||||
 | 
			
		||||
            if(textComponent.getHoverEvent() != null)
 | 
			
		||||
                stylizedText.setHoverEvent(textComponent.getHoverEvent());
 | 
			
		||||
            if(textComponent.hoverEvent() != null)
 | 
			
		||||
                stylizedText.hoverEvent(textComponent.hoverEvent());
 | 
			
		||||
 | 
			
		||||
            if(textComponent.getClickEvent() != null)
 | 
			
		||||
                stylizedText.setClickEvent(textComponent.getClickEvent());
 | 
			
		||||
            if(textComponent.clickEvent() != null)
 | 
			
		||||
                stylizedText.clickEvent(textComponent.clickEvent());
 | 
			
		||||
 | 
			
		||||
            bulkMessage.add(stylizedText);
 | 
			
		||||
            bulkMessage.add(emptySpace);
 | 
			
		||||
            messageToSend.set(stylizedText.build().append(emptySpace));
 | 
			
		||||
 | 
			
		||||
            newLineCount++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Convert our list into an array
 | 
			
		||||
         */
 | 
			
		||||
        TextComponent[] bulkArray = new TextComponent[bulkMessage.size()];
 | 
			
		||||
        bulkArray = bulkMessage.toArray(bulkArray);
 | 
			
		||||
 | 
			
		||||
        player.spigot().sendMessage(bulkArray);
 | 
			
		||||
        Component toSend = messageToSend.get();
 | 
			
		||||
        if (toSend != null) {
 | 
			
		||||
            audience.sendMessage(toSend.append(emptySpace));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static TextComponent getWebLinkTextComponent(McMMOWebLinks webLinks)
 | 
			
		||||
    private static Component getWebLinkTextComponent(McMMOWebLinks webLinks)
 | 
			
		||||
    {
 | 
			
		||||
        TextComponent webTextComponent;
 | 
			
		||||
        TextComponent.Builder webTextComponent;
 | 
			
		||||
 | 
			
		||||
        switch(webLinks)
 | 
			
		||||
        {
 | 
			
		||||
            case WEBSITE:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Web");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
 | 
			
		||||
                break;
 | 
			
		||||
            case SPIGOT:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Spigot");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
 | 
			
		||||
                break;
 | 
			
		||||
            case DISCORD:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Discord");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
 | 
			
		||||
                break;
 | 
			
		||||
            case PATREON:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Patreon");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
 | 
			
		||||
                break;
 | 
			
		||||
            case WIKI:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Wiki");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
 | 
			
		||||
                break;
 | 
			
		||||
            case HELP_TRANSLATE:
 | 
			
		||||
                webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
 | 
			
		||||
                addChild(webTextComponent, "Lang");
 | 
			
		||||
                webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
 | 
			
		||||
                webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                webTextComponent = new TextComponent("NOT DEFINED");
 | 
			
		||||
                webTextComponent = TextComponent.builder("NOT DEFINED");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        addNewHoverComponentToTextComponent(webTextComponent, getUrlHoverEvent(webLinks));
 | 
			
		||||
        webTextComponent.setInsertion(webLinks.getUrl());
 | 
			
		||||
        webTextComponent.insertion(webLinks.getUrl());
 | 
			
		||||
 | 
			
		||||
        return webTextComponent;
 | 
			
		||||
        return webTextComponent.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addChild(TextComponent webTextComponent, String childName) {
 | 
			
		||||
        TextComponent childComponent = new TextComponent(childName);
 | 
			
		||||
        childComponent.setColor(ChatColor.BLUE);
 | 
			
		||||
        webTextComponent.addExtra(childComponent);
 | 
			
		||||
    private static void addChild(Component webTextComponent, String childName) {
 | 
			
		||||
        TextComponent childComponent = TextComponent.of(childName);
 | 
			
		||||
        childComponent.color(NamedTextColor.BLUE);
 | 
			
		||||
        webTextComponent.append(childComponent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static BaseComponent[] getUrlHoverEvent(McMMOWebLinks webLinks)
 | 
			
		||||
    private static void addChild(ComponentBuilder<?, ?> webTextComponent, String childName) {
 | 
			
		||||
        TextComponent childComponent = TextComponent.of(childName);
 | 
			
		||||
        childComponent.color(NamedTextColor.BLUE);
 | 
			
		||||
        webTextComponent.append(childComponent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static Component getUrlHoverEvent(McMMOWebLinks webLinks)
 | 
			
		||||
    {
 | 
			
		||||
        ComponentBuilder componentBuilder = new ComponentBuilder(webLinks.getNiceTitle());
 | 
			
		||||
        TextComponent.Builder componentBuilder = TextComponent.builder(webLinks.getNiceTitle());
 | 
			
		||||
 | 
			
		||||
        switch(webLinks)
 | 
			
		||||
        {
 | 
			
		||||
            case WEBSITE:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\nDev Blogs, and information related to mcMMO can be found here").color(ChatColor.GRAY);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                componentBuilder.append(TextComponent.of("\nDev Blogs, and information related to mcMMO can be found here", NamedTextColor.GRAY));
 | 
			
		||||
                break;
 | 
			
		||||
            case SPIGOT:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\nI post regularly in the discussion thread here!").color(ChatColor.GRAY);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                componentBuilder.append(TextComponent.of("\nI post regularly in the discussion thread here!", NamedTextColor.GRAY));
 | 
			
		||||
                break;
 | 
			
		||||
            case PATREON:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                componentBuilder.append("\n");
 | 
			
		||||
                componentBuilder.append("Show support by buying me a coffee :)").italic(false).color(ChatColor.GRAY);
 | 
			
		||||
                componentBuilder.append(TextComponent.of("Show support by buying me a coffee :)", NamedTextColor.GRAY));
 | 
			
		||||
                break;
 | 
			
		||||
            case WIKI:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                componentBuilder.append("\n");
 | 
			
		||||
                componentBuilder.append("I'm looking for more wiki staff, contact me on our discord!").italic(false).color(ChatColor.DARK_GRAY);
 | 
			
		||||
                componentBuilder.append(TextComponent.of("I'm looking for more wiki staff, contact me on our discord!", NamedTextColor.DARK_GRAY));
 | 
			
		||||
                break;
 | 
			
		||||
            case DISCORD:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                break;
 | 
			
		||||
            case HELP_TRANSLATE:
 | 
			
		||||
                addUrlHeaderHover(webLinks, componentBuilder);
 | 
			
		||||
                componentBuilder.append("\n\n").italic(false);
 | 
			
		||||
                componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
 | 
			
		||||
                componentBuilder.append("\n\n");
 | 
			
		||||
                componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
 | 
			
		||||
                componentBuilder.append("\n");
 | 
			
		||||
                componentBuilder.append("You can use this website to help translate mcMMO into your language!" +
 | 
			
		||||
                        "\nIf you want to know more contact me in discord.").italic(false).color(ChatColor.DARK_GRAY);
 | 
			
		||||
                componentBuilder.append(TextComponent.of("You can use this website to help translate mcMMO into your language!" +
 | 
			
		||||
                  "\nIf you want to know more contact me in discord.", NamedTextColor.DARK_GRAY));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return componentBuilder.create();
 | 
			
		||||
        return componentBuilder.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addUrlHeaderHover(McMMOWebLinks webLinks, ComponentBuilder componentBuilder) {
 | 
			
		||||
    private static void addUrlHeaderHover(McMMOWebLinks webLinks, TextComponent.Builder componentBuilder) {
 | 
			
		||||
        componentBuilder.append("\n");
 | 
			
		||||
        componentBuilder.append(webLinks.getUrl()).color(ChatColor.GRAY).italic(true);
 | 
			
		||||
        componentBuilder.append(TextComponent.of(webLinks.getUrl(), NamedTextColor.GRAY, TextDecoration.ITALIC));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static ClickEvent getUrlClickEvent(String url)
 | 
			
		||||
    {
 | 
			
		||||
        return new ClickEvent(ClickEvent.Action.OPEN_URL, url);
 | 
			
		||||
        return ClickEvent.openUrl(url);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static TextComponent getSubSkillTextComponent(Player player, SubSkillType subSkillType)
 | 
			
		||||
    private static Component getSubSkillTextComponent(Player player, SubSkillType subSkillType)
 | 
			
		||||
    {
 | 
			
		||||
        //Get skill name
 | 
			
		||||
        String skillName = subSkillType.getLocaleName();
 | 
			
		||||
 | 
			
		||||
        boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
 | 
			
		||||
 | 
			
		||||
        TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 | 
			
		||||
        TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 | 
			
		||||
 | 
			
		||||
        //Hover Event
 | 
			
		||||
        addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
 | 
			
		||||
 | 
			
		||||
        //Insertion
 | 
			
		||||
        textComponent.setInsertion(skillName);
 | 
			
		||||
        textComponent.insertion(skillName);
 | 
			
		||||
 | 
			
		||||
        return textComponent;
 | 
			
		||||
        return textComponent.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addNewHoverComponentToTextComponent(TextComponent textComponent, BaseComponent[] baseComponent) {
 | 
			
		||||
        textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, baseComponent));
 | 
			
		||||
    private static void addNewHoverComponentToTextComponent(TextComponent.Builder textComponent, Component baseComponent) {
 | 
			
		||||
        textComponent.hoverEvent(HoverEvent.showText(baseComponent));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill)
 | 
			
		||||
@@ -289,42 +298,42 @@ public class TextComponentFactory {
 | 
			
		||||
 | 
			
		||||
        boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
 | 
			
		||||
 | 
			
		||||
        TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 | 
			
		||||
        TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
 | 
			
		||||
 | 
			
		||||
        //Hover Event
 | 
			
		||||
        addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill));
 | 
			
		||||
 | 
			
		||||
        //Insertion
 | 
			
		||||
        textComponent.setInsertion(skillName);
 | 
			
		||||
        textComponent.insertion(skillName);
 | 
			
		||||
 | 
			
		||||
        return textComponent;
 | 
			
		||||
        return textComponent.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static TextComponent initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
 | 
			
		||||
        TextComponent textComponent;
 | 
			
		||||
    private static TextComponent.Builder initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
 | 
			
		||||
        TextComponent.Builder textComponent;
 | 
			
		||||
        if (skillUnlocked) {
 | 
			
		||||
            if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
 | 
			
		||||
                textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
 | 
			
		||||
                textComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
 | 
			
		||||
            else
 | 
			
		||||
                textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
 | 
			
		||||
                textComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.SkillName", skillName));
 | 
			
		||||
 | 
			
		||||
            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo " + subSkillType.getNiceNameNoSpaces(subSkillType)));
 | 
			
		||||
            textComponent.clickEvent(ClickEvent.runCommand("/mmoinfo " + subSkillType.getNiceNameNoSpaces(subSkillType)));
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.Mystery",
 | 
			
		||||
            textComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.Mystery",
 | 
			
		||||
                    String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
 | 
			
		||||
 | 
			
		||||
            textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
 | 
			
		||||
            textComponent.clickEvent(ClickEvent.runCommand("/mmoinfo ???"));
 | 
			
		||||
        }
 | 
			
		||||
        return textComponent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static BaseComponent[] getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
 | 
			
		||||
    private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
 | 
			
		||||
    {
 | 
			
		||||
        return getSubSkillHoverEventJSON(abstractSubSkill, player);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static BaseComponent[] getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
 | 
			
		||||
    private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
 | 
			
		||||
    {
 | 
			
		||||
        return getSubSkillHoverEventJSON(subSkillType, player);
 | 
			
		||||
    }
 | 
			
		||||
@@ -335,27 +344,27 @@ public class TextComponentFactory {
 | 
			
		||||
     * @param player the player who owns this subskill
 | 
			
		||||
     * @return the hover basecomponent object for this subskill
 | 
			
		||||
     */
 | 
			
		||||
    private static BaseComponent[] getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player)
 | 
			
		||||
    private static Component getSubSkillHoverEventJSON(AbstractSubSkill abstractSubSkill, Player player)
 | 
			
		||||
    {
 | 
			
		||||
        String skillName = abstractSubSkill.getNiceName();
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Hover Event BaseComponent color table
 | 
			
		||||
         */
 | 
			
		||||
        ChatColor ccSubSkillHeader      = ChatColor.GOLD;
 | 
			
		||||
        ChatColor ccRank                = ChatColor.BLUE;
 | 
			
		||||
        ChatColor ccCurRank             = ChatColor.GREEN;
 | 
			
		||||
        ChatColor ccPossessive          = ChatColor.WHITE;
 | 
			
		||||
        TextColor ccSubSkillHeader      = NamedTextColor.GOLD;
 | 
			
		||||
        TextColor ccRank                = NamedTextColor.BLUE;
 | 
			
		||||
        TextColor ccCurRank             = NamedTextColor.GREEN;
 | 
			
		||||
        TextColor ccPossessive          = NamedTextColor.WHITE;
 | 
			
		||||
        //ChatColor ccDescriptionHeader   = ChatColor.DARK_PURPLE;
 | 
			
		||||
        //ChatColor ccDescription         = ChatColor.WHITE;
 | 
			
		||||
        ChatColor ccLocked              = ChatColor.DARK_GRAY;
 | 
			
		||||
        ChatColor ccLevelRequirement    = ChatColor.BLUE;
 | 
			
		||||
        ChatColor ccLevelRequired       = ChatColor.RED;
 | 
			
		||||
        TextColor ccLocked              = NamedTextColor.DARK_GRAY;
 | 
			
		||||
        TextColor ccLevelRequirement    = NamedTextColor.BLUE;
 | 
			
		||||
        TextColor ccLevelRequired       = NamedTextColor.RED;
 | 
			
		||||
 | 
			
		||||
        SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
 | 
			
		||||
 | 
			
		||||
        //SubSkillType Name
 | 
			
		||||
        ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
 | 
			
		||||
        TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
 | 
			
		||||
 | 
			
		||||
        if(!RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
 | 
			
		||||
        {
 | 
			
		||||
@@ -379,18 +388,18 @@ public class TextComponentFactory {
 | 
			
		||||
            componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
 | 
			
		||||
 | 
			
		||||
            //Empty line
 | 
			
		||||
            componentBuilder.append("\n").bold(false);
 | 
			
		||||
            componentBuilder.append("\n").decoration(TextDecoration.BOLD, false);
 | 
			
		||||
            componentBuilder.append("\n");
 | 
			
		||||
 | 
			
		||||
            //Finally, add details to the tooltip
 | 
			
		||||
            abstractSubSkill.addStats(componentBuilder, player);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return componentBuilder.create();
 | 
			
		||||
        return componentBuilder.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static ComponentBuilder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
 | 
			
		||||
        ComponentBuilder componentBuilder;
 | 
			
		||||
    private static TextComponent.Builder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
 | 
			
		||||
        TextComponent.Builder componentBuilder;
 | 
			
		||||
        if (skillUnlocked) {
 | 
			
		||||
            if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
 | 
			
		||||
                componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
 | 
			
		||||
@@ -402,66 +411,64 @@ public class TextComponentFactory {
 | 
			
		||||
        return componentBuilder;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static ComponentBuilder getNewComponentBuilder(String skillName) {
 | 
			
		||||
        ComponentBuilder componentBuilder = new ComponentBuilder(skillName);
 | 
			
		||||
    private static TextComponent.Builder getNewComponentBuilder(String skillName) {
 | 
			
		||||
        TextComponent.Builder componentBuilder = TextComponent.builder(skillName);
 | 
			
		||||
        componentBuilder.append("\n");
 | 
			
		||||
        return componentBuilder;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank, int nextRank) {
 | 
			
		||||
    private static void addRanked(TextColor ccRank, TextColor ccCurRank, TextColor ccPossessive, TextColor ccNumRanks, TextComponent.Builder componentBuilder, int numRanks, int rank, int nextRank) {
 | 
			
		||||
        if (numRanks > 0) {
 | 
			
		||||
            //Rank: x
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n")
 | 
			
		||||
                    .bold(false).italic(false).strikethrough(false).underlined(false);
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n");
 | 
			
		||||
 | 
			
		||||
            //Next Rank: x
 | 
			
		||||
            if(nextRank > rank)
 | 
			
		||||
                componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n")
 | 
			
		||||
                        .bold(false).italic(false).strikethrough(false).underlined(false);
 | 
			
		||||
                componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n");
 | 
			
		||||
 | 
			
		||||
            /*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
 | 
			
		||||
            componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addLocked(SubSkillType subSkillType, ChatColor ccLocked, ChatColor ccLevelRequirement, ChatColor ccLevelRequired, ComponentBuilder componentBuilder) {
 | 
			
		||||
    private static void addLocked(SubSkillType subSkillType, TextColor ccLocked, TextColor ccLevelRequirement, TextColor ccLevelRequired, TextComponent.Builder componentBuilder) {
 | 
			
		||||
        addLocked(ccLocked, ccLevelRequirement, componentBuilder);
 | 
			
		||||
        componentBuilder.append(String.valueOf(RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, 1))).color(ccLevelRequired);
 | 
			
		||||
        componentBuilder.append(TextComponent.of(String.valueOf(RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, 1)), ccLevelRequired));
 | 
			
		||||
        //componentBuilder.append("\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addLocked(AbstractSubSkill abstractSubSkill, ChatColor ccLocked, ChatColor ccLevelRequirement, ChatColor ccLevelRequired, ComponentBuilder componentBuilder) {
 | 
			
		||||
    private static void addLocked(AbstractSubSkill abstractSubSkill, TextColor ccLocked, TextColor ccLevelRequirement, TextColor ccLevelRequired, TextComponent.Builder componentBuilder) {
 | 
			
		||||
        addLocked(ccLocked, ccLevelRequirement, componentBuilder);
 | 
			
		||||
        componentBuilder.append(String.valueOf(RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, 1))).color(ccLevelRequired);
 | 
			
		||||
        componentBuilder.append(TextComponent.of(String.valueOf(RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, 1)), ccLevelRequired));
 | 
			
		||||
        //componentBuilder.append("\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addLocked(ChatColor ccLocked, ChatColor ccLevelRequirement, ComponentBuilder componentBuilder) {
 | 
			
		||||
        componentBuilder.append(LocaleLoader.getString("JSON.Locked")).color(ccLocked).bold(true);
 | 
			
		||||
        componentBuilder.append("\n").append("\n").bold(false);
 | 
			
		||||
        componentBuilder.append(LocaleLoader.getString("JSON.LevelRequirement") + ": ").color(ccLevelRequirement);
 | 
			
		||||
    private static void addLocked(TextColor ccLocked, TextColor ccLevelRequirement, TextComponent.Builder componentBuilder) {
 | 
			
		||||
        componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Locked"), ccLocked, TextDecoration.BOLD));
 | 
			
		||||
        componentBuilder.append("\n").append("\n");
 | 
			
		||||
        componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.LevelRequirement") + ": ", ccLevelRequirement));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Deprecated
 | 
			
		||||
    private static BaseComponent[] getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
 | 
			
		||||
    private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
 | 
			
		||||
    {
 | 
			
		||||
        String skillName = subSkillType.getLocaleName();
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Hover Event BaseComponent color table
 | 
			
		||||
         */
 | 
			
		||||
        ChatColor ccSubSkillHeader      = ChatColor.GOLD;
 | 
			
		||||
        ChatColor ccRank                = ChatColor.BLUE;
 | 
			
		||||
        ChatColor ccCurRank             = ChatColor.GREEN;
 | 
			
		||||
        ChatColor ccPossessive          = ChatColor.WHITE;
 | 
			
		||||
        ChatColor ccDescriptionHeader   = ChatColor.DARK_PURPLE;
 | 
			
		||||
        ChatColor ccDescription         = ChatColor.DARK_GRAY;
 | 
			
		||||
        ChatColor ccLocked              = ChatColor.DARK_GRAY;
 | 
			
		||||
        ChatColor ccLevelRequirement    = ChatColor.BLUE;
 | 
			
		||||
        ChatColor ccLevelRequired       = ChatColor.RED;
 | 
			
		||||
        TextColor ccSubSkillHeader      = NamedTextColor.GOLD;
 | 
			
		||||
        TextColor ccRank                = NamedTextColor.BLUE;
 | 
			
		||||
        TextColor ccCurRank             = NamedTextColor.GREEN;
 | 
			
		||||
        TextColor ccPossessive          = NamedTextColor.WHITE;
 | 
			
		||||
        TextColor ccDescriptionHeader   = NamedTextColor.DARK_PURPLE;
 | 
			
		||||
        TextColor ccDescription         = NamedTextColor.DARK_GRAY;
 | 
			
		||||
        TextColor ccLocked              = NamedTextColor.DARK_GRAY;
 | 
			
		||||
        TextColor ccLevelRequirement    = NamedTextColor.BLUE;
 | 
			
		||||
        TextColor ccLevelRequired       = NamedTextColor.RED;
 | 
			
		||||
 | 
			
		||||
        //SubSkillType Name
 | 
			
		||||
        ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
 | 
			
		||||
        TextComponent.Builder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
 | 
			
		||||
 | 
			
		||||
        if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
 | 
			
		||||
        {
 | 
			
		||||
@@ -476,7 +483,7 @@ public class TextComponentFactory {
 | 
			
		||||
                int curRank = RankUtils.getRank(player, subSkillType);
 | 
			
		||||
                int nextRank = 0;
 | 
			
		||||
 | 
			
		||||
                if(curRank < subSkillType.getNumRanks() && subSkillType.getNumRanks() > 0)
 | 
			
		||||
                if(curRank < subSkillType.getNumRanks())
 | 
			
		||||
                {
 | 
			
		||||
                    nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank+1);
 | 
			
		||||
                }
 | 
			
		||||
@@ -485,7 +492,7 @@ public class TextComponentFactory {
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            componentBuilder.append("\n").bold(false);
 | 
			
		||||
            componentBuilder.append("\n");
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
 | 
			
		||||
            componentBuilder.color(ccDescriptionHeader);
 | 
			
		||||
            componentBuilder.append("\n");
 | 
			
		||||
@@ -493,28 +500,25 @@ public class TextComponentFactory {
 | 
			
		||||
            componentBuilder.color(ccDescription);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return componentBuilder.create();
 | 
			
		||||
        return componentBuilder.build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, ComponentBuilder componentBuilder)
 | 
			
		||||
    private static void addSubSkillTypeToHoverEventJSON(AbstractSubSkill abstractSubSkill, TextComponent.Builder componentBuilder)
 | 
			
		||||
    {
 | 
			
		||||
        if(abstractSubSkill.isSuperAbility())
 | 
			
		||||
        {
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.Type.SuperAbility")).color(ChatColor.LIGHT_PURPLE);
 | 
			
		||||
            componentBuilder.bold(true);
 | 
			
		||||
            componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.SuperAbility"), NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
 | 
			
		||||
        } else if(abstractSubSkill.isActiveUse())
 | 
			
		||||
        {
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.Type.Active")).color(ChatColor.DARK_RED);
 | 
			
		||||
            componentBuilder.bold(true);
 | 
			
		||||
            componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.Active"), NamedTextColor.DARK_RED, TextDecoration.BOLD));
 | 
			
		||||
        } else {
 | 
			
		||||
            componentBuilder.append(LocaleLoader.getString("JSON.Type.Passive")).color(ChatColor.GREEN);
 | 
			
		||||
            componentBuilder.bold(true);
 | 
			
		||||
            componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.Passive"), NamedTextColor.GREEN, TextDecoration.BOLD));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        componentBuilder.append("\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void getSubSkillTextComponents(Player player, List<TextComponent> textComponents, PrimarySkillType parentSkill) {
 | 
			
		||||
    public static void getSubSkillTextComponents(Player player, List<Component> textComponents, PrimarySkillType parentSkill) {
 | 
			
		||||
        for(SubSkillType subSkillType : SubSkillType.values())
 | 
			
		||||
        {
 | 
			
		||||
            if(subSkillType.getParentSkill() == parentSkill)
 | 
			
		||||
@@ -540,11 +544,10 @@ public class TextComponentFactory {
 | 
			
		||||
 | 
			
		||||
    public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType)
 | 
			
		||||
    {
 | 
			
		||||
        TextComponent unlockMessage = new TextComponent("");
 | 
			
		||||
        unlockMessage.setText(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
 | 
			
		||||
        unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
 | 
			
		||||
        unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
 | 
			
		||||
        return unlockMessage;
 | 
			
		||||
        TextComponent.Builder unlockMessage = TextComponent.builder(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
 | 
			
		||||
        unlockMessage.hoverEvent(HoverEvent.showText(getSubSkillHoverComponent(player, subSkillType)));
 | 
			
		||||
        unlockMessage.clickEvent(ClickEvent.runCommand("/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
 | 
			
		||||
        return unlockMessage.build();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,12 +10,14 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
			
		||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
 | 
			
		||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
			
		||||
import com.gmail.nossr50.mcMMO;
 | 
			
		||||
import com.gmail.nossr50.util.McMMOMessageType;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import com.gmail.nossr50.util.TextComponentFactory;
 | 
			
		||||
import com.gmail.nossr50.util.sounds.SoundManager;
 | 
			
		||||
import com.gmail.nossr50.util.sounds.SoundType;
 | 
			
		||||
import net.md_5.bungee.api.ChatMessageType;
 | 
			
		||||
import net.md_5.bungee.api.chat.TextComponent;
 | 
			
		||||
import net.kyori.adventure.audience.Audience;
 | 
			
		||||
import net.kyori.adventure.audience.MessageType;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.Server;
 | 
			
		||||
@@ -36,9 +38,9 @@ public class NotificationManager {
 | 
			
		||||
        if(mcMMO.getUserManager().getPlayer(player) == null || !mcMMO.getUserManager().getPlayer(player).hasSkillChatNotifications())
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
 | 
			
		||||
        McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
 | 
			
		||||
 | 
			
		||||
        TextComponent message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
 | 
			
		||||
        Component message = TextComponentFactory.getNotificationTextComponentFromLocale(key);
 | 
			
		||||
        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
 | 
			
		||||
 | 
			
		||||
        sendNotification(player, customEvent);
 | 
			
		||||
@@ -91,9 +93,9 @@ public class NotificationManager {
 | 
			
		||||
        if(mcMMO.getUserManager().getPlayer(player) == null || !mcMMO.getUserManager().getPlayer(player).hasSkillChatNotifications())
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
 | 
			
		||||
        McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
 | 
			
		||||
 | 
			
		||||
        TextComponent message = TextComponentFactory.getNotificationMultipleValues(key, values);
 | 
			
		||||
        Component message = TextComponentFactory.getNotificationMultipleValues(key, values);
 | 
			
		||||
        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
 | 
			
		||||
 | 
			
		||||
        sendNotification(player, customEvent);
 | 
			
		||||
@@ -103,22 +105,24 @@ public class NotificationManager {
 | 
			
		||||
        if (customEvent.isCancelled())
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        final Audience audience = mcMMO.getAudiences().audience(player);
 | 
			
		||||
 | 
			
		||||
        //If the message is being sent to the action bar we need to check if the copy if a copy is sent to the chat system
 | 
			
		||||
        if(customEvent.getChatMessageType() == ChatMessageType.ACTION_BAR)
 | 
			
		||||
        if(customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR)
 | 
			
		||||
        {
 | 
			
		||||
            player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
 | 
			
		||||
            audience.sendActionBar(customEvent.getNotificationTextComponent());
 | 
			
		||||
 | 
			
		||||
            if(customEvent.isMessageAlsoBeingSentToChat())
 | 
			
		||||
            {
 | 
			
		||||
                //Send copy to chat system
 | 
			
		||||
                player.spigot().sendMessage(ChatMessageType.SYSTEM, customEvent.getNotificationTextComponent());
 | 
			
		||||
                audience.sendMessage(customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            player.spigot().sendMessage(customEvent.getChatMessageType(), customEvent.getNotificationTextComponent());
 | 
			
		||||
            audience.sendMessage(customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, ChatMessageType destination, TextComponent message) {
 | 
			
		||||
    private static McMMOPlayerNotificationEvent checkNotificationEvent(Player player, NotificationType notificationType, McMMOMessageType destination, Component message) {
 | 
			
		||||
        //Init event
 | 
			
		||||
        McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
 | 
			
		||||
                notificationType, message, destination, AdvancedConfig.getInstance().doesNotificationSendCopyToChat(notificationType));
 | 
			
		||||
@@ -139,9 +143,9 @@ public class NotificationManager {
 | 
			
		||||
        if(!mmoPlayer.hasSkillChatNotifications())
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
 | 
			
		||||
        McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
 | 
			
		||||
 | 
			
		||||
        TextComponent levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
 | 
			
		||||
        Component levelUpTextComponent = TextComponentFactory.getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
 | 
			
		||||
        McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mmoPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
 | 
			
		||||
 | 
			
		||||
        sendNotification(mmoPlayer.getPlayer(), customEvent);
 | 
			
		||||
@@ -161,7 +165,8 @@ public class NotificationManager {
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        //CHAT MESSAGE
 | 
			
		||||
        mmoPlayer.getPlayer().spigot().sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mmoPlayer.getPlayer(), subSkillType));
 | 
			
		||||
 | 
			
		||||
        mcMMO.getAudiences().audience(mcMMOPlayer.getPlayer()).sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mmoPlayer.getPlayer(), subSkillType));
 | 
			
		||||
 | 
			
		||||
        //Unlock Sound Effect
 | 
			
		||||
        SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,9 @@ package com.gmail.nossr50.util.skills;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
 | 
			
		||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 | 
			
		||||
import com.gmail.nossr50.mcMMO;
 | 
			
		||||
import com.gmail.nossr50.util.Permissions;
 | 
			
		||||
import net.md_5.bungee.api.ChatColor;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
public final class PerksUtils {
 | 
			
		||||
 
 | 
			
		||||
@@ -209,10 +209,6 @@ public class SkillUtils {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void removeAbilityBoostsFromInventory(@NotNull Player player) {
 | 
			
		||||
        if (!HiddenConfig.getInstance().useEnchantmentBuffs()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for (ItemStack itemStack : player.getInventory().getContents()) {
 | 
			
		||||
            removeAbilityBuff(itemStack);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user