public class Nyx extends Object
Singleton central object of the whole server.
Modifier and Type | Class and Description |
---|---|
static class |
Nyx.NyxBuilder |
Modifier and Type | Method and Description |
---|---|
void |
addShutdownTask(Runnable runnable)
Adds a
Runnable task that will be run after the last server tick is completed. |
static Nyx.NyxBuilder |
builder() |
CommandManager |
getCommandManager()
The
CommandManager for this server. |
NyxConfig |
getConfig()
The loaded
nyx.xml config file |
ConsoleReader |
getConsole()
A thread in charge of reading command input from console (
System.in ). |
File |
getDataPath()
The parent directory of all simple loaded and saved data of this server instance.
|
static Nyx |
getInstance()
The singleton instance of Nyx
|
org.apache.logging.log4j.Logger |
getLog()
The
log4j2 logger for this server |
Map<String,ModuleManager<?>> |
getModuleManagers()
An internal list of module managers used to accept modules
|
File |
getModulePath()
The directory where JAR module files are loaded
|
NetworkManager |
getNetwork()
The
NetworkManager for this server. |
PlayerManager |
getPlayers()
The
PlayerManager for this server. |
List<Runnable> |
getShutdownTasks()
A list of tasks to run after the last tick of the server is completed.
|
Ticker |
getTicker()
Ticker is the server's core pacemaker. |
void |
shutdown()
Causes the current server tick to be the last tick that runs, followed by running the
shutdownTasks . |
public void addShutdownTask(Runnable runnable)
Adds a Runnable
task that will be run after the last server tick is completed.
runnable
- the task to runpublic void shutdown()
Causes the current server tick to be the last tick that runs, followed by running the shutdownTasks
.
This method will not block until the last server tick is completed. Actually, this method should only be triggered from the main thread, i.e. from a server tick.
public static Nyx.NyxBuilder builder()
public static Nyx getInstance()
public File getModulePath()
The directory where JAR module files are loaded
Can be specified from command line using the -m
(--module-path
) option.
public File getDataPath()
The parent directory of all simple loaded and saved data of this server instance.
Can be specified from command line using the -d
(--data-path
) option.
Developers who clone this project should set this path to an outside directory or one of the files listed in
.gitignore
. The /data/
entry was designated for this use.
public org.apache.logging.log4j.Logger getLog()
The log4j2 logger
for this server
public NyxConfig getConfig()
The loaded nyx.xml
config file
public Map<String,ModuleManager<?>> getModuleManagers()
An internal list of module managers used to accept modules
public Ticker getTicker()
Ticker
is the server's core pacemaker. Manages the main loop that keeps the server on.
public NetworkManager getNetwork()
The NetworkManager
for this server.
public PlayerManager getPlayers()
The PlayerManager
for this server.
public CommandManager getCommandManager()
The CommandManager
for this server.
public ConsoleReader getConsole()
A thread in charge of reading command input from console (System.in
).
Copyright © 2016. All rights reserved.