mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-14 13:20:12 +02:00
Added display of brand name under f3
This commit is contained in:
parent
2dfb952d71
commit
1d200dcfd9
@ -19,6 +19,7 @@ public final class LimboConfig {
|
||||
|
||||
private SocketAddress address;
|
||||
private int maxPlayers;
|
||||
private String brandName;
|
||||
private PingData pingData;
|
||||
|
||||
private String dimensionType;
|
||||
@ -55,6 +56,7 @@ 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);
|
||||
@ -116,6 +118,10 @@ public final class LimboConfig {
|
||||
return maxPlayers;
|
||||
}
|
||||
|
||||
public String getBrandName() {
|
||||
return brandName;
|
||||
}
|
||||
|
||||
public PingData getPingData() {
|
||||
return pingData;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private static PreEncodedPacket PACKET_LOGIN_SUCCESS;
|
||||
private static PreEncodedPacket PACKET_JOIN_GAME;
|
||||
private static PreEncodedPacket PACKET_PLUGIN_MESSAGE;
|
||||
private static PreEncodedPacket PACKET_PLAYER_ABILITIES;
|
||||
private static PreEncodedPacket PACKET_PLAYER_INFO;
|
||||
private static PreEncodedPacket PACKET_DECLARE_COMMANDS;
|
||||
@ -215,6 +216,7 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
||||
server.getConnections().addConnection(this);
|
||||
|
||||
writePacket(PACKET_JOIN_GAME);
|
||||
writePacket(PACKET_PLUGIN_MESSAGE);
|
||||
writePacket(PACKET_PLAYER_ABILITIES);
|
||||
writePacket(PACKET_PLAYER_POS);
|
||||
writePacket(PACKET_PLAYER_INFO);
|
||||
@ -383,6 +385,10 @@ 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);
|
||||
@ -406,6 +412,7 @@ 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);
|
||||
|
@ -0,0 +1,23 @@
|
||||
package ru.nanit.limbo.protocol.packets.play;
|
||||
|
||||
import ru.nanit.limbo.protocol.ByteMessage;
|
||||
import ru.nanit.limbo.protocol.PacketOut;
|
||||
import ru.nanit.limbo.protocol.registry.Version;
|
||||
|
||||
public class PacketPluginMessage implements PacketOut {
|
||||
private String channel;
|
||||
private String message;
|
||||
|
||||
public void setChannel(String channel){
|
||||
this.channel = channel;
|
||||
}
|
||||
public void setMessage(String message){
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteMessage msg, Version version) {
|
||||
msg.writeString(channel);
|
||||
msg.writeString(message);
|
||||
}
|
||||
}
|
@ -87,6 +87,10 @@ public enum State {
|
||||
map(0x24, V1_16_2, V1_16_4),
|
||||
map(0x26, V1_17, V1_18)
|
||||
);
|
||||
// to do
|
||||
clientBound.register(PacketPluginMessage::new,
|
||||
map(0x18, V1_18, V1_18)
|
||||
);
|
||||
clientBound.register(PacketPlayerAbilities::new,
|
||||
map(0x39, V1_8, V1_8),
|
||||
map(0x2B, V1_9, V1_12),
|
||||
|
@ -11,6 +11,9 @@ 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"}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user