Package wtf.choco.veinminer.platform
Interface ServerPlatform
- All Known Implementing Classes:
BukkitServerPlatform
public interface ServerPlatform
A bridge interface for various implementing platforms.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
Represents VeinMiner's details. -
Method Summary
Modifier and TypeMethodDescriptionGet the string representation of keys of all registered blocks on the server.Get the string representation of keys of all registered items on the server.@Nullable BlockType
getBlockType
(@NotNull String type) Construct a newBlockType
from a string.@NotNull ServerCommandRegistry
Get an instance of theServerCommandRegistry
.@NotNull VeinMinerConfiguration
Get theVeinMinerConfiguration
instance for this server platform.@NotNull ServerEventDispatcher
Get an instance of theServerEventDispatcher
.@Nullable ItemType
getItemType
(@NotNull String type) Construct a newItemType
from a string.@NotNull Logger
Get VeinMiner'sLogger
.@NotNull Collection<? extends PlatformPlayer>
Get all online players.@NotNull PlatformPermission
getOrRegisterPermission
(String permission, Supplier<String> description, PlatformPermission.Default permissionDefault) Get thePlatformPermission
with the given name, or register it with the given description and default value if it does not exist.@NotNull PlatformPlayer
getPlatformPlayer
(@NotNull UUID playerUUID) Create aPlatformPlayer
instance for the player with the given UUID.@Nullable BlockState
Construct a newBlockState
from a string.@NotNull UpdateChecker
Get an instance of theUpdateChecker
.@NotNull ServerPlatform.VeinMinerDetails
Get the details of the currently installed VeinMiner plugin.@NotNull File
Get theFile
directory where VeinMiner's files are located.void
runTaskAsynchronously
(@NotNull Runnable runnable) Run the givenRunnable
task asynchronously.void
runTaskLater
(@NotNull Runnable runnable, int ticks) Run the givenRunnable
task the given amount of ticks later.
-
Method Details
-
getVeinMinerDetails
Get the details of the currently installed VeinMiner plugin.- Returns:
- the vein miner details
-
getVeinMinerPluginDirectory
Get theFile
directory where VeinMiner's files are located.- Returns:
- VeinMiner's plugin directory
-
getLogger
Get VeinMiner'sLogger
.- Returns:
- the logger
-
getConfig
Get theVeinMinerConfiguration
instance for this server platform.- Returns:
- the config
-
getState
Construct a newBlockState
from a string.The string passed to this method must be a fully-qualified state understood by Minecraft. For instance,
"minecraft:chest[waterlogged=true,facing=south]"
(excluding the quotation marks). States are entirely optional and a simple block type may be passed as well, in which case the default BlockState will be returned.getState("minecraft:chest[waterlogged=true,facing=south]"); getState("button[powered=false]"); getState("minecraft:air"); getState("torch");
- Parameters:
state
- the state string from which to create a BlockState- Returns:
- the created BlockState, or null if an invalid string
-
getBlockType
Construct a newBlockType
from a string.The string passed to this method must be a type of block registered to Minecraft.
getBlockType("minecraft:stone"); getBlockType("diamond_ore");
- Parameters:
type
- the type string from which to create a BlockType- Returns:
- the created BlockType, or null if an unknown type
-
getItemType
Construct a newItemType
from a string.The string passed to this method must be a type of item registered to Minecraft.
getBlockType("minecraft:apple"); getBlockType("diamond_ore"); // While it is a block, it also has an item
- Parameters:
type
- the type string from which to create an ItemType- Returns:
- the created ItemType, or null if an unknown type
-
getAllBlockTypeKeys
Get the string representation of keys of all registered blocks on the server.- Returns:
- all block type keys
-
getAllItemTypeKeys
Get the string representation of keys of all registered items on the server.- Returns:
- all item type keys
-
getPlatformPlayer
Create aPlatformPlayer
instance for the player with the given UUID.- Parameters:
playerUUID
- the player UUID- Returns:
- the platform player
-
getOnlinePlayers
Get all online players.- Returns:
- all online players
-
getOrRegisterPermission
@NotNull @NotNull PlatformPermission getOrRegisterPermission(String permission, Supplier<String> description, PlatformPermission.Default permissionDefault) Get thePlatformPermission
with the given name, or register it with the given description and default value if it does not exist.- Parameters:
permission
- the permission name to get (or register)description
- a description provider if the permission does not exist and needs to be registeredpermissionDefault
- the default permission value- Returns:
- the permission
-
getEventDispatcher
Get an instance of theServerEventDispatcher
.- Returns:
- the event dispatcher
-
getCommandRegistry
Get an instance of theServerCommandRegistry
.- Returns:
- the command registry
-
getUpdateChecker
Get an instance of theUpdateChecker
.- Returns:
- the update checker
-
runTaskLater
Run the givenRunnable
task the given amount of ticks later.- Parameters:
runnable
- the task to runticks
- the amount of time (in ticks) after which to run the task
-
runTaskAsynchronously
Run the givenRunnable
task asynchronously.- Parameters:
runnable
- the task to run
-