Solved Teleport a Player

Discussion in 'Plugin Development' started by tomtiger11, Jan 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    tomtiger11

    Hi,


    I have this code:
    Code:
                    World world = Bukkit.getWorld("pvp");
                    Player s = (Player)sender; //Gets the Sender
                    s.teleport(world, -2369.37555, 4, 683.22911);
    in Eclipse, and it gives me this error:
    Code:
    The method teleport(Location, PlayerTeleportEvent.TeleportCause) in the type Entity is not applicable for the arguments (World, double, int, double)
     
  2. Offline

    SgtStud

    You aren't passing in the correct parameters to the method. Not to sound condescending, but how much java/programming do you know?
     
  3. Offline

    tomtiger11

    I'm pretty good at programming in general, I'm just not sure why it isnt accepting my parameters when they *should* be correct.
     
  4. Offline

    Bulldogg9098

    The teleport method you are calling needs a different parameter. the four parameters you are using need to be stored into a Location object before they can be used.

    Location dest = new Location(world, -2369.37555, 4, 683.22911);
    s.teleport(dest);
     
  5. Offline

    SgtStud

    it says right there whats wrong. You need to pass in a location and a reason, not a world and coordinates.
    "The method teleport(Location, PlayerTeleportEvent.TeleportCause) in the type Entity is not applicable for the arguments (World, double, int, double)"
     
  6. Offline

    tomtiger11

    How can I teleport a player to soe coordinates and a world?
     
  7. Offline

    fireblast709

    player.teleport(new Location(world, x, y, z))
     
  8. Offline

    tomtiger11

    Thanks

    Now, ClassNotFoundException...

    Code:
    2013-01-01 20:59:42 [SEVERE] Could not load 'plugins/pvp.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: uk.co.tom4u.bukkit.PvpArena
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
        at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugins(CraftServer.java:235)
        at org.bukkit.craftbukkit.v1_4_6.CraftServer.<init>(CraftServer.java:213)
        at net.minecraft.server.v1_4_6.PlayerList.<init>(PlayerList.java:52)
        at net.minecraft.server.v1_4_6.DedicatedPlayerList.<init>(SourceFile:11)
        at net.minecraft.server.v1_4_6.DedicatedServer.init(DedicatedServer.java:104)
        at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:399)
        at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
    Caused by: java.lang.ClassNotFoundException: uk.co.tom4u.bukkit.PvpArena
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
        ... 9 more
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  9. Offline

    fireblast709

    your package is probably: uk.co.tom4u.bukkit.PvpArena
    your main class is probably PvpArena
    'main' in plugin.yml should be: uk.co.tom4u.bukkit.PvpArena.PvpArena
     
  10. Offline

    tomtiger11

    thanks :)
     
  11. Offline

    HappyPikachu

    tomtiger11 Mark as solved. (Thread Tools > Edit Thread > Prefix)
     
Thread Status:
Not open for further replies.

Share This Page