Skip to content

Conversation

@SpaceWalkerRS
Copy link
Member

Similar to #46 but for the server, this PR adds a simple wrapper class for retrieving the current MinecraftServer instance. This is useful given that MinecraftServer::getInstance was only present in some versions.

The class looks as follows:

public class MinecraftServerInstance {

	public static MinecraftServer get() {
		return MinecraftServerAccess.getInstance();
	}
}

Internally this returns the instance if it is available, and otherwise throws an IllegalStateException. The instance is available from the start of the run method until the end of the shutdown method.

@SpaceWalkerRS
Copy link
Member Author

Should there be other getters for integrated/dedicated servers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants