hsyyid / EssentialCmds

EssentialCmds adds useful commands to Minecraft
https://bit.ly/2HPQ9tR
MIT License
30 stars 21 forks source link

NoSuchElementException savePlayerInventory #129

Open ghost opened 8 years ago

ghost commented 8 years ago

http://pastebin.com/iK89auJQ

hsyyid commented 8 years ago

Not a NullPointerException but okay.

ghost commented 8 years ago

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

MarkL4YG commented 8 years ago

@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

ghost commented 8 years ago

its 1.8.9 spongeforge build 1625, forge 1890