Add static variable to disable bedrock listener (#2254)

* Add static variable to disable bedrock listener

* Add default value

* Add javadoc comment
This commit is contained in:
rtm516 2021-06-05 01:02:10 +01:00 committed by GitHub
parent 4c542ba2c4
commit aaa100b2d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -99,6 +99,12 @@ public class GeyserConnector {
private static GeyserConnector instance; private static GeyserConnector instance;
/**
* This is used in GeyserConnect to stop the bedrock server binding to a port
*/
@Setter
private static boolean shouldStartListener = true;
@Setter @Setter
private AuthType defaultAuthType; private AuthType defaultAuthType;
@ -219,6 +225,8 @@ public class GeyserConnector {
} }
bedrockServer.setHandler(new ConnectorServerEventHandler(this)); bedrockServer.setHandler(new ConnectorServerEventHandler(this));
if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> { bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) { if (throwable == null) {
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
@ -227,6 +235,7 @@ public class GeyserConnector {
throwable.printStackTrace(); throwable.printStackTrace();
} }
}).join(); }).join();
}
if (config.getMetrics().isEnabled()) { if (config.getMetrics().isEnabled()) {
metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger(""));

View file

@ -75,7 +75,7 @@
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.18.4</version> <version>1.18.20</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>