Begin work on the Plex API

This commit is contained in:
2026-05-19 12:32:56 -04:00
parent 64c691bb58
commit 9fa8d82217
142 changed files with 1960 additions and 566 deletions
+23
View File
@@ -0,0 +1,23 @@
plugins {
java
`maven-publish`
}
dependencies {
compileOnly("io.papermc.paper:paper-api:26.1.2.build.+")
compileOnly("org.apache.logging.log4j:log4j-api:2.26.0")
compileOnly("org.jetbrains:annotations:26.1.0")
}
group = rootProject.group
version = rootProject.version
description = "Plex-API"
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
@@ -0,0 +1,12 @@
package dev.plex.api;
/**
* Describes the module API compatibility level provided by this Plex build.
*/
public interface ApiCompatibility
{
/**
* @return the provided module API compatibility version
*/
int version();
}
@@ -0,0 +1,55 @@
package dev.plex.api;
import dev.plex.api.command.CommandApi;
import dev.plex.api.config.ConfigurationApi;
import dev.plex.api.config.ModuleConfigApi;
import dev.plex.api.listener.ListenerApi;
import dev.plex.api.logging.LoggingApi;
import dev.plex.api.message.MessageApi;
import dev.plex.api.module.ModulesApi;
import dev.plex.api.player.PlayersApi;
import dev.plex.api.punishment.PunishmentsApi;
import dev.plex.api.scheduler.SchedulerApi;
import dev.plex.api.storage.StorageApi;
/**
* Public API facade exposed to Plex modules.
*
* <p>Keep this interface small and deliberate; adding a method here makes it
* part of the supported module API contract.</p>
*/
public interface PlexApi
{
/**
* @return module API compatibility information for this Plex build
*/
ApiCompatibility compatibility();
/**
* @return safe access to shared Plex configuration files
*/
ConfigurationApi configuration();
/**
* @return safe access to module metadata and module-related operations
*/
ModulesApi modules();
CommandApi commands();
ListenerApi listeners();
ModuleConfigApi moduleConfigs();
LoggingApi logging();
MessageApi messages();
PlayersApi players();
PunishmentsApi punishments();
SchedulerApi scheduler();
StorageApi storage();
}
@@ -0,0 +1,10 @@
package dev.plex.api.command;
import org.bukkit.command.Command;
public interface CommandApi
{
void register(Command command);
void unregister(Command command);
}
@@ -0,0 +1,15 @@
package dev.plex.api.config;
/**
* Public configuration access exposed to modules.
*/
public interface ConfigurationApi
{
PlexConfiguration mainConfig();
PlexConfiguration messages();
PlexConfiguration indefiniteBans();
PlexConfiguration toggles();
}
@@ -0,0 +1,8 @@
package dev.plex.api.config;
import dev.plex.module.PlexModule;
public interface ModuleConfigApi
{
ModuleConfiguration create(PlexModule module, String from, String to);
}
@@ -0,0 +1,9 @@
package dev.plex.api.config;
import org.bukkit.configuration.file.YamlConfiguration;
public abstract class ModuleConfiguration extends YamlConfiguration
{
public abstract void load();
public abstract void save();
}
@@ -0,0 +1,23 @@
package dev.plex.api.config;
import java.util.List;
/**
* Stable configuration wrapper exposed through the Plex module API.
*/
public interface PlexConfiguration
{
String getString(String path);
boolean getBoolean(String path);
int getInt(String path);
List<String> getStringList(String path);
void set(String path, Object value);
void setComments(String path, List<String> comments);
void save();
}
@@ -0,0 +1,10 @@
package dev.plex.api.listener;
import org.bukkit.event.Listener;
public interface ListenerApi
{
void register(Listener listener);
void unregister(Listener listener);
}
@@ -0,0 +1,9 @@
package dev.plex.api.logging;
public interface LoggingApi
{
void info(String message, Object... args);
void debug(String message, Object... args);
void warn(String message, Object... args);
void error(String message, Object... args);
}
@@ -0,0 +1,15 @@
package dev.plex.api.message;
import java.util.List;
import net.kyori.adventure.text.Component;
public interface MessageApi
{
Component messageComponent(String entry, Object... objects);
Component messageComponent(String entry, Component... objects);
String messageString(String entry, Object... objects);
Component miniMessage(String input);
void broadcast(String miniMessage);
void broadcast(Component component);
List<String> onlinePlayerNames();
}
@@ -0,0 +1,25 @@
package dev.plex.api.module;
import dev.plex.module.PlexModuleFile;
import java.util.Collection;
import java.util.Optional;
/**
* Public module metadata access exposed to modules.
*/
public interface ModulesApi
{
/**
* @return immutable metadata for all currently discovered modules
*/
Collection<PlexModuleFile> loadedModules();
/**
* Looks up a module by name.
*
* @param name module name from module.yml
* @return module metadata, if a module with this name is loaded
*/
Optional<PlexModuleFile> module(String name);
}
@@ -0,0 +1,12 @@
package dev.plex.api.player;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
public interface PlayersApi
{
Optional<? extends PlexPlayerView> byUuid(UUID uuid);
Optional<? extends PlexPlayerView> byName(String name);
List<String> onlineNames();
}
@@ -0,0 +1,18 @@
package dev.plex.api.player;
import java.util.List;
import java.util.UUID;
import dev.plex.api.punishment.PunishmentView;
import org.bukkit.entity.Player;
public interface PlexPlayerView
{
UUID uuid();
String name();
List<String> ips();
List<? extends PunishmentView> punishments();
boolean frozen();
boolean muted();
boolean lockedUp();
Player bukkitPlayer();
}
@@ -0,0 +1,12 @@
package dev.plex.api.punishment;
import java.util.List;
import java.util.UUID;
public interface IndefiniteBanView
{
List<String> usernames();
List<UUID> uuids();
List<String> ips();
String reason();
}
@@ -0,0 +1,10 @@
package dev.plex.api.punishment;
import java.time.ZonedDateTime;
import java.util.UUID;
public record PunishmentRequest(UUID punished, UUID punisher, String punisherName, String ip,
String punishedUsername, PunishmentType type, String reason,
boolean customTime, boolean active, ZonedDateTime endDate)
{
}
@@ -0,0 +1,11 @@
package dev.plex.api.punishment;
public enum PunishmentType
{
MUTE,
FREEZE,
BAN,
TEMPBAN,
KICK,
SMITE
}
@@ -0,0 +1,19 @@
package dev.plex.api.punishment;
import java.time.ZonedDateTime;
import java.util.UUID;
public interface PunishmentView
{
UUID punished();
UUID punisher();
String punisherName();
String ip();
String punishedUsername();
PunishmentType type();
String reason();
boolean customTime();
boolean active();
ZonedDateTime issueDate();
ZonedDateTime endDate();
}
@@ -0,0 +1,13 @@
package dev.plex.api.punishment;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import dev.plex.api.player.PlexPlayerView;
public interface PunishmentsApi
{
List<? extends IndefiniteBanView> indefiniteBans();
Optional<? extends IndefiniteBanView> indefiniteBanByUuid(UUID uuid);
void punish(PlexPlayerView player, PunishmentRequest punishment);
}
@@ -0,0 +1,8 @@
package dev.plex.api.scheduler;
public interface SchedulerApi
{
Object runSync(Runnable task);
Object runLater(Runnable task, long delayTicks);
Object runTimer(Runnable task, long delayTicks, long periodTicks);
}
@@ -0,0 +1,15 @@
package dev.plex.api.storage;
import java.sql.Connection;
import java.sql.SQLException;
public interface StorageApi
{
<T> T withConnection(SqlFunction<T> function) throws SQLException;
@FunctionalInterface
interface SqlFunction<T>
{
T apply(Connection connection) throws SQLException;
}
}
@@ -0,0 +1,262 @@
package dev.plex.command;
import java.util.ArrayList;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException;
import dev.plex.command.exception.ConsoleMustDefinePlayerException;
import dev.plex.command.exception.ConsoleOnlyException;
import dev.plex.command.exception.PlayerNotBannedException;
import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.command.source.RequiredCommandSource;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/** Public base class for module commands. */
public abstract class PlexCommand extends Command
{
private static Runtime runtime;
private final CommandParameters params;
private final CommandPermissions perms;
private final RequiredCommandSource commandSource;
public static void setRuntime(Runtime runtime)
{
PlexCommand.runtime = runtime;
}
public PlexCommand(boolean register)
{
super("");
this.params = getClass().getAnnotation(CommandParameters.class);
this.perms = getClass().getAnnotation(CommandPermissions.class);
if (params == null || perms == null)
{
throw new IllegalStateException("PlexCommand requires CommandParameters and CommandPermissions annotations");
}
setName(params.name());
setLabel(params.name());
setDescription(params.description());
setPermission(perms.permission());
setUsage(params.usage().replace("<command>", params.name()));
if (!params.aliases().isEmpty())
{
setAliases(Arrays.asList(params.aliases().split(",")));
}
this.commandSource = perms.source();
if (register)
{
requireRuntime().register(this);
}
}
public PlexCommand()
{
this(true);
}
protected abstract Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args);
@Override
public boolean execute(@NotNull CommandSender sender, @NotNull String label, String[] args)
{
if (!matches(label))
{
return false;
}
if (commandSource == RequiredCommandSource.CONSOLE && sender instanceof Player)
{
send(sender, messageComponent("noPermissionInGame"));
return true;
}
if (commandSource == RequiredCommandSource.IN_GAME && sender instanceof ConsoleCommandSender)
{
send(sender, messageComponent("noPermissionConsole"));
return true;
}
if (!perms.permission().isEmpty() && sender instanceof Player player && !player.hasPermission(perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
}
try
{
Component component = execute(sender, isConsole(sender) ? null : (Player)sender, args);
if (component != null)
{
send(sender, component);
}
}
catch (PlayerNotFoundException | CommandFailException | ConsoleOnlyException |
ConsoleMustDefinePlayerException | PlayerNotBannedException | NumberFormatException ex)
{
send(sender, mmString(ex.getMessage()));
}
return true;
}
@NotNull
public abstract List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException;
@NotNull
@Override
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return StringUtil.copyPartialMatches(args[args.length - 1], smartTabComplete(sender, alias, args), new ArrayList<>());
}
private boolean matches(String label)
{
return getName().equalsIgnoreCase(label) || getAliases().stream().anyMatch(alias -> alias.equalsIgnoreCase(label));
}
protected void send(Audience audience, String s)
{
audience.sendMessage(componentFromString(s));
}
protected void send(Audience audience, Component component)
{
audience.sendMessage(component);
}
protected boolean checkPermission(CommandSender sender, String permission)
{
return isConsole(sender) || checkPermission((Player)sender, permission);
}
protected boolean silentCheckPermission(CommandSender sender, String permission)
{
return isConsole(sender) || silentCheckPermission((Player)sender, permission);
}
protected boolean checkPermission(Player player, String permission)
{
if (!permission.isEmpty() && !player.hasPermission(permission))
{
throw new CommandFailException(messageString("noPermissionNode", permission));
}
return true;
}
protected boolean silentCheckPermission(Player player, String permission)
{
return permission.isEmpty() || player.hasPermission(permission);
}
protected UUID getUUID(CommandSender sender)
{
return sender instanceof Player player ? player.getUniqueId() : null;
}
protected boolean isConsole(CommandSender sender)
{
return !(sender instanceof Player);
}
protected Component messageComponent(String s, Object... objects)
{
return requireRuntime().messageComponent(s, objects);
}
protected Component messageComponent(String s, Component... objects)
{
return requireRuntime().messageComponent(s, objects);
}
protected String messageString(String s, Object... objects)
{
return requireRuntime().messageString(s, objects);
}
protected Component usage()
{
return Component.text("Correct Usage: ").color(NamedTextColor.YELLOW).append(componentFromString(getUsage()).color(NamedTextColor.GRAY));
}
protected Component usage(String s)
{
return Component.text("Correct Usage: ").color(NamedTextColor.YELLOW).append(componentFromString(s).color(NamedTextColor.GRAY));
}
protected Player getNonNullPlayer(String name)
{
Player player;
try
{
player = Bukkit.getPlayer(UUID.fromString(name));
}
catch (IllegalArgumentException ignored)
{
player = Bukkit.getPlayer(name);
}
if (player == null)
{
throw new PlayerNotFoundException();
}
return player;
}
protected World getNonNullWorld(String name)
{
World world = Bukkit.getWorld(name);
if (world == null)
{
throw new CommandFailException(messageString("worldNotFound"));
}
return world;
}
protected Component componentFromString(String s)
{
return LegacyComponentSerializer.legacyAmpersand().deserialize(s).colorIfAbsent(NamedTextColor.GRAY);
}
protected Component noColorComponentFromString(String s)
{
return LegacyComponentSerializer.legacyAmpersand().deserialize(s);
}
protected Component mmString(String s)
{
return requireRuntime().miniMessage(s);
}
public CommandMap getMap()
{
return Bukkit.getCommandMap();
}
private static Runtime requireRuntime()
{
if (runtime == null)
{
throw new IllegalStateException("PlexCommand runtime has not been installed by Plex");
}
return runtime;
}
public interface Runtime
{
void register(Command command);
Component messageComponent(String entry, Object... objects);
Component messageComponent(String entry, Component... objects);
String messageString(String entry, Object... objects);
Component miniMessage(String input);
}
}
@@ -0,0 +1,13 @@
package dev.plex.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandParameters
{
String name();
String description() default "";
String usage() default "/<command>";
String aliases() default "";
}
@@ -0,0 +1,12 @@
package dev.plex.command.annotation;
import dev.plex.command.source.RequiredCommandSource;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandPermissions
{
String permission() default "";
RequiredCommandSource source() default RequiredCommandSource.ANY;
}
@@ -0,0 +1,14 @@
package dev.plex.command.exception;
public class CommandFailException extends RuntimeException
{
public CommandFailException()
{
super("CommandFailException");
}
public CommandFailException(String message)
{
super(message);
}
}
@@ -1,11 +1,14 @@
package dev.plex.command.exception; package dev.plex.command.exception;
import static dev.plex.util.PlexUtils.messageString;
public class ConsoleMustDefinePlayerException extends RuntimeException public class ConsoleMustDefinePlayerException extends RuntimeException
{ {
public ConsoleMustDefinePlayerException() public ConsoleMustDefinePlayerException()
{ {
super(messageString("consoleMustDefinePlayer")); super("ConsoleMustDefinePlayerException");
} }
}
public ConsoleMustDefinePlayerException(String message)
{
super(message);
}
}
@@ -1,11 +1,14 @@
package dev.plex.command.exception; package dev.plex.command.exception;
import static dev.plex.util.PlexUtils.messageString;
public class ConsoleOnlyException extends RuntimeException public class ConsoleOnlyException extends RuntimeException
{ {
public ConsoleOnlyException() public ConsoleOnlyException()
{ {
super(messageString("consoleOnly")); super("ConsoleOnlyException");
} }
}
public ConsoleOnlyException(String message)
{
super(message);
}
}
@@ -1,11 +1,14 @@
package dev.plex.command.exception; package dev.plex.command.exception;
import static dev.plex.util.PlexUtils.messageString;
public class PlayerNotBannedException extends RuntimeException public class PlayerNotBannedException extends RuntimeException
{ {
public PlayerNotBannedException() public PlayerNotBannedException()
{ {
super(messageString("playerNotBanned")); super("PlayerNotBannedException");
} }
}
public PlayerNotBannedException(String message)
{
super(message);
}
}
@@ -1,11 +1,14 @@
package dev.plex.command.exception; package dev.plex.command.exception;
import static dev.plex.util.PlexUtils.messageString;
public class PlayerNotFoundException extends RuntimeException public class PlayerNotFoundException extends RuntimeException
{ {
public PlayerNotFoundException() public PlayerNotFoundException()
{ {
super(messageString("playerNotFound")); super("PlayerNotFoundException");
} }
}
public PlayerNotFoundException(String message)
{
super(message);
}
}
@@ -2,7 +2,7 @@ package dev.plex.command.source;
public enum RequiredCommandSource public enum RequiredCommandSource
{ {
ANY,
IN_GAME, IN_GAME,
CONSOLE, CONSOLE
ANY }
}
@@ -0,0 +1,87 @@
package dev.plex.config;
import dev.plex.api.config.ModuleConfiguration;
import dev.plex.module.PlexModule;
/**
* Public module config entry point. The platform installs a factory at runtime.
*/
public class ModuleConfig extends ModuleConfiguration
{
private static Factory factory;
private final ModuleConfiguration delegate;
public static void setFactory(Factory factory)
{
ModuleConfig.factory = factory;
}
public ModuleConfig(PlexModule module, String from, String to)
{
if (factory == null)
{
throw new IllegalStateException("ModuleConfig factory has not been installed by Plex");
}
this.delegate = factory.create(module, from, to);
}
@Override
public void load()
{
delegate.load();
}
@Override
public void save()
{
delegate.save();
}
@Override
public Object get(String path)
{
return delegate.get(path);
}
@Override
public String getString(String path)
{
return delegate.getString(path);
}
@Override
public String getString(String path, String def)
{
return delegate.getString(path, def);
}
@Override
public int getInt(String path)
{
return delegate.getInt(path);
}
@Override
public int getInt(String path, int def)
{
return delegate.getInt(path, def);
}
@Override
public boolean getBoolean(String path)
{
return delegate.getBoolean(path);
}
@Override
public void set(String path, Object value)
{
delegate.set(path, value);
}
@FunctionalInterface
public interface Factory
{
ModuleConfiguration create(PlexModule module, String from, String to);
}
}
@@ -0,0 +1,10 @@
package dev.plex.listener;
import org.bukkit.event.Listener;
public abstract class PlexListener implements Listener
{
protected PlexListener()
{
}
}
@@ -0,0 +1,172 @@
package dev.plex.module;
import dev.plex.api.PlexApi;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.apache.logging.log4j.Logger;
import org.bukkit.command.Command;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Base class for Plex modules.
*
* <p>This class is part of the public module API. Modules use {@link #api()} for
* supported integration points.</p>
*/
public abstract class PlexModule
{
private final List<Command> commands = new ArrayList<>();
private final List<Listener> listeners = new ArrayList<>();
private PlexApi api;
private PlexModuleFile plexModuleFile;
private File dataFolder;
private Logger logger;
public PlexApi api()
{
return api;
}
public void load()
{
}
public void enable()
{
}
public void disable()
{
}
public void registerListener(Listener listener)
{
listeners.add(listener);
}
public void unregisterListener(Listener listener)
{
listeners.remove(listener);
HandlerList.unregisterAll(listener);
}
public void registerCommand(Command command)
{
commands.add(command);
}
public void unregisterCommand(Command command)
{
commands.remove(command);
}
@Nullable
public Command getCommand(String name)
{
return commands.stream()
.filter(command -> command.getName().equalsIgnoreCase(name) || command.getAliases().stream().map(String::toLowerCase).toList().contains(name.toLowerCase(Locale.ROOT)))
.findFirst()
.orElse(null);
}
public void addDefaultMessage(String message, Object initValue)
{
if (api.configuration().messages().getString(message) == null)
{
api.configuration().messages().set(message, initValue);
api.configuration().messages().save();
logger.debug("'{}' message added from {}", message, plexModuleFile.getName());
}
}
public void addDefaultMessage(String message, Object initValue, String... comments)
{
if (api.configuration().messages().getString(message) == null)
{
api.configuration().messages().set(message, initValue);
api.configuration().messages().save();
api.configuration().messages().setComments(message, Arrays.asList(comments));
api.configuration().messages().save();
logger.debug("'{}' message added from {}", message, plexModuleFile.getName());
}
}
@Nullable
public InputStream getResource(@NotNull String filename)
{
try
{
URL url = this.getClass().getClassLoader().getResource(filename);
if (url == null)
{
return null;
}
URLConnection connection = url.openConnection();
connection.setUseCaches(false);
return connection.getInputStream();
}
catch (IOException ex)
{
return null;
}
}
public List<Command> getCommands()
{
return commands;
}
public List<Listener> getListeners()
{
return listeners;
}
public PlexModuleFile getPlexModuleFile()
{
return plexModuleFile;
}
public File getDataFolder()
{
return dataFolder;
}
public Logger getLogger()
{
return logger;
}
public void setApi(PlexApi api)
{
this.api = api;
}
public void setPlexModuleFile(PlexModuleFile plexModuleFile)
{
this.plexModuleFile = plexModuleFile;
}
public void setDataFolder(File dataFolder)
{
this.dataFolder = dataFolder;
}
public void setLogger(Logger logger)
{
this.logger = logger;
}
}
@@ -0,0 +1,60 @@
package dev.plex.module;
import java.util.List;
/**
* Metadata read from a module's module.yml file.
*/
public final class PlexModuleFile
{
private final String name;
private final String main;
private final String description;
private final String version;
private final int apiCompatibility;
private List<String> libraries = List.of();
public PlexModuleFile(String name, String main, String description, String version, int apiCompatibility)
{
this.name = name;
this.main = main;
this.description = description;
this.version = version;
this.apiCompatibility = apiCompatibility;
}
public String getName()
{
return name;
}
public String getMain()
{
return main;
}
public String getDescription()
{
return description;
}
public String getVersion()
{
return version;
}
public int getApiCompatibility()
{
return apiCompatibility;
}
public List<String> getLibraries()
{
return libraries;
}
public void setLibraries(List<String> libraries)
{
this.libraries = List.copyOf(libraries);
}
}
+1
View File
@@ -47,6 +47,7 @@ publishing {
} }
dependencies { dependencies {
implementation(project(":api"))
compileOnly("org.projectlombok:lombok:1.18.46") compileOnly("org.projectlombok:lombok:1.18.46")
annotationProcessor("org.projectlombok:lombok:1.18.46") annotationProcessor("org.projectlombok:lombok:1.18.46")
compileOnly("org.json:json:20251224") compileOnly("org.json:json:20251224")
+5
View File
@@ -6,6 +6,8 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Plugin; import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import dev.plex.api.PlexApi;
import dev.plex.api.impl.DefaultPlexApi;
import dev.plex.config.TomlConfig; import dev.plex.config.TomlConfig;
import dev.plex.handlers.ListenerHandler; import dev.plex.handlers.ListenerHandler;
import dev.plex.settings.ServerSettings; import dev.plex.settings.ServerSettings;
@@ -35,6 +37,7 @@ import lombok.Getter;
@Getter @Getter
public class Plex public class Plex
{ {
public static final int MODULE_API_COMPATIBILITY_VERSION = 1;
private static Plex plugin; private static Plex plugin;
public final ProxyServer server; public final ProxyServer server;
@@ -42,6 +45,7 @@ public class Plex
private final File dataFolder; private final File dataFolder;
private TomlConfig config; private TomlConfig config;
private PlexApi api;
@Inject @Inject
public Plex(ProxyServer server, Logger logger, @DataDirectory Path folder) public Plex(ProxyServer server, Logger logger, @DataDirectory Path folder)
@@ -71,6 +75,7 @@ public class Plex
}); });
this.config.create(true); this.config.create(true);
this.config.write(new ServerSettings()); this.config.write(new ServerSettings());
this.api = new DefaultPlexApi(this, MODULE_API_COMPATIBILITY_VERSION);
new ListenerHandler(); new ListenerHandler();
} }
@@ -0,0 +1,19 @@
package dev.plex.api.impl;
import dev.plex.api.ApiCompatibility;
final class DefaultApiCompatibility implements ApiCompatibility
{
private final int version;
DefaultApiCompatibility(int version)
{
this.version = version;
}
@Override
public int version()
{
return version;
}
}
@@ -0,0 +1,39 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.config.ConfigurationApi;
import dev.plex.api.config.PlexConfiguration;
final class DefaultConfigurationApi implements ConfigurationApi
{
private final Plex plugin;
DefaultConfigurationApi(Plex plugin)
{
this.plugin = plugin;
}
@Override
public PlexConfiguration mainConfig()
{
return new DefaultPlexConfiguration(plugin.getConfig());
}
@Override
public PlexConfiguration messages()
{
throw new UnsupportedOperationException("Proxy does not provide messages configuration");
}
@Override
public PlexConfiguration indefiniteBans()
{
throw new UnsupportedOperationException("Proxy does not provide indefinite bans configuration");
}
@Override
public PlexConfiguration toggles()
{
throw new UnsupportedOperationException("Proxy does not provide toggles configuration");
}
}
@@ -0,0 +1,23 @@
package dev.plex.api.impl;
import dev.plex.api.module.ModulesApi;
import dev.plex.module.PlexModuleFile;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
final class DefaultModulesApi implements ModulesApi
{
@Override
public Collection<PlexModuleFile> loadedModules()
{
return List.of();
}
@Override
public Optional<PlexModuleFile> module(String name)
{
return Optional.empty();
}
}
@@ -0,0 +1,48 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.ApiCompatibility;
import dev.plex.api.PlexApi;
import dev.plex.api.command.CommandApi;
import dev.plex.api.config.ConfigurationApi;
import dev.plex.api.config.ModuleConfigApi;
import dev.plex.api.listener.ListenerApi;
import dev.plex.api.logging.LoggingApi;
import dev.plex.api.message.MessageApi;
import dev.plex.api.module.ModulesApi;
import dev.plex.api.player.PlayersApi;
import dev.plex.api.punishment.PunishmentsApi;
import dev.plex.api.scheduler.SchedulerApi;
import dev.plex.api.storage.StorageApi;
public final class DefaultPlexApi implements PlexApi
{
private final ApiCompatibility compatibility;
private final ConfigurationApi configuration;
private final ModulesApi modules;
public DefaultPlexApi(Plex plugin, int apiCompatibilityVersion)
{
this.compatibility = new DefaultApiCompatibility(apiCompatibilityVersion);
this.configuration = new DefaultConfigurationApi(plugin);
this.modules = new DefaultModulesApi();
}
@Override public ApiCompatibility compatibility() { return compatibility; }
@Override public ConfigurationApi configuration() { return configuration; }
@Override public ModulesApi modules() { return modules; }
@Override public CommandApi commands() { throw unsupported(); }
@Override public ListenerApi listeners() { throw unsupported(); }
@Override public ModuleConfigApi moduleConfigs() { throw unsupported(); }
@Override public LoggingApi logging() { throw unsupported(); }
@Override public MessageApi messages() { throw unsupported(); }
@Override public PlayersApi players() { throw unsupported(); }
@Override public PunishmentsApi punishments() { throw unsupported(); }
@Override public SchedulerApi scheduler() { throw unsupported(); }
@Override public StorageApi storage() { throw unsupported(); }
private static UnsupportedOperationException unsupported()
{
return new UnsupportedOperationException("This Plex API service is only available on the server platform");
}
}
@@ -0,0 +1,59 @@
package dev.plex.api.impl;
import dev.plex.api.config.PlexConfiguration;
import dev.plex.config.TomlConfig;
import java.util.List;
final class DefaultPlexConfiguration implements PlexConfiguration
{
private final TomlConfig config;
DefaultPlexConfiguration(TomlConfig config)
{
this.config = config;
}
@Override
public String getString(String path)
{
return config.getToml().getString(path);
}
@Override
public boolean getBoolean(String path)
{
return config.getToml().getBoolean(path, false);
}
@Override
public int getInt(String path)
{
Long value = config.getToml().getLong(path, 0L);
return value.intValue();
}
@Override
public List<String> getStringList(String path)
{
return config.getToml().getList(path, List.of());
}
@Override
public void set(String path, Object value)
{
throw new UnsupportedOperationException("Proxy TOML configuration writes are not supported through PlexConfiguration");
}
@Override
public void setComments(String path, List<String> comments)
{
throw new UnsupportedOperationException("Proxy TOML configuration comments are not supported through PlexConfiguration");
}
@Override
public void save()
{
throw new UnsupportedOperationException("Proxy TOML configuration saves are not supported through PlexConfiguration");
}
}
@@ -9,13 +9,12 @@ import dev.plex.Plex;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
import java.util.Arrays;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
public abstract class PlexCommand implements SimpleCommand public abstract class ProxyCommand implements SimpleCommand
{ {
/** /**
* Returns the instance of the plugin * Returns the instance of the plugin
@@ -36,14 +35,17 @@ public abstract class PlexCommand implements SimpleCommand
*/ */
private final RequiredCommandSource commandSource; private final RequiredCommandSource commandSource;
public PlexCommand() public ProxyCommand()
{ {
this.params = getClass().getAnnotation(CommandParameters.class); this.params = getClass().getAnnotation(CommandParameters.class);
this.perms = getClass().getAnnotation(CommandPermissions.class); this.perms = getClass().getAnnotation(CommandPermissions.class);
this.commandSource = this.perms.source(); this.commandSource = this.perms.source();
CommandMeta.Builder meta = plugin.getServer().getCommandManager().metaBuilder(this.params.name()); CommandMeta.Builder meta = plugin.getServer().getCommandManager().metaBuilder(this.params.name());
meta.aliases(this.params.aliases()); if (!this.params.aliases().isEmpty())
{
meta.aliases(this.params.aliases().split(","));
}
meta.plugin(Plex.get()); meta.plugin(Plex.get());
plugin.getServer().getCommandManager().register(meta.build(), this); plugin.getServer().getCommandManager().register(meta.build(), this);
} }
@@ -92,7 +94,7 @@ public abstract class PlexCommand implements SimpleCommand
{ {
return true; return true;
} }
return Arrays.stream(params.aliases()).anyMatch(s -> s.equalsIgnoreCase(label)); return !params.aliases().isEmpty() && java.util.Arrays.stream(params.aliases().split(",")).anyMatch(s -> s.equalsIgnoreCase(label));
} }
protected void send(Audience audience, Component component) protected void send(Audience audience, Component component)
@@ -1,39 +0,0 @@
package dev.plex.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Storage for a command's parameters
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandParameters
{
/**
* The name
*
* @return Name of the command
*/
String name();
/**
* The description
*
* @return Description of the command
*/
String description() default "";
/**
* The usage (optional)
*
* @return The usage of the command
*/
String usage() default "/<command>";
/**
* The aliases (optional)
*
* @return The aliases of the command
*/
String[] aliases() default {};
}
@@ -1,27 +0,0 @@
package dev.plex.command.annotation;
import dev.plex.command.source.RequiredCommandSource;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Storage for the command's permissions
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandPermissions
{
/**
* Required command source
*
* @return The required command source of the command
* @see RequiredCommandSource
*/
RequiredCommandSource source() default RequiredCommandSource.ANY;
/**
* The permission
*
* @return Permission of the command
*/
String permission() default ""; // No idea what to put here
}
@@ -1,8 +0,0 @@
package dev.plex.command.source;
public enum RequiredCommandSource
{
IN_GAME,
CONSOLE,
ANY
}
@@ -1,7 +1,7 @@
package dev.plex.handlers; package dev.plex.handlers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.plex.listener.PlexListener; import dev.plex.listener.ProxyListener;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import dev.plex.util.ReflectionsUtil; import dev.plex.util.ReflectionsUtil;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@@ -12,8 +12,8 @@ public class ListenerHandler
{ {
public ListenerHandler() public ListenerHandler()
{ {
Set<Class<? extends PlexListener>> listenerSet = ReflectionsUtil.getClassesBySubType("dev.plex.listener.impl", PlexListener.class); Set<Class<? extends ProxyListener>> listenerSet = ReflectionsUtil.getClassesBySubType("dev.plex.listener.impl", ProxyListener.class);
List<PlexListener> listeners = Lists.newArrayList(); List<ProxyListener> listeners = Lists.newArrayList();
listenerSet.forEach(clazz -> listenerSet.forEach(clazz ->
{ {
@@ -2,11 +2,11 @@ package dev.plex.listener;
import dev.plex.Plex; import dev.plex.Plex;
public class PlexListener public class ProxyListener
{ {
protected final Plex plugin = Plex.get(); protected final Plex plugin = Plex.get();
public PlexListener() public ProxyListener()
{ {
Plex.get().getServer().getEventManager().register(Plex.get(), this); Plex.get().getServer().getEventManager().register(Plex.get(), this);
} }
@@ -5,11 +5,11 @@ import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.player.ServerConnectedEvent; import com.velocitypowered.api.event.player.ServerConnectedEvent;
import dev.plex.Plex; import dev.plex.Plex;
import dev.plex.listener.PlexListener; import dev.plex.listener.ProxyListener;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
public class ConnectionListener extends PlexListener public class ConnectionListener extends ProxyListener
{ {
@Subscribe(order = PostOrder.FIRST) @Subscribe(order = PostOrder.FIRST)
public void onPlayerJoin(ServerConnectedEvent event) public void onPlayerJoin(ServerConnectedEvent event)
@@ -4,7 +4,7 @@ import com.velocitypowered.api.event.PostOrder;
import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyPingEvent; import com.velocitypowered.api.event.proxy.ProxyPingEvent;
import com.velocitypowered.api.proxy.server.ServerPing; import com.velocitypowered.api.proxy.server.ServerPing;
import dev.plex.listener.PlexListener; import dev.plex.listener.ProxyListener;
import dev.plex.settings.ServerSettings; import dev.plex.settings.ServerSettings;
import dev.plex.util.RandomUtil; import dev.plex.util.RandomUtil;
import java.util.UUID; import java.util.UUID;
@@ -15,7 +15,7 @@ import java.util.regex.Pattern;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
public class ServerListener extends PlexListener public class ServerListener extends ProxyListener
{ {
@Subscribe(order = PostOrder.FIRST) @Subscribe(order = PostOrder.FIRST)
public void onPing(ProxyPingEvent event) public void onPing(ProxyPingEvent event)
+1
View File
@@ -19,6 +19,7 @@ repositories {
} }
dependencies { dependencies {
implementation(project(":api"))
library("org.projectlombok:lombok:1.18.46") library("org.projectlombok:lombok:1.18.46")
library("commons-io:commons-io:2.22.0") library("commons-io:commons-io:2.22.0")
library("redis.clients:jedis:7.5.0") library("redis.clients:jedis:7.5.0")
+60
View File
@@ -1,7 +1,12 @@
package dev.plex; package dev.plex;
import dev.plex.api.PlexApi;
import dev.plex.api.impl.DefaultPlexApi;
import dev.plex.cache.PlayerCache; import dev.plex.cache.PlayerCache;
import dev.plex.command.PlexCommand;
import dev.plex.command.ServerCommand;
import dev.plex.config.Config; import dev.plex.config.Config;
import dev.plex.config.ModuleConfig;
import dev.plex.handlers.CommandHandler; import dev.plex.handlers.CommandHandler;
import dev.plex.handlers.ListenerHandler; import dev.plex.handlers.ListenerHandler;
import dev.plex.hook.CoreProtectHook; import dev.plex.hook.CoreProtectHook;
@@ -45,6 +50,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public class Plex extends JavaPlugin public class Plex extends JavaPlugin
{ {
public static final BuildInfo build = new BuildInfo(); public static final BuildInfo build = new BuildInfo();
public static final int MODULE_API_COMPATIBILITY_VERSION = 1;
private static Plex plugin; private static Plex plugin;
public Config config; public Config config;
public Config messages; public Config messages;
@@ -66,6 +72,7 @@ public class Plex extends JavaPlugin
private ServiceManager serviceManager; private ServiceManager serviceManager;
private PunishmentManager punishmentManager; private PunishmentManager punishmentManager;
private UpdateChecker updateChecker; private UpdateChecker updateChecker;
private PlexApi api;
private Permission permissions; private Permission permissions;
private Chat chat; private Chat chat;
@@ -88,6 +95,8 @@ public class Plex extends JavaPlugin
indefBans = new Config(this, "indefbans.yml"); indefBans = new Config(this, "indefbans.yml");
toggles = new Config(this, "toggles.yml"); toggles = new Config(this, "toggles.yml");
build.load(this); build.load(this);
api = new DefaultPlexApi(this, MODULE_API_COMPATIBILITY_VERSION);
installModuleApiRuntimes();
modulesFolder = new File(this.getDataFolder() + File.separator + "modules"); modulesFolder = new File(this.getDataFolder() + File.separator + "modules");
if (!modulesFolder.exists()) if (!modulesFolder.exists())
@@ -102,6 +111,57 @@ public class Plex extends JavaPlugin
//this.setChatHandler(new ChatListener.ChatHandlerImpl()); //this.setChatHandler(new ChatListener.ChatHandlerImpl());
} }
private void installModuleApiRuntimes()
{
ServerCommand.setRuntime(new ServerCommand.Runtime()
{
@Override
public Plex plugin()
{
return Plex.this;
}
@Override
public void register(org.bukkit.command.Command command)
{
api.commands().register(command);
}
});
PlexCommand.setRuntime(new PlexCommand.Runtime()
{
@Override
public void register(org.bukkit.command.Command command)
{
api.commands().register(command);
}
@Override
public net.kyori.adventure.text.Component messageComponent(String entry, Object... objects)
{
return api.messages().messageComponent(entry, objects);
}
@Override
public net.kyori.adventure.text.Component messageComponent(String entry, net.kyori.adventure.text.Component... objects)
{
return api.messages().messageComponent(entry, objects);
}
@Override
public String messageString(String entry, Object... objects)
{
return api.messages().messageString(entry, objects);
}
@Override
public net.kyori.adventure.text.Component miniMessage(String input)
{
return api.messages().miniMessage(input);
}
});
ModuleConfig.setFactory((module, from, to) -> api.moduleConfigs().create(module, from, to));
}
@Override @Override
public void onEnable() public void onEnable()
{ {
@@ -0,0 +1,19 @@
package dev.plex.api.impl;
import dev.plex.api.ApiCompatibility;
final class DefaultApiCompatibility implements ApiCompatibility
{
private final int version;
DefaultApiCompatibility(int version)
{
this.version = version;
}
@Override
public int version()
{
return version;
}
}
@@ -0,0 +1,28 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.command.CommandApi;
import org.bukkit.command.Command;
final class DefaultCommandApi implements CommandApi
{
private final Plex plugin;
DefaultCommandApi(Plex plugin) { this.plugin = plugin; }
@Override
public void register(Command command)
{
plugin.getServer().getCommandMap().getKnownCommands().remove(command.getName().toLowerCase());
command.getAliases().forEach(alias -> plugin.getServer().getCommandMap().getKnownCommands().remove(alias.toLowerCase()));
plugin.getServer().getCommandMap().register("plex", command);
}
@Override
public void unregister(Command command)
{
plugin.getServer().getCommandMap().getKnownCommands().remove(command.getName());
command.getAliases().forEach(alias -> plugin.getServer().getCommandMap().getKnownCommands().remove(alias));
command.unregister(plugin.getServer().getCommandMap());
}
}
@@ -0,0 +1,39 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.config.ConfigurationApi;
import dev.plex.api.config.PlexConfiguration;
final class DefaultConfigurationApi implements ConfigurationApi
{
private final Plex plugin;
DefaultConfigurationApi(Plex plugin)
{
this.plugin = plugin;
}
@Override
public PlexConfiguration mainConfig()
{
return new DefaultPlexConfiguration(plugin.config);
}
@Override
public PlexConfiguration messages()
{
return new DefaultPlexConfiguration(plugin.messages);
}
@Override
public PlexConfiguration indefiniteBans()
{
return new DefaultPlexConfiguration(plugin.indefBans);
}
@Override
public PlexConfiguration toggles()
{
return new DefaultPlexConfiguration(plugin.toggles);
}
}
@@ -0,0 +1,14 @@
package dev.plex.api.impl;
import dev.plex.api.punishment.IndefiniteBanView;
import dev.plex.punishment.PunishmentManager;
import java.util.List;
import java.util.UUID;
record DefaultIndefiniteBanView(PunishmentManager.IndefiniteBan ban) implements IndefiniteBanView
{
@Override public List<String> usernames() { return List.copyOf(ban.getUsernames()); }
@Override public List<UUID> uuids() { return List.copyOf(ban.getUuids()); }
@Override public List<String> ips() { return List.copyOf(ban.getIps()); }
@Override public String reason() { return ban.getReason(); }
}
@@ -0,0 +1,19 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.listener.ListenerApi;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
final class DefaultListenerApi implements ListenerApi
{
private final Plex plugin;
DefaultListenerApi(Plex plugin) { this.plugin = plugin; }
@Override
public void register(Listener listener) { plugin.getServer().getPluginManager().registerEvents(listener, plugin); }
@Override
public void unregister(Listener listener) { HandlerList.unregisterAll(listener); }
}
@@ -0,0 +1,12 @@
package dev.plex.api.impl;
import dev.plex.api.logging.LoggingApi;
import dev.plex.util.PlexLog;
final class DefaultLoggingApi implements LoggingApi
{
@Override public void info(String message, Object... args) { PlexLog.log(message, args); }
@Override public void debug(String message, Object... args) { PlexLog.debug(message, args); }
@Override public void warn(String message, Object... args) { PlexLog.warn(message, args); }
@Override public void error(String message, Object... args) { PlexLog.error(message, args); }
}
@@ -0,0 +1,17 @@
package dev.plex.api.impl;
import dev.plex.api.message.MessageApi;
import dev.plex.util.PlexUtils;
import java.util.List;
import net.kyori.adventure.text.Component;
final class DefaultMessageApi implements MessageApi
{
@Override public Component messageComponent(String entry, Object... objects) { return PlexUtils.messageComponent(entry, objects); }
@Override public Component messageComponent(String entry, Component... objects) { return PlexUtils.messageComponent(entry, objects); }
@Override public String messageString(String entry, Object... objects) { return PlexUtils.messageString(entry, objects); }
@Override public Component miniMessage(String input) { return PlexUtils.mmDeserialize(input); }
@Override public void broadcast(String miniMessage) { PlexUtils.broadcast(miniMessage); }
@Override public void broadcast(Component component) { PlexUtils.broadcast(component); }
@Override public List<String> onlinePlayerNames() { return PlexUtils.getPlayerNameList(); }
}
@@ -0,0 +1,14 @@
package dev.plex.api.impl;
import dev.plex.api.config.ModuleConfigApi;
import dev.plex.api.config.ModuleConfiguration;
import dev.plex.module.PlexModule;
final class DefaultModuleConfigApi implements ModuleConfigApi
{
@Override
public ModuleConfiguration create(PlexModule module, String from, String to)
{
return new ServerModuleConfiguration(module, from, to);
}
}
@@ -0,0 +1,36 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.module.ModulesApi;
import dev.plex.module.PlexModuleFile;
import java.util.Collection;
import java.util.Locale;
import java.util.Optional;
final class DefaultModulesApi implements ModulesApi
{
private final Plex plugin;
DefaultModulesApi(Plex plugin)
{
this.plugin = plugin;
}
@Override
public Collection<PlexModuleFile> loadedModules()
{
return plugin.getModuleManager().getModules().stream()
.map(module -> module.getPlexModuleFile())
.toList();
}
@Override
public Optional<PlexModuleFile> module(String name)
{
String normalizedName = name.toLowerCase(Locale.ROOT);
return loadedModules().stream()
.filter(module -> module.getName().toLowerCase(Locale.ROOT).equals(normalizedName))
.findFirst();
}
}
@@ -0,0 +1,27 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.player.PlayersApi;
import dev.plex.api.player.PlexPlayerView;
import dev.plex.player.PlexPlayer;
import dev.plex.util.PlexUtils;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
final class DefaultPlayersApi implements PlayersApi
{
private final Plex plugin;
DefaultPlayersApi(Plex plugin) { this.plugin = plugin; }
@Override public Optional<? extends PlexPlayerView> byUuid(UUID uuid) { return Optional.ofNullable(plugin.getPlayerService().getPlayer(uuid)).map(DefaultPlexPlayerView::new); }
@Override public Optional<? extends PlexPlayerView> byName(String name) { return Optional.ofNullable(plugin.getPlayerService().getPlayer(name)).map(DefaultPlexPlayerView::new); }
@Override public List<String> onlineNames() { return PlexUtils.getPlayerNameList(); }
static PlexPlayer unwrap(PlexPlayerView view)
{
if (view instanceof DefaultPlexPlayerView wrapped) return wrapped.player();
return null;
}
}
@@ -0,0 +1,61 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.ApiCompatibility;
import dev.plex.api.PlexApi;
import dev.plex.api.command.CommandApi;
import dev.plex.api.config.ConfigurationApi;
import dev.plex.api.config.ModuleConfigApi;
import dev.plex.api.listener.ListenerApi;
import dev.plex.api.logging.LoggingApi;
import dev.plex.api.message.MessageApi;
import dev.plex.api.module.ModulesApi;
import dev.plex.api.player.PlayersApi;
import dev.plex.api.punishment.PunishmentsApi;
import dev.plex.api.scheduler.SchedulerApi;
import dev.plex.api.storage.StorageApi;
public final class DefaultPlexApi implements PlexApi
{
private final ApiCompatibility compatibility;
private final ConfigurationApi configuration;
private final ModulesApi modules;
private final CommandApi commands;
private final ListenerApi listeners;
private final ModuleConfigApi moduleConfigs;
private final LoggingApi logging;
private final MessageApi messages;
private final PlayersApi players;
private final PunishmentsApi punishments;
private final SchedulerApi scheduler;
private final StorageApi storage;
public DefaultPlexApi(Plex plugin, int apiCompatibilityVersion)
{
this.compatibility = new DefaultApiCompatibility(apiCompatibilityVersion);
this.configuration = new DefaultConfigurationApi(plugin);
this.modules = new DefaultModulesApi(plugin);
this.commands = new DefaultCommandApi(plugin);
this.listeners = new DefaultListenerApi(plugin);
this.moduleConfigs = new DefaultModuleConfigApi();
this.logging = new DefaultLoggingApi();
this.messages = new DefaultMessageApi();
this.players = new DefaultPlayersApi(plugin);
this.punishments = new DefaultPunishmentsApi(plugin);
this.scheduler = new DefaultSchedulerApi(plugin);
this.storage = new DefaultStorageApi(plugin);
}
@Override public ApiCompatibility compatibility() { return compatibility; }
@Override public ConfigurationApi configuration() { return configuration; }
@Override public ModulesApi modules() { return modules; }
@Override public CommandApi commands() { return commands; }
@Override public ListenerApi listeners() { return listeners; }
@Override public ModuleConfigApi moduleConfigs() { return moduleConfigs; }
@Override public LoggingApi logging() { return logging; }
@Override public MessageApi messages() { return messages; }
@Override public PlayersApi players() { return players; }
@Override public PunishmentsApi punishments() { return punishments; }
@Override public SchedulerApi scheduler() { return scheduler; }
@Override public StorageApi storage() { return storage; }
}
@@ -0,0 +1,58 @@
package dev.plex.api.impl;
import dev.plex.api.config.PlexConfiguration;
import dev.plex.config.Config;
import java.util.List;
final class DefaultPlexConfiguration implements PlexConfiguration
{
private final Config config;
DefaultPlexConfiguration(Config config)
{
this.config = config;
}
@Override
public String getString(String path)
{
return config.getString(path);
}
@Override
public boolean getBoolean(String path)
{
return config.getBoolean(path);
}
@Override
public int getInt(String path)
{
return config.getInt(path);
}
@Override
public List<String> getStringList(String path)
{
return config.getStringList(path);
}
@Override
public void set(String path, Object value)
{
config.set(path, value);
}
@Override
public void setComments(String path, List<String> comments)
{
config.setComments(path, comments);
}
@Override
public void save()
{
config.save();
}
}
@@ -0,0 +1,20 @@
package dev.plex.api.impl;
import dev.plex.api.player.PlexPlayerView;
import dev.plex.api.punishment.PunishmentView;
import dev.plex.player.PlexPlayer;
import java.util.List;
import java.util.UUID;
import org.bukkit.entity.Player;
record DefaultPlexPlayerView(PlexPlayer player) implements PlexPlayerView
{
@Override public UUID uuid() { return player.getUuid(); }
@Override public String name() { return player.getName(); }
@Override public List<String> ips() { return List.copyOf(player.getIps()); }
@Override public List<? extends PunishmentView> punishments() { return player.getPunishments().stream().map(DefaultPunishmentView::new).toList(); }
@Override public boolean frozen() { return player.isFrozen(); }
@Override public boolean muted() { return player.isMuted(); }
@Override public boolean lockedUp() { return player.isLockedUp(); }
@Override public Player bukkitPlayer() { return player.getPlayer(); }
}
@@ -0,0 +1,22 @@
package dev.plex.api.impl;
import dev.plex.api.punishment.PunishmentType;
import dev.plex.api.punishment.PunishmentView;
import dev.plex.punishment.Punishment;
import java.time.ZonedDateTime;
import java.util.UUID;
record DefaultPunishmentView(Punishment punishment) implements PunishmentView
{
@Override public UUID punished() { return punishment.getPunished(); }
@Override public UUID punisher() { return punishment.getPunisher(); }
@Override public String punisherName() { return punishment.getPunisherName(); }
@Override public String ip() { return punishment.getIp(); }
@Override public String punishedUsername() { return punishment.getPunishedUsername(); }
@Override public PunishmentType type() { return PunishmentType.valueOf(punishment.getType().name()); }
@Override public String reason() { return punishment.getReason(); }
@Override public boolean customTime() { return punishment.isCustomTime(); }
@Override public boolean active() { return punishment.isActive(); }
@Override public ZonedDateTime issueDate() { return punishment.getIssueDate(); }
@Override public ZonedDateTime endDate() { return punishment.getEndDate(); }
}
@@ -0,0 +1,40 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.player.PlexPlayerView;
import dev.plex.api.punishment.IndefiniteBanView;
import dev.plex.api.punishment.PunishmentRequest;
import dev.plex.api.punishment.PunishmentsApi;
import dev.plex.player.PlexPlayer;
import dev.plex.punishment.Punishment;
import dev.plex.punishment.PunishmentType;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
final class DefaultPunishmentsApi implements PunishmentsApi
{
private final Plex plugin;
DefaultPunishmentsApi(Plex plugin) { this.plugin = plugin; }
@Override public List<? extends IndefiniteBanView> indefiniteBans() { return plugin.getPunishmentManager().getIndefiniteBans().stream().map(DefaultIndefiniteBanView::new).toList(); }
@Override public Optional<? extends IndefiniteBanView> indefiniteBanByUuid(UUID uuid) { return Optional.ofNullable(plugin.getPunishmentManager().getIndefiniteBanByUUID(uuid)).map(DefaultIndefiniteBanView::new); }
@Override
public void punish(PlexPlayerView playerView, PunishmentRequest request)
{
PlexPlayer player = DefaultPlayersApi.unwrap(playerView);
if (player == null) player = plugin.getPlayerService().getPlayer(playerView.uuid());
Punishment punishment = new Punishment(request.punished(), request.punisher());
punishment.setPunisherName(request.punisherName());
punishment.setIp(request.ip());
punishment.setPunishedUsername(request.punishedUsername());
punishment.setType(PunishmentType.valueOf(request.type().name()));
punishment.setReason(request.reason());
punishment.setCustomTime(request.customTime());
punishment.setActive(request.active());
punishment.setEndDate(request.endDate());
plugin.getPunishmentManager().punish(player, punishment);
}
}
@@ -0,0 +1,15 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.scheduler.SchedulerApi;
final class DefaultSchedulerApi implements SchedulerApi
{
private final Plex plugin;
DefaultSchedulerApi(Plex plugin) { this.plugin = plugin; }
@Override public Object runSync(Runnable task) { return plugin.getServer().getScheduler().runTask(plugin, task); }
@Override public Object runLater(Runnable task, long delayTicks) { return plugin.getServer().getScheduler().runTaskLater(plugin, task, delayTicks); }
@Override public Object runTimer(Runnable task, long delayTicks, long periodTicks) { return plugin.getServer().getScheduler().runTaskTimer(plugin, task, delayTicks, periodTicks); }
}
@@ -0,0 +1,22 @@
package dev.plex.api.impl;
import dev.plex.Plex;
import dev.plex.api.storage.StorageApi;
import java.sql.Connection;
import java.sql.SQLException;
final class DefaultStorageApi implements StorageApi
{
private final Plex plugin;
DefaultStorageApi(Plex plugin) { this.plugin = plugin; }
@Override
public <T> T withConnection(SqlFunction<T> function) throws SQLException
{
try (Connection connection = plugin.getSqlConnection().getCon())
{
return function.apply(connection);
}
}
}
@@ -1,60 +1,32 @@
package dev.plex.config; package dev.plex.api.impl;
import dev.plex.api.config.ModuleConfiguration;
import dev.plex.config.ConfigDefaultsMerger;
import dev.plex.module.PlexModule; import dev.plex.module.PlexModule;
import dev.plex.util.PlexLog; import dev.plex.util.PlexLog;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
/** final class ServerModuleConfiguration extends ModuleConfiguration
* Creates a custom Config object
*/
public class ModuleConfig extends YamlConfiguration
{ {
/**
* The plugin instance
*/
private final PlexModule module; private final PlexModule module;
/**
* The File instance
*/
private final File file; private final File file;
/**
* Where the file is in the module JAR
*/
private final String from; private final String from;
/**
* Where it should be copied to in the module folder
*/
private final String to; private final String to;
/** ServerModuleConfiguration(PlexModule module, String from, String to)
* Creates a config object
*
* @param module The module instance
* @param to The file name
*/
public ModuleConfig(PlexModule module, String from, String to)
{ {
this.module = module; this.module = module;
this.file = new File(module.getDataFolder(), to); this.file = new File(module.getDataFolder(), to);
this.to = to;
this.from = from; this.from = from;
this.to = to;
if (!file.exists()) if (!file.exists()) saveDefault();
{
saveDefault();
}
} }
@Override
public void load() public void load()
{ {
try try
@@ -64,8 +36,7 @@ public class ModuleConfig extends YamlConfiguration
{ {
PlexLog.log("Merged default key(s) into " + to + ": " + String.join(", ", result.addedKeys())); PlexLog.log("Merged default key(s) into " + to + ": " + String.join(", ", result.addedKeys()));
} }
options().parseComments(true);
this.options().parseComments(true);
super.load(file); super.load(file);
} }
catch (IOException | InvalidConfigurationException ex) catch (IOException | InvalidConfigurationException ex)
@@ -74,33 +45,18 @@ public class ModuleConfig extends YamlConfiguration
} }
} }
/** @Override
* Saves the configuration file
*/
public void save() public void save()
{ {
try try { super.save(file); } catch (IOException ex) { ex.printStackTrace(); }
{
super.save(file);
}
catch (Exception ex)
{
ex.printStackTrace();
}
} }
/**
* Moves the configuration file from the plugin's resources folder to the data folder (plugins/Plex/)
*/
private void saveDefault() private void saveDefault()
{ {
try try
{ {
File parent = file.getParentFile(); File parent = file.getParentFile();
if (parent != null) if (parent != null) parent.mkdirs();
{
parent.mkdirs();
}
try (InputStream stream = module.getClass().getResourceAsStream("/" + from)) try (InputStream stream = module.getClass().getResourceAsStream("/" + from))
{ {
if (stream == null) if (stream == null)
@@ -108,12 +64,12 @@ public class ModuleConfig extends YamlConfiguration
PlexLog.warn("Unable to save default module config " + to + ": missing resource " + from); PlexLog.warn("Unable to save default module config " + to + ": missing resource " + from);
return; return;
} }
Files.copy(stream, this.file.toPath()); Files.copy(stream, file.toPath());
} }
} }
catch (IOException e) catch (IOException ex)
{ {
e.printStackTrace(); ex.printStackTrace();
} }
} }
} }
@@ -35,10 +35,12 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* Superclass for all commands * Superclass for all server commands.
*/ */
public abstract class PlexCommand extends Command implements PluginIdentifiableCommand public abstract class ServerCommand extends Command implements PluginIdentifiableCommand
{ {
private static Runtime runtime;
/** /**
* Returns the instance of the plugin * Returns the instance of the plugin
*/ */
@@ -59,13 +61,18 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
*/ */
private final RequiredCommandSource commandSource; private final RequiredCommandSource commandSource;
public static void setRuntime(Runtime runtime)
{
ServerCommand.runtime = runtime;
}
/** /**
* Creates an instance of the command * Creates an instance of the command
*/ */
public PlexCommand(boolean register) public ServerCommand(boolean register)
{ {
super(""); super("");
this.plugin = Plex.get(); this.plugin = requireRuntime().plugin();
this.params = getClass().getAnnotation(CommandParameters.class); this.params = getClass().getAnnotation(CommandParameters.class);
this.perms = getClass().getAnnotation(CommandPermissions.class); this.perms = getClass().getAnnotation(CommandPermissions.class);
@@ -82,16 +89,11 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
if (register) if (register)
{ {
getMap().getKnownCommands().remove(this.getName().toLowerCase()); requireRuntime().register(this);
this.getAliases().forEach(s ->
{
getMap().getKnownCommands().remove(s.toLowerCase());
});
getMap().register("plex", this);
} }
} }
public PlexCommand() public ServerCommand()
{ {
this(true); this(true);
} }
@@ -480,4 +482,40 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{ {
return plugin.getServer().getCommandMap(); return plugin.getServer().getCommandMap();
} }
private static Runtime requireRuntime()
{
if (runtime == null)
{
Plex plex = Plex.get();
if (plex == null)
{
throw new IllegalStateException("ServerCommand runtime has not been installed by Plex");
}
return new Runtime()
{
@Override
public Plex plugin()
{
return plex;
}
@Override
public void register(Command command)
{
plex.getServer().getCommandMap().getKnownCommands().remove(command.getName().toLowerCase());
command.getAliases().forEach(alias -> plex.getServer().getCommandMap().getKnownCommands().remove(alias.toLowerCase()));
plex.getServer().getCommandMap().register("plex", command);
}
};
}
return runtime;
}
public interface Runtime
{
Plex plugin();
void register(Command command);
}
} }
@@ -1,39 +0,0 @@
package dev.plex.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Storage for a command's parameters
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandParameters
{
/**
* The name
*
* @return Name of the command
*/
String name();
/**
* The description
*
* @return Description of the command
*/
String description() default "";
/**
* The usage (optional)
*
* @return The usage of the command
*/
String usage() default "/<command>";
/**
* The aliases (optional)
*
* @return The aliases of the command
*/
String aliases() default "";
}
@@ -1,28 +0,0 @@
package dev.plex.command.annotation;
import dev.plex.command.source.RequiredCommandSource;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Storage for the command's permissions
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandPermissions
{
/**
* Required command source
*
* @return The required command source of the command
* @see RequiredCommandSource
*/
RequiredCommandSource source() default RequiredCommandSource.ANY;
/**
* The permission
*
* @return Permission of the command
*/
String permission() default ""; // No idea what to put here
}
@@ -1,9 +0,0 @@
package dev.plex.command.exception;
public class CommandFailException extends RuntimeException // this is literally just a runtime exception lol
{
public CommandFailException(String s)
{
super(s);
}
}
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.adminchat", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.adminchat", source = RequiredCommandSource.ANY)
@CommandParameters(name = "adminchat", description = "Talk privately with other admins", usage = "/<command> <message>", aliases = "o,ac,sc,staffchat") @CommandParameters(name = "adminchat", description = "Talk privately with other admins", usage = "/<command> <message>", aliases = "o,ac,sc,staffchat")
public class AdminChatCMD extends PlexCommand public class AdminChatCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.adminworld", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.adminworld", source = RequiredCommandSource.IN_GAME)
@CommandParameters(name = "adminworld", aliases = "aw", description = "Teleport to the adminworld") @CommandParameters(name = "adminworld", aliases = "aw", description = "Teleport to the adminworld")
public class AdminworldCMD extends PlexCommand public class AdminworldCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException; import dev.plex.command.exception.CommandFailException;
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.gamemode.adventure", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.gamemode.adventure", source = RequiredCommandSource.ANY)
@CommandParameters(name = "adventure", aliases = "gma,egma,eadventure,adventuremode,eadventuremode", description = "Set your own or another player's gamemode to adventure mode") @CommandParameters(name = "adventure", aliases = "gma,egma,eadventure,adventuremode,eadventuremode", description = "Set your own or another player's gamemode to adventure mode")
public class AdventureCMD extends PlexCommand public class AdventureCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
@@ -35,7 +35,7 @@ import org.prism_mc.prism.paper.api.activities.PaperActivityQuery;
@CommandParameters(name = "ban", usage = "/<command> <player> [reason] [-rb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online") @CommandParameters(name = "ban", usage = "/<command> <player> [reason] [-rb]", aliases = "offlineban,gtfo", description = "Bans a player, offline or online")
@CommandPermissions(permission = "plex.ban", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.ban", source = RequiredCommandSource.ANY)
public class BanCMD extends PlexCommand public class BanCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.punishment.Punishment; import dev.plex.punishment.Punishment;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]") @CommandParameters(name = "banlist", description = "Manages the banlist", usage = "/<command> [purge]")
@CommandPermissions(permission = "plex.banlist") @CommandPermissions(permission = "plex.banlist")
public class BanListCommand extends PlexCommand public class BanListCommand extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
@@ -2,7 +2,7 @@ package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.broadcastloginmessage", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.broadcastloginmessage", source = RequiredCommandSource.ANY)
@CommandParameters(name = "bcastloginmessage", usage = "/<command> <player>", description = "Broadcast your login message (for vanish support)", aliases = "bcastlm") @CommandParameters(name = "bcastloginmessage", usage = "/<command> <player>", description = "Broadcast your login message (for vanish support)", aliases = "bcastlm")
public class BcastLoginMessageCMD extends PlexCommand public class BcastLoginMessageCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.listener.impl.BlockListener; import dev.plex.listener.impl.BlockListener;
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.blockedit") @CommandPermissions(permission = "plex.blockedit")
@CommandParameters(name = "blockedit", usage = "/<command> [list | purge | all | <player>]", aliases = "bedit", description = "Prevent players from modifying blocks") @CommandParameters(name = "blockedit", usage = "/<command> [list | purge | all | <player>]", aliases = "bedit", description = "Prevent players from modifying blocks")
public class BlockEditCMD extends PlexCommand public class BlockEditCMD extends ServerCommand
{ {
private final BlockListener bl = new BlockListener(); private final BlockListener bl = new BlockListener();
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.commandspy", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.commandspy", source = RequiredCommandSource.IN_GAME)
@CommandParameters(name = "commandspy", aliases = "cmdspy", description = "Spy on other player's commands") @CommandParameters(name = "commandspy", aliases = "cmdspy", description = "Spy on other player's commands")
public class CommandSpyCMD extends PlexCommand public class CommandSpyCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.consolesay", source = RequiredCommandSource.CONSOLE) @CommandPermissions(permission = "plex.consolesay", source = RequiredCommandSource.CONSOLE)
@CommandParameters(name = "consolesay", usage = "/<command> <message>", description = "Displays a message to everyone", aliases = "csay") @CommandParameters(name = "consolesay", usage = "/<command> <message>", description = "Displays a message to everyone", aliases = "csay")
public class ConsoleSayCMD extends PlexCommand public class ConsoleSayCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException; import dev.plex.command.exception.CommandFailException;
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.gamemode.creative", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.gamemode.creative", source = RequiredCommandSource.ANY)
@CommandParameters(name = "creative", aliases = "gmc,egmc,ecreative,eecreative,creativemode,ecreativemode", description = "Set your own or another player's gamemode to creative mode") @CommandParameters(name = "creative", aliases = "gmc,egmc,ecreative,eecreative,creativemode,ecreativemode", description = "Set your own or another player's gamemode to creative mode")
public class CreativeCMD extends PlexCommand public class CreativeCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.menu.impl.MaterialMenu; import dev.plex.menu.impl.MaterialMenu;
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <aliases <command> | redis-reset <player> | gamerules>") @CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <aliases <command> | redis-reset <player> | gamerules>")
@CommandPermissions(permission = "plex.debug") @CommandPermissions(permission = "plex.debug")
public class DebugCMD extends PlexCommand public class DebugCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.entitywipe", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.entitywipe", source = RequiredCommandSource.ANY)
@CommandParameters(name = "entitywipe", description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> [entity] [radius]", aliases = "ew,rd") @CommandParameters(name = "entitywipe", description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> [entity] [radius]", aliases = "ew,rd")
public class EntityWipeCMD extends PlexCommand public class EntityWipeCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.flatlands", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.flatlands", source = RequiredCommandSource.IN_GAME)
@CommandParameters(name = "flatlands", description = "Teleport to the flatlands") @CommandParameters(name = "flatlands", description = "Teleport to the flatlands")
public class FlatlandsCMD extends PlexCommand public class FlatlandsCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>", aliases = "fr") @CommandParameters(name = "freeze", description = "Freeze a player on the server", usage = "/<command> <player>", aliases = "fr")
@CommandPermissions(permission = "plex.freeze") @CommandPermissions(permission = "plex.freeze")
public class FreezeCMD extends PlexCommand public class FreezeCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException; import dev.plex.command.exception.CommandFailException;
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "gamemode", usage = "/<command> <creative | survival | adventure | default | spectator> [player]", description = "Change your gamemode", aliases = "gm,egamemode,gmt,egmt") @CommandParameters(name = "gamemode", usage = "/<command> <creative | survival | adventure | default | spectator> [player]", description = "Change your gamemode", aliases = "gm,egamemode,gmt,egmt")
@CommandPermissions(permission = "plex.gamemode", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.gamemode", source = RequiredCommandSource.ANY)
public class GamemodeCMD extends PlexCommand public class GamemodeCMD extends ServerCommand
{ {
private GameMode gamemode; private GameMode gamemode;
@@ -2,7 +2,7 @@ package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "kick", description = "Kicks a player", usage = "/<command> <player>") @CommandParameters(name = "kick", description = "Kicks a player", usage = "/<command> <player>")
@CommandPermissions(permission = "plex.kick", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.kick", source = RequiredCommandSource.ANY)
public class KickCMD extends PlexCommand public class KickCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.hook.VaultHook; import dev.plex.hook.VaultHook;
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "list", description = "Show a list of all online players", usage = "/<command> [-d | -v]", aliases = "lsit,who,playerlist,online") @CommandParameters(name = "list", description = "Show a list of all online players", usage = "/<command> [-d | -v]", aliases = "lsit,who,playerlist,online")
@CommandPermissions(permission = "plex.list") @CommandPermissions(permission = "plex.list")
public class ListCMD extends PlexCommand public class ListCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "localspawn", description = "Teleport to the spawnpoint of the world you are in") @CommandParameters(name = "localspawn", description = "Teleport to the spawnpoint of the world you are in")
@CommandPermissions(permission = "plex.localspawn", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.localspawn", source = RequiredCommandSource.IN_GAME)
public class LocalSpawnCMD extends PlexCommand public class LocalSpawnCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
@@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "lockup", description = "Lockup a player on the server", usage = "/<command> <player>") @CommandParameters(name = "lockup", description = "Lockup a player on the server", usage = "/<command> <player>")
@CommandPermissions(permission = "plex.lockup") @CommandPermissions(permission = "plex.lockup")
public class LockupCMD extends PlexCommand public class LockupCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.masterbuilderworld", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.masterbuilderworld", source = RequiredCommandSource.IN_GAME)
@CommandParameters(name = "masterbuilderworld", aliases = "mbw", description = "Teleport to the Master Builder world") @CommandParameters(name = "masterbuilderworld", aliases = "mbw", description = "Teleport to the Master Builder world")
public class MasterbuilderworldCMD extends PlexCommand public class MasterbuilderworldCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "moblimit", usage = "/<command> [on | off | setmax <limit>]", aliases = "entitylimit", description = "Manages the mob limit per chunk.") @CommandParameters(name = "moblimit", usage = "/<command> [on | off | setmax <limit>]", aliases = "entitylimit", description = "Manages the mob limit per chunk.")
@CommandPermissions(permission = "plex.moblimit", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.moblimit", source = RequiredCommandSource.ANY)
public class MobLimitCMD extends PlexCommand public class MobLimitCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.mobpurge", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.mobpurge", source = RequiredCommandSource.ANY)
@CommandParameters(name = "mobpurge", description = "Purge all mobs.", usage = "/<command> [mob]", aliases = "mp") @CommandParameters(name = "mobpurge", description = "Purge all mobs.", usage = "/<command> [mob]", aliases = "mp")
public class MobPurgeCMD extends PlexCommand public class MobPurgeCMD extends ServerCommand
{ {
private final List<EntityType> MOB_TYPES = new ArrayList<>(); private final List<EntityType> MOB_TYPES = new ArrayList<>();
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "mute", description = "Mute a player on the server", usage = "/<command> <player>", aliases = "stfu") @CommandParameters(name = "mute", description = "Mute a player on the server", usage = "/<command> <player>", aliases = "stfu")
@CommandPermissions(permission = "plex.mute") @CommandPermissions(permission = "plex.mute")
public class MuteCMD extends PlexCommand public class MuteCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,7 +1,7 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.player.PlexPlayer; import dev.plex.player.PlexPlayer;
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "notes", description = "Manage notes for a player", usage = "/<command> <player> <list | add <note> | remove <id> | clear>") @CommandParameters(name = "notes", description = "Manage notes for a player", usage = "/<command> <player> <list | add <note> | remove <id> | clear>")
@CommandPermissions(permission = "plex.notes") @CommandPermissions(permission = "plex.notes")
public class NotesCMD extends PlexCommand public class NotesCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.CommandFailException; import dev.plex.command.exception.CommandFailException;
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(source = RequiredCommandSource.ANY) @CommandPermissions(source = RequiredCommandSource.ANY)
@CommandParameters(name = "plex", usage = "/<command> [reload | redis | modules [reload]]", description = "Show information about Plex or reload it") @CommandParameters(name = "plex", usage = "/<command> [reload | redis | modules [reload]]", description = "Show information about Plex or reload it")
public class PlexCMD extends PlexCommand public class PlexCMD extends ServerCommand
{ {
// Don't modify this command // Don't modify this command
@Override @Override
@@ -2,7 +2,7 @@ package dev.plex.command.impl;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "punishments", usage = "/<command> [player]", description = "Opens the Punishments GUI", aliases = "punishlist,punishes") @CommandParameters(name = "punishments", usage = "/<command> [player]", description = "Opens the Punishments GUI", aliases = "punishlist,punishes")
@CommandPermissions(permission = "plex.punishments", source = RequiredCommandSource.IN_GAME) @CommandPermissions(permission = "plex.punishments", source = RequiredCommandSource.IN_GAME)
public class PunishmentsCMD extends PlexCommand public class PunishmentsCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
@@ -1,6 +1,6 @@
package dev.plex.command.impl; package dev.plex.command.impl;
import dev.plex.command.PlexCommand; import dev.plex.command.ServerCommand;
import dev.plex.command.annotation.CommandParameters; import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions; import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
@CommandPermissions(permission = "plex.rawsay", source = RequiredCommandSource.ANY) @CommandPermissions(permission = "plex.rawsay", source = RequiredCommandSource.ANY)
@CommandParameters(name = "rawsay", usage = "/<command> <message>", description = "Displays a raw message to everyone") @CommandParameters(name = "rawsay", usage = "/<command> <message>", description = "Displays a raw message to everyone")
public class RawSayCMD extends PlexCommand public class RawSayCMD extends ServerCommand
{ {
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)

Some files were not shown because too many files have changed in this diff Show More