mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
adventure
This commit is contained in:
parent
0b20fc2c16
commit
02fe8addb7
20
pom.xml
20
pom.xml
@ -160,16 +160,16 @@
|
|||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>net.kyori</groupId>-->
|
<groupId>net.kyori</groupId>
|
||||||
<!-- <artifactId>adventure-platform-bukkit</artifactId>-->
|
<artifactId>adventure-api</artifactId>
|
||||||
<!-- <version>4.0.0-SNAPSHOT</version>-->
|
<version>4.0.0-SNAPSHOT</version>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
<!-- <dependency>-->
|
<dependency>
|
||||||
<!-- <groupId>net.kyori</groupId>-->
|
<groupId>net.kyori</groupId>
|
||||||
<!-- <artifactId>adventure-api</artifactId>-->
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
<!-- <version>4.0.0-SNAPSHOT</version>-->
|
<version>4.0.0-SNAPSHOT</version>
|
||||||
<!-- </dependency>-->
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||||
|
@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
|
|||||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -89,8 +89,8 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -93,8 +93,8 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
|
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.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -84,8 +84,8 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -105,8 +105,8 @@ public class AxesCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -66,8 +66,8 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
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.Location;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -167,8 +167,8 @@ public class FishingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING);
|
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.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -141,8 +141,8 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -111,8 +111,8 @@ public class MiningCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -121,8 +121,8 @@ public class RepairCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.skills.salvage.SalvageManager;
|
|||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -64,8 +64,8 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import com.gmail.nossr50.util.skills.PerksUtils;
|
|||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import com.google.common.collect.ImmutableList;
|
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.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -85,7 +86,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
||||||
|
|
||||||
//Make JSON text components
|
//Make JSON text components
|
||||||
List<TextComponent> subskillTextComponents = getTextComponents(player);
|
List<Component> subskillTextComponents = getTextComponents(player);
|
||||||
|
|
||||||
//Subskills Header
|
//Subskills Header
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul")));
|
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul")));
|
||||||
@ -283,7 +284,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
|
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
|
* Checks if a player can use a skill
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.util.TextComponentFactory;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -88,8 +88,8 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -110,8 +110,8 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
|
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.Permissions;
|
||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -92,8 +92,8 @@ public class TamingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -123,8 +123,8 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
|
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.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -83,8 +83,8 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<TextComponent> getTextComponents(Player player) {
|
protected List<Component> getTextComponents(Player player) {
|
||||||
List<TextComponent> textComponents = new ArrayList<>();
|
List<Component> textComponents = new ArrayList<>();
|
||||||
|
|
||||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
|
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
|
|||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -116,7 +117,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
* @param player target player
|
* @param player target player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addStats(ComponentBuilder componentBuilder, Player player) {
|
public void addStats(TextComponent.Builder componentBuilder, Player player) {
|
||||||
String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
|
String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
|
||||||
|
|
||||||
/* Values related to the player */
|
/* Values related to the player */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.subskills.interfaces;
|
package com.gmail.nossr50.datatypes.skills.subskills.interfaces;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public interface SubSkill extends Skill {
|
|||||||
* @param componentBuilder target component builder
|
* @param componentBuilder target component builder
|
||||||
* @param player owner of this skill
|
* @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
|
* Whether or not this subskill is enabled
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.events.skills;
|
package com.gmail.nossr50.events.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import com.gmail.nossr50.util.McMMOMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -22,12 +22,12 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
private boolean isMessageAlsoBeingSentToChat;
|
private boolean isMessageAlsoBeingSentToChat;
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
protected ChatMessageType chatMessageType;
|
protected McMMOMessageType chatMessageType;
|
||||||
|
|
||||||
protected TextComponent notificationTextComponent;
|
protected Component notificationTextComponent;
|
||||||
protected final NotificationType notificationType;
|
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);
|
super(false);
|
||||||
this.notificationType = notificationType;
|
this.notificationType = notificationType;
|
||||||
this.notificationTextComponent = notificationTextComponent;
|
this.notificationTextComponent = notificationTextComponent;
|
||||||
@ -48,19 +48,19 @@ public class McMMOPlayerNotificationEvent extends Event implements Cancellable {
|
|||||||
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
isMessageAlsoBeingSentToChat = messageAlsoBeingSentToChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextComponent getNotificationTextComponent() {
|
public Component getNotificationTextComponent() {
|
||||||
return notificationTextComponent;
|
return notificationTextComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationTextComponent(TextComponent notificationTextComponent) {
|
public void setNotificationTextComponent(Component notificationTextComponent) {
|
||||||
this.notificationTextComponent = notificationTextComponent;
|
this.notificationTextComponent = notificationTextComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatMessageType getChatMessageType() {
|
public McMMOMessageType getChatMessageType() {
|
||||||
return chatMessageType;
|
return chatMessageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChatMessageType(ChatMessageType chatMessageType) {
|
public void setChatMessageType(McMMOMessageType chatMessageType) {
|
||||||
this.chatMessageType = chatMessageType;
|
this.chatMessageType = chatMessageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ import com.gmail.nossr50.util.skills.SmeltingTracker;
|
|||||||
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.util.upgrade.UpgradeManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -81,6 +82,9 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private static PlayerLevelUtils playerLevelUtils;
|
private static PlayerLevelUtils playerLevelUtils;
|
||||||
private static SmeltingTracker smeltingTracker;
|
private static SmeltingTracker smeltingTracker;
|
||||||
|
|
||||||
|
/* Adventure */
|
||||||
|
private static BukkitAudiences audiences;
|
||||||
|
|
||||||
/* Blacklist */
|
/* Blacklist */
|
||||||
private static WorldBlacklist worldBlacklist;
|
private static WorldBlacklist worldBlacklist;
|
||||||
|
|
||||||
@ -270,6 +274,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//Init smelting tracker
|
//Init smelting tracker
|
||||||
smeltingTracker = new SmeltingTracker();
|
smeltingTracker = new SmeltingTracker();
|
||||||
|
|
||||||
|
audiences = BukkitAudiences.create(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerLevelUtils getPlayerLevelUtils() {
|
public static PlayerLevelUtils getPlayerLevelUtils() {
|
||||||
@ -678,4 +684,8 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static SmeltingTracker getSmeltingTracker() {
|
public static SmeltingTracker getSmeltingTracker() {
|
||||||
return smeltingTracker;
|
return smeltingTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BukkitAudiences getAudiences() {
|
||||||
|
return audiences;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
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.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.listeners.InteractionManager;
|
import com.gmail.nossr50.listeners.InteractionManager;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
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.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.*;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -33,24 +43,23 @@ public class TextComponentFactory {
|
|||||||
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
|
public static TextComponent getNotificationMultipleValues(String localeKey, String... values)
|
||||||
{
|
{
|
||||||
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
String preColoredString = LocaleLoader.getString(localeKey, (Object[]) values);
|
||||||
TextComponent msg = new TextComponent(preColoredString);
|
return TextComponent.of(preColoredString);
|
||||||
return new TextComponent(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextComponent getNotificationTextComponentFromLocale(String localeKey)
|
public static Component getNotificationTextComponentFromLocale(String localeKey)
|
||||||
{
|
{
|
||||||
return getNotificationTextComponent(LocaleLoader.getString(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)
|
private static TextComponent getNotificationTextComponent(String text)
|
||||||
{
|
{
|
||||||
//textComponent.setColor(getNotificationColor(notificationType));
|
//textComponent.setColor(getNotificationColor(notificationType));
|
||||||
return new TextComponent(text);
|
return TextComponent.of(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
|
public static void sendPlayerSubSkillWikiLink(Player player, String subskillformatted)
|
||||||
@ -58,225 +67,225 @@ public class TextComponentFactory {
|
|||||||
if(!Config.getInstance().getUrlLinksEnabled())
|
if(!Config.getInstance().getUrlLinksEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player.Spigot spigotPlayer = player.spigot();
|
TextComponent.Builder wikiLinkComponent = TextComponent.builder(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
|
||||||
|
wikiLinkComponent.decoration(TextDecoration.UNDERLINED, true);
|
||||||
TextComponent wikiLinkComponent = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.MmoInfo.Wiki"));
|
|
||||||
wikiLinkComponent.setUnderlined(true);
|
|
||||||
|
|
||||||
String wikiUrl = "https://mcmmo.org/wiki/"+subskillformatted;
|
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) {
|
public static void sendPlayerUrlHeader(Player player) {
|
||||||
Player.Spigot spigotPlayer = player.spigot();
|
TextComponent prefix = TextComponent.of(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
|
||||||
|
|
||||||
TextComponent prefix = new TextComponent(LocaleLoader.getString("Overhaul.mcMMO.Url.Wrap.Prefix") + " ");
|
|
||||||
/*prefix.setColor(ChatColor.DARK_AQUA);*/
|
/*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);*/
|
/*suffix.setColor(ChatColor.DARK_AQUA);*/
|
||||||
|
|
||||||
TextComponent emptySpace = new TextComponent(" ");
|
TextComponent emptySpace = TextComponent.space();
|
||||||
|
|
||||||
BaseComponent[] baseComponents = {new TextComponent(prefix),
|
mcMMO.getAudiences().audience(player).sendMessage(TextComponent.ofChildren(
|
||||||
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
|
prefix,
|
||||||
emptySpace,
|
getWebLinkTextComponent(McMMOWebLinks.WEBSITE),
|
||||||
getWebLinkTextComponent(McMMOWebLinks.DISCORD),
|
emptySpace,
|
||||||
emptySpace,
|
getWebLinkTextComponent(McMMOWebLinks.DISCORD),
|
||||||
getWebLinkTextComponent(McMMOWebLinks.PATREON),
|
emptySpace,
|
||||||
emptySpace,
|
getWebLinkTextComponent(McMMOWebLinks.PATREON),
|
||||||
getWebLinkTextComponent(McMMOWebLinks.WIKI),
|
emptySpace,
|
||||||
emptySpace,
|
getWebLinkTextComponent(McMMOWebLinks.WIKI),
|
||||||
getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
|
emptySpace,
|
||||||
emptySpace,
|
getWebLinkTextComponent(McMMOWebLinks.SPIGOT),
|
||||||
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
|
emptySpace,
|
||||||
new TextComponent(suffix)};
|
getWebLinkTextComponent(McMMOWebLinks.HELP_TRANSLATE),
|
||||||
|
suffix
|
||||||
spigotPlayer.sendMessage(baseComponents);
|
), 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
|
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
|
//Don't send more than 3 subskills per line to avoid MOST wordwrap problems
|
||||||
if(newLineCount > 2)
|
if(newLineCount > 2)
|
||||||
{
|
{
|
||||||
TextComponent[] bulkArray = new TextComponent[bulkMessage.size()];
|
Component toSend = messageToSend.get();
|
||||||
bulkArray = bulkMessage.toArray(bulkArray);
|
if (toSend != null) {
|
||||||
|
audience.sendMessage(toSend.append(emptySpace));
|
||||||
|
}
|
||||||
|
|
||||||
player.spigot().sendMessage(bulkArray);
|
messageToSend.set(null);
|
||||||
bulkMessage = new ArrayList<>();
|
|
||||||
newLineCount = 0;
|
newLineCount = 0;
|
||||||
}
|
}
|
||||||
//Style the skills into @links
|
//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);
|
addChild(stylizedText, originalTxt);
|
||||||
|
|
||||||
if(textComponent.getHoverEvent() != null)
|
if(textComponent.hoverEvent() != null)
|
||||||
stylizedText.setHoverEvent(textComponent.getHoverEvent());
|
stylizedText.hoverEvent(textComponent.hoverEvent());
|
||||||
|
|
||||||
if(textComponent.getClickEvent() != null)
|
if(textComponent.clickEvent() != null)
|
||||||
stylizedText.setClickEvent(textComponent.getClickEvent());
|
stylizedText.clickEvent(textComponent.clickEvent());
|
||||||
|
|
||||||
bulkMessage.add(stylizedText);
|
messageToSend.set(stylizedText.build().append(emptySpace));
|
||||||
bulkMessage.add(emptySpace);
|
|
||||||
|
|
||||||
newLineCount++;
|
newLineCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
Component toSend = messageToSend.get();
|
||||||
* Convert our list into an array
|
if (toSend != null) {
|
||||||
*/
|
audience.sendMessage(toSend.append(emptySpace));
|
||||||
TextComponent[] bulkArray = new TextComponent[bulkMessage.size()];
|
}
|
||||||
bulkArray = bulkMessage.toArray(bulkArray);
|
|
||||||
|
|
||||||
player.spigot().sendMessage(bulkArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextComponent getWebLinkTextComponent(McMMOWebLinks webLinks)
|
private static Component getWebLinkTextComponent(McMMOWebLinks webLinks)
|
||||||
{
|
{
|
||||||
TextComponent webTextComponent;
|
TextComponent.Builder webTextComponent;
|
||||||
|
|
||||||
switch(webLinks)
|
switch(webLinks)
|
||||||
{
|
{
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Web");
|
addChild(webTextComponent, "Web");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWebsite));
|
||||||
break;
|
break;
|
||||||
case SPIGOT:
|
case SPIGOT:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Spigot");
|
addChild(webTextComponent, "Spigot");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlSpigot));
|
||||||
break;
|
break;
|
||||||
case DISCORD:
|
case DISCORD:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Discord");
|
addChild(webTextComponent, "Discord");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlDiscord));
|
||||||
break;
|
break;
|
||||||
case PATREON:
|
case PATREON:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Patreon");
|
addChild(webTextComponent, "Patreon");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlPatreon));
|
||||||
break;
|
break;
|
||||||
case WIKI:
|
case WIKI:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Wiki");
|
addChild(webTextComponent, "Wiki");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlWiki));
|
||||||
break;
|
break;
|
||||||
case HELP_TRANSLATE:
|
case HELP_TRANSLATE:
|
||||||
webTextComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
webTextComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.AtSymbolURL"));
|
||||||
addChild(webTextComponent, "Lang");
|
addChild(webTextComponent, "Lang");
|
||||||
webTextComponent.setClickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
|
webTextComponent.clickEvent(getUrlClickEvent(McMMOUrl.urlTranslate));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
webTextComponent = new TextComponent("NOT DEFINED");
|
webTextComponent = TextComponent.builder("NOT DEFINED");
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewHoverComponentToTextComponent(webTextComponent, getUrlHoverEvent(webLinks));
|
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) {
|
private static void addChild(Component webTextComponent, String childName) {
|
||||||
TextComponent childComponent = new TextComponent(childName);
|
TextComponent childComponent = TextComponent.of(childName);
|
||||||
childComponent.setColor(ChatColor.BLUE);
|
childComponent.color(NamedTextColor.BLUE);
|
||||||
webTextComponent.addExtra(childComponent);
|
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)
|
switch(webLinks)
|
||||||
{
|
{
|
||||||
case WEBSITE:
|
case WEBSITE:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
componentBuilder.append("\nDev Blogs, and information related to mcMMO can be found here").color(ChatColor.GRAY);
|
componentBuilder.append(TextComponent.of("\nDev Blogs, and information related to mcMMO can be found here", NamedTextColor.GRAY));
|
||||||
break;
|
break;
|
||||||
case SPIGOT:
|
case SPIGOT:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
componentBuilder.append("\nI post regularly in the discussion thread here!").color(ChatColor.GRAY);
|
componentBuilder.append(TextComponent.of("\nI post regularly in the discussion thread here!", NamedTextColor.GRAY));
|
||||||
break;
|
break;
|
||||||
case PATREON:
|
case PATREON:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
componentBuilder.append("\n");
|
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;
|
break;
|
||||||
case WIKI:
|
case WIKI:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
componentBuilder.append("\n");
|
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;
|
break;
|
||||||
case DISCORD:
|
case DISCORD:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
break;
|
break;
|
||||||
case HELP_TRANSLATE:
|
case HELP_TRANSLATE:
|
||||||
addUrlHeaderHover(webLinks, componentBuilder);
|
addUrlHeaderHover(webLinks, componentBuilder);
|
||||||
componentBuilder.append("\n\n").italic(false);
|
componentBuilder.append("\n\n");
|
||||||
componentBuilder.append(webLinks.getLocaleDescription()).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(webLinks.getLocaleDescription(), NamedTextColor.GREEN));
|
||||||
componentBuilder.append("\n");
|
componentBuilder.append("\n");
|
||||||
componentBuilder.append("You can use this website to help translate mcMMO into your language!" +
|
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.").italic(false).color(ChatColor.DARK_GRAY);
|
"\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("\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)
|
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
|
//Get skill name
|
||||||
String skillName = subSkillType.getLocaleName();
|
String skillName = subSkillType.getLocaleName();
|
||||||
|
|
||||||
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||||
|
|
||||||
TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
||||||
|
|
||||||
//Hover Event
|
//Hover Event
|
||||||
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
|
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, subSkillType));
|
||||||
|
|
||||||
//Insertion
|
//Insertion
|
||||||
textComponent.setInsertion(skillName);
|
textComponent.insertion(skillName);
|
||||||
|
|
||||||
return textComponent;
|
return textComponent.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addNewHoverComponentToTextComponent(TextComponent textComponent, BaseComponent[] baseComponent) {
|
private static void addNewHoverComponentToTextComponent(TextComponent.Builder textComponent, Component baseComponent) {
|
||||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, baseComponent));
|
textComponent.hoverEvent(HoverEvent.showText(baseComponent));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill)
|
private static TextComponent getSubSkillTextComponent(Player player, AbstractSubSkill abstractSubSkill)
|
||||||
@ -289,42 +298,42 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||||
|
|
||||||
TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
TextComponent.Builder textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
||||||
|
|
||||||
//Hover Event
|
//Hover Event
|
||||||
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill));
|
addNewHoverComponentToTextComponent(textComponent, getSubSkillHoverComponent(player, abstractSubSkill));
|
||||||
|
|
||||||
//Insertion
|
//Insertion
|
||||||
textComponent.setInsertion(skillName);
|
textComponent.insertion(skillName);
|
||||||
|
|
||||||
return textComponent;
|
return textComponent.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextComponent initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
private static TextComponent.Builder initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
||||||
TextComponent textComponent;
|
TextComponent.Builder textComponent;
|
||||||
if (skillUnlocked) {
|
if (skillUnlocked) {
|
||||||
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
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
|
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 {
|
} else {
|
||||||
textComponent = new TextComponent(LocaleLoader.getString("JSON.Hover.Mystery",
|
textComponent = TextComponent.builder(LocaleLoader.getString("JSON.Hover.Mystery",
|
||||||
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
|
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
|
||||||
|
|
||||||
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
|
textComponent.clickEvent(ClickEvent.runCommand("/mmoinfo ???"));
|
||||||
}
|
}
|
||||||
return textComponent;
|
return textComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent[] getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
|
private static Component getSubSkillHoverComponent(Player player, AbstractSubSkill abstractSubSkill)
|
||||||
{
|
{
|
||||||
return getSubSkillHoverEventJSON(abstractSubSkill, player);
|
return getSubSkillHoverEventJSON(abstractSubSkill, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BaseComponent[] getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
|
private static Component getSubSkillHoverComponent(Player player, SubSkillType subSkillType)
|
||||||
{
|
{
|
||||||
return getSubSkillHoverEventJSON(subSkillType, player);
|
return getSubSkillHoverEventJSON(subSkillType, player);
|
||||||
}
|
}
|
||||||
@ -335,27 +344,27 @@ public class TextComponentFactory {
|
|||||||
* @param player the player who owns this subskill
|
* @param player the player who owns this subskill
|
||||||
* @return the hover basecomponent object for 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();
|
String skillName = abstractSubSkill.getNiceName();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hover Event BaseComponent color table
|
* Hover Event BaseComponent color table
|
||||||
*/
|
*/
|
||||||
ChatColor ccSubSkillHeader = ChatColor.GOLD;
|
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
|
||||||
ChatColor ccRank = ChatColor.BLUE;
|
TextColor ccRank = NamedTextColor.BLUE;
|
||||||
ChatColor ccCurRank = ChatColor.GREEN;
|
TextColor ccCurRank = NamedTextColor.GREEN;
|
||||||
ChatColor ccPossessive = ChatColor.WHITE;
|
TextColor ccPossessive = NamedTextColor.WHITE;
|
||||||
//ChatColor ccDescriptionHeader = ChatColor.DARK_PURPLE;
|
//ChatColor ccDescriptionHeader = ChatColor.DARK_PURPLE;
|
||||||
//ChatColor ccDescription = ChatColor.WHITE;
|
//ChatColor ccDescription = ChatColor.WHITE;
|
||||||
ChatColor ccLocked = ChatColor.DARK_GRAY;
|
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
||||||
ChatColor ccLevelRequirement = ChatColor.BLUE;
|
TextColor ccLevelRequirement = NamedTextColor.BLUE;
|
||||||
ChatColor ccLevelRequired = ChatColor.RED;
|
TextColor ccLevelRequired = NamedTextColor.RED;
|
||||||
|
|
||||||
SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
|
SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
|
||||||
|
|
||||||
//SubSkillType Name
|
//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))
|
if(!RankUtils.hasUnlockedSubskill(player, abstractSubSkill))
|
||||||
{
|
{
|
||||||
@ -379,18 +388,18 @@ public class TextComponentFactory {
|
|||||||
componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
|
componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
|
||||||
|
|
||||||
//Empty line
|
//Empty line
|
||||||
componentBuilder.append("\n").bold(false);
|
componentBuilder.append("\n").decoration(TextDecoration.BOLD, false);
|
||||||
componentBuilder.append("\n");
|
componentBuilder.append("\n");
|
||||||
|
|
||||||
//Finally, add details to the tooltip
|
//Finally, add details to the tooltip
|
||||||
abstractSubSkill.addStats(componentBuilder, player);
|
abstractSubSkill.addStats(componentBuilder, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
return componentBuilder.create();
|
return componentBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ComponentBuilder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
private static TextComponent.Builder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
||||||
ComponentBuilder componentBuilder;
|
TextComponent.Builder componentBuilder;
|
||||||
if (skillUnlocked) {
|
if (skillUnlocked) {
|
||||||
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
||||||
componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
|
componentBuilder = getNewComponentBuilder(LocaleLoader.getString("JSON.Hover.MaxRankSkillName", skillName));
|
||||||
@ -402,66 +411,64 @@ public class TextComponentFactory {
|
|||||||
return componentBuilder;
|
return componentBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ComponentBuilder getNewComponentBuilder(String skillName) {
|
private static TextComponent.Builder getNewComponentBuilder(String skillName) {
|
||||||
ComponentBuilder componentBuilder = new ComponentBuilder(skillName);
|
TextComponent.Builder componentBuilder = TextComponent.builder(skillName);
|
||||||
componentBuilder.append("\n");
|
componentBuilder.append("\n");
|
||||||
return componentBuilder;
|
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) {
|
if (numRanks > 0) {
|
||||||
//Rank: x
|
//Rank: x
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n")
|
componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n");
|
||||||
.bold(false).italic(false).strikethrough(false).underlined(false);
|
|
||||||
|
|
||||||
//Next Rank: x
|
//Next Rank: x
|
||||||
if(nextRank > rank)
|
if(nextRank > rank)
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n")
|
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.RankPossesive") + " ").color(ccPossessive);
|
/*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
|
||||||
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
|
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);
|
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");
|
//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);
|
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");
|
//componentBuilder.append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addLocked(ChatColor ccLocked, ChatColor ccLevelRequirement, ComponentBuilder componentBuilder) {
|
private static void addLocked(TextColor ccLocked, TextColor ccLevelRequirement, TextComponent.Builder componentBuilder) {
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Locked")).color(ccLocked).bold(true);
|
componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Locked"), ccLocked, TextDecoration.BOLD));
|
||||||
componentBuilder.append("\n").append("\n").bold(false);
|
componentBuilder.append("\n").append("\n");
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.LevelRequirement") + ": ").color(ccLevelRequirement);
|
componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.LevelRequirement") + ": ", ccLevelRequirement));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static BaseComponent[] getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
|
private static Component getSubSkillHoverEventJSON(SubSkillType subSkillType, Player player)
|
||||||
{
|
{
|
||||||
String skillName = subSkillType.getLocaleName();
|
String skillName = subSkillType.getLocaleName();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hover Event BaseComponent color table
|
* Hover Event BaseComponent color table
|
||||||
*/
|
*/
|
||||||
ChatColor ccSubSkillHeader = ChatColor.GOLD;
|
TextColor ccSubSkillHeader = NamedTextColor.GOLD;
|
||||||
ChatColor ccRank = ChatColor.BLUE;
|
TextColor ccRank = NamedTextColor.BLUE;
|
||||||
ChatColor ccCurRank = ChatColor.GREEN;
|
TextColor ccCurRank = NamedTextColor.GREEN;
|
||||||
ChatColor ccPossessive = ChatColor.WHITE;
|
TextColor ccPossessive = NamedTextColor.WHITE;
|
||||||
ChatColor ccDescriptionHeader = ChatColor.DARK_PURPLE;
|
TextColor ccDescriptionHeader = NamedTextColor.DARK_PURPLE;
|
||||||
ChatColor ccDescription = ChatColor.DARK_GRAY;
|
TextColor ccDescription = NamedTextColor.DARK_GRAY;
|
||||||
ChatColor ccLocked = ChatColor.DARK_GRAY;
|
TextColor ccLocked = NamedTextColor.DARK_GRAY;
|
||||||
ChatColor ccLevelRequirement = ChatColor.BLUE;
|
TextColor ccLevelRequirement = NamedTextColor.BLUE;
|
||||||
ChatColor ccLevelRequired = ChatColor.RED;
|
TextColor ccLevelRequired = NamedTextColor.RED;
|
||||||
|
|
||||||
//SubSkillType Name
|
//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))
|
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
||||||
{
|
{
|
||||||
@ -485,7 +492,7 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentBuilder.append("\n").bold(false);
|
componentBuilder.append("\n");
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
|
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
|
||||||
componentBuilder.color(ccDescriptionHeader);
|
componentBuilder.color(ccDescriptionHeader);
|
||||||
componentBuilder.append("\n");
|
componentBuilder.append("\n");
|
||||||
@ -493,28 +500,25 @@ public class TextComponentFactory {
|
|||||||
componentBuilder.color(ccDescription);
|
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())
|
if(abstractSubSkill.isSuperAbility())
|
||||||
{
|
{
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Type.SuperAbility")).color(ChatColor.LIGHT_PURPLE);
|
componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.SuperAbility"), NamedTextColor.LIGHT_PURPLE, TextDecoration.BOLD));
|
||||||
componentBuilder.bold(true);
|
|
||||||
} else if(abstractSubSkill.isActiveUse())
|
} else if(abstractSubSkill.isActiveUse())
|
||||||
{
|
{
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Type.Active")).color(ChatColor.DARK_RED);
|
componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.Active"), NamedTextColor.DARK_RED, TextDecoration.BOLD));
|
||||||
componentBuilder.bold(true);
|
|
||||||
} else {
|
} else {
|
||||||
componentBuilder.append(LocaleLoader.getString("JSON.Type.Passive")).color(ChatColor.GREEN);
|
componentBuilder.append(TextComponent.of(LocaleLoader.getString("JSON.Type.Passive"), NamedTextColor.GREEN, TextDecoration.BOLD));
|
||||||
componentBuilder.bold(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentBuilder.append("\n");
|
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())
|
for(SubSkillType subSkillType : SubSkillType.values())
|
||||||
{
|
{
|
||||||
if(subSkillType.getParentSkill() == parentSkill)
|
if(subSkillType.getParentSkill() == parentSkill)
|
||||||
@ -540,11 +544,10 @@ public class TextComponentFactory {
|
|||||||
|
|
||||||
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType)
|
public static TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType)
|
||||||
{
|
{
|
||||||
TextComponent unlockMessage = new TextComponent("");
|
TextComponent.Builder unlockMessage = TextComponent.builder(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
||||||
unlockMessage.setText(LocaleLoader.getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
unlockMessage.hoverEvent(HoverEvent.showText(getSubSkillHoverComponent(player, subSkillType)));
|
||||||
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
|
unlockMessage.clickEvent(ClickEvent.runCommand("/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
|
||||||
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/"+subSkillType.getParentSkill().toString().toLowerCase(Locale.ENGLISH)));
|
return unlockMessage.build();
|
||||||
return unlockMessage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,12 +10,14 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerNotificationEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.util.McMMOMessageType;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.kyori.adventure.audience.MessageType;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -36,9 +38,9 @@ public class NotificationManager {
|
|||||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
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);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||||
|
|
||||||
sendNotification(player, customEvent);
|
sendNotification(player, customEvent);
|
||||||
@ -91,9 +93,9 @@ public class NotificationManager {
|
|||||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||||
return;
|
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);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(player, notificationType, destination, message);
|
||||||
|
|
||||||
sendNotification(player, customEvent);
|
sendNotification(player, customEvent);
|
||||||
@ -103,22 +105,24 @@ public class NotificationManager {
|
|||||||
if (customEvent.isCancelled())
|
if (customEvent.isCancelled())
|
||||||
return;
|
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 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())
|
if(customEvent.isMessageAlsoBeingSentToChat())
|
||||||
{
|
{
|
||||||
//Send copy to chat system
|
//Send copy to chat system
|
||||||
player.spigot().sendMessage(ChatMessageType.SYSTEM, customEvent.getNotificationTextComponent());
|
audience.sendMessage(customEvent.getNotificationTextComponent(), MessageType.SYSTEM);
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
//Init event
|
||||||
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
McMMOPlayerNotificationEvent customEvent = new McMMOPlayerNotificationEvent(player,
|
||||||
notificationType, message, destination, AdvancedConfig.getInstance().doesNotificationSendCopyToChat(notificationType));
|
notificationType, message, destination, AdvancedConfig.getInstance().doesNotificationSendCopyToChat(notificationType));
|
||||||
@ -139,9 +143,9 @@ public class NotificationManager {
|
|||||||
if(!mcMMOPlayer.useChatNotifications())
|
if(!mcMMOPlayer.useChatNotifications())
|
||||||
return;
|
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(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
|
McMMOPlayerNotificationEvent customEvent = checkNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, destination, levelUpTextComponent);
|
||||||
|
|
||||||
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
||||||
@ -161,7 +165,7 @@ public class NotificationManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//CHAT MESSAGE
|
//CHAT MESSAGE
|
||||||
mcMMOPlayer.getPlayer().spigot().sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
mcMMO.getAudiences().audience(mcMMOPlayer.getPlayer()).sendMessage(TextComponentFactory.getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
||||||
|
|
||||||
//Unlock Sound Effect
|
//Unlock Sound Effect
|
||||||
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
SoundManager.sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||||
|
@ -4,7 +4,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public final class PerksUtils {
|
public final class PerksUtils {
|
||||||
|
Loading…
Reference in New Issue
Block a user