mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Don't send softEnumPackets when command suggestions are false (#4037)
* Don't send SoftEnums if command suggestions are set to false, add system property to not send team suggestions * address review
This commit is contained in:
parent
b1f04a9012
commit
2361f587da
2 changed files with 8 additions and 2 deletions
|
@ -52,6 +52,7 @@ import static org.geysermc.geyser.scoreboard.UpdateType.*;
|
|||
|
||||
public final class Scoreboard {
|
||||
private static final boolean SHOW_SCOREBOARD_LOGS = Boolean.parseBoolean(System.getProperty("Geyser.ShowScoreboardLogs", "true"));
|
||||
private static final boolean ADD_TEAM_SUGGESTIONS = Boolean.parseBoolean(System.getProperty("Geyser.AddTeamSuggestions", "true"));
|
||||
|
||||
private final GeyserSession session;
|
||||
private final GeyserLogger logger;
|
||||
|
@ -150,8 +151,9 @@ public final class Scoreboard {
|
|||
teams.put(teamName, team);
|
||||
|
||||
// Update command parameters - is safe to send even if the command enum doesn't exist on the client (as of 1.19.51)
|
||||
session.addCommandEnum("Geyser_Teams", team.getId());
|
||||
|
||||
if (ADD_TEAM_SUGGESTIONS) {
|
||||
session.addCommandEnum("Geyser_Teams", team.getId());
|
||||
}
|
||||
return team;
|
||||
}
|
||||
|
||||
|
|
|
@ -2008,6 +2008,10 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
}
|
||||
|
||||
private void softEnumPacket(String name, SoftEnumUpdateType type, String enums) {
|
||||
// There is no need to send command enums if command suggestions are disabled
|
||||
if (!this.geyser.getConfig().isCommandSuggestions()) {
|
||||
return;
|
||||
}
|
||||
UpdateSoftEnumPacket packet = new UpdateSoftEnumPacket();
|
||||
packet.setType(type);
|
||||
packet.setSoftEnum(new CommandEnumData(name, Collections.singletonMap(enums, Collections.emptySet()), true));
|
||||
|
|
Loading…
Reference in a new issue