Add Veritas, Tyr, also other changes

This commit is contained in:
Paul Reilly
2023-08-26 19:05:45 -05:00
parent 8e2e466864
commit a676207afa
37 changed files with 851 additions and 64 deletions

View File

@ -28,7 +28,7 @@ import fns.patchwork.command.annotation.Info;
import fns.patchwork.command.annotation.Permissive;
import fns.patchwork.command.annotation.Subcommand;
import fns.patchwork.provider.ContextProvider;
import fns.patchwork.utils.logging.FreedomLogger;
import fns.patchwork.utils.logging.FNS4J;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -135,8 +135,8 @@ public final class BukkitDelegate extends Command implements PluginIdentifiableC
}
catch (Exception ex)
{
FreedomLogger.getLogger("Patchwork")
.error(ex);
FNS4J.getLogger("Patchwork")
.error(ex);
}
return true;
@ -184,8 +184,8 @@ public final class BukkitDelegate extends Command implements PluginIdentifiableC
final Object obj = provider.fromString(arg, argType);
if (obj == null)
{
FreedomLogger.getLogger("Datura")
.error("Failed to parse argument " + arg + " for type " + argType.getName());
FNS4J.getLogger("Datura")
.error("Failed to parse argument " + arg + " for type " + argType.getName());
return;
}
objects[i] = obj;
@ -207,8 +207,8 @@ public final class BukkitDelegate extends Command implements PluginIdentifiableC
}
catch (Exception ex)
{
FreedomLogger.getLogger("Patchwork")
.error(ex);
FNS4J.getLogger("Patchwork")
.error(ex);
}
}

View File

@ -23,7 +23,7 @@
package fns.patchwork.data;
import fns.patchwork.security.Group;
import fns.patchwork.permissible.Group;
import java.util.ArrayList;
import java.util.List;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;

View File

@ -23,7 +23,7 @@
package fns.patchwork.display;
import fns.patchwork.utils.kyori.FreedomAdventure;
import fns.patchwork.kyori.PlainTextWrapper;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
@ -73,7 +73,7 @@ public class DisplayableView extends InventoryView
this.top = top;
this.bottom = bottom;
this.type = InventoryType.CHEST;
this.title = FreedomAdventure.toPlainText(type.defaultTitle());
this.title = PlainTextWrapper.toPlainText(type.defaultTitle());
}
@Override
@ -116,6 +116,6 @@ public class DisplayableView extends InventoryView
@Override
public @NotNull String getOriginalTitle()
{
return FreedomAdventure.toPlainText(type.defaultTitle());
return PlainTextWrapper.toPlainText(type.defaultTitle());
}
}

View File

@ -25,8 +25,7 @@ package fns.patchwork.display.adminchat;
import fns.patchwork.base.Patchwork;
import fns.patchwork.base.Registration;
import fns.patchwork.base.Shortcuts;
import fns.patchwork.security.Groups;
import fns.patchwork.permissible.Groups;
import fns.patchwork.user.UserData;
import io.papermc.paper.event.player.AsyncChatEvent;
import java.util.HashMap;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.utils.kyori;
package fns.patchwork.kyori;
import fns.patchwork.base.Patchwork;
import net.kyori.adventure.chat.ChatType;
@ -40,7 +40,7 @@ import org.bukkit.plugin.java.JavaPlugin;
* <br>
* As a result, we need to conform to those specifications even if we do not use this feature.
*/
public final class KyoriConstants
public final class ChatBinder
{
private static final ChatType type = ChatType.CHAT;
@ -49,7 +49,7 @@ public final class KyoriConstants
*/
public static final ChatType.Bound PATCHWORK = fromPlugin(Patchwork.class);
private KyoriConstants()
private ChatBinder()
{
}

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.utils.kyori;
package fns.patchwork.kyori;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextDecoration;
@ -32,7 +32,7 @@ import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
/**
* This class contains a wrapper for a MiniMessage serializer.
*/
public class FreedomMiniMessage
public class MiniMessageWrapper
{
private static final MiniMessage unsafe = MiniMessage.miniMessage();
private static final MiniMessage safe = MiniMessage.builder()
@ -48,7 +48,7 @@ public class FreedomMiniMessage
))
.build();
private FreedomMiniMessage()
private MiniMessageWrapper()
{
throw new UnsupportedOperationException("Instantiation of a static utility class is not supported.");
}
@ -65,7 +65,7 @@ public class FreedomMiniMessage
public static Component deserialize(final boolean safe, final String input, final TagResolver... placeholders)
{
return (safe
? FreedomMiniMessage.safe
? MiniMessageWrapper.safe
: unsafe).deserialize(input, placeholders);
}
@ -80,7 +80,7 @@ public class FreedomMiniMessage
public static String serialize(final boolean safe, final Component input)
{
return (safe
? FreedomMiniMessage.safe
? MiniMessageWrapper.safe
: unsafe).serialize(input);
}
}

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.utils.kyori;
package fns.patchwork.kyori;
import java.util.function.Supplier;
import net.kyori.adventure.text.Component;
@ -31,12 +31,12 @@ 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
* functions.
*/
public class FreedomAdventure
public class PlainTextWrapper
{
private static final PlainTextComponentSerializer PLAIN_TEXT_COMPONENT_SERIALIZER =
PlainTextComponentSerializer.plainText();
private FreedomAdventure()
private PlainTextWrapper()
{
throw new UnsupportedOperationException("Instantiation of a static utility class is not supported.");
}

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
import net.kyori.adventure.text.Component;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
import javax.annotation.concurrent.Immutable;
import org.bukkit.permissions.Permission;

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
public interface NodeBuilder
{

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
public enum NodeType
{

View File

@ -21,7 +21,7 @@
* SOFTWARE.
*/
package fns.patchwork.security;
package fns.patchwork.permissible;
import java.util.Set;
import java.util.UUID;

View File

@ -25,7 +25,7 @@ package fns.patchwork.user;
import fns.patchwork.economy.EconomicEntity;
import fns.patchwork.economy.EconomicEntityData;
import fns.patchwork.security.PermissionHolder;
import fns.patchwork.permissible.PermissionHolder;
import net.kyori.adventure.text.Component;
public interface User extends PermissionHolder, EconomicEntity

View File

@ -25,7 +25,7 @@ package fns.patchwork.user;
import fns.patchwork.display.adminchat.AdminChatFormat;
import fns.patchwork.economy.EconomicEntityData;
import fns.patchwork.security.Group;
import fns.patchwork.permissible.Group;
import java.util.UUID;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@ -23,7 +23,7 @@
package fns.patchwork.utils.logging;
import fns.patchwork.utils.kyori.FreedomAdventure;
import fns.patchwork.kyori.PlainTextWrapper;
import java.util.function.Supplier;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.chat.ChatType;
@ -34,19 +34,21 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FreedomLogger implements Audience
public class FNS4J implements Audience
{
private final Logger logger;
private boolean debug = false;
private FreedomLogger(final String moduleName)
public static final FNS4J PATCHWORK = getLogger("Patchwork");
private FNS4J(final String moduleName)
{
this.logger = LoggerFactory.getLogger("FreedomNetworkSuite::" + moduleName);
}
public static FreedomLogger getLogger(final String moduleName)
public static FNS4J getLogger(final String moduleName)
{
return new FreedomLogger(moduleName);
return new FNS4J(moduleName);
}
public void setDebugMode(final boolean debug)
@ -87,7 +89,7 @@ public class FreedomLogger implements Audience
*/
public String infoComponent(final Component component)
{
final String plainText = FreedomAdventure.toPlainText(component);
final String plainText = PlainTextWrapper.toPlainText(component);
logger.info(plainText);
return plainText;
@ -120,7 +122,7 @@ public class FreedomLogger implements Audience
*/
public void warnComponent(final Component component)
{
final String plainText = FreedomAdventure.toPlainText(component);
final String plainText = PlainTextWrapper.toPlainText(component);
logger.warn(plainText);
}
@ -179,7 +181,7 @@ public class FreedomLogger implements Audience
*/
public String errorComponent(final Component component)
{
final String plainText = FreedomAdventure.toPlainText(component);
final String plainText = PlainTextWrapper.toPlainText(component);
logger.error(plainText);
@ -228,7 +230,7 @@ public class FreedomLogger implements Audience
*/
public String debugComponent(final Component component)
{
final String plainText = FreedomAdventure.toPlainText(component);
final String plainText = PlainTextWrapper.toPlainText(component);
this.debug(plainText);