EssentialCmds icon indicating copy to clipboard operation
EssentialCmds copied to clipboard

NoSuchElementException savePlayerInventory

Open ghost opened this issue 8 years ago • 4 comments

http://pastebin.com/iK89auJQ

ghost avatar Jul 29 '16 15:07 ghost

Not a NullPointerException but okay.

hsyyid avatar Jul 29 '16 21:07 hsyyid

In the attached pastebin are two exception - title of issue is type of first exception:

[17:39:10] [Server thread/ERROR] [Sponge]: Could not pass DisplaceEntityEvent$Move$TargetPlayer$Impl to org.spongepowered.mod.plugin.SpongeModPluginContainer@6ba5d2c4 java.lang.NullPointerException

ghost avatar Jul 30 '16 06:07 ghost

@hunter688 can you provide information about your setup? Songe version, (forge version), Minecraft version etc?

By the way, I took a quick peek over the trace:

Problematic part: PlayerMoveListener.java#88

        if (!event.getFromTransform().getExtent().getUniqueId().equals(event.getToTransform().getExtent().getUniqueId()))
        {
            World oldWorld = event.getFromTransform().getExtent();
            World newWorld = event.getToTransform().getExtent();

            Utils.savePlayerInventory(player, oldWorld.getUniqueId());

            if (!Utils.doShareInventories(oldWorld.getName(), newWorld.getName()))
            {
                Utils.updatePlayerInventory(player, newWorld.getUniqueId());
            }

            player.offer(Keys.GAME_MODE, newWorld.getProperties().getGameMode());
        }

-> newWorld.getUniqueId() causes problems in: Utils.java#1296

        String worldName = Sponge.getServer().getWorld(worldUuid).get().getName();

Seems like that either the UUID is invalid or null, or that the world with that UUID is not returned by #getWorld Anyways: The Optional is not present.

Also: Is this necessary? World->uuid->world->name? You could e.g. just use the world as a parameter for #savePlayerInventory

MarkL4YG avatar Jul 31 '16 11:07 MarkL4YG

its 1.8.9 spongeforge build 1625, forge 1890

ghost avatar Jul 31 '16 17:07 ghost