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