- * The provided logger is adapted to the {@link org.slf4j.Logger}. - * If no logger is provided on Nukkit, Anvil's logger will be used. - * (This means logs will be prefixed with "Anvil" instead of your plugin name) - *
- * - *
- * setLoggerSupplier(MyNukkitPlugin.this::getLogger);
- *
- *
- * @param logger to set.
- */
- Builder setLoggerSupplier(Supplier> logger);
-
- /**
- * This will load your root {@link CommandNode} as
- * defined by your guice module
- *
- * @return {@code this}
- */
- Builder withRootCommand();
-
- /**
- * Called when the {@link Environment} is loaded.
- *
- * - * This {@link Consumer} will be invoked when the {@link Environment} - * is first loaded and on subsequent reloads. - *
- * - *- * This method can be called multiple times on one builder. - * Preexisting listeners will be used and will not be overridden. - *
- * - * @param listener {@link Consumer} to run when this environment is loaded - * @return {@code this} - */ - Builder whenLoaded(Consumer- * This {@link Consumer} will only be invoked when the {@link Environment} - * is loaded for the first time. - *
- * - *- * This method can be called multiple times on one builder. - * Preexisting listeners will be used and will not be overridden. - *
- * - * @param listener {@link Consumer} to run when this environment is ready - * @return {@code this} - */ - Builder whenReady(Consumer- * This {@link Consumer} will only be invoked when the {@link Environment} - * is reloaded, but not when it is first loaded. - *
- * - *- * This method can be called multiple times on one builder. - * Preexisting listeners will be used and will not be overridden. - *
- * - * @param listener {@link Consumer} to run when this environment is reloaded - * @return {@code this} - */ - Builder whenReloaded(Consumer- * Examples: "bungee", "spigot", "sponge", "velocity" - *
- * - * @return A lowercase identifier for the current platform - */ - @Override - String getName(); - - /** - * @return Whether the current platform is a proxy like bungee or velocity - */ - boolean isProxy(); -} diff --git a/anvil-api/src/main/java/org/anvilpowered/anvil/api/ServiceManager.java b/anvil-api/src/main/java/org/anvilpowered/anvil/api/ServiceManager.java deleted file mode 100644 index ff12981f8..000000000 --- a/anvil-api/src/main/java/org/anvilpowered/anvil/api/ServiceManager.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Anvil - AnvilPowered - * Copyright (C) 2020-2021 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see- * If {@code childCommandFallback} is false - * and the first argument does not match a child, a syntax error message will - * be shown to the source. Otherwise, the root command executor will run. - *
- * - * @param root The command to run if no child was specified. - * @param children A map of child commands and their aliases. - * @param childCommandFallback whether to fall back to the root command if the first - * argument did not match a child command alias - * @throws UnsupportedOperationException on Sponge. - * Use {@code CommandSpec} instead. - * @return A routing command - */ - TCommandExecutor generateRoutingCommand( - @Nullable TCommandExecutor root, - Map- * If the userName has changed since the last time this method was called, it will be updated in the database - *
- *- * The boolean values in {@code flags} will be set according to the following rules: - *
- *- * 0 : Whether a new member was created in the database - *
- *- * 1 : Whether userName was updated in the database - *
- *- * 2 : Whether ipAddress was updated in the database - *
- *- * {@code flags} must be an array of length 8. - * There are currently 5 elements reserved for future use - *
- * - * @param userUUID {@link UUID} userUUID of user. - * @param userName {@link String} Name of user. - * @param ipAddress {@link String} IP Address of user. - * @param flags A boolean array of length 8. - * @return An {@link Optional} containing the inserted {@link CoreMember} if successful, otherwise {@link Optional#empty()} - * @throws IllegalArgumentException If {@code flags} is not of length 8 - */ - CompletableFuture- * If the userName has changed since the last time this method was called, it will be updated in the database - *
- * - * @param userUUID {@link UUID} userUUID of user - * @param userName {@link String} Name of user - * @param ipAddress {@link String} IP Address of user - * @return An {@link Optional} containing the inserted {@link CoreMember} if successful, otherwise {@link Optional#empty()} - */ - CompletableFuture- * A user is only banned if {@link CoreMember#isBanned()} is - * true and {@link CoreMember#getBanEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isBanned()} and - * {@link CoreMember#getBanEndUtc()} and sets the member's - * ban status accordingly. - *
- * - * @param coreMember {@link CoreMember} to verify ban for - * @return {@code true} if user is verified to be banned, otherwise {@code false} - */ - boolean checkBanned(CoreMember> coreMember); - - /** - * Verifies whether the {@link CoreMember} matching the provided - * {@link TKey} is in fact banned. - * - *- * A user is only banned if {@link CoreMember#isBanned()} is - * true and {@link CoreMember#getBanEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isBanned()} and - * {@link CoreMember#getBanEndUtc()} and sets the member's - * ban status accordingly. - *
- * - * @param id {@link TKey} id of member to verify ban for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be banned, otherwise {@code false} - */ - CompletableFuture- * A user is only banned if {@link CoreMember#isBanned()} is - * true and {@link CoreMember#getBanEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isBanned()} and - * {@link CoreMember#getBanEndUtc()} and sets the member's - * ban status accordingly. - *
- * - * @param userUUID {@link UUID} userUUID of member to verify ban for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be banned, otherwise {@code false} - */ - CompletableFuture- * A user is only banned if {@link CoreMember#isBanned()} is - * true and {@link CoreMember#getBanEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isBanned()} and - * {@link CoreMember#getBanEndUtc()} and sets the member's - * ban status accordingly. - *
- * - * @param userName {@link String} userUUID of member to verify ban for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be banned, otherwise {@code false} - */ - CompletableFuture- * A user is only muted if {@link CoreMember#isMuted()} is - * true and {@link CoreMember#getMuteEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isMuted()} and - * {@link CoreMember#getMuteEndUtc()} and sets the member's - * mute status accordingly. - *
- * - * @param coreMember {@link CoreMember} to verify mute for - * @return {@code true} if user is verified to be muted, otherwise {@code false} - */ - boolean checkMuted(CoreMember> coreMember); - - /** - * Verifies whether the {@link CoreMember} matching the provided - * {@link TKey} is in fact muted. - * - *- * A user is only muted if {@link CoreMember#isMuted()} is - * true and {@link CoreMember#getMuteEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isMuted()} and - * {@link CoreMember#getMuteEndUtc()} and sets the member's - * mute status accordingly. - *
- * - * @param id {@link TKey} id of member to verify mute for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be muted, otherwise {@code false} - */ - CompletableFuture- * A user is only muted if {@link CoreMember#isMuted()} is - * true and {@link CoreMember#getMuteEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isMuted()} and - * {@link CoreMember#getMuteEndUtc()} and sets the member's - * mute status accordingly. - *
- * - * @param userUUID {@link UUID} userUUID of member to verify mute for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be muted, otherwise {@code false} - */ - CompletableFuture- * A user is only muted if {@link CoreMember#isMuted()} is - * true and {@link CoreMember#getMuteEndUtc()} is in the future. - *
- * - *- * This method checks both {@link CoreMember#isMuted()} and - * {@link CoreMember#getMuteEndUtc()} and sets the member's - * mute status accordingly. - *
- * - * @param userUUID {@link UUID} userUUID of member to verify mute for - * @return {@link CompletableFuture} wrapped {@link Boolean}. - * {@code true} if user is verified to be muted, otherwise {@code false} - */ - CompletableFuture- * Usually used when (updated) data from DB needs to be applied to cache - *
- *- * {@code toCache} will run if and only if: - *
- *- * Usually used when (updated) data from DB needs to be applied to cache - *
- *- * {@code toCache} will run if and only if: - *
- *- * Usually used for editing model data - *
- *- * {@code cacheTransformer} will run if and only if: - *
- *- * Usually used for editing model data - *
- *- * {@code cacheTransformer} will run if and only if: - *
- *- * Usually used for editing model data - *
- *- * {@code cacheTransformer} will run if and only if: - *
- *- * Usually used for retrieving or editing model data - *
- *- * {@code cacheTransformer} will run if and only if: - *
- *- * {@code dbTransformer} will run if and only if: - *
- *- * Usually used for retrieving or editing model data - *
- *- * {@code cacheTransformer} will run if and only if: - *
- *- * A module consists of a {@link Manager} and a (single) {@link Component} - * for every data storage implementation. - *
- *- * The {@link Manager} of a module is its metaphorical gateway. Interactions with - * other modules should (almost always) be done through the {@link Manager}. - * There are, however, some cases where direct access to a component is required. - * One such case is inter-{@link Repository} access that requires compile time - * type safety. Because the {@link Component#getTKeyClass()} type is not known - * to the manager, code that interacts with {@code TKey} must be placed in a - * {@link Component}. - *
- *- * One of the primary functions of a {@link Manager} is to provide the correct - * {@link Component} implementation via {@link #getPrimaryComponent()}. - *
- *- * Implementations of {@link Manager} should consist of methods similar to the - * following: - *
- *- * {@code TString} is the base return type for the methods in a {@link Manager}. - * To build these results use {@link TextService.Builder}. - *
- *- * All methods (with some exceptions) in {@link Manager} should return a form of {@code TString} - * to be displayed directly to the end user. Normally, the return type, {@code TString}, is wrapped in - * a {@link java.util.concurrent.CompletableFuture} in order to keep the main game thread - * free from IO. It is sometimes necessary to further wrap the {@code TString} in a {@link java.util.List} - * when the result is more than a single line. In this case, pagination can be used to display the result - * to the end user. - *
- *- * The following interface signature is an example of a simple {@link Manager}: - *
- *{@code - * public interface FooManager< - * TFoo extends Foo>, - * TString> - * extends Manager- * - * @param> - * }
- * Represents the default singular identifier for this module - *
- *- * Should be overridden by other plugins who change the name of the object. - * Examples: "Clan", "Faction", "Guild", "Member", ... etc - *
- *- * Used in text sent to the player - *
- * - * @return The default singular identifier for this module - */ - String getDefaultIdentifierSingularUpper(); - - /** - *- * Represents the default plural identifier for this module - *
- *- * Should be overridden by other plugins who change the name of party. - * Examples: "Clans", "Factions", "Guilds", "Members" ... etc - *
- *- * Used in text sent to the player - *
- * - * @return The default plural identifier for this module - */ - String getDefaultIdentifierPluralUpper(); - - /** - *- * Represents the default singular identifier for this module - *
- *- * Should be overridden by other plugins who change the name of party. - * Examples: "clan", "faction", "guild", "member" ... etc - *
- *- * Used in text sent to the player - *
- * - * @return The default singular identifier for this module - */ - String getDefaultIdentifierSingularLower(); - - /** - *- * Represents the default plural identifier for this module - *
- *- * Should be overridden by other plugins who change the name of party. - * Examples: "clans", "factions", "guilds", "members" ... etc - *
- *- * Used in text sent to the player - *
- * - * @return The default plural identifier for this module - */ - String getDefaultIdentifierPluralLower(); - - /** - * Provides the current {@link Component} as defined by - * {@link Keys#DATA_STORE_NAME} in the current {@link Registry}. - * - *- * The current {@link Component} implementation is defined as the - * implementation provided by Guice that meets the following criteria: - *
- *- * The value for {@link Keys#DATA_STORE_NAME} found by - * the the current {@link Registry} must match (ignored case) a registered - * datastore implementation. This can be one of the following predefined values: - *
- *- * or a custom value defined by your guice module. - *
- *- * For example, 'mongodb' (or any capitalization thereof) will match - * a {@link Component} annotated with {@link Named}{@code (value = "mongodb"} - *
- *- * Use {@link BindingExtensions} to bind your component implementations - *
- * - * @return The current {@link Component} implementation - * @throws IllegalStateException If the config has not been loaded yet, - * or if no implementation was found - * @see Component - * @see BindingExtensions - */ - C getPrimaryComponent(); -} diff --git a/anvil-api/src/main/java/org/anvilpowered/anvil/api/datastore/MongoContext.java b/anvil-api/src/main/java/org/anvilpowered/anvil/api/datastore/MongoContext.java deleted file mode 100644 index d0ca5ec3b..000000000 --- a/anvil-api/src/main/java/org/anvilpowered/anvil/api/datastore/MongoContext.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Anvil - AnvilPowered - * Copyright (C) 2020-2021 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see