Archiviert
13
0

Actually use UpdateSign when it exists

Dieser Commit ist enthalten in:
Dan Mulloy 2016-09-18 14:42:40 -04:00
Ursprung 051989a396
Commit d173be0db5
2 geänderte Dateien mit 13 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -189,19 +189,19 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
* @deprecated Removed in 1.9 * @deprecated Removed in 1.9
*/ */
@Deprecated @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 Removed in 1.9
*/ */
@Deprecated @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 Removed in 1.9
*/ */
@Deprecated @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 // ----- Renamed packets
@ -235,7 +235,8 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
* @deprecated Replaced by {@link TILE_ENTITY_DATA} * @deprecated Replaced by {@link TILE_ENTITY_DATA}
*/ */
@Deprecated @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(); private final static Server INSTANCE = new Server();
@ -248,11 +249,6 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
public static Server getInstance() { public static Server getInstance() {
return INSTANCE; return INSTANCE;
} }
private static PacketType getUpdateSign() {
PacketType type = new PacketType(PROTOCOL, SENDER, -1, -1, "UpdateSign");
return type.getPacketClass() != null ? type : UPDATE_ENTITY_NBT.deprecated();
}
} }
/** /**

Datei anzeigen

@ -1827,6 +1827,14 @@ public class MinecraftReflection {
return getArrayClass(getMultiBlockChangeInfoClass()); return getArrayClass(getMultiBlockChangeInfoClass());
} }
public static boolean signUpdateExists() {
try {
return getMinecraftClass("PacketPlayOutUpdateSign") != null;
} catch (RuntimeException ex) {
return false;
}
}
/** /**
* Retrieve a CraftItemStack from a given ItemStack. * Retrieve a CraftItemStack from a given ItemStack.
* @param bukkitItemStack - the Bukkit ItemStack to convert. * @param bukkitItemStack - the Bukkit ItemStack to convert.