Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-25 15:50:10 +01:00
Consistent equalTo names
Dieser Commit ist enthalten in:
Ursprung
5c21f60ef7
Commit
dccda57fc0
@ -380,7 +380,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
|
||||
* @param other other protocol version
|
||||
* @return true if this protocol version is higher than or equal to the other protocol version
|
||||
*/
|
||||
public boolean newerThanOrEquals(final ProtocolVersion other) {
|
||||
public boolean newerThanOrEqualTo(final ProtocolVersion other) {
|
||||
return this.compareTo(other) >= 0;
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
|
||||
* @param other other protocol version
|
||||
* @return true if this protocol version is lower than or equal to the other protocol version
|
||||
*/
|
||||
public boolean olderThanOrEquals(final ProtocolVersion other) {
|
||||
public boolean olderThanOrEqualTo(final ProtocolVersion other) {
|
||||
return this.compareTo(other) <= 0;
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ public class ProtocolVersion implements Comparable<ProtocolVersion> {
|
||||
* @return true if this protocol version is between the given protocol versions, inclusive
|
||||
*/
|
||||
public boolean betweenInclusive(final ProtocolVersion min, final ProtocolVersion max) {
|
||||
return this.newerThanOrEquals(min) && this.olderThanOrEquals(max);
|
||||
return this.newerThanOrEqualTo(min) && this.olderThanOrEqualTo(max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
|
||||
if (info == null) return;
|
||||
|
||||
ProtocolVersion protocolVersion = info.protocolVersion();
|
||||
if (is1_14Fix && protocolVersion.newerThanOrEquals(ProtocolVersion.v1_14)) {
|
||||
if (is1_14Fix && protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_14)) {
|
||||
setHeight(player, event.isSneaking() ? HEIGHT_1_14 : STANDING_HEIGHT);
|
||||
if (event.isSneaking())
|
||||
sneakingUuids.add(player.getUniqueId());
|
||||
@ -108,7 +108,7 @@ public class PlayerSneakListener extends ViaBukkitListener {
|
||||
sneaking.put(player, true);
|
||||
else
|
||||
sneaking.remove(player);
|
||||
} else if (is1_9Fix && protocolVersion.newerThanOrEquals(ProtocolVersion.v1_9)) {
|
||||
} else if (is1_9Fix && protocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
|
||||
setHeight(player, event.isSneaking() ? HEIGHT_1_9 : STANDING_HEIGHT);
|
||||
if (!useCache) return;
|
||||
if (event.isSneaking())
|
||||
|
@ -133,7 +133,7 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider
|
||||
final ProtocolVersion protocol = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
|
||||
if (protocol.equalTo(ProtocolVersion.v1_8)) {
|
||||
ReflectionUtil.set(packet, "shift", 1);
|
||||
} else if (protocol.newerThanOrEquals(ProtocolVersion.v1_9)) {
|
||||
} else if (protocol.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
|
||||
ReflectionUtil.set(packet, "shift", clickTypeEnum);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -170,7 +170,7 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider
|
||||
try {
|
||||
this.windowClickPacketClass = NMSUtil.nms("PacketPlayInWindowClick");
|
||||
final ProtocolVersion protocol = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
|
||||
if (protocol.newerThanOrEquals(ProtocolVersion.v1_9)) {
|
||||
if (protocol.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
|
||||
Class<?> eclassz = NMSUtil.nms("InventoryClickType");
|
||||
Object[] constants = eclassz.getEnumConstants();
|
||||
this.clickTypeEnum = constants[1]; // QUICK_MOVE
|
||||
@ -199,6 +199,6 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider
|
||||
|
||||
private boolean isSupported() {
|
||||
final ProtocolVersion protocol = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
|
||||
return protocol.newerThanOrEquals(ProtocolVersion.v1_8) && protocol.olderThanOrEquals(ProtocolVersion.v1_11_1);
|
||||
return protocol.newerThanOrEqualTo(ProtocolVersion.v1_8) && protocol.olderThanOrEqualTo(ProtocolVersion.v1_11_1);
|
||||
}
|
||||
}
|
@ -173,7 +173,7 @@ public class BungeeServerHandler implements Listener {
|
||||
String serverName = server.getInfo().getName();
|
||||
storage.setCurrentServer(serverName);
|
||||
ProtocolVersion serverProtocolVersion = Via.proxyPlatform().protocolDetectorService().serverProtocolVersion(serverName);
|
||||
if (serverProtocolVersion.olderThanOrEquals(ProtocolVersion.v1_8) && storage.getBossbar() != null) { // 1.8 doesn't have BossBar packet
|
||||
if (serverProtocolVersion.olderThanOrEqualTo(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.
|
||||
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
|
||||
for (UUID uuid : storage.getBossbar()) {
|
||||
@ -210,8 +210,8 @@ public class BungeeServerHandler implements Listener {
|
||||
pipeline.add(Via.getManager().getProtocolManager().getBaseProtocol(serverProtocolVersion));
|
||||
|
||||
// Workaround 1.13 server change
|
||||
boolean toNewId = previousServerProtocol.olderThan(ProtocolVersion.v1_13) && serverProtocolVersion.newerThanOrEquals(ProtocolVersion.v1_13);
|
||||
boolean toOldId = previousServerProtocol.newerThanOrEquals(ProtocolVersion.v1_13) && serverProtocolVersion.olderThan(ProtocolVersion.v1_13);
|
||||
boolean toNewId = previousServerProtocol.olderThan(ProtocolVersion.v1_13) && serverProtocolVersion.newerThanOrEqualTo(ProtocolVersion.v1_13);
|
||||
boolean toOldId = previousServerProtocol.newerThanOrEqualTo(ProtocolVersion.v1_13) && serverProtocolVersion.olderThan(ProtocolVersion.v1_13);
|
||||
if (previousServerProtocol.isKnown() && (toNewId || toOldId)) {
|
||||
Collection<String> registeredChannels = (Collection<String>) getRegisteredChannels.invoke(event.getPlayer().getPendingConnection());
|
||||
if (!registeredChannels.isEmpty()) {
|
||||
|
@ -71,7 +71,7 @@ public class BaseProtocol extends AbstractProtocol<BaseClientboundPacket, BaseCl
|
||||
List<ProtocolPathEntry> protocolPath = null;
|
||||
|
||||
// Only allow newer clients (or 1.9.2 on 1.9.4 server if the server supports it)
|
||||
if (info.protocolVersion().newerThanOrEquals(serverProtocol) || Via.getPlatform().isOldClientsAllowed()) {
|
||||
if (info.protocolVersion().newerThanOrEqualTo(serverProtocol) || Via.getPlatform().isOldClientsAllowed()) {
|
||||
protocolPath = Via.getManager().getProtocolManager().getProtocolPath(info.protocolVersion(), serverProtocol);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class BaseProtocol1_7 extends AbstractProtocol<BaseClientboundPacket, Bas
|
||||
|
||||
ProtocolVersion closestServerProtocol = versionProvider.getClosestServerProtocol(wrapper.user());
|
||||
List<ProtocolPathEntry> protocols = null;
|
||||
if (info.protocolVersion().newerThanOrEquals(closestServerProtocol) || Via.getPlatform().isOldClientsAllowed()) {
|
||||
if (info.protocolVersion().newerThanOrEqualTo(closestServerProtocol) || Via.getPlatform().isOldClientsAllowed()) {
|
||||
protocols = Via.getManager().getProtocolManager()
|
||||
.getProtocolPath(info.protocolVersion(), closestServerProtocol);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
|
||||
clientChunks.setEnvironment(dimensionId);
|
||||
|
||||
// Reset recipes
|
||||
if (user.getProtocolInfo().protocolVersion().newerThanOrEquals(ProtocolVersion.v1_13)) {
|
||||
if (user.getProtocolInfo().protocolVersion().newerThanOrEqualTo(ProtocolVersion.v1_13)) {
|
||||
wrapper.create(ClientboundPackets1_13.DECLARE_RECIPES, packetWrapper -> packetWrapper.write(Type.VAR_INT, 0))
|
||||
.scheduleSend(Protocol1_13To1_12_2.class);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
||||
if (states != 0) return states;
|
||||
|
||||
ProtocolInfo protocolInfo = user.getProtocolInfo();
|
||||
return protocolInfo.serverProtocolVersion().olderThanOrEquals(ProtocolVersion.v1_8)
|
||||
return protocolInfo.serverProtocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)
|
||||
&& protocolInfo.serverProtocolVersion().isKnown() ? 0xF : states;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren