mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-28 13:05:25 +01:00
Add option to hide scoreboard numbers (#4122)
This commit is contained in:
parent
7edddda36e
commit
2841bf3040
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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 #
|
||||
#----------------------------------------------------------#
|
||||
|
Loading…
Reference in New Issue
Block a user