com.comphenix.protocol.events.ListenerPriority Java Examples
The following examples show how to use
com.comphenix.protocol.events.ListenerPriority.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpigotProtocolHackPacketListener.java From EchoPet with GNU General Public License v3.0 | 5 votes |
public SpigotProtocolHackPacketListener(EchoPetPlugin echoPetPlugin) { super(echoPetPlugin, ListenerPriority.HIGHEST, PacketType.Play.Server.SPAWN_ENTITY_LIVING, PacketType.Play.Server.ENTITY_METADATA); this.echoPetPlugin = echoPetPlugin; ProtocolLibrary.getProtocolManager().addPacketListener(this); }
Example #2
Source File: PacketInterceptor.java From BetonQuest with GNU General Public License v3.0 | 5 votes |
public PacketInterceptor(Conversation conv, String playerID) { this.conv = conv; this.player = PlayerConverter.getPlayer(playerID); // Intercept Packets packetAdapter = new PacketAdapter(BetonQuest.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Server.CHAT ) { @Override public void onPacketSending(PacketEvent event) { if (event.getPlayer() != player) { return; } if (event.getPacketType().equals(PacketType.Play.Server.CHAT)) { PacketContainer packet = event.getPacket(); BaseComponent[] bc = (BaseComponent[]) packet.getModifier().read(1); if (bc != null && bc.length > 0 && ((TextComponent) bc[0]).getText().contains("_bq_")) { packet.getModifier().write(1, Arrays.copyOfRange(bc, 1, bc.length)); event.setPacket(packet); return; } // Else save message to replay later WrapperPlayServerChat chat = new WrapperPlayServerChat(event.getPacket()); event.setCancelled(true); messages.add(chat); } } }; ProtocolLibrary.getProtocolManager().addPacketListener(packetAdapter); }
Example #3
Source File: KeepAlive.java From AACAdditionPro with GNU General Public License v3.0 | 5 votes |
public KeepAlive() { super(AACAdditionPro.getInstance(), ListenerPriority.LOW, // --------------- Server --------------- // // KeepAlive analysis PacketType.Play.Server.KEEP_ALIVE, // --------------- Client --------------- // // KeepAlive analysis PacketType.Play.Client.KEEP_ALIVE); }
Example #4
Source File: Inventory.java From AACAdditionPro with GNU General Public License v3.0 | 5 votes |
public Inventory() { super(AACAdditionPro.getInstance(), ListenerPriority.LOWEST, // Look PacketType.Play.Client.LOOK, // Move PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK); }
Example #5
Source File: PacketAnalysis.java From AACAdditionPro with GNU General Public License v3.0 | 5 votes |
public PacketAnalysis() { super(AACAdditionPro.getInstance(), ListenerPriority.LOW, // --------------- Server --------------- // // Compare PacketType.Play.Server.POSITION, // --------------- Client --------------- // // CombatOrder PacketType.Play.Client.USE_ENTITY, PacketType.Play.Client.ARM_ANIMATION, // EqualRotation PacketType.Play.Client.LOOK, // EqualRotation + Compare PacketType.Play.Client.POSITION_LOOK); }
Example #6
Source File: ChatPacketListener.java From ChatItem with GNU General Public License v3.0 | 5 votes |
public ChatPacketListener(Plugin plugin, ListenerPriority listenerPriority, Storage s, PacketType... types) { super(plugin, listenerPriority, types); if(ChatItem.supportsShulkerBoxes()){ SHULKER_BOXES.addAll(Arrays.asList(Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX)); } c = s; }
Example #7
Source File: LookPacketData.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
public LookPacketDataUpdater() { super(AACAdditionPro.getInstance(), ListenerPriority.MONITOR, PacketType.Play.Client.LOOK, PacketType.Play.Client.POSITION_LOOK); }
Example #8
Source File: TabCompletePacketAdapter.java From AuthMeReloaded with GNU General Public License v3.0 | 4 votes |
TabCompletePacketAdapter(AuthMe plugin, PlayerCache playerCache) { super(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.TAB_COMPLETE); this.playerCache = playerCache; }
Example #9
Source File: HardcoreHeartsModule.java From UHC with MIT License | 4 votes |
HardcoreHeartsListener() { super(HardcoreHeartsModule.this.plugin, ListenerPriority.NORMAL, PacketType.Play.Server.LOGIN); }
Example #10
Source File: VanishIndication.java From SuperVanish with Mozilla Public License 2.0 | 4 votes |
@Override public void onEnable() { ProtocolLibrary.getProtocolManager().addPacketListener( new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO) { @Override public void onPacketSending(PacketEvent event) { // multiple events share same packet object event.setPacket(event.getPacket().shallowClone()); List<PlayerInfoData> infoDataList = new ArrayList<>( event.getPacket().getPlayerInfoDataLists().read(0)); Player receiver = event.getPlayer(); for (PlayerInfoData infoData : ImmutableList.copyOf(infoDataList)) { try { if (!VanishIndication.this.plugin.getVisibilityChanger().getHider() .isHidden(infoData.getProfile().getUUID(), receiver) && VanishIndication.this.plugin.getVanishStateMgr() .isVanished(infoData.getProfile().getUUID())) { if (!receiver.getUniqueId().equals(infoData.getProfile().getUUID())) if (infoData.getGameMode() != EnumWrappers.NativeGameMode.SPECTATOR) { int latency; try { latency = infoData.getLatency(); } catch (NoSuchMethodError e) { latency = 21; } if (event.getPacket().getPlayerInfoAction().read(0) != EnumWrappers.PlayerInfoAction.UPDATE_GAME_MODE) { continue; } PlayerInfoData newData = new PlayerInfoData(infoData.getProfile(), latency, EnumWrappers.NativeGameMode.SPECTATOR, infoData.getDisplayName()); infoDataList.remove(infoData); infoDataList.add(newData); } } } catch (UnsupportedOperationException ignored) { // Ignore temporary players } } event.getPacket().getPlayerInfoDataLists().write(0, infoDataList); } }); }
Example #11
Source File: ServerListPacketListener.java From SuperVanish with Mozilla Public License 2.0 | 4 votes |
public ServerListPacketListener(SuperVanish plugin) { //noinspection deprecation super(plugin, ListenerPriority.NORMAL, PacketType.Status.Server.OUT_SERVER_INFO); this.plugin = plugin; }
Example #12
Source File: ForceFieldAdapter.java From CombatLogX with GNU General Public License v3.0 | 4 votes |
ForceFieldAdapter(ForceField forceField) { super(forceField.getExpansion().getPlugin().getPlugin(), ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_CHANGE); this.forceField = forceField; this.plugin = this.forceField.getExpansion().getPlugin(); }
Example #13
Source File: ChatPacketValidator.java From ChatItem with GNU General Public License v3.0 | 4 votes |
public ChatPacketValidator(Plugin plugin, ListenerPriority listenerPriority, Storage s, PacketType... types) { super(plugin, listenerPriority, types); c = s; }
Example #14
Source File: HandshakeListener.java From ChatItem with GNU General Public License v3.0 | 4 votes |
public HandshakeListener(Plugin plugin, ListenerPriority listenerPriority, PacketType... types) { super(plugin, listenerPriority, types); }
Example #15
Source File: DataUpdaterEvents.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
private KeepAliveDataUpdater() { super(AACAdditionPro.getInstance(), ListenerPriority.LOWEST, PacketType.Play.Server.KEEP_ALIVE); }
Example #16
Source File: DataUpdaterEvents.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
private VelocityChangeDataUpdater() { super(AACAdditionPro.getInstance(), ListenerPriority.MONITOR, PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK); }
Example #17
Source File: DamageIndicator.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
public DamageIndicator() { super(AACAdditionPro.getInstance(), ListenerPriority.HIGH, PacketType.Play.Server.ENTITY_METADATA, PacketType.Play.Server.NAMED_ENTITY_SPAWN); }
Example #18
Source File: ProtocolHandshakeListener.java From BungeeGuard with MIT License | 4 votes |
Adapter(Plugin plugin) { super(plugin, ListenerPriority.LOWEST, PacketType.Handshake.Client.SET_PROTOCOL); }
Example #19
Source File: ProtocolSubscriptionBuilderImpl.java From helper with MIT License | 4 votes |
ProtocolSubscriptionBuilderImpl(Set<PacketType> types, ListenerPriority priority) { this.types = ImmutableSet.copyOf(types); this.priority = priority; }
Example #20
Source File: ProtocolSubscriptionBuilder.java From helper with MIT License | 3 votes |
/** * Makes a HandlerBuilder for the given packets * * @param priority the priority to listen at * @param packets the packets to handle * @return a {@link ProtocolSubscriptionBuilder} to construct the event handler */ @Nonnull static ProtocolSubscriptionBuilder newBuilder(@Nonnull ListenerPriority priority, @Nonnull PacketType... packets) { Objects.requireNonNull(priority, "priority"); Objects.requireNonNull(packets, "packets"); return new ProtocolSubscriptionBuilderImpl(ImmutableSet.copyOf(packets), priority); }
Example #21
Source File: Protocol.java From helper with MIT License | 2 votes |
/** * Makes a HandlerBuilder for the given packets * * @param priority the priority to listen at * @param packets the packets to handle * @return a {@link ProtocolSubscriptionBuilder} to construct the event handler */ @Nonnull public static ProtocolSubscriptionBuilder subscribe(@Nonnull ListenerPriority priority, @Nonnull PacketType... packets) { return ProtocolSubscriptionBuilder.newBuilder(priority, packets); }
Example #22
Source File: ProtocolSubscriptionBuilder.java From helper with MIT License | 2 votes |
/** * Makes a HandlerBuilder for the given packets * * @param packets the packets to handle * @return a {@link ProtocolSubscriptionBuilder} to construct the event handler */ @Nonnull static ProtocolSubscriptionBuilder newBuilder(@Nonnull PacketType... packets) { return newBuilder(ListenerPriority.NORMAL, packets); }