Messing with player inventories?

Discussion in 'Plugin Development' started by ZNickq, Mar 22, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ZNickq

    Code:java
    1.  
    2. public static void reflect(Player player) {
    3. CraftHumanEntity che = (CraftHumanEntity) player;
    4. try {
    5. Field field = CraftHumanEntity.class.getDeclaredField("inventory");
    6. field.setAccessible(true);
    7. field.set(che, new BossInventory(player.getInventory()));
    8. } catch (Exception ex) {
    9. Logger.getLogger(PlayerManager.class.getName()).log(Level.SEVERE, null, ex);
    10. }
    11. }
    12.  


    If i check with instanceof BossInventory right after that code, it still fails...does anyone know what i could be doing wrong?
     
  2. Offline

    dsmyth1915

    Line 7, try; player.getName().getInventory()
     
  3. Offline

    Don Redhorse

    hmm I think you need to refresh the inventory
     
Thread Status:
Not open for further replies.

Share This Page