Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Merge pull request #1142 from creeper123123321/master
Use ProtocolInfo#getServerProtocolVersion for block connection, use b…
Dieser Commit ist enthalten in:
Commit
4a2bcf6fde
@ -2,6 +2,7 @@ package us.myles.ViaVersion.bungee.platform;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
@ -23,14 +24,17 @@ public class BungeeViaAPI implements ViaAPI<ProxiedPlayer> {
|
|||||||
@Override
|
@Override
|
||||||
public int getPlayerVersion(@NonNull ProxiedPlayer player) {
|
public int getPlayerVersion(@NonNull ProxiedPlayer player) {
|
||||||
if (!isPorted(player.getUniqueId()))
|
if (!isPorted(player.getUniqueId()))
|
||||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
return player.getPendingConnection().getVersion();
|
||||||
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlayerVersion(@NonNull UUID uuid) {
|
public int getPlayerVersion(@NonNull UUID uuid) {
|
||||||
if (!isPorted(uuid))
|
if (!isPorted(uuid)) {
|
||||||
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
|
||||||
|
if (player != null) return player.getPendingConnection().getVersion();
|
||||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
return ProtocolRegistry.SERVER_PROTOCOL;
|
||||||
|
}
|
||||||
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections;
|
|||||||
|
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.minecraft.Position;
|
import us.myles.ViaVersion.api.minecraft.Position;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||||
|
|
||||||
public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
||||||
|
|
||||||
@ -34,6 +34,8 @@ public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
|||||||
@Override
|
@Override
|
||||||
protected byte getStates(UserConnection user, Position position, int blockState) {
|
protected byte getStates(UserConnection user, Position position, int blockState) {
|
||||||
byte states = super.getStates(user, position, blockState);
|
byte states = super.getStates(user, position, blockState);
|
||||||
return states == 0 && (ProtocolRegistry.SERVER_PROTOCOL <= 47 && ProtocolRegistry.SERVER_PROTOCOL != -1) ? 0xF : states;
|
return states == 0
|
||||||
|
&& user.get(ProtocolInfo.class).getServerProtocolVersion() <= 47
|
||||||
|
&& user.get(ProtocolInfo.class).getServerProtocolVersion() != -1 ? 0xF : states;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package us.myles.ViaVersion.velocity.platform;
|
package us.myles.ViaVersion.velocity.platform;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
|
import com.velocitypowered.api.proxy.InboundConnection;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
import us.myles.ViaVersion.VelocityPlugin;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.ViaAPI;
|
import us.myles.ViaVersion.api.ViaAPI;
|
||||||
import us.myles.ViaVersion.api.boss.BossBar;
|
import us.myles.ViaVersion.api.boss.BossBar;
|
||||||
@ -21,14 +24,18 @@ public class VelocityViaAPI implements ViaAPI<Player> {
|
|||||||
@Override
|
@Override
|
||||||
public int getPlayerVersion(@NonNull Player player) {
|
public int getPlayerVersion(@NonNull Player player) {
|
||||||
if (!isPorted(player.getUniqueId()))
|
if (!isPorted(player.getUniqueId()))
|
||||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
return player.getProtocolVersion().getProtocol();
|
||||||
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlayerVersion(@NonNull UUID uuid) {
|
public int getPlayerVersion(@NonNull UUID uuid) {
|
||||||
if (!isPorted(uuid))
|
if (!isPorted(uuid)) {
|
||||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
return VelocityPlugin.PROXY.getPlayer(uuid)
|
||||||
|
.map(InboundConnection::getProtocolVersion)
|
||||||
|
.map(ProtocolVersion::getProtocol)
|
||||||
|
.orElse(ProtocolRegistry.SERVER_PROTOCOL);
|
||||||
|
}
|
||||||
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren