PerWorldInventory icon indicating copy to clipboard operation
PerWorldInventory copied to clipboard

Manually edit data files

Open lenzls opened this issue 7 years ago • 5 comments

Hello,

I installed PerWorldInventory on a sever with several preexisting worlds in it. For the most part it works great, but some players have problems of a completely empty inventory, enderchest, ....

I have a backup of the plugins folder from right after I installed the plugin. If I view the backed up plugins/PerWorldInventory/data/186aa6d2-d6da-3467-84a3-97ea08aa9745/world.json file of a specific player the full inventory is there. In the current version of the file, the inventory is empty.

Then I tried to just copy the backed up version over the current one and restart the server. But to my surprise, the inventory was still empty. In fact it seems, that my changes get overriden from a magical source (player.dat or something like this?) every time.

Does the plugin not load the state of the inventory from these files? Why has my overriding no effect?:)

thanks for the help in advance.

regards

for completeness my configuration:

[0] $> cat config.yml 
##########################################
#  PerWorldInventory configuration file  #
##########################################

# If true, the server 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

# If true, any worlds that are not in the worlds.yml configuration file will share the same inventory
share-if-unconfigured: false

metrics:
  # Choose whether or not to enable metrics sending.
  # See https://bstats.org/getting-started for details.
  enable: false
  # Send the number of configured groups.
  # No group names will be sent!
  send-number-of-groups: true
  # Send the total number of worlds on the server.
  send-number-of-worlds: 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: false
    # Load the maximum health a player can have
    max-health: 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

# Config Version 4 additions below this line #

# Disables bypass regardless of permission
# Defaults to false
disable-bypass: false

[0] $> cat worlds.yml 
# In this file you define your groups and the worlds in them.
# Follow this format:
# groups:
#   default:
#     worlds:
#     - world
#     - world_nether
#     - world_the_end
#     default-gamemode: SURVIVAL
#   creative:
#     worlds:
#     - creative
#     default-gamemode: CREATIVE
#
# 'default' and 'creative' are the names of the groups
# worlds: is a list of all worlds in the group
# If you have 'manage-gamemodes' set to true in the main config, the server
# will use the 'default-gamemode' here to know what gamemode to put users in.
groups:
  world:
    worlds:
    - world
    - world_nether
    - world_the_end
    default-gamemode: SURVIVAL
  world#2:
    worlds:
    - kreative_vorbereitungen
    default-gamemode: CREATIVE
  world#3:
    worlds:
    - Neuanfang
    default-gamemode: SURVIVAL
  internet:
    worlds:
    - inetwelt
    default-gamemode: SURVIVAL
  pilzwelt:
    worlds:
    - pilzwelt
    default-gamemode: SURVIVAL
  testworlds:
    worlds:
    - clean
    - ocean
    - test
    default-gamemode: CREATIVE
  erde:
    worlds:
    - erde
    default-gamemode: SURVIVAL
  biomebundle:
    world:
    - biomebundle
    - biomebundle_nether
    default-gamemode: SURVIVAL

lenzls avatar Jan 02 '18 21:01 lenzls

One issue is that your 'biomebundle' group is mis-formatted; it should have worlds: not world:, though I doubt that's the actual issue. PWI does indeed load from the .json files, and doesn't touch Minecraft's .dat's at all.

EbonJaeger avatar Jan 02 '18 21:01 EbonJaeger

thanks for the hint! but the problem sadly persists.

Here is an extensive example what I'm doing:

again my config.yml and updated worlds.yml

steps:

  1. this is the current data file of my player for my main world

  2. I want to override this file with my backed up version

  3. I copy the file from (2) over (1)

  4. when the server is started, the data file version is still (2), which is what I want

  5. when connecting with my client, the data file version is still (2), but my inventory is exactly the one from (1) -- so 2 things in my inventory and 1 in my enderchest

  6. after closing my client, the data file is again this which is the version (1)

This is the server log from steps 1 to 6

Small question: should /pwi reload reload also the data files on the fly or only the *.yml ones?

thanks for the help :)

lenzls avatar Jan 03 '18 17:01 lenzls

By the way: Out of curiosity I checked the current .dat file of my player from playerdata of my world.

And the inventory and enderchest state is exactly like the PWI data file version (1) from my previous post.

There has to be something wrong with my configuration.

It seems, that on startup PWI does not read the inventory from the json but rather from the dat. But in the end (after logging out) updates the json according to my changes ingame.

Do I maybe need to disable the 'vanilla inventory storage' somehow?

lenzls avatar Jan 03 '18 18:01 lenzls

On startup PWI only loads the configuration files. Player data files aren't looked at until they are needed. You can think of it this way: The .dat files are your current inventory that the server is tracking. PWI's .json files are your inventories in gamemodes/worlds that you aren't in.

EbonJaeger avatar Jan 04 '18 17:01 EbonJaeger

Do you have an idea how I can investigate my issue a bit further? The log says nothing and I am a bit clueless. Thanks for the help

lenzls avatar Jan 04 '18 17:01 lenzls