3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Rename comparing methods in ProtocolVersion (#3693)

Dieser Commit ist enthalten in:
EnZaXD 2024-02-14 09:54:15 +01:00 committet von GitHub
Ursprung d58c80cd2f
Commit e62c4a3f9e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
13 geänderte Dateien mit 46 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -353,13 +353,23 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
return snapshotVersion != -1; return snapshotVersion != -1;
} }
/**
* Returns whether this protocol version is equal to the other protocol version.
*
* @param other other protocol version
* @return true if this protocol version is equal to the other protocol version
*/
public boolean equalTo(final ProtocolVersion other) {
return this.compareTo(other) == 0;
}
/** /**
* Returns whether this protocol version is higher than the other protocol version. * Returns whether this protocol version is higher than the other protocol version.
* *
* @param other other protocol version * @param other other protocol version
* @return true if this protocol version is higher than the other protocol version * @return true if this protocol version is higher than the other protocol version
*/ */
public boolean higherThan(final ProtocolVersion other) { public boolean newerThan(final ProtocolVersion other) {
return this.compareTo(other) > 0; return this.compareTo(other) > 0;
} }
@ -369,7 +379,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @param other other protocol version * @param other other protocol version
* @return true if this protocol version is higher than or equal to the other protocol version * @return true if this protocol version is higher than or equal to the other protocol version
*/ */
public boolean higherThanOrEquals(final ProtocolVersion other) { public boolean newerThanOrEquals(final ProtocolVersion other) {
return this.compareTo(other) >= 0; return this.compareTo(other) >= 0;
} }
@ -379,7 +389,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @param other other protocol version * @param other other protocol version
* @return true if this protocol version is lower than the other protocol version * @return true if this protocol version is lower than the other protocol version
*/ */
public boolean lowerThan(final ProtocolVersion other) { public boolean olderThan(final ProtocolVersion other) {
return this.compareTo(other) < 0; return this.compareTo(other) < 0;
} }
@ -389,7 +399,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @param other other protocol version * @param other other protocol version
* @return true if this protocol version is lower than or equal to the other protocol version * @return true if this protocol version is lower than or equal to the other protocol version
*/ */
public boolean lowerThanOrEquals(final ProtocolVersion other) { public boolean olderThanOrEquals(final ProtocolVersion other) {
return this.compareTo(other) <= 0; return this.compareTo(other) <= 0;
} }
@ -402,7 +412,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @return true if this protocol version is between the given protocol versions, inclusive * @return true if this protocol version is between the given protocol versions, inclusive
*/ */
public boolean betweenInclusive(final ProtocolVersion min, final ProtocolVersion max) { public boolean betweenInclusive(final ProtocolVersion min, final ProtocolVersion max) {
return this.higherThanOrEquals(min) && this.lowerThanOrEquals(max); return this.newerThanOrEquals(min) && this.olderThanOrEquals(max);
} }
/** /**
@ -413,7 +423,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
* @return true if this protocol version is between the given protocol versions, exclusive * @return true if this protocol version is between the given protocol versions, exclusive
*/ */
public boolean betweenExclusive(final ProtocolVersion min, final ProtocolVersion max) { public boolean betweenExclusive(final ProtocolVersion min, final ProtocolVersion max) {
return this.higherThan(min) && this.lowerThan(max); return this.newerThan(min) && this.olderThan(max);
} }
/** /**

Datei anzeigen

@ -71,7 +71,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
// From 1.9 upwards the server hitbox is set in every entity tick, so we have to reset it everytime // From 1.9 upwards the server hitbox is set in every entity tick, so we have to reset it everytime
if (Via.getAPI().getServerVersion().lowestSupportedProtocolVersion().higherThan(ProtocolVersion.v1_8)) { if (Via.getAPI().getServerVersion().lowestSupportedProtocolVersion().newerThan(ProtocolVersion.v1_8)) {
sneaking = new WeakHashMap<>(); sneaking = new WeakHashMap<>();
useCache = true; useCache = true;
plugin.getServer().getScheduler().runTaskTimer(plugin, () -> { plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
@ -96,7 +96,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
if (info == null) return; if (info == null) return;
ProtocolVersion protocolVersion = info.protocolVersion(); ProtocolVersion protocolVersion = info.protocolVersion();
if (is1_14Fix && protocolVersion.higherThanOrEquals(ProtocolVersion.v1_14)) { if (is1_14Fix && protocolVersion.newerThanOrEquals(ProtocolVersion.v1_14)) {
setHeight(player, event.isSneaking() ? HEIGHT_1_14 : STANDING_HEIGHT); setHeight(player, event.isSneaking() ? HEIGHT_1_14 : STANDING_HEIGHT);
if (event.isSneaking()) if (event.isSneaking())
sneakingUuids.add(player.getUniqueId()); sneakingUuids.add(player.getUniqueId());
@ -108,7 +108,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
sneaking.put(player, true); sneaking.put(player, true);
else else
sneaking.remove(player); sneaking.remove(player);
} else if (is1_9Fix && protocolVersion.higherThanOrEquals(ProtocolVersion.v1_9)) { } else if (is1_9Fix && protocolVersion.newerThanOrEquals(ProtocolVersion.v1_9)) {
setHeight(player, event.isSneaking() ? HEIGHT_1_9 : STANDING_HEIGHT); setHeight(player, event.isSneaking() ? HEIGHT_1_9 : STANDING_HEIGHT);
if (!useCache) return; if (!useCache) return;
if (event.isSneaking()) if (event.isSneaking())

Datei anzeigen

@ -90,7 +90,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
ProtocolVersion serverProtocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); ProtocolVersion serverProtocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
/* 1.9 client to 1.8 server */ /* 1.9 client to 1.8 server */
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_9)) {
new ArmorListener(plugin).register(); new ArmorListener(plugin).register();
new DeathListener(plugin).register(); new DeathListener(plugin).register();
new BlockListener(plugin).register(); new BlockListener(plugin).register();
@ -101,8 +101,8 @@ public class BukkitViaLoader implements ViaPlatformLoader {
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_14)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_14)) {
boolean use1_9Fix = plugin.getConf().is1_9HitboxFix() && serverProtocolVersion.lowerThan(ProtocolVersion.v1_9); boolean use1_9Fix = plugin.getConf().is1_9HitboxFix() && serverProtocolVersion.olderThan(ProtocolVersion.v1_9);
if (use1_9Fix || plugin.getConf().is1_14HitboxFix()) { if (use1_9Fix || plugin.getConf().is1_14HitboxFix()) {
try { try {
new PlayerSneakListener(plugin, use1_9Fix, plugin.getConf().is1_14HitboxFix()).register(); new PlayerSneakListener(plugin, use1_9Fix, plugin.getConf().is1_14HitboxFix()).register();
@ -112,7 +112,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_15)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_15)) {
try { try {
Class.forName("org.bukkit.event.entity.EntityToggleGlideEvent"); Class.forName("org.bukkit.event.entity.EntityToggleGlideEvent");
new EntityToggleGlideListener(plugin).register(); new EntityToggleGlideListener(plugin).register();
@ -120,7 +120,7 @@ public class BukkitViaLoader implements ViaPlatformLoader {
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_12) && !Boolean.getBoolean("com.viaversion.ignorePaperBlockPlacePatch")) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_12) && !Boolean.getBoolean("com.viaversion.ignorePaperBlockPlacePatch")) {
boolean paper = true; boolean paper = true;
try { try {
Class.forName("org.github.paperspigot.PaperSpigotConfig"); // Paper 1.8 ? Class.forName("org.github.paperspigot.PaperSpigotConfig"); // Paper 1.8 ?
@ -136,12 +136,12 @@ public class BukkitViaLoader implements ViaPlatformLoader {
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_19_4) && plugin.getConf().isArmorToggleFix() && hasGetHandMethod()) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_19_4) && plugin.getConf().isArmorToggleFix() && hasGetHandMethod()) {
new ArmorToggleListener(plugin).register(); new ArmorToggleListener(plugin).register();
} }
/* Providers */ /* Providers */
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_9)) {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BukkitViaMovementTransmitter()); Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BukkitViaMovementTransmitter());
Via.getManager().getProviders().use(HandItemProvider.class, new HandItemProvider() { Via.getManager().getProviders().use(HandItemProvider.class, new HandItemProvider() {
@ -167,19 +167,19 @@ public class BukkitViaLoader implements ViaPlatformLoader {
}); });
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_12)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_12)) {
if (plugin.getConf().is1_12QuickMoveActionFix()) { if (plugin.getConf().is1_12QuickMoveActionFix()) {
Via.getManager().getProviders().use(InventoryQuickMoveProvider.class, new BukkitInventoryQuickMoveProvider()); Via.getManager().getProviders().use(InventoryQuickMoveProvider.class, new BukkitInventoryQuickMoveProvider());
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_13)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_13)) {
if (Via.getConfig().getBlockConnectionMethod().equalsIgnoreCase("world")) { if (Via.getConfig().getBlockConnectionMethod().equalsIgnoreCase("world")) {
BukkitBlockConnectionProvider blockConnectionProvider = new BukkitBlockConnectionProvider(); BukkitBlockConnectionProvider blockConnectionProvider = new BukkitBlockConnectionProvider();
Via.getManager().getProviders().use(BlockConnectionProvider.class, blockConnectionProvider); Via.getManager().getProviders().use(BlockConnectionProvider.class, blockConnectionProvider);
ConnectionData.blockConnectionProvider = blockConnectionProvider; ConnectionData.blockConnectionProvider = blockConnectionProvider;
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_19)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_19)) {
Via.getManager().getProviders().use(AckSequenceProvider.class, new BukkitAckSequenceProvider(plugin)); Via.getManager().getProviders().use(AckSequenceProvider.class, new BukkitAckSequenceProvider(plugin));
new BlockBreakListener(plugin).register(); new BlockBreakListener(plugin).register();
} }

Datei anzeigen

@ -38,7 +38,7 @@ public final class BukkitAckSequenceProvider extends AckSequenceProvider {
final int previousSequence = sequenceStorage.setSequenceId(sequence); final int previousSequence = sequenceStorage.setSequenceId(sequence);
if (previousSequence == -1) { if (previousSequence == -1) {
final ProtocolVersion serverProtocolVersion = connection.getProtocolInfo().serverProtocolVersion(); final ProtocolVersion serverProtocolVersion = connection.getProtocolInfo().serverProtocolVersion();
final long delay = serverProtocolVersion.higherThan(ProtocolVersion.v1_8) && serverProtocolVersion.lowerThan(ProtocolVersion.v1_14) ? 2 : 1; final long delay = serverProtocolVersion.newerThan(ProtocolVersion.v1_8) && serverProtocolVersion.olderThan(ProtocolVersion.v1_14) ? 2 : 1;
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new AckSequenceTask(connection, sequenceStorage), delay); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new AckSequenceTask(connection, sequenceStorage), delay);

Datei anzeigen

@ -173,7 +173,7 @@ public class BungeeServerHandler implements Listener {
String serverName = server.getInfo().getName(); String serverName = server.getInfo().getName();
storage.setCurrentServer(serverName); storage.setCurrentServer(serverName);
ProtocolVersion serverProtocolVersion = ProtocolVersion.getProtocol(Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName)); ProtocolVersion serverProtocolVersion = ProtocolVersion.getProtocol(Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName));
if (serverProtocolVersion.lowerThanOrEquals(ProtocolVersion.v1_8) && storage.getBossbar() != null) { // 1.8 doesn't have BossBar packet if (serverProtocolVersion.olderThanOrEquals(ProtocolVersion.v1_8) && storage.getBossbar() != null) { // 1.8 doesn't have BossBar packet
// This ensures we can encode it properly as only the 1.9 protocol is currently implemented. // This ensures we can encode it properly as only the 1.9 protocol is currently implemented.
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) { if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
for (UUID uuid : storage.getBossbar()) { for (UUID uuid : storage.getBossbar()) {
@ -211,8 +211,8 @@ public class BungeeServerHandler implements Listener {
pipeline.add(Via.getManager().getProtocolManager().getBaseProtocol(serverProtocolVersion.getVersion())); pipeline.add(Via.getManager().getProtocolManager().getBaseProtocol(serverProtocolVersion.getVersion()));
// Workaround 1.13 server change // Workaround 1.13 server change
boolean toNewId = previousServerProtocol.lowerThan(ProtocolVersion.v1_13) && serverProtocolVersion.higherThanOrEquals(ProtocolVersion.v1_13); boolean toNewId = previousServerProtocol.olderThan(ProtocolVersion.v1_13) && serverProtocolVersion.newerThanOrEquals(ProtocolVersion.v1_13);
boolean toOldId = previousServerProtocol.higherThanOrEquals(ProtocolVersion.v1_13) && serverProtocolVersion.lowerThan(ProtocolVersion.v1_13); boolean toOldId = previousServerProtocol.newerThanOrEquals(ProtocolVersion.v1_13) && serverProtocolVersion.olderThan(ProtocolVersion.v1_13);
if (previousServerProtocol.isKnown() && (toNewId || toOldId)) { if (previousServerProtocol.isKnown() && (toNewId || toOldId)) {
Collection<String> registeredChannels = (Collection<String>) getRegisteredChannels.invoke(event.getPlayer().getPendingConnection()); Collection<String> registeredChannels = (Collection<String>) getRegisteredChannels.invoke(event.getPlayer().getPendingConnection());
if (!registeredChannels.isEmpty()) { if (!registeredChannels.isEmpty()) {

Datei anzeigen

@ -61,7 +61,7 @@ public class BungeeViaLoader implements ViaPlatformLoader {
registerListener(new BungeeServerHandler()); registerListener(new BungeeServerHandler());
final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
if (protocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (protocolVersion.olderThan(ProtocolVersion.v1_9)) {
registerListener(new ElytraPatch()); registerListener(new ElytraPatch());
} }
@ -69,7 +69,7 @@ public class BungeeViaLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider()); Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider());
Via.getManager().getProviders().use(EntityIdProvider.class, new BungeeEntityIdProvider()); Via.getManager().getProviders().use(EntityIdProvider.class, new BungeeEntityIdProvider());
if (protocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (protocolVersion.olderThan(ProtocolVersion.v1_9)) {
Via.getManager().getProviders().use(BossBarProvider.class, new BungeeBossBarProvider()); Via.getManager().getProviders().use(BossBarProvider.class, new BungeeBossBarProvider());
Via.getManager().getProviders().use(MainHandProvider.class, new BungeeMainHandProvider()); Via.getManager().getProviders().use(MainHandProvider.class, new BungeeMainHandProvider());
} }

Datei anzeigen

@ -43,7 +43,6 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.TabCompleteThrea
import com.viaversion.viaversion.protocols.protocol1_9to1_8.ViaIdleThread; import com.viaversion.viaversion.protocols.protocol1_9to1_8.ViaIdleThread;
import com.viaversion.viaversion.scheduler.TaskScheduler; import com.viaversion.viaversion.scheduler.TaskScheduler;
import com.viaversion.viaversion.update.UpdateUtil; import com.viaversion.viaversion.update.UpdateUtil;
import it.unimi.dsi.fastutil.ints.IntSortedSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -146,7 +145,7 @@ public class ViaManagerImpl implements ViaManager {
platform.getLogger().warning("If you need support for older versions you may need to use one or more ViaVersion addons too."); platform.getLogger().warning("If you need support for older versions you may need to use one or more ViaVersion addons too.");
platform.getLogger().warning("In that case please read the ViaVersion resource page carefully or use https://viaversion.com/setup"); platform.getLogger().warning("In that case please read the ViaVersion resource page carefully or use https://viaversion.com/setup");
platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance."); platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance.");
} else if (protocolVersion.highestSupportedProtocolVersion().lowerThan(ProtocolVersion.v1_13)) { } else if (protocolVersion.highestSupportedProtocolVersion().olderThan(ProtocolVersion.v1_13)) {
platform.getLogger().warning("This version of Minecraft is extremely outdated and support for it has reached its end of life. " platform.getLogger().warning("This version of Minecraft is extremely outdated and support for it has reached its end of life. "
+ "You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. " + "You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. "
+ "Please consider updating to give your players a better experience and to avoid issues that have long been fixed."); + "Please consider updating to give your players a better experience and to avoid issues that have long been fixed.");
@ -169,12 +168,12 @@ public class ViaManagerImpl implements ViaManager {
}, 10L); }, 10L);
final ProtocolVersion serverProtocolVersion = protocolManager.getServerProtocolVersion().lowestSupportedProtocolVersion(); final ProtocolVersion serverProtocolVersion = protocolManager.getServerProtocolVersion().lowestSupportedProtocolVersion();
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_9)) {
if (Via.getConfig().isSimulatePlayerTick()) { if (Via.getConfig().isSimulatePlayerTick()) {
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L); Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
} }
} }
if (serverProtocolVersion.lowerThan(ProtocolVersion.v1_13)) { if (serverProtocolVersion.olderThan(ProtocolVersion.v1_13)) {
if (Via.getConfig().get1_13TabCompleteDelay() > 0) { if (Via.getConfig().get1_13TabCompleteDelay() > 0) {
Via.getPlatform().runRepeatingSync(new TabCompleteThread(), 1L); Via.getPlatform().runRepeatingSync(new TabCompleteThread(), 1L);
} }

Datei anzeigen

@ -71,7 +71,7 @@ public class BaseProtocol extends AbstractProtocol<BaseClientboundPacket, BaseCl
List<ProtocolPathEntry> protocolPath = null; List<ProtocolPathEntry> protocolPath = null;
// Only allow newer clients (or 1.9.2 on 1.9.4 server if the server supports it) // Only allow newer clients (or 1.9.2 on 1.9.4 server if the server supports it)
if (info.protocolVersion().higherThanOrEquals(serverProtocol) || Via.getPlatform().isOldClientsAllowed()) { if (info.protocolVersion().newerThanOrEquals(serverProtocol) || Via.getPlatform().isOldClientsAllowed()) {
protocolPath = Via.getManager().getProtocolManager() protocolPath = Via.getManager().getProtocolManager()
.getProtocolPath(info.protocolVersion().getVersion(), serverProtocol.getVersion()); .getProtocolPath(info.protocolVersion().getVersion(), serverProtocol.getVersion());
} }
@ -108,7 +108,7 @@ public class BaseProtocol extends AbstractProtocol<BaseClientboundPacket, BaseCl
} else if (state == TRANSFER_INTENT) { } else if (state == TRANSFER_INTENT) {
info.setState(State.LOGIN); info.setState(State.LOGIN);
if (serverProtocol.lowerThan(ProtocolVersion.v1_20_5)) { if (serverProtocol.olderThan(ProtocolVersion.v1_20_5)) {
wrapper.set(Type.VAR_INT, 1, LOGIN_INTENT); wrapper.set(Type.VAR_INT, 1, LOGIN_INTENT);
} }
} }

Datei anzeigen

@ -98,7 +98,7 @@ public class BaseProtocol1_7 extends AbstractProtocol<BaseClientboundPacket, Bas
ProtocolVersion closestServerProtocol = versionProvider.getClosestServerProtocol(wrapper.user()); ProtocolVersion closestServerProtocol = versionProvider.getClosestServerProtocol(wrapper.user());
List<ProtocolPathEntry> protocols = null; List<ProtocolPathEntry> protocols = null;
if (info.protocolVersion().higherThanOrEquals(closestServerProtocol) || Via.getPlatform().isOldClientsAllowed()) { if (info.protocolVersion().newerThanOrEquals(closestServerProtocol) || Via.getPlatform().isOldClientsAllowed()) {
protocols = Via.getManager().getProtocolManager() protocols = Via.getManager().getProtocolManager()
.getProtocolPath(info.protocolVersion().getVersion(), closestServerProtocol.getVersion()); .getProtocolPath(info.protocolVersion().getVersion(), closestServerProtocol.getVersion());
} }
@ -127,7 +127,7 @@ public class BaseProtocol1_7 extends AbstractProtocol<BaseClientboundPacket, Bas
// Login Success Packet // Login Success Packet
registerClientbound(ClientboundLoginPackets.GAME_PROFILE, wrapper -> { registerClientbound(ClientboundLoginPackets.GAME_PROFILE, wrapper -> {
ProtocolInfo info = wrapper.user().getProtocolInfo(); ProtocolInfo info = wrapper.user().getProtocolInfo();
if (info.protocolVersion().lowerThan(ProtocolVersion.v1_20_2)) { // On 1.20.2+, wait for the login ack if (info.protocolVersion().olderThan(ProtocolVersion.v1_20_2)) { // On 1.20.2+, wait for the login ack
info.setState(State.PLAY); info.setState(State.PLAY);
} }

Datei anzeigen

@ -152,7 +152,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
clientChunks.setEnvironment(dimensionId); clientChunks.setEnvironment(dimensionId);
// Reset recipes // Reset recipes
if (user.getProtocolInfo().protocolVersion().higherThanOrEquals(ProtocolVersion.v1_13)) { if (user.getProtocolInfo().protocolVersion().newerThanOrEquals(ProtocolVersion.v1_13)) {
wrapper.create(ClientboundPackets1_13.DECLARE_RECIPES, packetWrapper -> packetWrapper.write(Type.VAR_INT, 0)) wrapper.create(ClientboundPackets1_13.DECLARE_RECIPES, packetWrapper -> packetWrapper.write(Type.VAR_INT, 0))
.scheduleSend(Protocol1_13To1_12_2.class); .scheduleSend(Protocol1_13To1_12_2.class);
} }

Datei anzeigen

@ -63,7 +63,7 @@ public abstract class AbstractFenceConnectionHandler extends ConnectionHandler {
protected byte getStates(UserConnection user, Position position, int blockState) { protected byte getStates(UserConnection user, Position position, int blockState) {
byte states = 0; byte states = 0;
boolean pre1_12 = user.getProtocolInfo().serverProtocolVersion().lowerThan(ProtocolVersion.v1_12); boolean pre1_12 = user.getProtocolInfo().serverProtocolVersion().olderThan(ProtocolVersion.v1_12);
if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1; if (connects(BlockFace.EAST, getBlockData(user, position.getRelative(BlockFace.EAST)), pre1_12)) states |= 1;
if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2; if (connects(BlockFace.NORTH, getBlockData(user, position.getRelative(BlockFace.NORTH)), pre1_12)) states |= 2;
if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4; if (connects(BlockFace.SOUTH, getBlockData(user, position.getRelative(BlockFace.SOUTH)), pre1_12)) states |= 4;

Datei anzeigen

@ -59,7 +59,7 @@ public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
if (states != 0) return states; if (states != 0) return states;
ProtocolInfo protocolInfo = user.getProtocolInfo(); ProtocolInfo protocolInfo = user.getProtocolInfo();
return protocolInfo.serverProtocolVersion().lowerThanOrEquals(ProtocolVersion.v1_8) return protocolInfo.serverProtocolVersion().olderThanOrEquals(ProtocolVersion.v1_8)
&& protocolInfo.serverProtocolVersion().isKnown() ? 0xF : states; && protocolInfo.serverProtocolVersion().isKnown() ? 0xF : states;
} }
} }

Datei anzeigen

@ -36,7 +36,7 @@ public class VelocityViaLoader implements ViaPlatformLoader {
.getPlugin("viaversion").flatMap(PluginContainer::getInstance).get(); .getPlugin("viaversion").flatMap(PluginContainer::getInstance).get();
final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
if (protocolVersion.lowerThan(ProtocolVersion.v1_9)) { if (protocolVersion.olderThan(ProtocolVersion.v1_9)) {
Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider()); Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
} }