mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-30 14:43:27 +01:00
Actually use UpdateSign when it exists
This commit is contained in:
parent
051989a396
commit
d173be0db5
@ -189,19 +189,19 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
|
||||
* @deprecated Removed in 1.9
|
||||
*/
|
||||
@Deprecated
|
||||
public static final PacketType MAP_CHUNK_BULK = new PacketType(PROTOCOL, SENDER, -1, -1, "MapChunkBulk").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
public static final PacketType MAP_CHUNK_BULK = new PacketType(PROTOCOL, SENDER, 255, 255, "MapChunkBulk").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
|
||||
/**
|
||||
* @deprecated Removed in 1.9
|
||||
*/
|
||||
@Deprecated
|
||||
public static final PacketType SET_COMPRESSION = new PacketType(PROTOCOL, SENDER, -1, -1, "SetCompression").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
public static final PacketType SET_COMPRESSION = new PacketType(PROTOCOL, SENDER, 254, 254, "SetCompression").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
|
||||
/**
|
||||
* @deprecated Removed in 1.9
|
||||
*/
|
||||
@Deprecated
|
||||
public static final PacketType UPDATE_ENTITY_NBT = new PacketType(PROTOCOL, SENDER, -1, -1, "UpdateEntityNBT").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
public static final PacketType UPDATE_ENTITY_NBT = new PacketType(PROTOCOL, SENDER, 253, 253, "UpdateEntityNBT").deprecatedIn(MinecraftVersion.COMBAT_UPDATE);
|
||||
|
||||
// ----- Renamed packets
|
||||
|
||||
@ -235,7 +235,8 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
|
||||
* @deprecated Replaced by {@link TILE_ENTITY_DATA}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final PacketType UPDATE_SIGN = getUpdateSign();
|
||||
public static final PacketType UPDATE_SIGN = MinecraftReflection.signUpdateExists() ? new PacketType(PROTOCOL, SENDER, 252, 252, "UpdateSign") :
|
||||
TILE_ENTITY_DATA.deprecated();
|
||||
|
||||
private final static Server INSTANCE = new Server();
|
||||
|
||||
@ -248,11 +249,6 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
|
||||
public static Server getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static PacketType getUpdateSign() {
|
||||
PacketType type = new PacketType(PROTOCOL, SENDER, -1, -1, "UpdateSign");
|
||||
return type.getPacketClass() != null ? type : UPDATE_ENTITY_NBT.deprecated();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1827,6 +1827,14 @@ public class MinecraftReflection {
|
||||
return getArrayClass(getMultiBlockChangeInfoClass());
|
||||
}
|
||||
|
||||
public static boolean signUpdateExists() {
|
||||
try {
|
||||
return getMinecraftClass("PacketPlayOutUpdateSign") != null;
|
||||
} catch (RuntimeException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a CraftItemStack from a given ItemStack.
|
||||
* @param bukkitItemStack - the Bukkit ItemStack to convert.
|
||||
|
Loading…
Reference in New Issue
Block a user