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; } }