-
Notifications
You must be signed in to change notification settings - Fork 0
Connection Module
This module allows you to host and connect to a server. The server forwards requests to a NBTDatabaseAccess. You can browse entries in a server directly by entering the server's address into a browser (ie. Chrome, Firefox, etc.).
The standard port is 28260, which should be used whenever possible!
This interface allows you to send requests to an NBTDatabase. See the File Module for an example of the types of requests that can be made. Instead of returning values directly, all of the methods return a CompletableFuture. There are two implementations:
-
LocalNBTDatabaseAccess: Simply wraps aNBTDatabase. Note that requests are still executed on a different thread, so this could be useful for async requests. This will most commonly be used for the constructor of aNBTDatabaseAccessServer. -
RemoteNBTDatabaseAccess: Connects to aNBTDatabaseAccessServer. It is possible to pass this into the constructor of aNBTDatabaseAccessServer, which would act as a reverse proxy. This will most commonly be used to execute requests on a remoteNBTDatabasedirectly, rather than starting a second server.
This allows other people to connect to your database. (Note that you will need to do the normal port forwarding stuff.) The server accepts three different protocols:
- NBT Protocol: Indicated with the magic bytes 0x6E, 0x62, and 0x74 ("nbt" in ASCII). This is the protocol used internally by the
RemoteNBTDatabaseAccess. The first packet must be aProtocolVersionPacket. - HTTP (not upgraded): The server will return a website that only allows reading entries, not writing.
- WebSocket (upgraded from HTTP): This allows for NBT Protocol over WebSocket. The magic bytes shouldn't be sent. Each WebSocket message is one NBT Protocol packet.
This interface allows requests to be rejected based on the user sending it. There are several implementations:
-
AllowAuthorizationManager: Allows all requests. -
PermissionAuthorizationManager: Allows requests based on aPermissionManager. -
CachedAuthorizationManager: WrapsAuthorizationManagers to cache theAuthorizationCheckobjects.
This interface allows permissions to be granted for use by the PermissionAuthorizationManager. There are two implementations:
-
GlobalPermissionManager: Holds aSet<String>of granted permissions. -
UserMapPermissionManager: Holds aSet<String>of global permissions along with aMap<UUID, Map<String, Boolean>>of user-specific tweaks.