Players duplication after a Teleport

Discussion in 'Plugin Development' started by dadaking, Dec 27, 2011.

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

    dadaking

    Hello!

    I create a plugin which work perfectly in 1.8.1. But since the version 1.0.1 of craftbukkit, i have a problem with the plugin.

    I have a list of Player, i use the method "teleport()". The first player of the list is duplicate, the real entity stay at his place but the double is create at the location of the teleportation.

    After that, the server create a player with his pseudo with a number after that. The player can speak but he doesn't see the other player speaking. He can just see the left and join message et the message with the command "/me".

    Sorry for my english :s. I hope you understand and you will be able to help me.

    Thanks a lot!
     
  2. Offline

    ItsHarry

    As far as I know, the teleport(); method was not changed.
    You say that the first value of the list is a duplicate. Can't you just remove the first value so you don't have any duplicates?
     
  3. Offline

    dadaking

    I must test that. The plugin is a game, when the game is start, the first player is teleport to a point, when he win his jump, the second is teleport, etc ...

    I go test to put my first element of my list to null and go to my second element.

    If someone have a other idea i take it!
     
  4. Offline

    Father Of Time

    In no way should teleport() be duplicating Player instances, the problem resides elsewhere in your code.

    Chances are you are not manipulating a player variable correctly; Rather than manipulating the reference to the player object you are cloning it and making a second copy that is independent from the first (I assume).

    Your problem is not the result of a bug in the Bukkit code, I utilize player.Teleport() in several of my plug-ins that are built off the Bukkit RB 1.0 with no problem.

    Provide us with the code in question and we may be able to spot whats causing the issue.
     
  5. The problem is in the storing I think, because you're storing Player which kinda constantly changes, it can store a player more than once, even if you do remove it, you'd be removing something that's not yet there...

    So, just use something else, most commonly String and then just use getServer()/Bukkit.getPlayerExact(name);
     
Thread Status:
Not open for further replies.

Share This Page