public void sendPermission(UserConnection user) throws Exception { if (!isEnabled()) return; PacketWrapper wrapper = new PacketWrapper(0x1B, null, user); // Entity status wrapper.write(Type.INT, user.get(EntityTracker.class).getProvidedEntityId()); // Entity ID wrapper.write(Type.BYTE, (byte) 26); // Hardcoded op permission level wrapper.send(Protocol1_9TO1_8.class); user.get(CommandBlockStorage.class).setPermissions(true); }
@Subscribe(order = PostOrder.LAST) public void onServerConnected(ServerConnectedEvent event) { UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { int entityId = user.get(EntityTracker.class).getProvidedEntityId(); PacketWrapper wrapper = new PacketWrapper(0x39, null, user); wrapper.write(Type.VAR_INT, entityId); wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.Byte, (byte) 0))); wrapper.send(Protocol1_9TO1_8.class); } } catch (Exception e) { e.printStackTrace(); } } }
@EventHandler(priority = EventPriority.HIGH) public void onServerConnected(ServerConnectedEvent event) { UserConnection user = Via.getManager().getConnection(event.getPlayer().getUniqueId()); if (user == null) return; try { if (user.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) { int entityId = user.get(EntityTracker.class).getProvidedEntityId(); PacketWrapper wrapper = new PacketWrapper(0x39, null, user); wrapper.write(Type.VAR_INT, entityId); wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.Byte, (byte) 0))); wrapper.send(Protocol1_9TO1_8.class); } } catch (Exception e) { e.printStackTrace(); } } }
if (entityID != getProvidedEntityId() && Via.getConfig().isShieldBlocking()) { if ((data & 0x10) == 0x10) { if (validBlocking.contains(entityID)) {