Interface PlatformServerAdapter
public interface PlatformServerAdapter
Platform adapter for server-related operations in FlectonePulse.
Abstracts platform-specific server APIs for cross-platform compatibility.
- Since:
- 0.8.1
-
Method Summary
Modifier and TypeMethodDescription@NonNull ObjectbuildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String lore) Builds an item stack with lore.@NonNull ObjectbuildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String[] lore) Builds an item stack with lore.voiddispatchCommand(@NonNull String command) Dispatches a command to the server console.intGenerates a new entity ID.@Nullable StringgetIcon()Gets the server icon.@NonNull StringgetItemName(@NonNull Object item) Gets the Minecraft name of an item.intGets the maximum player count for the server.@NonNull ObjectgetMOTD()Gets the server MOTD.intGets the current online player count.intGets the platform-specific online player count.@NonNull PlatformTypeGets the platform type.default @Nullable InputStreamgetResource(@NonNull String path) Gets an input stream for the specified resource path.@NonNull StringReturns the name of the server core.@NonNull StringReturns server UUID.Returns server version.@NonNull StringGets the current server TPS (ticks per second) for a specific entity.@NonNull FileGets the server's whitelist file.booleanhasProject(@NonNull String projectName) Checks if a project/resource is available on the server.booleanChecks if the server is currently in online mode.booleanisOnlyPlayerOnline(UUID uuid) Checks if the server has only the specified player online or no players at all.booleanChecks if the current thread is the primary server thread.default voidsaveResource(@NonNull Path projectPath, @NonNull String path) Saves a resource to the plugin data folder.@NonNull net.kyori.adventure.text.ComponenttranslateItemName(@NonNull Object item, @NonNull UUID messageUUID, boolean translatable) Translates an item name with optional localization.
-
Method Details
-
dispatchCommand
Dispatches a command to the server console.- Parameters:
command- the command string to execute
-
getTPS
-
getMaxPlayers
int getMaxPlayers()Gets the maximum player count for the server.- Returns:
- maximum allowed players
-
getOnlinePlayerCount
int getOnlinePlayerCount()Gets the current online player count.- Returns:
- number of online players
-
getPlatformPlayerCount
int getPlatformPlayerCount()Gets the platform-specific online player count.- Returns:
- number of online players
-
generateEntityId
int generateEntityId()Generates a new entity ID.- Returns:
- entity ID
-
getServerCore
@NonNull String getServerCore()Returns the name of the server core.- Returns:
- a string representing the name of the server core
-
getServerUUID
-
getServerVersionName
-
getPlatformType
-
getMOTD
-
getIcon
@Nullable String getIcon()Gets the server icon.- Returns:
- the server icon as a string, or null if unavailable
-
getWhitelistFile
@NonNull File getWhitelistFile()Gets the server's whitelist file.- Returns:
- the whitelist File object, never null
-
hasProject
Checks if a project/resource is available on the server.- Parameters:
projectName- name of the project/resource to check- Returns:
- true if the project is available, false otherwise
-
isOnlineMode
boolean isOnlineMode()Checks if the server is currently in online mode.- Returns:
- true if the server is in online mode, false otherwise
-
isOnlyPlayerOnline
Checks if the server has only the specified player online or no players at all.- Parameters:
uuid- the UUID of the player to check for exclusive presence- Returns:
- true if only the specified player is online or if no players are online, false if multiple other players are present
-
isPrimaryThread
boolean isPrimaryThread()Checks if the current thread is the primary server thread.- Returns:
- true if on primary thread
-
getItemName
-
getResource
Gets an input stream for the specified resource path.- Parameters:
path- resource path (classpath relative)- Returns:
- InputStream or null if not found
-
saveResource
Saves a resource to the plugin data folder.- Parameters:
path- the resource path- Throws:
IOException
-
translateItemName
@NonNull net.kyori.adventure.text.Component translateItemName(@NonNull Object item, @NonNull UUID messageUUID, boolean translatable) Translates an item name with optional localization.- Parameters:
item- the platform-specific item objectmessageUUID- the message UUID for cachingtranslatable- whether the name should be translated- Returns:
- translated item name component
-
buildItemStack
@NonNull Object buildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String lore) Builds an item stack with lore.- Parameters:
fPlayer- the player receiving the itemmaterial- the item materialtitle- the item titlelore- the item lore- Returns:
- the built item stack
-
buildItemStack
@NonNull Object buildItemStack(@NonNull FPlayer fPlayer, @NonNull String material, @NonNull String title, @NonNull String[] lore) Builds an item stack with lore.- Parameters:
fPlayer- the player receiving the itemmaterial- the item materialtitle- the item titlelore- the item lore lines- Returns:
- the built item stack
-