mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-12 20:50:13 +02:00
add config section for brand name
This commit is contained in:
parent
016794cba8
commit
27ec7af95c
@ -22,16 +22,17 @@ public final class LimboConfig {
|
||||
|
||||
private SocketAddress address;
|
||||
private int maxPlayers;
|
||||
private String brandName;
|
||||
private PingData pingData;
|
||||
|
||||
private String dimensionType;
|
||||
private Position spawnPosition;
|
||||
private int gameMode;
|
||||
|
||||
private boolean useBrandName;
|
||||
private boolean useJoinMessage;
|
||||
private boolean useBossBar;
|
||||
private boolean useTitle;
|
||||
private String brandName;
|
||||
private String joinMessage;
|
||||
private BossBar bossBar;
|
||||
private Title title;
|
||||
@ -59,15 +60,18 @@ public final class LimboConfig {
|
||||
|
||||
address = conf.node("bind").get(SocketAddress.class);
|
||||
maxPlayers = conf.node("maxPlayers").getInt();
|
||||
brandName = conf.node("brandName").getString();
|
||||
pingData = conf.node("ping").get(PingData.class);
|
||||
dimensionType = conf.node("dimension").getString();
|
||||
spawnPosition = conf.node("spawnPosition").get(Position.class);
|
||||
gameMode = conf.node("gameMode").getInt();
|
||||
useBrandName = conf.node("brandName", "enable").getBoolean();
|
||||
useJoinMessage = conf.node("joinMessage", "enable").getBoolean();
|
||||
useBossBar = conf.node("bossBar", "enable").getBoolean();
|
||||
useTitle = conf.node("title", "enable").getBoolean();
|
||||
|
||||
if(useBrandName)
|
||||
brandName = conf.node("brandName", "content").getString();
|
||||
|
||||
if (useJoinMessage)
|
||||
joinMessage = Colors.of(conf.node("joinMessage", "text").getString(""));
|
||||
|
||||
@ -121,10 +125,6 @@ public final class LimboConfig {
|
||||
return maxPlayers;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public PingData getPingData() {
|
||||
return pingData;
|
||||
}
|
||||
@ -153,6 +153,10 @@ public final class LimboConfig {
|
||||
return debugLevel;
|
||||
}
|
||||
|
||||
public boolean isUseBrandName() {
|
||||
return useBrandName;
|
||||
}
|
||||
|
||||
public boolean isUseJoinMessage() {
|
||||
return useJoinMessage;
|
||||
}
|
||||
@ -165,6 +169,10 @@ public final class LimboConfig {
|
||||
return useTitle;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public String getJoinMessage() {
|
||||
return joinMessage;
|
||||
}
|
||||
|
@ -375,10 +375,6 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
||||
joinGame.setHashedSeed(0);
|
||||
joinGame.setDimensionRegistry(server.getDimensionRegistry());
|
||||
|
||||
PacketPluginMessage pluginMessage = new PacketPluginMessage();
|
||||
pluginMessage.setChannel("minecraft:brand");
|
||||
pluginMessage.setMessage(server.getConfig().getBrandName());
|
||||
|
||||
PacketPlayerAbilities playerAbilities = new PacketPlayerAbilities();
|
||||
playerAbilities.setFlyingSpeed(0.0F);
|
||||
playerAbilities.setFlags(0x02);
|
||||
@ -399,11 +395,17 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
||||
|
||||
PACKET_LOGIN_SUCCESS = PreEncodedPacket.of(loginSuccess);
|
||||
PACKET_JOIN_GAME = PreEncodedPacket.of(joinGame);
|
||||
PACKET_PLUGIN_MESSAGE = PreEncodedPacket.of(pluginMessage);
|
||||
PACKET_PLAYER_ABILITIES = PreEncodedPacket.of(playerAbilities);
|
||||
PACKET_PLAYER_POS = PreEncodedPacket.of(positionAndLook);
|
||||
PACKET_PLAYER_INFO = PreEncodedPacket.of(info);
|
||||
|
||||
if (server.getConfig().isUseBrandName()){
|
||||
PacketPluginMessage pluginMessage = new PacketPluginMessage();
|
||||
pluginMessage.setChannel("minecraft:brand");
|
||||
pluginMessage.setMessage(server.getConfig().getBrandName());
|
||||
PACKET_PLUGIN_MESSAGE = PreEncodedPacket.of(pluginMessage);
|
||||
}
|
||||
|
||||
if (server.getConfig().isUseJoinMessage()) {
|
||||
PacketChatMessage joinMessage = new PacketChatMessage();
|
||||
joinMessage.setJsonData(server.getConfig().getJoinMessage());
|
||||
|
@ -11,9 +11,6 @@ bind:
|
||||
# Set -1 to make it infinite
|
||||
maxPlayers: 100
|
||||
|
||||
# Server name which is shown under F3
|
||||
brandName: 'NanoLimbo'
|
||||
|
||||
# Server's data in servers list
|
||||
ping:
|
||||
description: '{"text": "&9NanoLimbo"}'
|
||||
@ -37,6 +34,11 @@ spawnPosition:
|
||||
# 3 - Spectator (hide all UI bars)
|
||||
gameMode: 3
|
||||
|
||||
# Server name which is shown under F3
|
||||
brandName:
|
||||
enable: true
|
||||
content: 'NanoLimbo'
|
||||
|
||||
# Message sends when player join to server
|
||||
joinMessage:
|
||||
enable: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user