Solved Essentials teleport conflict

Discussion in 'Spigot Plugin Development' started by Qruet, Jun 25, 2018.

  1. Surprised that I couldn't find anything on it, but I'm trying to teleport players at a y value of 450. This will cause them to fall quite a bit, however this will allow for a parachute to deploy that I've developed. Problem is that essentials is teleporting players to the ground, essentially overriding the y cord that they are suppose to go to. I haven't yet found a way around this, any ideas? I have already tried disabling teleport safety, without any luck. I assumed setting the teleport cause to plugin would perhaps prevent essentials from messing around with my plugin, but that hasn't changed anything as well.
     
  2. If you were to run the command minecraft:tp <Player> <Coords>
    Then it would force the server to use the default vanilla /tp command instead of using the one provided by essentials.
     
    • Like Like x 1
  3. ? So I would have to run this command externally via through console with the plugin instead of using the teleport function? I don't believe that would be the best option in my opinion.
     
  4. *Bump* Issue still persists, and I'd rather understand a way around this instead of simply running an external command.
     
  5. Why don't you want to just run the vanilla command? Bukkit.dispatchCommand();
     
  6. A.) I'm teleporting the player to another world, which would mean having to first teleport the player with the teleport method, then applying a 10 tick delay or so and than dispatching a command to teleport them up.
    B.) The vanilla command broadcasts a teleport command server wide. Perhaps if I disable command output in each world it'll go away? I haven't tested it, but this method just doesn't appear at all clean to me.

    EDIT: Attempting to disable the broadcast of player being teleported message does not go away, however it is only broadcasted to op's.

    EDIT: For some players the minecraft:tp isn't working, my guess is because I have the minecraft:tp command delayed so that it gives them time to get teleported into the other world, however for some players it may take longer. I could go ahead and just constantly check to see when the player is finally in the other world with a runnable, however can't there be a far more efficient, cleaner, method around this?
     
    #6 Qruet, Jun 25, 2018
    Last edited: Jun 25, 2018
  7. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerChangedWorldEvent.html may trigger, I'm not sure to be honest. You could add them to a list and then apply it. But this is all too hacky of a resolution. I'm sure you could figure out a way to just disable the essentials TP.
     
  8. So essentially I had to create a loop that checks to make sure that A.) the player is in the other world, then I need to make sure that if they are not above a certain height that I need to teleport them, however I noticed essentials would still teleport the player down after even dispatching the minecraft:tp command so I also need to check that their velocity is less than a certain amount to make sure that they are in fact falling. If this all turns out true then I can cancel the runnable, otherwise I keep teleporting them up. It's really a messy process and I would like either A.) A cleaner way about doing this or B.) The developers to check for the teleport reason before overriding it, since I can just set the TeleportReason to be command or plugin, therefore if the TeleportReason is in fact one of those two then it shouldn't override it or at the very least add an option in config to prevent overriding teleports. I'd like to assume that it's due to teleport safety but again, I've tried disabling it in config several times without any luck, so either it just doesn't work or it's for something else. I'll set the thread to "Solved" however I wouldn't really call it a solution, so I'm still open to suggestions.
     
  9. You could compile your own version of Essentials with the teleport safety removed, seeing as the config setting doesn't seem to be working for you for whatever reason. Although that wouldn't work very cleanly either, if this isn't for your own server, or you plan to distribute it as a resource.