forked from GeyserMC/Geyser
Add option for disabling command suggestions; add config version (#598)
* Add option for disabling command suggestions; add config version This commit adds an option for disabling command suggestions. If enabled, command suggestions will not be sent to the server so as to remove command freezing. This commit also adds a config version variable so users are notified when to regenerate their configs. * Rename GeyserConfiguration.checkGeyserConfiguration()
This commit is contained in:
parent
83c7858a8c
commit
a7f363ec09
13 changed files with 79 additions and 1 deletions
|
@ -31,12 +31,17 @@ import java.util.Map;
|
|||
|
||||
public interface GeyserConfiguration {
|
||||
|
||||
// Modify this when you update the config
|
||||
int CURRENT_CONFIG_VERSION = 1;
|
||||
|
||||
IBedrockConfiguration getBedrock();
|
||||
|
||||
IRemoteConfiguration getRemote();
|
||||
|
||||
Map<String, ? extends IUserAuthenticationInfo> getUserAuths();
|
||||
|
||||
boolean isCommandSuggestions();
|
||||
|
||||
boolean isPingPassthrough();
|
||||
|
||||
int getMaxPlayers();
|
||||
|
@ -87,4 +92,14 @@ public interface GeyserConfiguration {
|
|||
|
||||
String getUniqueId();
|
||||
}
|
||||
|
||||
int getConfigVersion();
|
||||
|
||||
static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) {
|
||||
if (geyserConfig.getConfigVersion() < CURRENT_CONFIG_VERSION) {
|
||||
geyserLogger.warning("Your Geyser config is out of date! Please regenerate your config when possible.");
|
||||
} else if (geyserConfig.getConfigVersion() > CURRENT_CONFIG_VERSION) {
|
||||
geyserLogger.warning("Your Geyser config is too new! Errors may occur.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,14 @@ import org.geysermc.connector.network.translators.Translator;
|
|||
import java.util.*;
|
||||
|
||||
@Translator(packet = ServerDeclareCommandsPacket.class)
|
||||
public class JavaServerDeclareCommandsTranslator extends PacketTranslator<ServerDeclareCommandsPacket> {
|
||||
public class JavaDeclareCommandsTranslator extends PacketTranslator<ServerDeclareCommandsPacket> {
|
||||
@Override
|
||||
public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) {
|
||||
// Don't send command suggestions if they are disabled
|
||||
if (!session.getConnector().getConfig().isCommandSuggestions()) {
|
||||
session.getConnector().getLogger().debug("Not sending command suggestions as they are disabled.");
|
||||
return;
|
||||
}
|
||||
List<CommandData> commandData = new ArrayList<>();
|
||||
Int2ObjectMap<String> commands = new Int2ObjectOpenHashMap<>();
|
||||
Int2ObjectMap<List<CommandNode>> commandArgs = new Int2ObjectOpenHashMap<>();
|
|
@ -41,6 +41,10 @@ floodgate-key-file: public-key.pem
|
|||
# email: herpderp@derpherp.com
|
||||
# password: dooooo
|
||||
|
||||
# Bedrock clients can freeze when opening up the command prompt for the first time if given a lot of commands.
|
||||
# Disabling this will prevent command suggestions from being sent and solve freezing for Bedrock clients.
|
||||
command-suggestions: true
|
||||
|
||||
# Relay the MOTD, player count and max players from the remote server
|
||||
ping-passthrough: false
|
||||
|
||||
|
@ -78,3 +82,6 @@ metrics:
|
|||
enabled: true
|
||||
# UUID of server, don't change!
|
||||
uuid: generateduuid
|
||||
|
||||
# DO NOT TOUCH!
|
||||
config-version: 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue