MyWorlds/SeperateInventories

From BergerHealer Wiki
Revision as of 19:02, 26 July 2022 by Bergerkiller (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

« Go back

Configuration

MyWorlds has an advanced system in place to separate player data on different 'island' groups of worlds. This way you can prevent items going between worlds, while allowing them between linked worlds in survival. Player data is saved inside the world folder, in standard Minecraft NBT format. No special database is used.

To begin using this system, set useWorldInventories to true in plugins/My_Worlds/config.yml.

The moment it is turned on, all worlds will have their own inventory state. This includes the player's items, experience, potion effects, health, hunger. Normally all player data is stored on the main world ('world'). Now this is no longer the case, it means players on other worlds will see their inventory wiped. Their items are still there, but only on the main world.

You'll have to arrange inventory migration if you have existing players. Make a backup of the main world's playerdata folder. This ensures players don't lose their inventory/experience/etc. due to a missing merged inventory world configuration.

To start, you will probably want to merge the main world/nether/end inventories. Use the following command (replace 'world' with your main world name):

/world inventory merge world world_nether world_the_end

Migration

MyWorlds loads player data in two stages. First the main world's player data is loaded. If that data points to the player being in another world with a different inventory, then that world's player data is loaded. If players were on a world pre-migration that is now on a separate, split inventory, they will log on and see that their inventory is empty.

To fix that, copy the affected player's player data file to the world they were last on. If you copy all the main world's player data files to the split-off worlds, this will fix it for everyone, but it will also cause all players that weren't on the split-off world to have the same inventory as they have on the main world. Basically, it's complicated, which is why backups are important.

Commands

The main command to manage world inventory configuration is the /world inventory command. Syntax is as follows:

/world inventory merge [world1] [world2] [world3]

/world inventory split [world1] [world2] [world3]

/world inventory enable [world]

/world inventory disable [world]

When merging inventories, all their state is shared. The data of this shared state is saved in the first world argument of your merge command, in the example 'world1'. If players have existing data on a particular world you want to keep, make sure to use this world name as a first argument.

When splitting, world name order doesn't matter. Each world you specify is detached from any shared state, and given its own inventory for that world alone. To migrate a world, you can first split it from the original shared world group, then use merge to connect it to the other group.

No player data will ever be lost as a result of splitting/merging. If you accidentally 'lose' people's data by setting the main world for an inventory group, you can either copy the worldname/playerdata folder to the right place, or use the split command for that world to allow players to (temporarily) access their old inventories again.

With enable/disable, inventory saving for that world can be turned off entirely. When players rejoin the world, their inventory will be completely wiped every time.

Permissions

There are several permissions which configure inventory behavior: myworlds.world.inventory - Whether the inventory merge/split/etc. commands can be used myworlds.world.keepinventory - Makes player exempt from splitting inventories, always keeping the inventory when switching between worlds.