overwrite inventory one way

Discussion in 'Plugin Development' started by tonyjack, Nov 4, 2019.

  1. Offline

    tonyjack

    so i got world a, and world b
    when i go from world a to world b, i want to take my world a inventory and add it to my world b inventory, and if inventory is full, then drop the items under the player

    when going from world b to world a, do nothing.

    public void onPlayerTeleport(PlayerTeleportEvent event) {
    object stuff1 = player.getInventory().getContents();
    object stuff2 = player.getInventory().getArmorContents();
    if (p.getWorld() = "a") {return;}
    if (p.getWorld() = "b") {
    player.getInventory().setArmorContents(stuff2);
    player.getInventory().setContents(stuff1);
    }
    }

    ... soo..... sigh.
     
  2. Offline

    CraftCreeper6

    @tonyjack
    Well all you've done there is set the players inventory to the players inventory.

    You need to save their inventory in one world, and transfer it to the next one.
     

Share This Page