mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-18 06:38:31 +01:00
#2610: Fix out of date message for unsupported versions
This commit is contained in:
parent
e2bc7ed797
commit
caeabb5b62
@ -1,6 +1,7 @@
|
|||||||
package net.md_5.bungee.protocol;
|
package net.md_5.bungee.protocol;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import gnu.trove.map.TIntObjectMap;
|
import gnu.trove.map.TIntObjectMap;
|
||||||
import gnu.trove.map.TObjectIntMap;
|
import gnu.trove.map.TObjectIntMap;
|
||||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||||
@ -359,9 +360,19 @@ public enum Protocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ProtocolData getProtocolData(int version)
|
||||||
|
{
|
||||||
|
ProtocolData protocol = protocols.get( version );
|
||||||
|
if ( protocol == null && ( protocolPhase != Protocol.GAME ) )
|
||||||
|
{
|
||||||
|
protocol = Iterables.getFirst( protocols.valueCollection(), null );
|
||||||
|
}
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
|
||||||
public final DefinedPacket createPacket(int id, int version)
|
public final DefinedPacket createPacket(int id, int version)
|
||||||
{
|
{
|
||||||
ProtocolData protocolData = protocols.get( version );
|
ProtocolData protocolData = getProtocolData( version );
|
||||||
if ( protocolData == null )
|
if ( protocolData == null )
|
||||||
{
|
{
|
||||||
throw new BadPacketException( "Unsupported protocol version " + version );
|
throw new BadPacketException( "Unsupported protocol version " + version );
|
||||||
@ -423,7 +434,7 @@ public enum Protocol
|
|||||||
final int getId(Class<? extends DefinedPacket> packet, int version)
|
final int getId(Class<? extends DefinedPacket> packet, int version)
|
||||||
{
|
{
|
||||||
|
|
||||||
ProtocolData protocolData = protocols.get( version );
|
ProtocolData protocolData = getProtocolData( version );
|
||||||
if ( protocolData == null )
|
if ( protocolData == null )
|
||||||
{
|
{
|
||||||
throw new BadPacketException( "Unsupported protocol version" );
|
throw new BadPacketException( "Unsupported protocol version" );
|
||||||
|
Loading…
Reference in New Issue
Block a user