forked from GeyserMC/Geyser
Add PlatformType enum and add bStats platform chart
This commit is contained in:
parent
0960ab2365
commit
1fbbb87689
5 changed files with 30 additions and 6 deletions
|
@ -26,6 +26,7 @@
|
||||||
package org.geysermc.platform.bukkit;
|
package org.geysermc.platform.bukkit;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ public class GeyserBukkitPlugin extends JavaPlugin implements IGeyserBootstrap {
|
||||||
|
|
||||||
geyserLogger = new GeyserBukkitLogger(getLogger(), geyserConfig.isDebugMode());
|
geyserLogger = new GeyserBukkitLogger(getLogger(), geyserConfig.isDebugMode());
|
||||||
|
|
||||||
GeyserConnector.start(this);
|
GeyserConnector.start(PlatformType.BUKKIT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
|
|
||||||
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ public class GeyserBungeePlugin extends Plugin implements IGeyserBootstrap {
|
||||||
|
|
||||||
geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
|
geyserLogger = new GeyserBungeeLogger(getLogger(), geyserConfig.isDebugMode());
|
||||||
|
|
||||||
GeyserConnector.start(this);
|
GeyserConnector.start(PlatformType.BUNGEECORD, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
package org.geysermc.platform.standalone;
|
package org.geysermc.platform.standalone;
|
||||||
|
|
||||||
import org.fusesource.jansi.AnsiConsole;
|
import org.fusesource.jansi.AnsiConsole;
|
||||||
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.utils.FileUtils;
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
|
@ -62,7 +63,7 @@ public class GeyserBootstrap implements IGeyserBootstrap {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GeyserConnector connector = GeyserConnector.start(this);
|
GeyserConnector connector = GeyserConnector.start(PlatformType.STANDALONE, this);
|
||||||
|
|
||||||
ConsoleCommandReader consoleReader = new ConsoleCommandReader(connector);
|
ConsoleCommandReader consoleReader = new ConsoleCommandReader(connector);
|
||||||
consoleReader.startConsole();
|
consoleReader.startConsole();
|
||||||
|
|
17
common/src/main/java/org/geysermc/common/PlatformType.java
Normal file
17
common/src/main/java/org/geysermc/common/PlatformType.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package org.geysermc.common;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PlatformType {
|
||||||
|
|
||||||
|
BUKKIT("Bukkit"),
|
||||||
|
BUNGEECORD("BungeeCord"),
|
||||||
|
SPONGE("Sponge"),
|
||||||
|
STANDALONE("Standalone"),
|
||||||
|
VELOCITY("Velocity");
|
||||||
|
|
||||||
|
private String platformName;
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ import com.nukkitx.protocol.bedrock.v388.Bedrock_v388;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
import org.geysermc.common.bootstrap.IGeyserBootstrap;
|
||||||
import org.geysermc.common.logger.IGeyserLogger;
|
import org.geysermc.common.logger.IGeyserLogger;
|
||||||
import org.geysermc.connector.command.GeyserCommandMap;
|
import org.geysermc.connector.command.GeyserCommandMap;
|
||||||
|
@ -77,15 +78,17 @@ public class GeyserConnector {
|
||||||
private PingPassthroughThread passthroughThread;
|
private PingPassthroughThread passthroughThread;
|
||||||
|
|
||||||
private BedrockServer bedrockServer;
|
private BedrockServer bedrockServer;
|
||||||
|
private PlatformType platformType;
|
||||||
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
private GeyserConnector(IGeyserConfiguration config, IGeyserLogger logger) {
|
private GeyserConnector(PlatformType platformType, IGeyserConfiguration config, IGeyserLogger logger) {
|
||||||
long startupTime = System.currentTimeMillis();
|
long startupTime = System.currentTimeMillis();
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.platformType = platformType;
|
||||||
|
|
||||||
logger.info("******************************************");
|
logger.info("******************************************");
|
||||||
logger.info("");
|
logger.info("");
|
||||||
|
@ -124,6 +127,7 @@ public class GeyserConnector {
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("servers", () -> 1));
|
metrics.addCustomChart(new Metrics.SingleLineChart("servers", () -> 1));
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("players", players::size));
|
metrics.addCustomChart(new Metrics.SingleLineChart("players", players::size));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("authMode", config.getRemote()::getAuthType));
|
metrics.addCustomChart(new Metrics.SimplePie("authMode", config.getRemote()::getAuthType));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::getPlatformName));
|
||||||
}
|
}
|
||||||
|
|
||||||
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
|
double completeTime = (System.currentTimeMillis() - startupTime) / 1000D;
|
||||||
|
@ -150,8 +154,8 @@ public class GeyserConnector {
|
||||||
players.remove(player.getSocketAddress());
|
players.remove(player.getSocketAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GeyserConnector start(IGeyserBootstrap bootstrap) {
|
public static GeyserConnector start(PlatformType platformType, IGeyserBootstrap bootstrap) {
|
||||||
return new GeyserConnector(bootstrap.getGeyserConfig(), bootstrap.getGeyserLogger());
|
return new GeyserConnector(platformType, bootstrap.getGeyserConfig(), bootstrap.getGeyserLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stop() {
|
public static void stop() {
|
||||||
|
|
Loading…
Reference in a new issue