From 15578bb84ea90e3d94c511e976bd64e626d9e1c9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 4 Nov 2020 12:12:51 -0800 Subject: [PATCH] Some refactoring --- .../com/gmail/nossr50/chat/ChatManager.java | 2 +- .../gmail/nossr50/commands/XprateCommand.java | 2 +- .../commands/chat/PartyChatCommand.java | 2 +- .../hardcore/HardcoreModeCommand.java | 2 +- .../commands/party/PartyItemShareCommand.java | 2 +- .../commands/party/PartyXpShareCommand.java | 2 +- .../nossr50/commands/player/MctopCommand.java | 2 +- .../nossr50/commands/player/XPBarCommand.java | 2 +- .../commands/skills/AcrobaticsCommand.java | 2 +- .../commands/skills/AlchemyCommand.java | 2 +- .../nossr50/commands/skills/AprilCommand.java | 2 +- .../commands/skills/ArcheryCommand.java | 2 +- .../nossr50/commands/skills/AxesCommand.java | 2 +- .../commands/skills/ExcavationCommand.java | 2 +- .../commands/skills/FishingCommand.java | 2 +- .../commands/skills/HerbalismCommand.java | 2 +- .../commands/skills/MiningCommand.java | 2 +- .../commands/skills/MmoInfoCommand.java | 2 +- .../commands/skills/RepairCommand.java | 2 +- .../commands/skills/SalvageCommand.java | 2 +- .../nossr50/commands/skills/SkillCommand.java | 4 +- .../commands/skills/SkillGuideCommand.java | 2 +- .../commands/skills/SmeltingCommand.java | 2 +- .../commands/skills/SwordsCommand.java | 2 +- .../commands/skills/TamingCommand.java | 2 +- .../commands/skills/UnarmedCommand.java | 2 +- .../commands/skills/WoodcuttingCommand.java | 2 +- .../com/gmail/nossr50/config/ChatConfig.java | 2 +- .../java/com/gmail/nossr50/config/Config.java | 2 +- .../nossr50/config/CoreSkillsConfig.java | 2 +- .../config/experience/ExperienceConfig.java | 2 +- .../config/party/ItemWeightConfig.java | 2 +- .../config/treasure/TreasureConfig.java | 2 +- .../database/FlatfileDatabaseManager.java | 2 +- .../nossr50/datatypes/json/McMMOWebLinks.java | 2 +- .../datatypes/party/ItemShareType.java | 2 +- .../nossr50/datatypes/party/PartyFeature.java | 2 +- .../datatypes/skills/PrimarySkillType.java | 2 +- .../datatypes/skills/SubSkillType.java | 2 +- .../datatypes/skills/SuperAbilityType.java | 2 +- .../acrobatics/AcrobaticsSubSkill.java | 2 +- .../subskills/taming/CallOfTheWildType.java | 2 +- .../skills/McMMOPlayerNotificationEvent.java | 2 +- .../skills/alchemy/AlchemyManager.java | 2 +- .../nossr50/skills/child/ChildConfig.java | 2 +- .../nossr50/skills/excavation/Excavation.java | 2 +- .../skills/herbalism/HerbalismManager.java | 1 + .../nossr50/skills/repair/RepairManager.java | 2 +- .../skills/salvage/SalvageManager.java | 2 +- .../nossr50/skills/taming/TamingManager.java | 2 +- .../gmail/nossr50/util/HolidayManager.java | 1 + .../gmail/nossr50/util/MobHealthbarUtils.java | 1 + .../commands/CommandRegistrationManager.java | 2 +- .../nossr50/util/commands/CommandUtils.java | 2 +- .../util/compat/CompatibilityManager.java | 2 +- .../util/experience/ExperienceBarWrapper.java | 2 +- .../util/player/NotificationManager.java | 4 +- .../gmail/nossr50/util/skills/SkillUtils.java | 2 +- .../util/{ => text}/McMMOMessageType.java | 2 +- .../nossr50/util/{ => text}/StringUtils.java | 2 +- .../util/{ => text}/TextComponentFactory.java | 163 +++--------------- .../gmail/nossr50/util/text/TextUtils.java | 87 ++++++++++ 62 files changed, 170 insertions(+), 201 deletions(-) rename src/main/java/com/gmail/nossr50/util/{ => text}/McMMOMessageType.java (94%) rename src/main/java/com/gmail/nossr50/util/{ => text}/StringUtils.java (99%) rename src/main/java/com/gmail/nossr50/util/{ => text}/TextComponentFactory.java (79%) create mode 100644 src/main/java/com/gmail/nossr50/util/text/TextUtils.java diff --git a/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/src/main/java/com/gmail/nossr50/chat/ChatManager.java index 826521e5d..b62708d54 100644 --- a/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -11,7 +11,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.text.TextComponent; import org.bukkit.command.ConsoleCommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java index 1d7935549..150b97590 100644 --- a/src/main/java/com/gmail/nossr50/commands/XprateCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/XprateCommand.java @@ -7,9 +7,9 @@ import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/src/main/java/com/gmail/nossr50/commands/chat/PartyChatCommand.java b/src/main/java/com/gmail/nossr50/commands/chat/PartyChatCommand.java index e1f17b840..9fc985308 100644 --- a/src/main/java/com/gmail/nossr50/commands/chat/PartyChatCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/chat/PartyChatCommand.java @@ -11,8 +11,8 @@ import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.party.PartyManager; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/gmail/nossr50/commands/hardcore/HardcoreModeCommand.java b/src/main/java/com/gmail/nossr50/commands/hardcore/HardcoreModeCommand.java index 73da843a6..62206566a 100644 --- a/src/main/java/com/gmail/nossr50/commands/hardcore/HardcoreModeCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/hardcore/HardcoreModeCommand.java @@ -2,8 +2,8 @@ package com.gmail.nossr50.commands.hardcore; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyItemShareCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyItemShareCommand.java index 54a8af8fa..4b0d8fb23 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyItemShareCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyItemShareCommand.java @@ -6,9 +6,9 @@ import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyXpShareCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyXpShareCommand.java index c1310cf0e..a8354914e 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyXpShareCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyXpShareCommand.java @@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java index a50b51c20..63ed2726e 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/MctopCommand.java @@ -7,9 +7,9 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/player/XPBarCommand.java b/src/main/java/com/gmail/nossr50/commands/player/XPBarCommand.java index 2c429ddd8..ad24c60da 100644 --- a/src/main/java/com/gmail/nossr50/commands/player/XPBarCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/player/XPBarCommand.java @@ -2,11 +2,11 @@ package com.gmail.nossr50.commands.player; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.experience.ExperienceBarManager; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.SkillUtils; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 1733329ff..9b6e8ea2f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -5,10 +5,10 @@ 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.util.TextComponentFactory; import com.gmail.nossr50.util.random.RandomChanceSkill; import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index cdb87e461..a8d5fcc8b 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.alchemy.AlchemyManager; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AprilCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AprilCommand.java index 6c41b232d..819205ca1 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AprilCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AprilCommand.java @@ -3,8 +3,8 @@ package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.HolidayManager.FakeSkillType; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.commands.CommandUtils; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index bbf0f875b..59decaf9f 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -4,9 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.archery.Archery; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index 52aa62d8e..d6b5c029a 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -5,11 +5,11 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java index 170e80054..de7341e93 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 33f2c4cd5..692b18174 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -9,10 +9,10 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.fishing.FishingManager; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.Location; import org.bukkit.entity.EntityType; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 8f82ce3ff..3d4693b77 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -4,9 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; 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 com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index 950953908..5e7a14a7a 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java index c23c7ac78..e562e9429 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MmoInfoCommand.java @@ -6,7 +6,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; +import com.gmail.nossr50.util.text.TextComponentFactory; import com.google.common.collect.ImmutableList; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 7444a9fb6..1941357d0 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -10,10 +10,10 @@ import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.RepairManager; import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java index ebbd629e3..770299951 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java @@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; 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.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 5aecd63c7..e550913fa 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -8,8 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; @@ -18,6 +16,8 @@ import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.skills.PerksUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.StringUtils; +import com.gmail.nossr50.util.text.TextComponentFactory; import com.google.common.collect.ImmutableList; import net.kyori.adventure.text.Component; import net.md_5.bungee.api.ChatColor; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillGuideCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillGuideCommand.java index 60fc82184..a7879bb8d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillGuideCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillGuideCommand.java @@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index 27ce7fc13..55544acc2 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -4,10 +4,10 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index 325b5bb10..1e6bf1d72 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -5,11 +5,11 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 8970f5c08..35f04f5bc 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; 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 com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java index e8e85418e..5f9784be7 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -4,11 +4,11 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index b26b385b1..505a37c8d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -4,9 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; 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 com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/config/ChatConfig.java b/src/main/java/com/gmail/nossr50/config/ChatConfig.java index 27e57930d..1b9204e4b 100644 --- a/src/main/java/com/gmail/nossr50/config/ChatConfig.java +++ b/src/main/java/com/gmail/nossr50/config/ChatConfig.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.config; import com.gmail.nossr50.datatypes.chat.ChatChannel; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.jetbrains.annotations.NotNull; public class ChatConfig extends AutoUpdateConfigLoader { diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 1ab532744..d3fdb5c74 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.data.BlockData; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java index 269ee30f2..4a10cdf2a 100644 --- a/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/CoreSkillsConfig.java @@ -2,7 +2,7 @@ package com.gmail.nossr50.config; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; public class CoreSkillsConfig extends AutoUpdateConfigLoader { private static CoreSkillsConfig instance; diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index b094d0176..bd4e92ad6 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockState; diff --git a/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java b/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java index 2af0cb727..6864b71e6 100644 --- a/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java +++ b/src/main/java/com/gmail/nossr50/config/party/ItemWeightConfig.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.config.party; import com.gmail.nossr50.config.ConfigLoader; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import java.util.HashSet; diff --git a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java index 2c0b3f795..be050d298 100755 --- a/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java +++ b/src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java @@ -3,7 +3,7 @@ package com.gmail.nossr50.config.treasure; import com.gmail.nossr50.config.ConfigLoader; import com.gmail.nossr50.datatypes.treasure.*; import com.gmail.nossr50.util.EnchantmentUtils; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Tag; diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index 75c4ff6ca..ab87fe955 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -13,7 +13,7 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.OfflinePlayer; import java.io.*; diff --git a/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java index 0dbad85db..9648883fb 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java +++ b/src/main/java/com/gmail/nossr50/datatypes/json/McMMOWebLinks.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.datatypes.json; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; public enum McMMOWebLinks { WEBSITE, diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java b/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java index faa1b6599..270421f14 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java @@ -2,7 +2,7 @@ package com.gmail.nossr50.datatypes.party; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.ItemUtils; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.inventory.ItemStack; public enum ItemShareType { diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/PartyFeature.java b/src/main/java/com/gmail/nossr50/datatypes/party/PartyFeature.java index 55fa2688f..dd215fb5a 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/PartyFeature.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/PartyFeature.java @@ -4,7 +4,7 @@ import com.gmail.nossr50.commands.party.PartySubcommandType; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.entity.Player; public enum PartyFeature { diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java index 766d25f63..8f022ab6c 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/PrimarySkillType.java @@ -21,8 +21,8 @@ import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.skills.unarmed.UnarmedManager; import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.Color; import org.bukkit.entity.Entity; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index 95738acfd..97f9848b1 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.datatypes.skills; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import java.util.Locale; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java index dddb4bef5..6d038332c 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SuperAbilityType.java @@ -5,7 +5,7 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.block.BlockState; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/AcrobaticsSubSkill.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/AcrobaticsSubSkill.java index d692747b8..df479bb53 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/AcrobaticsSubSkill.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/AcrobaticsSubSkill.java @@ -6,7 +6,7 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.event.Event; import org.bukkit.event.EventPriority; diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/taming/CallOfTheWildType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/taming/CallOfTheWildType.java index 9a88fc295..9e1749adc 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/taming/CallOfTheWildType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/taming/CallOfTheWildType.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.datatypes.skills.subskills.taming; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.entity.EntityType; public enum CallOfTheWildType { diff --git a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java index 45424ae40..1b0c17949 100644 --- a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java +++ b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.events.skills; import com.gmail.nossr50.datatypes.interactions.NotificationType; -import com.gmail.nossr50.util.McMMOMessageType; +import com.gmail.nossr50.util.text.McMMOMessageType; import net.kyori.adventure.text.Component; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java index 01c8e7665..92050ae77 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java @@ -9,8 +9,8 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; import com.gmail.nossr50.skills.SkillManager; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.skills.RankUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.inventory.ItemStack; import java.util.List; diff --git a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java index a2cf127a8..66e3b48e6 100644 --- a/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java +++ b/src/main/java/com/gmail/nossr50/skills/child/ChildConfig.java @@ -2,7 +2,7 @@ package com.gmail.nossr50.skills.child; import com.gmail.nossr50.config.AutoUpdateConfigLoader; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.configuration.file.YamlConfiguration; import java.util.EnumSet; diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java index ea2db8613..aa6209e80 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java @@ -5,7 +5,7 @@ import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.block.BlockState; import java.util.ArrayList; diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index edd33d28d..20f8e0ba0 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -28,6 +28,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 com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index 910c3f5bf..8e8e56a3c 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -15,7 +15,6 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.random.RandomChanceSkillStatic; import com.gmail.nossr50.util.random.RandomChanceUtil; @@ -24,6 +23,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 com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index f71b6fbe2..aa2d30542 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -15,7 +15,6 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.random.RandomChanceSkillStatic; import com.gmail.nossr50.util.random.RandomChanceUtil; @@ -23,6 +22,7 @@ import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 8df527618..7b5f11f0b 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -16,7 +16,6 @@ import com.gmail.nossr50.runnables.skills.BleedTimerTask; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.random.RandomChanceSkillStatic; @@ -26,6 +25,7 @@ import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.attribute.Attribute; diff --git a/src/main/java/com/gmail/nossr50/util/HolidayManager.java b/src/main/java/com/gmail/nossr50/util/HolidayManager.java index bf312524b..7004245f6 100644 --- a/src/main/java/com/gmail/nossr50/util/HolidayManager.java +++ b/src/main/java/com/gmail/nossr50/util/HolidayManager.java @@ -11,6 +11,7 @@ import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.ChatColor; import org.bukkit.Color; diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index c31e51424..f306a4854 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.meta.OldName; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.ChatColor; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java index b01e34e4a..e6b50d469 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java @@ -22,7 +22,7 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.command.PluginCommand; import java.util.ArrayList; diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java index 84d96680d..de6f689fb 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java @@ -7,9 +7,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.SkillUtils; +import com.gmail.nossr50.util.text.StringUtils; import com.google.common.collect.ImmutableList; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/gmail/nossr50/util/compat/CompatibilityManager.java b/src/main/java/com/gmail/nossr50/util/compat/CompatibilityManager.java index 6e5f7c8f4..775592a70 100644 --- a/src/main/java/com/gmail/nossr50/util/compat/CompatibilityManager.java +++ b/src/main/java/com/gmail/nossr50/util/compat/CompatibilityManager.java @@ -2,13 +2,13 @@ package com.gmail.nossr50.util.compat; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.compat.layers.attackcooldown.PlayerAttackCooldownExploitPreventionLayer; import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer; import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_13; import com.gmail.nossr50.util.compat.layers.persistentdata.SpigotPersistentDataLayer_1_14; import com.gmail.nossr50.util.nms.NMSVersion; import com.gmail.nossr50.util.platform.MinecraftGameVersion; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.command.CommandSender; import java.util.HashMap; diff --git a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java index 1d66ac823..64ea51da3 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java @@ -4,8 +4,8 @@ import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.player.PlayerLevelUtils; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index b42a6e3cb..b334566f2 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -10,11 +10,11 @@ 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 com.gmail.nossr50.util.text.McMMOMessageType; +import com.gmail.nossr50.util.text.TextComponentFactory; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.identity.Identity; diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 668f41976..08b931764 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -14,10 +14,10 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.Misc; -import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.compat.layers.persistentdata.AbstractPersistentDataLayer; import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.UserManager; +import com.gmail.nossr50.util.text.StringUtils; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; diff --git a/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java b/src/main/java/com/gmail/nossr50/util/text/McMMOMessageType.java similarity index 94% rename from src/main/java/com/gmail/nossr50/util/McMMOMessageType.java rename to src/main/java/com/gmail/nossr50/util/text/McMMOMessageType.java index ed29e886f..f4fb0d7bb 100644 --- a/src/main/java/com/gmail/nossr50/util/McMMOMessageType.java +++ b/src/main/java/com/gmail/nossr50/util/text/McMMOMessageType.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.util; +package com.gmail.nossr50.util.text; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.MessageType; diff --git a/src/main/java/com/gmail/nossr50/util/StringUtils.java b/src/main/java/com/gmail/nossr50/util/text/StringUtils.java similarity index 99% rename from src/main/java/com/gmail/nossr50/util/StringUtils.java rename to src/main/java/com/gmail/nossr50/util/text/StringUtils.java index ba0b9cdc2..637e4b4e4 100644 --- a/src/main/java/com/gmail/nossr50/util/StringUtils.java +++ b/src/main/java/com/gmail/nossr50/util/text/StringUtils.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.util; +package com.gmail.nossr50.util.text; import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.skills.SuperAbilityType; diff --git a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java b/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java similarity index 79% rename from src/main/java/com/gmail/nossr50/util/TextComponentFactory.java rename to src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java index 302fe335c..d8c13faf2 100644 --- a/src/main/java/com/gmail/nossr50/util/TextComponentFactory.java +++ b/src/main/java/com/gmail/nossr50/util/text/TextComponentFactory.java @@ -1,4 +1,4 @@ -package com.gmail.nossr50.util; +package com.gmail.nossr50.util.text; import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.RankConfig; @@ -10,24 +10,21 @@ 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.Permissions; import com.gmail.nossr50.util.skills.RankUtils; import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.identity.Identity; 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 org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -56,7 +53,7 @@ public class TextComponentFactory { public static Component getNotificationLevelUpTextComponent(PrimarySkillType skill, int levelsGained, int currentLevel) { - return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel)); + return Component.text(LocaleLoader.getString("Overhaul.Levelup", LocaleLoader.getString("Overhaul.Name."+ StringUtils.getCapitalized(skill.toString())), levelsGained, currentLevel)); } private static TextComponent getNotificationTextComponent(String text) @@ -109,6 +106,13 @@ public class TextComponentFactory { ), MessageType.SYSTEM); } + /** + * Sends a player a bunch of text components that represent a list of sub-skills + * Styling and formatting is applied before sending the messages + * + * @param player target player + * @param subSkillComponents the text components representing the sub-skills by name + */ public static void sendPlayerSubSkillList(@NotNull Player player, @NotNull List subSkillComponents) { final Audience audience = mcMMO.getAudiences().player(player); @@ -117,12 +121,12 @@ public class TextComponentFactory { TextComponent atSignComponent = Component.text(LocaleLoader.getString("JSON.Hover.AtSymbolSkills")); //Only send 3 sub-skills per line - Component[][] splitSubSkills = splitComponentsIntoGroups(subSkillComponents, 3); + Component[][] splitSubSkills = TextUtils.splitComponentsIntoGroups(subSkillComponents, 3); ArrayList individualLinesToSend = new ArrayList<>(); //Create each line for (Component[] componentArray : splitSubSkills) { - individualLinesToSend.add(fromArray(componentArray, atSignComponent, space)); + individualLinesToSend.add(TextUtils.fromArray(componentArray, atSignComponent, space)); } //Send each group @@ -131,116 +135,6 @@ public class TextComponentFactory { } } - /** - * Makes a single component from an array of components, can optionally add prefixes and suffixes to come before and after each component - * @param componentsArray target array - * @return - */ - private static @NotNull Component fromArray(@NotNull Component[] componentsArray, @Nullable Component prefixComponent, @Nullable Component suffixComponent) { - TextComponent.Builder componentBuilder = Component.text(); - - for(Component component : componentsArray) { - if(component == null) //Individual elements can be null - continue; - - if(prefixComponent != null) - componentBuilder.append(prefixComponent); - - componentBuilder.append(component); - - if(suffixComponent != null) - componentBuilder.append(suffixComponent); - - } - - return componentBuilder.build(); - } - - - /** - * Takes a list of components and splits them into arrays each with a maximum element limit - * Individual elements in [][X] may be null - * - * @param components target component list - * @param groupsSize maximum size per array - * @return a 2D array with components split into groups - */ - private static @NotNull Component[][] splitComponentsIntoGroups(@NotNull List components, int groupsSize) { - int groupCount = (int) Math.ceil((double) components.size() / (double) groupsSize); - - Component[][] splitGroups = new Component[groupCount][groupsSize]; - - int groupsFinished = 0; - - while (groupsFinished < groupCount) { - //Fill group with members - for(int i = 0; i < groupsSize; i++) { - int indexOfPotentialMember = i + (groupsFinished * 3); //Groups don't always fill all members neatly - - //Some groups won't have entirely non-null elements - if(indexOfPotentialMember > components.size()-1) { - break; - } - - Component potentialMember = components.get(indexOfPotentialMember); - - //Make sure the potential member exists because of rounding - if(potentialMember != null) { - splitGroups[groupsFinished][i] = potentialMember; - } - } - - //Another group is finished - groupsFinished++; - } - - return splitGroups; - } - - -// public static void sendPlayerSubSkillList(Player player, List textComponents) -// { -// TextComponent emptySpace = Component.space(); -// -// AtomicReference messageToSend = new AtomicReference<>(); -// int newLineCount = 0; //Hacky solution to wordwrap problems -// -// final Audience audience = mcMMO.getAudiences().player(player); -// for (Component textComponent : textComponents) { -// //Don't send more than 3 subskills per line to avoid MOST wordwrap problems -// if(newLineCount > 2) -// { -// Component toSend = messageToSend.get(); -// if (toSend != null) { -// audience.sendMessage(Identity.nil(), toSend.append(emptySpace)); -// } -// -// messageToSend.set(null); -// newLineCount = 0; -// } -// //Style the skills into @links -// final String originalTxt = textComponent instanceof TextComponent ? ((TextComponent) textComponent).content() : ""; -// -// TextComponent.Builder stylizedText = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolSkills")); -// addChild(stylizedText, originalTxt); -// -// if(textComponent.hoverEvent() != null) -// stylizedText.hoverEvent(textComponent.hoverEvent()); -// -// if(textComponent.clickEvent() != null) -// stylizedText.clickEvent(textComponent.clickEvent()); -// -// messageToSend.set(stylizedText.build().append(emptySpace)); -// -// newLineCount++; -// } -// -// Component toSend = messageToSend.get(); -// if (toSend != null) { -// audience.sendMessage(Identity.nil(), toSend.append(emptySpace)); -// } -// } - private static Component getWebLinkTextComponent(McMMOWebLinks webLinks) { TextComponent.Builder webTextComponent; @@ -249,55 +143,44 @@ public class TextComponentFactory { { case WEBSITE: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Web"); + TextUtils.addChildWebComponent(webTextComponent, "Web"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWebsite)); break; case SPIGOT: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Spigot"); + TextUtils.addChildWebComponent(webTextComponent, "Spigot"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlSpigot)); break; case DISCORD: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Discord"); + TextUtils.addChildWebComponent(webTextComponent, "Discord"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlDiscord)); break; case PATREON: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Patreon"); + TextUtils.addChildWebComponent(webTextComponent, "Patreon"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlPatreon)); break; case WIKI: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Wiki"); + TextUtils.addChildWebComponent(webTextComponent, "Wiki"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWiki)); break; case HELP_TRANSLATE: webTextComponent = Component.text().content(LocaleLoader.getString("JSON.Hover.AtSymbolURL")); - addChild(webTextComponent, "Lang"); + TextUtils.addChildWebComponent(webTextComponent, "Lang"); webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlTranslate)); break; default: webTextComponent = Component.text().content("NOT DEFINED"); } - addNewHoverComponentToTextComponent(webTextComponent, getUrlHoverEvent(webLinks)); + TextUtils.addNewHoverComponentToTextComponent(webTextComponent, getUrlHoverEvent(webLinks)); webTextComponent.insertion(webLinks.getUrl()); return webTextComponent.build(); } - private static void addChild(Component webTextComponent, String childName) { - TextComponent childComponent = Component.text(childName); - childComponent.color(NamedTextColor.BLUE); - webTextComponent.append(childComponent); - } - - private static void addChild(ComponentBuilder webTextComponent, String childName) { - TextComponent childComponent = Component.text(childName).color(NamedTextColor.BLUE); - webTextComponent.append(childComponent); - } - private static Component getUrlHoverEvent(McMMOWebLinks webLinks) { TextComponent.Builder componentBuilder = Component.text().content(webLinks.getNiceTitle()); @@ -367,7 +250,7 @@ public class TextComponentFactory { TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked); //Hover Event - addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType)); + TextUtils.addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType)); //Insertion textComponent.insertion(skillName); @@ -375,10 +258,6 @@ public class TextComponentFactory { return textComponent.build(); } - private static void addNewHoverComponentToTextComponent(TextComponent.Builder textComponent, Component baseComponent) { - textComponent.hoverEvent(HoverEvent.showText(baseComponent)); - } - private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill) { //String key = abstractSubSkill.getConfigKeyName(); @@ -392,7 +271,7 @@ public class TextComponentFactory { TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked); //Hover Event - addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill)); + TextUtils.addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill)); //Insertion textComponent.insertion(skillName); diff --git a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java new file mode 100644 index 000000000..579128250 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java @@ -0,0 +1,87 @@ +package com.gmail.nossr50.util.text; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.ComponentBuilder; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.event.HoverEvent; +import net.kyori.adventure.text.format.NamedTextColor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class TextUtils { + /** + * Makes a single component from an array of components, can optionally add prefixes and suffixes to come before and after each component + * @param componentsArray target array + * @return a component with optional styling built from an array + */ + static @NotNull Component fromArray(@NotNull Component[] componentsArray, @Nullable Component prefixComponent, @Nullable Component suffixComponent) { + TextComponent.Builder componentBuilder = Component.text(); + + for(Component component : componentsArray) { + if(component == null) //Individual elements can be null + continue; + + if(prefixComponent != null) + componentBuilder.append(prefixComponent); + + componentBuilder.append(component); + + if(suffixComponent != null) + componentBuilder.append(suffixComponent); + + } + + return componentBuilder.build(); + } + + /** + * Takes a list of components and splits them into arrays each with a maximum element limit + * Individual elements in [][X] may be null + * + * @param components target component list + * @param groupsSize maximum size per array + * @return a 2D array with components split into groups + */ + static @NotNull Component[][] splitComponentsIntoGroups(@NotNull List components, int groupsSize) { + int groupCount = (int) Math.ceil((double) components.size() / (double) groupsSize); + + Component[][] splitGroups = new Component[groupCount][groupsSize]; + + int groupsFinished = 0; + + while (groupsFinished < groupCount) { + //Fill group with members + for(int i = 0; i < groupsSize; i++) { + int indexOfPotentialMember = i + (groupsFinished * 3); //Groups don't always fill all members neatly + + //Some groups won't have entirely non-null elements + if(indexOfPotentialMember > components.size()-1) { + break; + } + + Component potentialMember = components.get(indexOfPotentialMember); + + //Make sure the potential member exists because of rounding + if(potentialMember != null) { + splitGroups[groupsFinished][i] = potentialMember; + } + } + + //Another group is finished + groupsFinished++; + } + + return splitGroups; + } + + static void addChildWebComponent(@NotNull ComponentBuilder webTextComponent, @NotNull String childName) { + TextComponent childComponent = Component.text(childName).color(NamedTextColor.BLUE); + webTextComponent.append(childComponent); + } + + static void addNewHoverComponentToTextComponent(@NotNull TextComponent.Builder textComponent, @NotNull Component baseComponent) { + textComponent.hoverEvent(HoverEvent.showText(baseComponent)); + } +}