Migrates the entire package nomenclature to be more direct and straightforward. (#17)

Signed-off-by: Paul Reilly <pawereus@gmail.com>
This commit is contained in:
Paldiu
2023-08-01 22:34:18 -05:00
committed by GitHub
parent e1a6b5e587
commit 21463c50fe
146 changed files with 595 additions and 608 deletions

View File

@ -1,6 +1,7 @@
package me.totalfreedom.api;
package fns.patchwork.api;
import me.totalfreedom.provider.ContextProvider;
import fns.patchwork.provider.ContextProvider;
import java.util.function.Function;
import net.kyori.adventure.text.Component;
import org.bukkit.Location;
import org.bukkit.World;
@ -12,8 +13,6 @@ import org.bukkit.event.block.Action;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Function;
/**
* Represents an object context. This class is a simple generic type wrapper that can be used to ensure data types. This
* class is also used to provide a simple way to map data types.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.api;
package fns.patchwork.api;
/**
* Interpolates a range of values and returns the results in a {@link Double} array.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.api;
package fns.patchwork.api;
/**
* This interface represents a Serializable object. Objects which require custom serialization and cannot simply

View File

@ -1,4 +1,4 @@
package me.totalfreedom.audience;
package fns.patchwork.audience;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,9 +1,9 @@
package me.totalfreedom.base;
package fns.patchwork.base;
import me.totalfreedom.display.adminchat.AdminChatDisplay;
import me.totalfreedom.event.EventBus;
import me.totalfreedom.service.FreedomExecutor;
import me.totalfreedom.service.SubscriptionProvider;
import fns.patchwork.display.adminchat.AdminChatDisplay;
import fns.patchwork.event.EventBus;
import fns.patchwork.service.FreedomExecutor;
import fns.patchwork.service.SubscriptionProvider;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,11 +1,11 @@
package me.totalfreedom.base;
package fns.patchwork.base;
import me.totalfreedom.data.ConfigRegistry;
import me.totalfreedom.data.EventRegistry;
import me.totalfreedom.data.GroupRegistry;
import me.totalfreedom.data.ModuleRegistry;
import me.totalfreedom.data.ServiceTaskRegistry;
import me.totalfreedom.data.UserRegistry;
import fns.patchwork.data.ConfigRegistry;
import fns.patchwork.data.EventRegistry;
import fns.patchwork.data.GroupRegistry;
import fns.patchwork.data.ModuleRegistry;
import fns.patchwork.data.ServiceTaskRegistry;
import fns.patchwork.data.UserRegistry;
/**
* This class is a holder for each registry in the data package.

View File

@ -1,7 +1,6 @@
package me.totalfreedom.base;
package fns.patchwork.base;
import me.totalfreedom.api.Context;
import me.totalfreedom.user.User;
import fns.patchwork.user.User;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,13 +1,13 @@
package me.totalfreedom.command;
package fns.patchwork.command;
import fns.patchwork.command.annotation.Completion;
import fns.patchwork.command.annotation.Subcommand;
import fns.patchwork.provider.ContextProvider;
import fns.patchwork.utils.logging.FreedomLogger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import me.totalfreedom.command.annotation.Completion;
import me.totalfreedom.command.annotation.Subcommand;
import me.totalfreedom.provider.ContextProvider;
import me.totalfreedom.utils.logging.FreedomLogger;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Location;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command;
package fns.patchwork.command;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;

View File

@ -1,14 +1,10 @@
package me.totalfreedom.command;
import me.totalfreedom.command.annotation.Base;
import me.totalfreedom.command.annotation.Completion;
import me.totalfreedom.command.annotation.Info;
import me.totalfreedom.command.annotation.Permissive;
import me.totalfreedom.command.annotation.Subcommand;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
package fns.patchwork.command;
import fns.patchwork.command.annotation.Base;
import fns.patchwork.command.annotation.Completion;
import fns.patchwork.command.annotation.Info;
import fns.patchwork.command.annotation.Permissive;
import fns.patchwork.command.annotation.Subcommand;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
@ -16,6 +12,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* This is the base command class which should be extended when creating a new command. Commands must be annotated with

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command.annotation;
package fns.patchwork.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command.annotation;
package fns.patchwork.command.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command.annotation;
package fns.patchwork.command.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command.annotation;
package fns.patchwork.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.command.annotation;
package fns.patchwork.command.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,8 +1,7 @@
package me.totalfreedom.command.annotation;
import me.totalfreedom.command.CommandHandler;
import me.totalfreedom.provider.ContextProvider;
package fns.patchwork.command.annotation;
import fns.patchwork.command.CommandHandler;
import fns.patchwork.provider.ContextProvider;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,8 +1,7 @@
package me.totalfreedom.config;
import me.totalfreedom.api.Context;
import me.totalfreedom.provider.ContextProvider;
package fns.patchwork.config;
import fns.patchwork.api.Context;
import fns.patchwork.provider.ContextProvider;
import java.io.File;
import java.io.IOException;
import java.util.List;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.config;
package fns.patchwork.config;
public final class YamlWrapper
{

View File

@ -1,7 +1,6 @@
package me.totalfreedom.data;
import me.totalfreedom.config.Configuration;
package fns.patchwork.data;
import fns.patchwork.config.Configuration;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,8 +1,7 @@
package me.totalfreedom.data;
import me.totalfreedom.event.FEvent;
import me.totalfreedom.provider.EventProvider;
package fns.patchwork.data;
import fns.patchwork.event.FEvent;
import fns.patchwork.provider.EventProvider;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,10 +1,9 @@
package me.totalfreedom.data;
import me.totalfreedom.security.Group;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
package fns.patchwork.data;
import fns.patchwork.security.Group;
import java.util.ArrayList;
import java.util.List;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
/**
* A registry for {@link Group}s.

View File

@ -1,10 +1,9 @@
package me.totalfreedom.data;
import me.totalfreedom.provider.ModuleProvider;
import org.bukkit.plugin.java.JavaPlugin;
package fns.patchwork.data;
import fns.patchwork.provider.ModuleProvider;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
/**
* A registry for modules.

View File

@ -1,14 +1,13 @@
package me.totalfreedom.data;
import me.totalfreedom.service.Service;
import me.totalfreedom.service.ServiceSubscription;
import me.totalfreedom.service.SubscriptionProvider;
import me.totalfreedom.service.Task;
import me.totalfreedom.service.TaskSubscription;
import org.jetbrains.annotations.Nullable;
package fns.patchwork.data;
import fns.patchwork.service.Service;
import fns.patchwork.service.ServiceSubscription;
import fns.patchwork.service.SubscriptionProvider;
import fns.patchwork.service.Task;
import fns.patchwork.service.TaskSubscription;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.Nullable;
/**
* A registry for all services and tasks registered with Patchwork.

View File

@ -1,11 +1,10 @@
package me.totalfreedom.data;
import me.totalfreedom.user.User;
import me.totalfreedom.user.UserData;
import org.bukkit.entity.Player;
package fns.patchwork.data;
import fns.patchwork.user.User;
import fns.patchwork.user.UserData;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player;
/**
* A registry for {@link UserData} objects.

View File

@ -1,5 +1,10 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -9,12 +14,6 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Represents a menu that can be opened by a player.
*/

View File

@ -1,5 +1,8 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import net.kyori.adventure.bossbar.BossBar;
@ -7,10 +10,6 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import org.jetbrains.annotations.Range;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* This class is a wrapper for {@link BossBar} objects. It provides some handy methods for changing the boss bar's
* properties, displaying the bar to {@link Audience}s, and a {@link BossBarBuilder} to easily create new boss bars.

View File

@ -1,9 +1,8 @@
package me.totalfreedom.display;
import me.totalfreedom.service.Task;
import org.bukkit.Bukkit;
package fns.patchwork.display;
import fns.patchwork.service.Task;
import java.time.Duration;
import org.bukkit.Bukkit;
public class BossBarTimer extends Task
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import org.bukkit.entity.Player;

View File

@ -1,5 +1,9 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
@ -10,11 +14,6 @@ import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
/**
* A class that represents an inventory that can be displayed to players. This class also represents the inventory
* holder which contains the inventory.

View File

@ -1,6 +1,6 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import me.totalfreedom.utils.kyori.FreedomAdventure;
import fns.patchwork.utils.kyori.FreedomAdventure;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;

View File

@ -1,13 +1,12 @@
package me.totalfreedom.display;
package fns.patchwork.display;
import java.time.Duration;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.title.Title;
import java.time.Duration;
/**
* A wrapper class for {@link Title}s that allows for easy display to an {@link Audience}.
*/

View File

@ -1,4 +1,4 @@
package me.totalfreedom.display.adminchat;
package fns.patchwork.display.adminchat;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

View File

@ -1,10 +1,15 @@
package me.totalfreedom.display.adminchat;
package fns.patchwork.display.adminchat;
import fns.patchwork.base.Patchwork;
import fns.patchwork.base.Shortcuts;
import fns.patchwork.security.Groups;
import fns.patchwork.user.UserData;
import io.papermc.paper.event.player.AsyncChatEvent;
import me.totalfreedom.base.Patchwork;
import me.totalfreedom.base.Shortcuts;
import me.totalfreedom.security.Groups;
import me.totalfreedom.user.UserData;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -13,12 +18,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class AdminChatDisplay
{
protected static final String ACPERM = "patchwork.adminchat";

View File

@ -1,4 +1,4 @@
package me.totalfreedom.display.adminchat;
package fns.patchwork.display.adminchat;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* Represents an immutable transaction that has been fully handled by a {@link Transactor} instance

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* An entity that is able to transfer sums of currency between other {@link EconomicEntity}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* Metadata associated with a {@link EconomicEntity}

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* A transaction that can be changed.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* A class that denotes the transfer of currency between two EconomicEntity instances.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* A class that intercepts transactions after they are completed and logs them to a data point

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
import net.kyori.adventure.text.Component;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.economy;
package fns.patchwork.economy;
/**
* A class that implements the completion of transactions.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.event;
package fns.patchwork.event;
@FunctionalInterface
public interface Callback<T extends FEvent>

View File

@ -1,9 +1,8 @@
package me.totalfreedom.event;
import me.totalfreedom.api.Context;
import me.totalfreedom.base.Patchwork;
import me.totalfreedom.service.Service;
package fns.patchwork.event;
import fns.patchwork.api.Context;
import fns.patchwork.base.Patchwork;
import fns.patchwork.service.Service;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.event;
package fns.patchwork.event;
public record EventSubscription<T extends FEvent>(T event, Callback<T> callback)
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.event;
package fns.patchwork.event;
public abstract class FEvent
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.event;
package fns.patchwork.event;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,13 +1,12 @@
package me.totalfreedom.logging;
package fns.patchwork.logging;
import java.time.Instant;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.UUID;
public final class BlockInteraction implements Interaction<BlockData>
{
private final Location location;

View File

@ -1,16 +1,15 @@
package me.totalfreedom.logging;
import org.bukkit.Location;
import org.bukkit.block.Container;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
package fns.patchwork.logging;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.block.Container;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public final class ContainerInteraction implements Interaction<List<ItemStack>>
{

View File

@ -1,11 +1,10 @@
package me.totalfreedom.logging;
package fns.patchwork.logging;
import com.google.errorprone.annotations.Immutable;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.UUID;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
@Immutable
public interface Interaction<T>

View File

@ -1,12 +1,11 @@
package me.totalfreedom.logging;
package fns.patchwork.logging;
import java.time.Instant;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import java.time.Instant;
public final class InteractionFormatter
{
public String formatInteraction(final Interaction<?> interaction)

View File

@ -1,4 +1,4 @@
package me.totalfreedom.particle;
package fns.patchwork.particle;
import org.bukkit.Particle;
import org.bukkit.World;

View File

@ -1,16 +1,15 @@
package me.totalfreedom.particle;
package fns.patchwork.particle;
import me.totalfreedom.api.Interpolator;
import me.totalfreedom.utils.InterpolationUtils;
import fns.patchwork.api.Interpolator;
import fns.patchwork.utils.InterpolationUtils;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.OfflinePlayer;
import org.bukkit.Particle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
import java.util.UUID;
/**
* Represents a Trail instance for a specific player.
*/

View File

@ -1,4 +1,4 @@
package me.totalfreedom.particle;
package fns.patchwork.particle;
import org.bukkit.Particle;

View File

@ -1,8 +1,11 @@
package me.totalfreedom.provider;
package fns.patchwork.provider;
import me.totalfreedom.api.Context;
import me.totalfreedom.command.BukkitDelegate;
import me.totalfreedom.command.annotation.Subcommand;
import fns.patchwork.command.BukkitDelegate;
import fns.patchwork.command.annotation.Subcommand;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -13,9 +16,6 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
import java.util.stream.Stream;
/**
* This class is used to provide context to subcommand methods. This class is used by the BukkitDelegate to parse
* arguments for subcommands. The following types are supported:
@ -34,6 +34,7 @@ import java.util.stream.Stream;
* </ul>
* All of these types can be parsed from a String input. If the String cannot be parsed into any of
* these types, then null will be returned.
*
* @see #fromString(String, Class)
*/
public class ContextProvider
@ -41,15 +42,15 @@ public class ContextProvider
public <T> T fromString(final String string, final Class<T> clazz)
{
return Stream.of(toBoolean(string, clazz),
toDouble(string, clazz),
toInt(string, clazz),
toLong(string, clazz),
toFloat(string, clazz),
toMaterial(string, clazz),
toPlayer(string, clazz),
toWorld(string, clazz),
toLocation(string, clazz),
toComponent(string, clazz))
toDouble(string, clazz),
toInt(string, clazz),
toLong(string, clazz),
toFloat(string, clazz),
toMaterial(string, clazz),
toPlayer(string, clazz),
toWorld(string, clazz),
toLocation(string, clazz),
toComponent(string, clazz))
.filter(Objects::nonNull)
.findFirst()
.map(clazz::cast)
@ -58,24 +59,29 @@ public class ContextProvider
private @Nullable Boolean toBoolean(final String string, final Class<?> clazz)
{
if (clazz != Boolean.class) return null;
if (clazz != Boolean.class)
return null;
// Previously we used Boolean#parseBoolean, but that will always return a value and does not throw
// an exception. This means that if the string is not "true" or "false", it will return false.
if (string.equalsIgnoreCase("true")) return true;
if (string.equalsIgnoreCase("false")) return false;
if (string.equalsIgnoreCase("true"))
return true;
if (string.equalsIgnoreCase("false"))
return false;
return null;
}
private @Nullable Double toDouble(final String string, final Class<?> clazz)
{
if (clazz != Double.class) return null;
if (clazz != Double.class)
return null;
try
{
return Double.parseDouble(string);
} catch (NumberFormatException ignored)
}
catch (NumberFormatException ignored)
{
return null;
}
@ -83,12 +89,14 @@ public class ContextProvider
private @Nullable Integer toInt(final String string, final Class<?> clazz)
{
if (clazz != Integer.class) return null;
if (clazz != Integer.class)
return null;
try
{
return Integer.parseInt(string);
} catch (NumberFormatException ignored)
}
catch (NumberFormatException ignored)
{
return null;
}
@ -96,12 +104,14 @@ public class ContextProvider
private @Nullable Long toLong(final String string, final Class<?> clazz)
{
if (clazz != Long.class) return null;
if (clazz != Long.class)
return null;
try
{
return Long.parseLong(string);
} catch (NumberFormatException ignored)
}
catch (NumberFormatException ignored)
{
return null;
}
@ -109,12 +119,14 @@ public class ContextProvider
private @Nullable Float toFloat(final String string, final Class<?> clazz)
{
if (clazz != Float.class) return null;
if (clazz != Float.class)
return null;
try
{
return Float.parseFloat(string);
} catch (NumberFormatException ignored)
}
catch (NumberFormatException ignored)
{
return null;
}
@ -122,19 +134,22 @@ public class ContextProvider
private @Nullable Material toMaterial(final String string, final Class<?> clazz)
{
if (clazz != Material.class) return null;
if (clazz != Material.class)
return null;
return Material.matchMaterial(string);
}
private @Nullable Player toPlayer(final String string, final Class<?> clazz)
{
if (clazz != Player.class) return null;
if (clazz != Player.class)
return null;
return Bukkit.getPlayer(string);
}
private @Nullable World toWorld(final String string, final Class<?> clazz)
{
if (clazz != World.class) return null;
if (clazz != World.class)
return null;
return Bukkit.getWorld(string);
}
@ -145,30 +160,46 @@ public class ContextProvider
*
* @param string The string to parse
* @return A location object if xyz is valid
* @see BukkitDelegate#processSubCommands(String[], CommandSender, ContextProvider, Subcommand)
* @see BukkitDelegate#processSubCommands(String[], CommandSender, ContextProvider, Subcommand)
*/
private @Nullable Location toLocation(final String string, final Class<?> clazz)
{
if (clazz != Location.class) return null;
if (clazz != Location.class)
return null;
final String[] split = string.split(" ");
if (split.length != 4 || toWorld(split[0], World.class) == null) return null;
if (split.length != 4 || toWorld(split[0], World.class) == null)
return null;
try {
try
{
final double x = Double.parseDouble(split[1]);
final double y = Double.parseDouble(split[2]);
final double z = Double.parseDouble(split[3]);
return new Location(toWorld(split[0], World.class), x, y, z);
} catch (NumberFormatException ex) {
}
catch (NumberFormatException ex)
{
return null;
}
}
private @Nullable Component toComponent(final String string, final Class<?> clazz)
{
if (clazz != Component.class) return null;
if (clazz != Component.class)
return null;
return Component.text(string);
}
public @NotNull <T> List<@Nullable T> getList(final List<String> resolvable, final Class<T> clazz)
{
final List<T> resolved = new ArrayList<>();
for (final String entry : resolvable)
{
resolved.add(this.fromString(entry, clazz));
}
return resolved;
}
}

View File

@ -1,6 +1,6 @@
package me.totalfreedom.provider;
package fns.patchwork.provider;
import me.totalfreedom.event.FEvent;
import fns.patchwork.event.FEvent;
@FunctionalInterface
public interface EventProvider<T extends FEvent>

View File

@ -1,4 +1,4 @@
package me.totalfreedom.provider;
package fns.patchwork.provider;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,6 +1,6 @@
package me.totalfreedom.provider;
package fns.patchwork.provider;
import me.totalfreedom.service.Service;
import fns.patchwork.service.Service;
public interface ServiceProvider<T extends Service>
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.security;
package fns.patchwork.security;
import net.kyori.adventure.text.Component;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.security;
package fns.patchwork.security;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,7 @@
package me.totalfreedom.security;
import org.bukkit.permissions.Permission;
package fns.patchwork.security;
import javax.annotation.concurrent.Immutable;
import org.bukkit.permissions.Permission;
@Immutable
public interface Node

View File

@ -1,4 +1,4 @@
package me.totalfreedom.security;
package fns.patchwork.security;
public interface NodeBuilder
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.security;
package fns.patchwork.security;
public enum NodeType
{

View File

@ -1,9 +1,8 @@
package me.totalfreedom.security;
import org.bukkit.permissions.Permissible;
package fns.patchwork.security;
import java.util.Set;
import java.util.UUID;
import org.bukkit.permissions.Permissible;
public interface PermissionHolder extends Permissible
{

View File

@ -1,11 +1,10 @@
package me.totalfreedom.service;
import me.totalfreedom.base.Patchwork;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
package fns.patchwork.service;
import fns.patchwork.base.Patchwork;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
/**
* This is a holder class for {@link Executor} objects that are used to delegate runnable tasks to the Bukkit Scheduler.

View File

@ -1,4 +1,4 @@
package me.totalfreedom.service;
package fns.patchwork.service;
/**
* Represents a ticking service. Services may be asynchronous or synchronous, however there are some restrictions:

View File

@ -1,12 +1,11 @@
package me.totalfreedom.service;
package fns.patchwork.service;
import java.util.concurrent.Executor;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Executor;
/**
* Represents a subscription to a {@link Service}.
* <p>

View File

@ -1,4 +1,4 @@
package me.totalfreedom.service;
package fns.patchwork.service;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Contract;

View File

@ -1,9 +1,8 @@
package me.totalfreedom.service;
import me.totalfreedom.utils.DurationTools;
import org.bukkit.scheduler.BukkitRunnable;
package fns.patchwork.service;
import fns.patchwork.utils.DurationTools;
import java.time.Duration;
import org.bukkit.scheduler.BukkitRunnable;
/**
* Represents a task that can be run asynchronously or synchronously.

View File

@ -1,13 +1,12 @@
package me.totalfreedom.service;
package fns.patchwork.service;
import me.totalfreedom.utils.container.Pair;
import fns.patchwork.utils.container.Pair;
import java.util.concurrent.Executor;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import java.util.concurrent.Executor;
/**
* Represents a subscription to a task. Task subscriptions offer a nice wrapper for managing tasks, which are inevitably
* just bukkit runnables with a bit more lenience in terms of instantiation modification and execution. It also offers a

View File

@ -1,11 +1,10 @@
package me.totalfreedom.shop;
package fns.patchwork.shop;
import me.totalfreedom.economy.EconomicEntity;
import fns.patchwork.economy.EconomicEntity;
import java.time.Duration;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import java.time.Duration;
public interface Reactable
{
Component getReactionMessage();

View File

@ -1,4 +1,4 @@
package me.totalfreedom.shop;
package fns.patchwork.shop;
import java.time.Duration;
import net.kyori.adventure.text.Component;

View File

@ -1,11 +1,11 @@
package me.totalfreedom.shop;
package fns.patchwork.shop;
import fns.patchwork.base.Patchwork;
import fns.patchwork.display.BossBarDisplay;
import fns.patchwork.display.BossBarTimer;
import fns.patchwork.economy.EconomicEntity;
import fns.patchwork.service.Task;
import io.papermc.paper.event.player.AsyncChatEvent;
import me.totalfreedom.base.Patchwork;
import me.totalfreedom.display.BossBarDisplay;
import me.totalfreedom.display.BossBarTimer;
import me.totalfreedom.economy.EconomicEntity;
import me.totalfreedom.service.Task;
import net.kyori.adventure.bossbar.BossBar;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.shop;
package fns.patchwork.shop;
public enum ReactionType
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.sql;
package fns.patchwork.sql;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.sql;
package fns.patchwork.sql;
import java.io.File;
import java.util.Properties;

View File

@ -1,8 +1,8 @@
package me.totalfreedom.user;
package fns.patchwork.user;
import me.totalfreedom.economy.EconomicEntity;
import me.totalfreedom.economy.EconomicEntityData;
import me.totalfreedom.security.PermissionHolder;
import fns.patchwork.economy.EconomicEntity;
import fns.patchwork.economy.EconomicEntityData;
import fns.patchwork.security.PermissionHolder;
import net.kyori.adventure.text.Component;
public interface User extends PermissionHolder, EconomicEntity

View File

@ -1,13 +1,12 @@
package me.totalfreedom.user;
package fns.patchwork.user;
import me.totalfreedom.display.adminchat.AdminChatFormat;
import me.totalfreedom.economy.EconomicEntityData;
import me.totalfreedom.security.Group;
import fns.patchwork.display.adminchat.AdminChatFormat;
import fns.patchwork.economy.EconomicEntityData;
import fns.patchwork.security.Group;
import java.util.UUID;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public interface UserData extends EconomicEntityData
{
@NotNull UUID getUniqueId();

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils;
package fns.patchwork.utils;
import java.time.Duration;

View File

@ -1,13 +1,12 @@
package me.totalfreedom.utils;
package fns.patchwork.utils;
import me.totalfreedom.api.Interpolator;
import fns.patchwork.api.Interpolator;
import java.util.LinkedHashSet;
import java.util.Set;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.Color;
import java.util.LinkedHashSet;
import java.util.Set;
public final class InterpolationUtils
{
private InterpolationUtils()

View File

@ -1,11 +1,10 @@
package me.totalfreedom.utils;
import org.bukkit.Location;
import org.bukkit.World;
package fns.patchwork.utils;
import java.util.LinkedList;
import java.util.List;
import java.util.function.DoubleUnaryOperator;
import org.bukkit.Location;
import org.bukkit.World;
public class ShapeUtils
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils;
package fns.patchwork.utils;
import java.util.ArrayList;
import java.util.List;
@ -80,16 +80,17 @@ public final class Tagged<T>
EntityType.BLOCK_DISPLAY,
EntityType.ITEM_DISPLAY);
private final List<T> tagged;
private final List<T> taggable;
private Tagged(final T... tagged)
private Tagged(final T... taggable)
{
this.tagged = new ArrayList<>();
this.taggable = new ArrayList<>();
this.taggable.addAll(List.of(taggable));
}
public boolean isTagged(final @NotNull T object)
{
for (final T t : this.tagged)
for (final T t : this.taggable)
{
if (object.equals(t))
return true;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils.container;
package fns.patchwork.utils.container;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils.container;
package fns.patchwork.utils.container;
public record Pair<K, V>(K key, V value)
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils.container;
package fns.patchwork.utils.container;
public record Trio<A, B, C>(A primary, B secondary, C tertiary)
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils.container;
package fns.patchwork.utils.container;
public record UnaryPair<T>(T first, T second)
{

View File

@ -1,4 +1,4 @@
package me.totalfreedom.utils.container;
package fns.patchwork.utils.container;
public record UnaryTrio<T>(T primary, T secondary, T tertiary)
{

View File

@ -1,9 +1,8 @@
package me.totalfreedom.utils.kyori;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
package fns.patchwork.utils.kyori;
import java.util.function.Supplier;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
/**
* This class contains the only reference to plain text component serializer, and allows access to it via wrapper

View File

@ -19,7 +19,7 @@
* THE SOFTWARE.
*/
package me.totalfreedom.utils.kyori;
package fns.patchwork.utils.kyori;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextDecoration;
@ -60,11 +60,11 @@ public class FreedomMiniMessage
* @param placeholders Custom placeholders to use when processing the input
* @return A processed Component
*/
public static Component deserialize(boolean safe, String input, TagResolver... placeholders)
public static Component deserialize(final boolean safe, final String input, final TagResolver... placeholders)
{
return (safe
? FreedomMiniMessage.safe
: unsafe).deserialize(input, placeholders);
? FreedomMiniMessage.safe
: unsafe).deserialize(input, placeholders);
}
/**
@ -75,10 +75,10 @@ public class FreedomMiniMessage
* @param input An already processed component
* @return A processed Component
*/
public static String serialize(boolean safe, Component input)
public static String serialize(final boolean safe, final Component input)
{
return (safe
? FreedomMiniMessage.safe
: unsafe).serialize(input);
? FreedomMiniMessage.safe
: unsafe).serialize(input);
}
}

View File

@ -1,6 +1,6 @@
package me.totalfreedom.utils.kyori;
package fns.patchwork.utils.kyori;
import me.totalfreedom.base.Patchwork;
import fns.patchwork.base.Patchwork;
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;

View File

@ -1,6 +1,7 @@
package me.totalfreedom.utils.logging;
package fns.patchwork.utils.logging;
import me.totalfreedom.utils.kyori.FreedomAdventure;
import fns.patchwork.utils.kyori.FreedomAdventure;
import java.util.function.Supplier;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.chat.ChatType;
import net.kyori.adventure.chat.SignedMessage;
@ -10,8 +11,6 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.function.Supplier;
public class FreedomLogger implements Audience
{
private final Logger logger;