Jump to content

im trying to replace multiverse inventories


DraykerMaykerr

Recommended Posts

yo can someone help with this? heres what i have so far

 

on join:
  loop 36 times:
    set {%player's world%inventory::%uuid of player%::%loop-number - 1%} to slot "%loop-number - 1%" parsed as an integer of inventory of player

on world change:
  set {%uuid of player%prevworld} to {%uuid of player%world} 
  set {%uuid of player%world} to player's world
  if {%uuid of player%world} is not equal to {%uuid of player%prevworld}:
    loop 36 times:
      set {%player's world%inventory::%uuid of player%::%loop-number - 1%} to slot "%loop-number - 1%" parsed as an integer of inventory of player
    clear inventory of player
    loop {%player's world%inventory::%uuid of player%::*}:
      set slot {_num} of player's inventory to loop-value
      add 1 to {_num}

Link to comment
Share on other sites

on world change:
  clear player's inventory
  loop {%player's uuid%%player's world%userinv::*}:
    add loop-value-1 to player

every 5 ticks:
  loop all players:
    loop 54 times:
      if {%loop-player's uuid%%loop-player's world%userinv::*} does not contain slot "%loop-number - 1%" parsed as an integer of inventory of loop-player:
        add slot "%loop-number - 1%" parsed as an integer of inventory of loop-player to {%loop-player's uuid%%loop-player's world%userinv::*}
        loop {%loop-player's uuid%%loop-player's world%userinv::*}:
          set {%loop-player's uuid%lv} to loop-value-2
          if loop-player's inventory does not contain {%loop-player's uuid%lv}:
            add 1 to {%loop-player's uuid%num_}
            remove {%loop-player's uuid%lv} from {%loop-player's uuid%%loop-player's world%userinv::*}

command /clearinvworld [<text>]:
  trigger:
    clear {%player's uuid%%arg 1%userinv::*}
    send "&aSuccessfully cleared the inventory for the world %arg 1%."

  • Thanks 1
Link to comment
Share on other sites

Hey, I feel like you should do something differently:

create a saveInv and a giveInv function, which take in a text and a player and either save their inventory to a variable based on the text or retrieve it, and then use that to save inventories across worlds 😄

This will let you use it for other things that aren't related to worlds.

Another thing, you shouldn't use every 5 ticks, I recommend you try to figure out how to detect when they've teleported from one world to another and then detect their old and their new worlds. This will make your server lag less (because in this case you're looping 200 times per second per player which isn't very efficient)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...