com.comphenix.protocol.reflect.FieldAccessException Java Examples
The following examples show how to use
com.comphenix.protocol.reflect.FieldAccessException.
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: SkinApplier.java From ChangeSkin with MIT License | 5 votes |
private void sendUpdateOthers() throws FieldAccessException { //triggers an update for others player to see the new skin Bukkit.getOnlinePlayers().stream() .filter(onlinePlayer -> !onlinePlayer.equals(receiver)) .filter(onlinePlayer -> onlinePlayer.canSee(receiver)) .forEach(this::hideAndShow); }
Example #2
Source File: SkinApplier.java From ChangeSkin with MIT License | 5 votes |
private void sendUpdateSelf(WrappedGameProfile gameProfile) throws FieldAccessException { Optional.ofNullable(receiver.getVehicle()).ifPresent(Entity::eject); sendPacketsSelf(gameProfile); //trigger update exp receiver.setExp(receiver.getExp()); //triggers updateAbilities receiver.setWalkSpeed(receiver.getWalkSpeed()); //send the current inventory - otherwise player would have an empty inventory receiver.updateInventory(); PlayerInventory inventory = receiver.getInventory(); inventory.setHeldItemSlot(inventory.getHeldItemSlot()); //trigger update attributes like health modifier for generic.maxHealth try { receiver.getClass().getDeclaredMethod("updateScaledHealth").invoke(receiver); } catch (ReflectiveOperationException reflectiveEx) { plugin.getLog().error("Failed to invoke updateScaledHealth for attributes", reflectiveEx); } //tell NameTagEdit to refresh the scoreboard if (Bukkit.getPluginManager().isPluginEnabled("NametagEdit")) { NametagEdit.getApi().reloadNametag(receiver); } }
Example #3
Source File: TabCompletePacketAdapter.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
@Override public void onPacketReceiving(PacketEvent event) { if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE) { try { if (!playerCache.isAuthenticated(event.getPlayer().getName())) { event.setCancelled(true); } } catch (FieldAccessException e) { logger.logException("Couldn't access field:", e); } } }