com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction Java Examples
The following examples show how to use
com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction.
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: Packets.java From tabbed with MIT License | 5 votes |
/** * Creates a PLAYER_INFO packet from the params. * @param action * @param data * @return */ public static PacketContainer getPacket(PlayerInfoAction action, List<PlayerInfoData> data) { PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(Server.PLAYER_INFO); packet.getPlayerInfoAction().write(0, action); packet.getPlayerInfoDataLists().write(0, data); return packet; }
Example #2
Source File: WrapperPlayServerPlayerInfo.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
public PlayerInfoAction getAction() { return handle.getPlayerInfoAction().read(0); }
Example #3
Source File: WrapperPlayServerPlayerInfo.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
public void setAction(PlayerInfoAction value) { handle.getPlayerInfoAction().write(0, value); }
Example #4
Source File: SimpleTabList.java From tabbed with MIT License | 4 votes |
private List<PacketContainer> getUpdate(Map<Integer,TabItem> oldItems, Map<Integer,TabItem> newItems) { List<PlayerInfoData> removePlayer = new ArrayList<>(); List<PlayerInfoData> addPlayer = new ArrayList<>(); List<PlayerInfoData> displayChanged = new ArrayList<>(); List<PlayerInfoData> pingUpdated = new ArrayList<>(); for (Entry<Integer, TabItem> entry : newItems.entrySet()) { int index = entry.getKey(); TabItem oldItem = oldItems.get(index); TabItem newItem = entry.getValue(); if (newItem == null && oldItem != null) { // TabItem has been removed. removePlayer.add(getPlayerInfoData(index, oldItem)); continue; } boolean skinChanged = oldItem == null || newItem.updateSkin() || !newItem.getSkin().equals(oldItem.getSkin()); boolean textChanged = oldItem == null || newItem.updateText() || !newItem.getText().equals(oldItem.getText()); boolean pingChanged = oldItem == null || newItem.updatePing() || oldItem.getPing() != newItem.getPing(); if (skinChanged) { if (oldItem != null) removePlayer.add(getPlayerInfoData(index, oldItem)); addPlayer.add(getPlayerInfoData(index, newItem)); } else if (pingChanged) { pingUpdated.add(getPlayerInfoData(index, newItem)); } if (textChanged) displayChanged.add(getPlayerInfoData(index, newItem)); } List<PacketContainer> result = new ArrayList<>(4); if (removePlayer.size() > 0 || addPlayer.size() > 0) { result.add(Packets.getPacket(PlayerInfoAction.REMOVE_PLAYER, removePlayer)); result.add(Packets.getPacket(PlayerInfoAction.ADD_PLAYER, addPlayer)); } if (displayChanged.size() > 0) result.add(Packets.getPacket(PlayerInfoAction.UPDATE_DISPLAY_NAME, displayChanged)); if (pingUpdated.size() > 0) result.add(Packets.getPacket(PlayerInfoAction.UPDATE_LATENCY, pingUpdated)); return result; }
Example #5
Source File: Packets.java From tabbed with MIT License | 2 votes |
/** * Creates a PLAYER_INFO packet from the params. * @param action * @param data * @return */ public static PacketContainer getPacket(PlayerInfoAction action, PlayerInfoData data) { return getPacket(action, Collections.singletonList(data)); }