Skip to content

Commit

Permalink
Set declare commands empty
Browse files Browse the repository at this point in the history
  • Loading branch information
BoomEaro committed Jan 30, 2022
1 parent 188d2de commit 5e1bf15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
15 changes: 0 additions & 15 deletions src/main/java/ru/nanit/limbo/configuration/LimboConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

public final class LimboConfig {

Expand All @@ -51,13 +50,11 @@ public final class LimboConfig {
private boolean useJoinMessage;
private boolean useBossBar;
private boolean useTitle;
private boolean useDeclareCommands;
private boolean usePlayerList;
private String brandName;
private String joinMessage;
private BossBar bossBar;
private Title title;
private List<String> declareCommands;

private InfoForwarding infoForwarding;
private long readTimeout;
Expand Down Expand Up @@ -90,7 +87,6 @@ public void load() throws Exception {
useJoinMessage = conf.node("joinMessage", "enable").getBoolean();
useBossBar = conf.node("bossBar", "enable").getBoolean();
useTitle = conf.node("title", "enable").getBoolean();
useDeclareCommands = conf.node("declareCommands", "enable").getBoolean();
usePlayerList = conf.node("playerList").getBoolean();

if (useBrandName)
Expand All @@ -105,9 +101,6 @@ public void load() throws Exception {
if (useTitle)
title = conf.node("title").get(Title.class);

if (useDeclareCommands)
declareCommands = conf.node("declareCommands", "commands").getList(String.class);

infoForwarding = conf.node("infoForwarding").get(InfoForwarding.class);
readTimeout = conf.node("readTimeout").getLong();
debugLevel = conf.node("debugLevel").getInt();
Expand Down Expand Up @@ -196,10 +189,6 @@ public boolean isUseTitle() {
return useTitle;
}

public boolean isUseDeclareCommands() {
return useDeclareCommands;
}

public boolean isUsePlayerList() {
return usePlayerList;
}
Expand All @@ -220,10 +209,6 @@ public Title getTitle() {
return title;
}

public List<String> getDeclareCommands() {
return declareCommands;
}

public boolean isUseEpoll() {
return useEpoll;
}
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/ru/nanit/limbo/connection/ClientConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import java.net.SocketAddress;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

Expand Down Expand Up @@ -243,8 +244,7 @@ private void fireLoginSuccess() {
}

if (clientVersion.moreOrEqual(Version.V1_13)){
if (PACKET_DECLARE_COMMANDS != null)
writePacket(PACKET_DECLARE_COMMANDS);
writePacket(PACKET_DECLARE_COMMANDS);


if (PACKET_PLUGIN_MESSAGE != null)
Expand Down Expand Up @@ -429,6 +429,9 @@ public static void initPackets(LimboServer server) {
info.setGameMode(server.getConfig().getGameMode());
info.setUuid(uuid);

PacketDeclareCommands declareCommands = new PacketDeclareCommands();
declareCommands.setCommands(Collections.emptyList());

PACKET_LOGIN_SUCCESS = PacketSnapshot.of(loginSuccess);
PACKET_JOIN_GAME = PacketSnapshot.of(joinGame);
PACKET_PLAYER_ABILITIES = PacketSnapshot.of(playerAbilities);
Expand All @@ -438,12 +441,7 @@ public static void initPackets(LimboServer server) {
PACKET_PLAYER_INFO = PacketSnapshot.of(info);
}

if (server.getConfig().isUseDeclareCommands()) {
PacketDeclareCommands declareCommands = new PacketDeclareCommands();
declareCommands.setCommands(server.getConfig().getDeclareCommands());

PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands);
}
PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands);

if (server.getConfig().isUseBrandName()){
PacketPluginMessage pluginMessage = new PacketPluginMessage();
Expand Down

0 comments on commit 5e1bf15

Please sign in to comment.