public SpecialEnderChest(Player p, Boolean online) { super( ((CraftPlayer) p).getHandle().getEnderChest().getInventoryName(), ((CraftPlayer) p).getHandle().getEnderChest().k_(), ((CraftPlayer) p).getHandle().getEnderChest().getSize()); CraftPlayer player = (CraftPlayer) p; this.enderChest = player.getHandle().getEnderChest(); this.owner = player; this.items = enderChest.getContents(); }
@Override public void setPlayerOnline(Player player) { if (!playerOnline) { try { owner = (CraftPlayer) player; InventoryEnderChest playerEnderChest = owner.getHandle().getEnderChest(); Field field = playerEnderChest.getClass().getField("items"); field.setAccessible(true); field.set(playerEnderChest, this.items); } catch (Exception e) { } playerOnline = true; } }
@Override public void run() { for (Player player : Bukkit.getOnlinePlayers()) ((CraftPlayer) player).getHandle().getDataWatcher().watch(9, (byte) 0); }
@SuppressWarnings("unchecked") @Override public void queueChunkForUpdate(Player player, int cx, int cz) { ((CraftPlayer) player).getHandle().chunkCoordIntPairQueue.add(new ChunkCoordIntPair(cx, cz)); }