Class AbstractServer
java.lang.Object
org.geysermc.mcprotocollib.network.server.AbstractServer
- All Implemented Interfaces:
Server
- Direct Known Subclasses:
NetworkServer
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractServer(SocketAddress bindAddress, Supplier<? extends MinecraftProtocol> protocolSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ServerListener listener) Adds a listener to this server.voidaddSession(Session session) bind()Binds the listener to its host and port.bind(boolean wait) Binds the listener to its host and port.Binds the listener to its host and port.protected abstract voidprotected voidcallEvent(ServerEvent event) voidclose()Closes the listener.voidclose(boolean wait) Closes the listener.voidCloses the listener.protected abstract voidprotected MinecraftProtocolGets the bind address the server is listening on.Gets this server's set flags.<T> TgetGlobalFlagSupplied(Flag<T> flag, Supplier<T> defSupplier) Gets the value of the given flag as an instance of the given type.Gets the listeners listening on this session.Supplier<? extends MinecraftProtocol>Gets the packet protocol of the server.Gets all sessions belonging to this server.booleanhasGlobalFlag(Flag<?> flag) Checks whether this server has a flag set.voidremoveListener(ServerListener listener) Removes a listener from this server.voidremoveSession(Session session) <T> voidsetGlobalFlag(Flag<T> flag, T value) Sets the value of a flag.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.mcprotocollib.network.Server
getGlobalFlag, getGlobalFlag, isListening
-
Constructor Details
-
AbstractServer
public AbstractServer(SocketAddress bindAddress, Supplier<? extends MinecraftProtocol> protocolSupplier)
-
-
Method Details
-
getBindAddress
Description copied from interface:ServerGets the bind address the server is listening on.- Specified by:
getBindAddressin interfaceServer- Returns:
- The listening bind address.
-
getPacketProtocol
Description copied from interface:ServerGets the packet protocol of the server.- Specified by:
getPacketProtocolin interfaceServer- Returns:
- The server's packet protocol.
-
createPacketProtocol
-
getGlobalFlags
Description copied from interface:ServerGets this server's set flags.- Specified by:
getGlobalFlagsin interfaceServer- Returns:
- This server's flags.
-
hasGlobalFlag
Description copied from interface:ServerChecks whether this server has a flag set.- Specified by:
hasGlobalFlagin interfaceServer- Parameters:
flag- Flag to check for.- Returns:
- Whether this server has a flag set.
-
getGlobalFlagSupplied
Description copied from interface:ServerGets the value of the given flag as an instance of the given type. If the flag is not set, the specified default value will be returned.- Specified by:
getGlobalFlagSuppliedin interfaceServer- Type Parameters:
T- Type of the flag.- Parameters:
flag- Flag to check for.defSupplier- Default value supplier.- Returns:
- Value of the flag.
-
setGlobalFlag
Description copied from interface:ServerSets the value of a flag. The flag will be used in sessions if a session does not contain a value for the flag.- Specified by:
setGlobalFlagin interfaceServer- Type Parameters:
T- Type of the flag.- Parameters:
flag- Flag to check for.value- Value to set the flag to.
-
getListeners
Description copied from interface:ServerGets the listeners listening on this session.- Specified by:
getListenersin interfaceServer- Returns:
- This server's listeners.
-
addListener
Description copied from interface:ServerAdds a listener to this server.- Specified by:
addListenerin interfaceServer- Parameters:
listener- Listener to add.
-
removeListener
Description copied from interface:ServerRemoves a listener from this server.- Specified by:
removeListenerin interfaceServer- Parameters:
listener- Listener to remove.
-
callEvent
-
getSessions
Description copied from interface:ServerGets all sessions belonging to this server.- Specified by:
getSessionsin interfaceServer- Returns:
- Sessions belonging to this server.
-
addSession
-
removeSession
-
bind
Description copied from interface:ServerBinds the listener to its host and port. -
bind
Description copied from interface:ServerBinds the listener to its host and port. -
bind
Description copied from interface:ServerBinds the listener to its host and port. -
bindImpl
-
close
public void close()Description copied from interface:ServerCloses the listener. -
close
public void close(boolean wait) Description copied from interface:ServerCloses the listener. -
close
Description copied from interface:ServerCloses the listener. -
closeImpl
-