#Issue with getting world from yml file.

1 messages Β· Page 1 of 1 (latest)

fervent swallow
#

Hi πŸ‘‹ i have a issue with getting world from config (line 67), always i want to teleport player to location it sends me Name cannot be null to console. On line 29 i'm using same thing but there is just another file, the setup for both of files are same.
I don't understand why world didn't work but x/y/z/pitch/yaw (lines 68 - 72) works. I tried many variants but after 30 minutes i don't have nerves.

true forge
#

It's probably just wrong path.

#

Is the error on the line with Bukkit.getWorld?

fervent swallow
#

67

true forge
#

Can you send the code?

fervent swallow
#

Sorry i didn't send screenshot πŸ˜‚

true forge
#

and the config too

fervent swallow
true forge
#

that's a little bit odd

fervent swallow
#

yea ik

true forge
#

i think you just need to test it over and over again, play with your code

fervent swallow
#

I tested everything

#

or maybe nearly everything

true forge
#

and also consider to improve your code design, it's kinda hard to detect issue with your current code

#

and also you can just set location on the config.

#

Location is ConfigurationSerializable

#

FileConfiguration#setLocation(path, location)
FileConfiguration#getLocation(path)

fervent swallow
#

Ok, so i now know where is problem but how to solve it?

If i "hardcode" path to code it works fine, but when i add"something."+ event +".something" it didn't work.

#

Can problem be in getString()?

true forge
#

No way the method FileConfiguration#getString is the problem here.

#

You mean if you do "something.test.something" works and if "something." + event + ".something" doesn't work?

#

There you go then, you found the problem.

#

Show me where you use the getEventLocation method that leads to the error.

fervent swallow
#

At /event join command

true forge
#

okay, show the getCurrentEvent method

fervent swallow
#

It just returning currentevent - string

#

That string is set if some event is started

#

so if I use /event start <event> it also set currentevent

true forge
#

uppercases letter matters here

#

that's probably why

fervent swallow
#

That is also what i checked but i don't understand why in this case it didn't work only on world, everything else works fine.

#

In this case it works:

#

But if there is String from method it returns null.

#

This is full error message in console:

[16:12:35] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'event' in plugin EventSystem vDEV-0.0.1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.TickTask.run(SourceFile:18) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148)```
#

~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.util.thread.IAsyncTaskHandler.executeAll(SourceFile:110) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1124) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.IllegalArgumentException: Name cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at org.bukkit.craftbukkit.v1_17_R1.CraftServer.getWorld(CraftServer.java:1189) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at org.bukkit.Bukkit.getWorld(Bukkit.java:612) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        at sk.adr3ez.eventsystem.eventmanager.EventManager.getEventLocation(EventManager.java:68) ~[?:?]
        at sk.adr3ez.eventsystem.commands.event.subcommands.join.perform(join.java:32) ~[?:?]
        at sk.adr3ez.eventsystem.commands.event.EventCmdManager.onCommand(EventCmdManager.java:33) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3262-Spigot-dc75aca-f0f801e]
        ... 19 more```
true forge
#

That's mean your getCurrentEvent is returning null right?

fervent swallow
#

Nope, what i dont understand is why only eventw cant get world from config

#

But others like eventx, eventz..... get double without any problem

true forge