private void overrideI() { try { Field field = EnumProtocol.class.getDeclaredField("i"); field.setAccessible(true); this.map = (BiMap) field.get(EnumProtocol.PLAY); special = new ProxyHashBiMap<Integer, Class>(map); set(field, EnumProtocol.PLAY, special); } catch(Exception ex) { ex.printStackTrace(); throw new ExceptionInInitializerError("Nope, not allowed."); } }
protected void a(ChannelHandlerContext channelhandlercontext, Packet packet, ByteBuf bytebuf) throws IOException { Integer integer = (Integer) ((BiMap) channelhandlercontext.channel().attr(NetworkManager.f).get()).inverse().get(packet.getClass()); if (a.isDebugEnabled()) { a.debug(b, "OUT: [{}:{}] {}[{}]", new Object[] { channelhandlercontext.channel().attr(NetworkManager.d).get(), integer, packet.getClass().getName(), packet.b()}); } if (integer == null) { throw new IOException("Can\'t serialize unregistered packet"); } else { PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext.channel())); // Spigot packetdataserializer.b(integer.intValue()); packet.b(packetdataserializer); this.c.b(integer.intValue(), (long) packetdataserializer.readableBytes()); } }
public static Packet a(BiMap bimap, int i) { try { Class oclass = (Class) bimap.get(Integer.valueOf(i)); return oclass == null ? null : (Packet) oclass.newInstance(); } catch (Exception exception) { a.error("Couldn\'t create packet " + i, exception); return null; } }
public ProxyHashBiMap(BiMap<K, V> map) { this.delegate = map; this.inverse = new Inverse(this, map.inverse(), map); }
private ProxyHashBiMap(BiMap<K, V> map, BiMap<V, K> inversed) { this.delegate = map; this.inverse = null; }
private Inverse(ProxyHashBiMap original, BiMap<V, K> forward, BiMap<K, V> backward) { super(forward, backward); this.original = original; }