/** * Determine if the given legacy packet exists. * @param packetId - the legacy packet ID. * @return TRUE if it does, FALSE otherwise. * @deprecated Legacy IDs haven't functioned properly for some time */ @Deprecated public static boolean hasLegacy(int packetId) { return getLookup().getFromLegacy(packetId) != null; }
/** * Retrieve a packet type from a legacy (1.6.4 and below) packet ID. * @param packetId - the legacy packet ID. * @return The corresponding packet type. * @throws IllegalArgumentException If the legacy packet could not be found. * @deprecated Legacy IDs haven't functioned properly for some time */ @Deprecated public static PacketType findLegacy(int packetId) { PacketType type = getLookup().getFromLegacy(packetId); if (type != null) return type; throw new IllegalArgumentException("Cannot find legacy packet " + packetId); }
/** * Retrieve a packet type from a legacy (1.6.4 and below) packet ID. * @param packetId - the legacy packet ID. * @param preference - the preferred sender, or NULL for any arbitrary sender. * @return The corresponding packet type. * @throws IllegalArgumentException If the legacy packet could not be found. * @deprecated Legacy IDs haven't functioned properly for some time */ @Deprecated public static PacketType findLegacy(int packetId, Sender preference) { if (preference == null) return findLegacy(packetId); PacketType type = getLookup().getFromLegacy(packetId, preference); if (type != null) return type; throw new IllegalArgumentException("Cannot find legacy packet " + packetId); }
/** * Retrieve a packet type from a legacy ID. * <p> * If no associated packet type could be found, a new will be registered under LEGACY. * @param id - the legacy ID. * @param sender - the sender of the packet, or NULL if unknown. * @return The packet type. * @throws IllegalArgumentException If the sender is NULL and the packet doesn't exist. * @deprecated Legacy IDs haven't functioned properly for some time */ @Deprecated public static PacketType fromLegacy(int id, Sender sender) { PacketType type = getLookup().getFromLegacy(id, sender); if (type == null) { if (sender == null) throw new IllegalArgumentException("Cannot find legacy packet " + id); type = newLegacy(sender, id); // As below scheduleRegister(type, "Dynamic-" + UUID.randomUUID().toString()); } return type; }