Per World Inventory

34.3k Downloads

PerWorldInventory

The way this plugin stores data is fundamentally different from MultiVerse-Inventories. Like MV-I, this plugin saves data in a .json format, but that is where the similarities end. Not only does this save your inventory, it saves your stats as well! This includes things like active potion effects, exp, level, economy balance, and more. These all can be configured on a per-item basis, should you not want all of these saved. See the Configuration section below for these. All commands can be seen ingame with the '/pwi help' command.

> Configuration

##########################################
#  PerWorldInventory configuration file                     #
#                                                                                #
#  If new values are added to the                              #
#  config, they will not automatically                          #
#  be added here. They will default to                       #
#  false if not present.                                                #
##########################################

# Version of the config. DO NOT CHANGE!!!!!
config-version: 3

# If true, the plugin will change player's gamemodes when entering a world
# The gamemode set is configured in the worlds.yml file
manage-gamemodes: false

# If true, players will have different inventories for each gamemode
separate-gamemode-inventories: true

# All settings for players are here:
player:
  # Save and Load players' economy balances. Requires Vault!
  economy: false
  # Load players' ender chests
  ender-chest: true
  # Load players' inventory
  inventory: true
  # All options for player stats are here:
  stats:
    # Load if a player is able to fly
    can-fly: true
    # Load the player's display name
    display-name: false
    # Load a player's exhaustion level
    exhaustion: true
    # Load how much exp a player has
    exp: true
    # Load a player's hunger level
    food: true
    # Load if a player is flying
    flying: true
    # Load what gamemode a player is in. This is shadow-set to false if
    # 'manage-gamemodes' is true, to stop infinite loop
    gamemode: true
    # Load how much health a player has
    health: true
    # Load what level the player is
    level: true
    # Load all the potion effects of the player
    potion-effects: true
    # Load the saturation level of the player
    saturation: true
    # Load a player's fall distance
    fall-distance: true
    # Load the fire ticks a player has
    fire-ticks: true
    # Load the maximum amount of air a player can have
    max-air: true
    # Load the current remaining air a player has
    remaining-air: true

# Config Version 2 below this line #

# Configure the amount of time between saves, in seconds
# Default is 5 minutes (300 seconds)
save-interval: 300

# Config Version 3 Additions below this line #

# Attempt to figure out which world a player last logged off in
# and save/load the correct data if that world is different.
# REQUIRES MC 1.9.2 OR NEWER
load-data-on-join: false

# Print out debug messages to the console for every event that happens in PWI
debug-mode: false

Pretty straightforward, turning the options to false will cause that item to not be loaded on world change. The option 'manage-gamemodes' is set to false by default to not interfere with other plugins that you may have to manage GameModes.

groups:
  world1:
    worlds:
    - world1
    - world1_nether
    - world1_the_end
    default-gamemode: SURVIVAL
  world_2:
    worlds:
    - world_2
    default-gamemode: CREATIVE

This is where you configure your world groups. Follow the default or above example to get the format. If you have 'manage-gamemodes' set to false in your main config, the 'default-gamemode' option here does nothing, and can be safely removed. Worlds in the same group will all share the same inventory and stats.

Once you have made your desired changes, simply type /pwi reload.

A default inventory loadout is provided for each configured group, as well as for a server fallback, if for some reason a world isn't in any group. These can be set ingame by using the '/pwi setworlddefault [group]' command, where group is a configured group name, or 'default'. If no group is specified, it will set the loadout for the group that you are currently standing in. This does not require a reload.

> Permissions and Commands

Permissions:

  • - perworldinventory.admin: Defaults to Ops, grants all other permissions
  • - perworldinventory.convert: Allows user to convert data from other plugins
  • - perworldinventory.reload: Allows user to reload configs and world groups
  • - perworldinventory.setdefaults: Allows user to set the default inventory loadout for a group
  • - perworldinventory.notify: Users with this permission will be notified if the config is out of date
  • - perworldinventory.bypass.*: Users that have this will keep their inventory when changing worlds or gamemode
  • - perworldinventory.bypass.gamemode: Users that have this will keep their inventory when changing gamemode
  • - perworldinventory.bypass.world: Users that have this will keep their inventory when changing worlds

Commands:

  • /pwi help: Shows the help page
  • /pwi convert: Converts data from MultiVerse-Inventories; see below
  • /pwi reload: Reloads the config file and worlds file
  • /pwi setWorldDefault [default | <group_name>]: Sets the default inventory loadout for the specified group, or server default. If no parameter is given, it will sets the loadout for the group you are currently standing in.

> Conversion

If you are converting from MV-I, simply run the "/pwi convert multiverse" command and the plugin will take care of everything. You must have MV-I running for this. Keep in mind, converting only works with MV-I version 2.5, it will not work on 2.4. When MV-I is updated from 2.4 to 2.5, it switches from yml to json files, but does not convert the data until it is used. Be sure to keep your MV-I data around, just in case something does go wrong.

A converter from MultiInv is still in the works. There is a beginning framework as of version 1.4.0; do not use it! It is not fully operational yet, and will result in errors.

> Miscellaneous

Support If you have an issue, please go here. Include your configs and relevant logs!

> Other

The code repository can be found on both Github and BitBucket.