Hey guys, i need some quick help, So what I need is when the player dies or respawns I want them to be TP'd to a specefic X, Y, Z cordinate. I've tried p.teleport(location) and all of that but I cant seme to get anything to work. Any help?
Thanks, Do I replace x, y, z with the cordiantes? And thanks again. Ok i think i fixed it. Is it ok that i had to initialize world to null? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
yes, Just replace x,y,z with the coords of where you are going to. best practice if you have a config file, to write them in the file, call them as double and variable them. so later if you want to change x,y,z you dont have to recompile, and restart to change it. ( did that mistake thinking "i will never need to change where spawn point is on this map") that might cause problems, if your not telling it 'which' world it is, they will goto those coords in the current world. say you want them to spawn at 1,1,1 in 'world' and they die in nether, it doesn't know which world so it puts them at 1,1,1 in nether. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Well, thanks for all of your responses but im getting console errors. Code: World world = null; double z = 54; double x = -11; double y = 42; player.teleport(new Location(world,x,y,z)); And here is my error from the console Code: [SEVERE] Could not pass event PlayerRespawnEvent to PaintBall org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:304) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:459) at net.minecraft.server.ServerConfigurationManager.moveToWorld(ServerConfigurationManager.java:289) at net.minecraft.server.ServerConfigurationManager.moveToWorld(ServerConfigurationManager.java:248) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:1036) at net.minecraft.server.Packet9Respawn.handle(SourceFile:28) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:567) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:459) at net.minecraft.server.ThreadServerApplication.run(SourceFile:492) Caused by: java.lang.NullPointerException at org.bukkit.craftbukkit.entity.CraftPlayer.teleport(CraftPlayer.java:351) at org.bukkit.craftbukkit.entity.CraftEntity.teleport(CraftEntity.java:162) at com.goldmine.caleb.PaintBall.PaintBall.PlayerRespawn(PaintBall.java:229) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaP
lol THANKS!!! You guys ROCK!! Yes i do know about the resawn thing, this was just a test in a radom event. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Cool, i understand know. You see Iwas taing java clases but im new to bukkit though. IFail seems funny btw. EDIT by Moderator: merged posts, please use the edit button instead of double posting.