3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01: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
Dieser Commit ist enthalten in:
chris 2023-08-07 02:39:27 +02:00 committet von GitHub
Ursprung b1f04a9012
Commit 2361f587da
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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)
if (ADD_TEAM_SUGGESTIONS) {
session.addCommandEnum("Geyser_Teams", team.getId());
}
return team;
}

Datei anzeigen

@ -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));