Interface ServerConnector
- All Known Implementing Classes:
BukkitServerProvider
,PaperServerProvider
,SpongeServerProvider
public interface ServerConnector
Acts like a bridge between various server software and classes specific to each
server software such as opening menus, and sending messages.
- Since:
- 0.1.2.0
- Author:
- creatorfromhell
-
Method Summary
Modifier and TypeMethodDescription<S,
T extends net.tnemc.item.AbstractItemStack<S>, INV>
net.tnemc.item.providers.CalculationsProvider<T, S, INV> Returns the name of the default world.findPlayer
(@NotNull UUID identifier) Attempts to find aplayer
based on anidentifier
.Used to locate a username for a specific name.Used to locate a UUID for a specific name.default UUID
Used to get a cached UUID based on a username.@Nullable InputStream
getResource
(@NotNull String filename) Retrieves an input stream for the specified filename from the resources.initializePlayer
(@NotNull Object player) This is used to return an instance of anplayer
based on the provided instance's player object.name()
The name of this implementation.boolean
Used to determine if a player with the specified username is online.int
Used to get the amount of online players.boolean
playedBefore
(String name) Used to determine if a player with the specified username has played before.boolean
playedBefore
(UUID uuid) Used to determine if this player has played on this server before.default Pattern
Returns thepattern
utilized to determine if a string is a valid player username.default boolean
pluginAvailable
(String name) Determines if a plugin with the correlating name is currently installed.proxy()
The proxy provider to use for this implementation.void
registerCrafting
(@NotNull String key, @NotNull CraftingRecipe recipe) Used to register a crafting recipe to the server.replaceColours
(String string, boolean strip) Used to replace colour codes in a string.replacePlaceholder
(UUID player, String message) Used to replace placeholders from a string.void
saveResource
(String path, boolean replace) Used to save a resource from the plugin's jar file to the local system's storage.Provides this implementation'sscheduler
.CmdSource
<?> source
(@NotNull revxrsal.commands.command.CommandActor actor) Used to convert anCommandActor
to aCmdSource
.net.tnemc.item.AbstractItemStack
<?> Provides direct access to the implementation's instance of TNIL's AbstractItemStack, which acts as a builder.
-
Method Details
-
name
The name of this implementation.- Returns:
- The name of the implementation.
-
replacePlaceholder
Used to replace placeholders from a string.- Parameters:
player
- The player to use for the placeholder replacement.message
- The message to replace placeholders in.- Returns:
- The string after placeholders have been replaced.
-
proxy
The proxy provider to use for this implementation.- Returns:
- The proxy provider to use for this implementation.
-
source
Used to convert anCommandActor
to aCmdSource
.- Returns:
- The
CmdSource
for this actor.
-
onlinePlayers
int onlinePlayers()Used to get the amount of online players.- Returns:
- The amount of online players.
-
findPlayer
Attempts to find aplayer
based on anidentifier
.- Parameters:
identifier
- The identifier- Returns:
- An Optional containing the located
player
, or an empty Optional if no player is located.
-
initializePlayer
This is used to return an instance of anplayer
based on the provided instance's player object.- Parameters:
player
- The instance of the player.- Returns:
- The initialized
player object
.
-
getCached
Used to get a cached UUID based on a username.- Parameters:
name
- The name to use for the check.- Returns:
- The UUID from the cached player. If no data with the player name exists, this will not check the MojangAPI, it'll instead generate a random UUID.
-
playedBefore
Used to determine if this player has played on this server before.- Parameters:
uuid
- TheUUID
that is associated with the player.- Returns:
- True if the player has played on the server before, otherwise false.
-
playedBefore
Used to determine if a player with the specified username has played before.- Parameters:
name
- The username to search for.- Returns:
- True if someone with the specified username has played before, otherwise false.
-
online
Used to determine if a player with the specified username is online.- Parameters:
name
- The username to search for.- Returns:
- True if someone with the specified username is online.
-
fromName
Used to locate a UUID for a specific name. This could be called from either a primary or secondary thread, and should not call back to the Mojang API ever.- Parameters:
name
- The name to use for the search.- Returns:
- An optional containing the UUId if exists, otherwise false.
-
fromID
Used to locate a username for a specific name. This could be called from either a primary or secondary thread, and should not call back to the Mojang API ever.- Parameters:
id
- TheUUID
to use for the search.- Returns:
- An optional containing the name if exists, otherwise false.
-
playerMatcher
Returns thepattern
utilized to determine if a string is a valid player username.- Returns:
- The
pattern
to use for determining if a string is a valid player username. - See Also:
-
defaultWorld
Returns the name of the default world.- Returns:
- The name of the default world.
-
pluginAvailable
Determines if a plugin with the correlating name is currently installed.- Parameters:
name
- The name to use for our check.- Returns:
- True if a plugin with that name exists, otherwise false.
-
replaceColours
Used to replace colour codes in a string.- Parameters:
string
- The string to format.strip
- If true, the color codes are striped from the string.- Returns:
- The formatted string.
-
stackBuilder
net.tnemc.item.AbstractItemStack<?> stackBuilder()Provides direct access to the implementation's instance of TNIL's AbstractItemStack, which acts as a builder.- Returns:
- The software's implementation of
AbstractItemStack
.
-
saveResource
Used to save a resource from the plugin's jar file to the local system's storage.- Parameters:
path
- The path to the resource inside the jar.replace
- If the file exists in the local system's storage, should it be replaced?
-
getResource
Retrieves an input stream for the specified filename from the resources.- Parameters:
filename
- The name of the file to retrieve from the resources. Cannot be null.- Returns:
- An input stream for the specified file, or null if the file is not found in the resources.
-
scheduler
Provides this implementation'sscheduler
.- Returns:
- The scheduler for this implementation.
-
registerCrafting
Used to register a crafting recipe to the server.- Parameters:
key
- The key for the crafting recipe to be registered.recipe
- The crafting recipe to register.- See Also:
-
calculations
<S,T extends net.tnemc.item.AbstractItemStack<S>, net.tnemc.item.providers.CalculationsProvider<T,INV> S, calculations()INV>
-