3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-16 04:50:08 +01:00

Add option to hide scoreboard numbers (#4122)

Dieser Commit ist enthalten in:
Pablo Herrera 2024-08-24 15:49:09 +02:00 committet von GitHub
Ursprung 7edddda36e
Commit 2841bf3040
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
4 geänderte Dateien mit 25 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -464,4 +464,11 @@ public interface ViaVersionConfig extends Config {
* @return true if enabled
*/
boolean cancelBlockSounds();
/**
* Hides scoreboard numbers for 1.20.3+ clients on older server versions.
*
* @return true if enabled
*/
boolean hideScoreboardNumbers();
}

Datei anzeigen

@ -94,6 +94,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
private boolean enforceSecureChat;
private boolean handleInvalidItemCount;
private boolean cancelBlockSounds;
private boolean hideScoreboardNumbers;
protected AbstractViaConfig(final File configFile, final Logger logger) {
super(configFile, logger);
@ -161,6 +162,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
enforceSecureChat = getBoolean("enforce-secure-chat", false);
handleInvalidItemCount = getBoolean("handle-invalid-item-count", false);
cancelBlockSounds = getBoolean("cancel-block-sounds", true);
hideScoreboardNumbers = getBoolean("hide-scoreboard-numbers", false);
}
private BlockedProtocolVersions loadBlockedProtocolVersions() {
@ -542,4 +544,9 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
public boolean cancelBlockSounds() {
return cancelBlockSounds;
}
@Override
public boolean hideScoreboardNumbers() {
return hideScoreboardNumbers;
}
}

Datei anzeigen

@ -17,6 +17,7 @@
*/
package com.viaversion.viaversion.protocols.v1_20_2to1_20_3;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.data.MappingData;
import com.viaversion.viaversion.api.data.MappingDataBase;
@ -107,8 +108,13 @@ public final class Protocol1_20_2To1_20_3 extends AbstractProtocol<ClientboundPa
final byte action = wrapper.passthrough(Types.BYTE); // Method
if (action == 0 || action == 2) {
convertComponent(wrapper); // Display Name
wrapper.passthrough(Types.VAR_INT); // Render type
wrapper.write(Types.BOOLEAN, false); // Null number format
final int render = wrapper.passthrough(Types.VAR_INT); // Render type
if (render == 0 && Via.getConfig().hideScoreboardNumbers()) { // 0 = "integer", 1 = "hearts"
wrapper.write(Types.BOOLEAN, true); // has number format
wrapper.write(Types.VAR_INT, 0); // Blank format
} else {
wrapper.write(Types.BOOLEAN, false); // has number format
}
}
});

Datei anzeigen

@ -164,6 +164,9 @@ enforce-secure-chat: false
# Handles items with invalid count values (higher than max stack size) on 1.20.3 servers.
handle-invalid-item-count: false
#
# Hides scoreboard numbers for 1.20.3+ clients on older server versions.
hide-scoreboard-numbers: false
#
#----------------------------------------------------------#
# 1.9+ CLIENTS ON 1.8 SERVERS OPTIONS #
#----------------------------------------------------------#