mirror of
https://github.com/SimplexDevelopment/SimplexCL.git
synced 2025-07-06 00:06:41 +00:00
Update to match Maven
This commit is contained in:
196
src/main/java/io/github/simplexdevelopment/cl/CommandBase.java
Normal file
196
src/main/java/io/github/simplexdevelopment/cl/CommandBase.java
Normal file
@ -0,0 +1,196 @@
|
||||
package io.github.simplexdevelopment.cl;
|
||||
|
||||
import io.github.simplexdevelopment.cl.api.ICommand;
|
||||
import io.github.simplexdevelopment.cl.api.SubCommand;
|
||||
import io.github.simplexdevelopment.msgutils.AdvancedColors;
|
||||
import io.github.simplexdevelopment.msgutils.BasicColors;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class CommandBase extends Permissible implements ICommand {
|
||||
/**
|
||||
* @param permission The permission the user should have to run the command
|
||||
* @param permissionMessage The message to send when the user does not have the permission to run the command.
|
||||
* @param allowConsole Whether to allow the command to be run anywhere, or only in game.
|
||||
*/
|
||||
public CommandBase(@NotNull String permission, String permissionMessage, boolean allowConsole) {
|
||||
super(permission, permissionMessage, allowConsole);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permission The permission the user should have to run the command
|
||||
* @param permissionMessage The message to send when the user does not have the permission to run the command.
|
||||
*/
|
||||
public CommandBase(@NotNull String permission, String permissionMessage) {
|
||||
this(permission, permissionMessage, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permission The permission the user should have to run the command
|
||||
* @param allowConsole Whether to allow the command to be run anywhere, or only in game.
|
||||
*/
|
||||
public CommandBase(@NotNull String permission, boolean allowConsole) {
|
||||
this(permission, "You do not have permission to use this command!", allowConsole);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permission The permission the user should have to run the command
|
||||
*/
|
||||
public CommandBase(@NotNull String permission) {
|
||||
this(permission, "You do not have permission to use this command!", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String lbl, String[] args) {
|
||||
if (!hasPermission(sender)) {
|
||||
sender.sendMessage(msg(getPermissionMessage(), BasicColors.RED));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player) && !allowConsole()) {
|
||||
sender.sendMessage(msg("This command can only be run in game."));
|
||||
}
|
||||
|
||||
execute(sender, args, allowConsole());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a text component for Kyori friendly messaging.
|
||||
*
|
||||
* @param text The text to convert to a component
|
||||
* @return A {@link TextComponent} containing the message provided in {@param text}
|
||||
*/
|
||||
@NotNull
|
||||
public TextComponent msg(@NotNull String text) {
|
||||
return Component.empty().content(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a text component for Kyori friendly messaging.
|
||||
*
|
||||
* @param text The text to convert to a Component
|
||||
* @param color The color you'd like the text. These colors are basic and the majority of which are provided by Minecraft's native color system.
|
||||
* @return A {@link TextComponent} containing the message provided in {@param text} with the provided {@param color}
|
||||
*/
|
||||
@NotNull
|
||||
public TextComponent msg(@NotNull String text, @NotNull BasicColors color) {
|
||||
return Component.empty().content(text).color(color.getColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a text component for Kyori friendly messaging.
|
||||
*
|
||||
* @param text The text to convert to a Component
|
||||
* @param color The color you'd like the text. These colors are much more diverse for viewing pleasure.
|
||||
* @return A {@link TextComponent} containing the message provided in {@param text} with the provided {@param color}
|
||||
*/
|
||||
@NotNull
|
||||
public TextComponent msg(@NotNull String text, @NotNull AdvancedColors color) {
|
||||
return Component.empty().content(text).color(color.getColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a subcommand provided that the user has the required permission.
|
||||
*
|
||||
* @param name The name of the subcommand.
|
||||
* @param sender The user who executed the command. (Provided by Paper)
|
||||
* @param permission The permission required to run the subcommand.
|
||||
* @param args The arguments the user input to run the subcommand. (Provided by Paper)
|
||||
* @param command The SubCommand to run.
|
||||
* This is a functional interface to provide easy implementation of the command's details.
|
||||
*/
|
||||
public boolean subCommand(@NotNull String name, @NotNull CommandSender sender, @NotNull String permission, String @NotNull [] args, @NotNull SubCommand command) {
|
||||
if (!sender.hasPermission(permission)) {
|
||||
sender.sendMessage(msg(getPermissionMessage()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String[] tieredCmd = name.split(" ");
|
||||
|
||||
if (args.length == 1 && tieredCmd.length == 1) {
|
||||
if (args[0].equalsIgnoreCase(name)) {
|
||||
command.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args.length == 2 && tieredCmd.length == 2) {
|
||||
if (args[0].equalsIgnoreCase(tieredCmd[0]) && args[1].equalsIgnoreCase(tieredCmd[1])) {
|
||||
command.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args.length == 3 && tieredCmd.length == 3) {
|
||||
if (args[0].equalsIgnoreCase(tieredCmd[0])
|
||||
&& args[1].equalsIgnoreCase(tieredCmd[1])
|
||||
&& args[2].equalsIgnoreCase(tieredCmd[2])) {
|
||||
command.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (args.length == 4 && tieredCmd.length == 4) {
|
||||
if (args[0].equalsIgnoreCase(tieredCmd[0])
|
||||
&& args[1].equalsIgnoreCase(tieredCmd[1])
|
||||
&& args[2].equalsIgnoreCase(tieredCmd[2])
|
||||
&& args[3].equalsIgnoreCase(tieredCmd[3])) {
|
||||
command.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Player getPlayer(@NotNull String name) {
|
||||
return Bukkit.getServer().getPlayer(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Player getPlayer(@NotNull UUID uuid) {
|
||||
return Bukkit.getServer().getPlayer(uuid);
|
||||
}
|
||||
|
||||
public List<? extends Player> getOnlinePlayers() {
|
||||
return Bukkit.getOnlinePlayers().stream().toList();
|
||||
}
|
||||
|
||||
public void broadcast(String text) {
|
||||
Bukkit.getServer().broadcast(msg(text));
|
||||
}
|
||||
|
||||
public void broadcast(String text, BasicColors color) {
|
||||
Bukkit.getServer().broadcast(msg(text, color));
|
||||
}
|
||||
|
||||
public void broadcast(String text, AdvancedColors color) {
|
||||
Bukkit.getServer().broadcast(msg(text, color));
|
||||
}
|
||||
|
||||
public void enablePlugin(Plugin plugin) {
|
||||
Bukkit.getServer().getPluginManager().enablePlugin(plugin);
|
||||
}
|
||||
|
||||
public void disablePlugin(Plugin plugin) {
|
||||
Bukkit.getServer().getPluginManager().disablePlugin(plugin);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package io.github.simplexdevelopment.cl;
|
||||
|
||||
import io.github.simplexdevelopment.cl.api.annotations.Info;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CommandLoader {
|
||||
private final Plugin plugin;
|
||||
private final List<DummyCommand> commandList = new ArrayList<>();
|
||||
private final String FALLBACK_PREFIX;
|
||||
|
||||
/**
|
||||
* @param plugin Your plugin instance
|
||||
* @param fallbackPrefix The fallback prefix to use in case your plugin fails to provide a namespace.
|
||||
*/
|
||||
public CommandLoader(Plugin plugin, String fallbackPrefix) {
|
||||
this.FALLBACK_PREFIX = fallbackPrefix;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will register your command internally within the CommandLoader.
|
||||
* Instances of commands will be cached and readied for loading into Paper.
|
||||
* You should always run this before using {@link CommandLoader#load()}, otherwise your commands will not be loaded.
|
||||
*
|
||||
* @param command A new instance of your command which should extend CommandBase.
|
||||
*/
|
||||
public void register(CommandBase command) {
|
||||
Class<? extends CommandBase> cmd = command.getClass();
|
||||
if (cmd.getDeclaredAnnotation(Info.class) != null) {
|
||||
Info info = cmd.getDeclaredAnnotation(Info.class);
|
||||
DummyCommand dummy = new DummyCommand(plugin,
|
||||
command,
|
||||
info.name(),
|
||||
info.description(),
|
||||
info.usage(),
|
||||
Arrays.asList(info.aliases().split(",")));
|
||||
commandList.add(dummy);
|
||||
} else {
|
||||
throw new RuntimeException("Missing a required annotation! Unable to load the command.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will run a loop for each command instance you input and register them all within one method.
|
||||
* This simply runs the array through a stream and uses a lambda reference to {@link CommandLoader#register(CommandBase)} in order to register the commands.
|
||||
* Each command will be loaded in the order it is provided.
|
||||
*
|
||||
* @param commands An indefinite amount of command instances to be registered.
|
||||
*/
|
||||
public void register(CommandBase... commands) {
|
||||
Arrays.stream(commands).forEachOrdered(this::register);
|
||||
}
|
||||
|
||||
/**
|
||||
* This will load your commands and initialize them within Paper's CommandMap.
|
||||
*/
|
||||
public void load() {
|
||||
commandList.forEach(cmd -> {
|
||||
Bukkit.getCommandMap().register(cmd.getName(), FALLBACK_PREFIX, cmd);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This will effectively register all your commands and then load them into the Paper CommandMap.
|
||||
*
|
||||
* @param commands An indefinite amount of command instances to be registered and loaded.
|
||||
*/
|
||||
public void registerAndLoad(CommandBase... commands) {
|
||||
register(commands);
|
||||
load();
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package io.github.simplexdevelopment.cl;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class DummyCommand extends Command implements PluginIdentifiableCommand {
|
||||
private final CommandBase base;
|
||||
private final Plugin plugin;
|
||||
|
||||
/**
|
||||
* @param plugin Your plugin instance.
|
||||
* @param base Your command instance.
|
||||
* @param name The name of your command
|
||||
* @param description The description of your command
|
||||
* @param usageMessage The usage for your command
|
||||
* @param aliases The aliases for your command.
|
||||
*/
|
||||
DummyCommand(@NotNull Plugin plugin, @NotNull CommandBase base, @NotNull String name, @NotNull String description, @NotNull String usageMessage, @NotNull List<String> aliases) {
|
||||
super(name, description, usageMessage, aliases);
|
||||
this.setName(name);
|
||||
this.setDescription(description);
|
||||
this.setUsage(usageMessage);
|
||||
this.setAliases(aliases);
|
||||
this.setPermission(base.getPermission());
|
||||
this.permissionMessage(Component.empty().content(base.getPermissionMessage()));
|
||||
this.base = base;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual executor method.
|
||||
*
|
||||
* @param sender The user who sent the command
|
||||
* @param commandLabel The name of the command
|
||||
* @param args Any additional arguments the user may input
|
||||
* @return Successfully executed the command or not
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
|
||||
base.onCommand(sender, this, commandLabel, args);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Gets your plugin (Generic)
|
||||
*/
|
||||
@Override
|
||||
public @NotNull Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package io.github.simplexdevelopment.cl;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public abstract class Permissible {
|
||||
private final String permission;
|
||||
private final String permissionMessage;
|
||||
private final boolean allowConsole;
|
||||
|
||||
/**
|
||||
* @param permission The permission the user should have to run the command
|
||||
* @param permissionMessage The message to send when the user does not have the permission to run the command.
|
||||
* @param allowConsole Whether to allow the command to be run anywhere, or only in game.
|
||||
*/
|
||||
public Permissible(String permission, String permissionMessage, boolean allowConsole) {
|
||||
this.permission = permission;
|
||||
this.permissionMessage = permissionMessage;
|
||||
this.allowConsole = allowConsole;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permission for the command it represents.
|
||||
*
|
||||
* @return The permission required to run the command.
|
||||
*/
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message to display when a user doesn't have permission to run the command.
|
||||
*
|
||||
* @return The message to send the user when they do not have the required permission.
|
||||
*/
|
||||
public String getPermissionMessage() {
|
||||
return permissionMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the source of the command has the permission required to run it.
|
||||
*
|
||||
* @param sender The command source
|
||||
* @return Whether the sender has the permission or not.
|
||||
*/
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return sender.hasPermission(getPermission());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether to allow the command to be run from anywhere, or only players.
|
||||
*/
|
||||
public boolean allowConsole() {
|
||||
return allowConsole;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package io.github.simplexdevelopment.cl.api;
|
||||
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
|
||||
public interface ICommand extends CommandExecutor, TabCompleter {
|
||||
/**
|
||||
* This is the actual onCommand method. This should be used when you want to execute the command itself.
|
||||
*
|
||||
* @param sender The user who sent the command. (Provided by Paper)
|
||||
* @param args The additional arguments to the command, if applicable (Provided by Paper)
|
||||
* @param allowConsole Whether the command should be allowed anywhere, or only in game.
|
||||
*/
|
||||
void execute(CommandSender sender, String[] args, boolean allowConsole);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package io.github.simplexdevelopment.cl.api;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface SubCommand {
|
||||
/**
|
||||
* This provides a way to use a functional interface to clearly define subcommands and their actions.
|
||||
*/
|
||||
void execute();
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package io.github.simplexdevelopment.cl.api.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Info {
|
||||
/**
|
||||
* @return The name of the command.
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* @return The description of the command.
|
||||
*/
|
||||
String description();
|
||||
|
||||
/**
|
||||
* @return The proper usage of the command.
|
||||
*/
|
||||
String usage();
|
||||
|
||||
/**
|
||||
* @return The aliases for the command, separated by commas (alias1,alias2,alias3)
|
||||
*/
|
||||
String aliases() default "";
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package io.github.simplexdevelopment.cl.impl;
|
||||
|
||||
import io.github.simplexdevelopment.cl.CommandBase;
|
||||
import io.github.simplexdevelopment.cl.api.annotations.Info;
|
||||
import io.github.simplexdevelopment.msgutils.AdvancedColors;
|
||||
import io.github.simplexdevelopment.msgutils.BasicColors;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@Info(name = "example", description = "An example command implementation to see how this works.", usage = "/example [info]", aliases = "ex, impl")
|
||||
public final class ExampleCommand extends CommandBase {
|
||||
public ExampleCommand() {
|
||||
super("simplexcl.example",
|
||||
"You do not have permission to use this command!",
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args, boolean allowConsole) {
|
||||
if (subCommand("info", sender, getPermission() + ".info", args, () -> sender.sendMessage(msg("SimplexCL was created by SimplexDevelopment!", BasicColors.GOLD)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (subCommand("info more", sender, getPermission() + ".info.more", args, () -> sender.sendMessage(msg("https://github.com/SimplexDevelopment", AdvancedColors.FUCHSIA)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage(msg("This is an example command.", BasicColors.BLUE));
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package io.github.simplexdevelopment.msgutils;
|
||||
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
public enum AdvancedColors {
|
||||
AMETHYST(TextColor.color(253, 103, 204)),
|
||||
AQUAMARINE(TextColor.color(127, 255, 212)),
|
||||
AZURE(TextColor.color(0, 127, 255)),
|
||||
BRONZE(TextColor.color(205, 127, 50)),
|
||||
BURLYWOOD(TextColor.color(222, 184, 135)),
|
||||
CHARTREUSE(TextColor.color(223, 255, 0)),
|
||||
CORAL(TextColor.color(255, 127, 80)),
|
||||
CORNFLOWER(TextColor.color(100, 149, 237)),
|
||||
CRIMSON(TextColor.color(220, 20, 60)),
|
||||
FUCHSIA(TextColor.color(255, 0, 255)),
|
||||
GOLDENROD(TextColor.color(218, 165, 32)),
|
||||
GRAPE(TextColor.color(111, 45, 168)),
|
||||
HONEYDEW(TextColor.color(240, 255, 240)),
|
||||
INDIGO(TextColor.color(75, 0, 130)),
|
||||
IVORY(TextColor.color(255, 255, 240)),
|
||||
MAROON(TextColor.color(128, 0 , 0)),
|
||||
MEDIUM_VIOLET_RED(TextColor.color(199, 21, 133)),
|
||||
MOCCASIN(TextColor.color(255, 228, 181)),
|
||||
OLIVE(TextColor.color(128, 128, 0)),
|
||||
PALE_VIOLET_RED(TextColor.color(219, 112, 147)),
|
||||
PLUM(TextColor.color(142, 69, 133)),
|
||||
SALMON(TextColor.color(250, 128, 114)),
|
||||
SEA_GREEN(TextColor.color(46, 139, 87)),
|
||||
SILVER(TextColor.color(192, 192, 192)),
|
||||
SLATE(TextColor.color(192, 194, 201)),
|
||||
SLATE_BLUE(TextColor.color(106, 90, 205)),
|
||||
STEEL_BLUE(TextColor.color(70, 130, 180)),
|
||||
TOMATO(TextColor.color(255, 99, 71)),
|
||||
TURQUOISE(TextColor.color(48, 213, 200)),
|
||||
WHEAT(TextColor.color(245, 222, 179));
|
||||
|
||||
final TextColor color;
|
||||
|
||||
AdvancedColors(TextColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public TextColor getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package io.github.simplexdevelopment.msgutils;
|
||||
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
public enum BasicColors {
|
||||
RED(TextColor.color(255, 0, 0)),
|
||||
DARK_RED(TextColor.color(127, 0, 0)),
|
||||
ORANGE(TextColor.color(255, 165, 0)),
|
||||
DARK_ORANGE(TextColor.color(255, 140, 0)),
|
||||
YELLOW(TextColor.color(255, 255, 0)),
|
||||
GOLD(TextColor.color(255, 215, 0)),
|
||||
GREEN(TextColor.color(0, 255, 0)),
|
||||
DARK_GREEN(TextColor.color(0, 127, 0)),
|
||||
BLUE(TextColor.color(0, 0, 255)),
|
||||
DARK_BLUE(TextColor.color(0, 0, 127)),
|
||||
AQUA(TextColor.color(0, 255, 255)),
|
||||
DARK_AQUA(TextColor.color(0, 127, 127)),
|
||||
PURPLE(TextColor.color(255, 0, 255)),
|
||||
DARK_PURPLE(TextColor.color(127, 0, 127)),
|
||||
PINK(TextColor.color(255, 105, 180)),
|
||||
DARK_PINK(TextColor.color(231, 84, 128)),
|
||||
WHITE(TextColor.color(255, 255, 255)),
|
||||
BLACK(TextColor.color(0, 0, 0)),
|
||||
LIGHT_GRAY(TextColor.color(127, 127, 127)),
|
||||
DARK_GRAY(TextColor.color(65, 65, 65));
|
||||
|
||||
final TextColor color;
|
||||
|
||||
BasicColors(TextColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public TextColor getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package io.github.simplexdevelopment.msgutils;
|
||||
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.format.TextFormat;
|
||||
|
||||
public enum TextFormatting {
|
||||
BOLD(TextDecoration.BOLD),
|
||||
ITALICS(TextDecoration.ITALIC),
|
||||
UNDERLINED(TextDecoration.UNDERLINED),
|
||||
STRIKETHROUGH(TextDecoration.STRIKETHROUGH),
|
||||
MAGIC(TextDecoration.OBFUSCATED);
|
||||
|
||||
final TextDecoration format;
|
||||
|
||||
TextFormatting(TextDecoration format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public TextFormat getFormat() {
|
||||
return format;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user