Add "forced-use-1_17-resource-pack" option (#2390)

This commit is contained in:
LemonCaramel 2021-03-08 20:30:23 +09:00 committed by GitHub
parent 72de597544
commit ea014656bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View File

@ -55,6 +55,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
private boolean healthNaNFix;
private boolean instantRespawn;
private boolean ignoreLongChannelNames;
private boolean forcedUse1_17ResourcePack;
protected AbstractViaConfig(File configFile) {
super(configFile);
@ -113,6 +114,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
healthNaNFix = getBoolean("fix-1_14-health-nan", true);
instantRespawn = getBoolean("use-1_15-instant-respawn", false);
ignoreLongChannelNames = getBoolean("ignore-long-1_16-channel-names", true);
forcedUse1_17ResourcePack = getBoolean("forced-use-1_17-resource-pack", false);
}
@Override
@ -376,4 +378,9 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
public boolean isIgnoreLong1_16ChannelNames() {
return ignoreLongChannelNames;
}
@Override
public boolean isForcedUse1_17ResourcePack() {
return forcedUse1_17ResourcePack;
}
}

View File

@ -366,4 +366,11 @@ public interface ViaVersionConfig {
* @return true if enabled
*/
boolean isIgnoreLong1_16ChannelNames();
/**
* Force 1.17+ client to accept the server resource pack.
*
* @return true if enabled
*/
boolean isForcedUse1_17ResourcePack();
}

View File

@ -1,6 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_17to1_16_4;
import org.jetbrains.annotations.Nullable;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.MappingData;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
@ -81,7 +82,7 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
handler(wrapper -> {
wrapper.passthrough(Type.STRING);
wrapper.passthrough(Type.STRING);
wrapper.write(Type.BOOLEAN, false); // Required
wrapper.write(Type.BOOLEAN, Via.getConfig().isForcedUse1_17ResourcePack()); // Required
});
}
});

View File

@ -151,6 +151,9 @@ vine-climb-fix: false
# CraftBukkit had this limit hardcoded until 1.16, so we have to assume any server/proxy might have this arbitrary check present.
ignore-long-1_16-channel-names: true
#
# Force 1.17+ client to accept the server resource pack; they will automatically disconnect if they decline.
forced-use-1_17-resource-pack: false
#
#----------------------------------------------------------#
# 1.9+ CLIENTS ON 1.8 SERVERS OPTIONS #
#----------------------------------------------------------#