Interface ViaPlatform<T>
- Type Parameters:
T- - The player type for the platform, used for API related methods
- All Known Subinterfaces:
ViaServerProxyPlatform<T>
public interface ViaPlatform<T>
ViaPlatform represents a platform ViaVersion runs on
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether the platform might be reloading.default LoggercreateLogger(String name) Creates a logger for the given name.getApi()Get the API for this platformgetConf()Get the config API for this platformGet ViaVersions's data folder.default com.google.gson.JsonObjectgetDump()Gets optional platform specific data for /viaversion dump.Get the logger for this platformGet the platform nameGet the platform versiondefault StringGet the plugin version.default Collection<UnsupportedSoftware>Returns an immutable collection of classes to be checked as unsupported software with their software name.default booleanReturns whether the platform has a plugin/mod with the given name (even if disabled).default booleanisProxy()Returns true if the server Via is running on is a proxy server.default booleankickPlayer(UserConnection connection, String message) Kick a player for a reasondefault voidmodifyPlayerDetails(UserConnection connection, com.google.gson.JsonObject payload) Modify the player details payload before it is sent.default voidmodifyServerDetails(UserConnection connection, com.google.gson.JsonObject payload) Modify the server details payload before it is sent.default voidonReload()Called when ViaVersion is initialized twice during the same process, this happens on platforms where ViaVersion is loaded as a plugin which can be reloaded.default PlatformTaskRun a task Asyncdefault PlatformTaskrunRepeatingAsync(Runnable runnable, long ticks) Run a task async at a repeating interval.default PlatformTaskrunRepeatingSync(Runnable runnable, long period) Runs a synchronous task at a repeating interval.default PlatformTaskRun a task Syncdefault PlatformTaskRuns a synchronous task after a delay in ticks.default voidsendCustomPayload(UserConnection connection, String channel, byte[] message) Send a custom payload to from a player to the server.default voidsendCustomPayloadToClient(UserConnection connection, String channel, byte[] message) Send a custom payload from the server to a player.default voidsendMessage(UserConnection connection, String message) Send a message to a player
-
Method Details
-
getLogger
Logger getLogger()Get the logger for this platform- Returns:
- Java Logger (may be a wrapper)
-
createLogger
Creates a logger for the given name. Returns the main platform logger by default- Parameters:
name- The name of the logger- Returns:
- The logger
-
getPlatformName
String getPlatformName()Get the platform name- Returns:
- Platform Name (simply its name)
-
getPlatformVersion
String getPlatformVersion()Get the platform version- Returns:
- Platform version
-
isProxy
default boolean isProxy()Returns true if the server Via is running on is a proxy server.- Returns:
- true if the platform is a proxy
-
getPluginVersion
Get the plugin version.- Returns:
- Plugin version as a semver string
-
runAsync
Run a task Async- Parameters:
runnable- The task to run- Returns:
- The Task ID
-
runRepeatingAsync
Run a task async at a repeating interval.- Parameters:
runnable- The task to runticks- The interval to run it at- Returns:
- The Task ID
-
runSync
Run a task Sync- Parameters:
runnable- The task to run- Returns:
- The Task ID
-
runSync
Runs a synchronous task after a delay in ticks.- Parameters:
runnable- task to rundelay- delay in ticks to run it after- Returns:
- created task
-
runRepeatingSync
Runs a synchronous task at a repeating interval.- Parameters:
runnable- task to runperiod- period in ticks to run at- Returns:
- created task
-
sendMessage
Send a message to a player- Parameters:
connection- The UserConnectionmessage- The message to send
-
kickPlayer
Kick a player for a reason- Parameters:
connection- The UserConnectionmessage- The message to kick them with- Returns:
- True if it was successful
-
modifyPlayerDetails
Modify the player details payload before it is sent. This method allows adding, changing, or removing fields from the payload. It is only called ifViaVersionConfig.sendPlayerDetails()is true.- Parameters:
connection- The UserConnectionpayload- The constructed payload to modify
-
modifyServerDetails
Modify the server details payload before it is sent. This method allows adding, changing, or removing fields from the payload. It is only called ifViaVersionConfig.sendPlayerDetails()is true.- Parameters:
connection- The UserConnectionpayload- The constructed payload to modify
-
sendCustomPayload
Send a custom payload to from a player to the server.- Parameters:
connection- The UserConnectionchannel- The channel to send the payload onmessage- The data to send
-
sendCustomPayloadToClient
Send a custom payload from the server to a player.- Parameters:
connection- The UserConnectionchannel- The channel to send the payload onmessage- The data to send
-
getApi
Get the API for this platform- Returns:
- The API for the platform
-
getConf
ViaVersionConfig getConf()Get the config API for this platform- Returns:
- The config API
-
getDataFolder
File getDataFolder()Get ViaVersions's data folder.- Returns:
- data folder
-
onReload
default void onReload()Called when ViaVersion is initialized twice during the same process, this happens on platforms where ViaVersion is loaded as a plugin which can be reloaded. -
getDump
default com.google.gson.JsonObject getDump()Gets optional platform specific data for /viaversion dump. This can be a specific version or a list of installed plugins on the platform.- Returns:
- The json data
-
getUnsupportedSoftwareClasses
Returns an immutable collection of classes to be checked as unsupported software with their software name. If any of the classes exist at runtime, a warning about their potential instability will be given to the console.- Returns:
- immutable collection of unsupported software to be checked
-
hasPlugin
Returns whether the platform has a plugin/mod with the given name (even if disabled).- Parameters:
name- plugin or identifier- Returns:
- whether the platform has a plugin/mod with the given name
-
couldBeReloading
default boolean couldBeReloading()Returns whether the platform might be reloading.- Returns:
- whether the platform might be reloading
-