Solved Teleport Delay

Discussion in 'Plugin Development' started by HyrulesLegend, Nov 25, 2013.

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

    HyrulesLegend

    (Yes, I know I made similar thread, but that was related to a problem with array lists, now I'm using a different method).

    The problem that I'm having is not setting the config, it's when the delay is over, it does not send me the teleport message when I haven't moved.

    Here's the code:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    2. if(commandLabel.equalsIgnoreCase("spawn")){
    3. final Player p = (Player) sender;
    4. if(args.length <= 0) {
    5. settings.getData().set("stele." + "" + p.getName() + "location" + ".x", Double.valueOf(p.getLocation().getX()));
    6. settings.getData().set("stele." + "" + p.getName() + "location" + ".z", Double.valueOf(p.getLocation().getZ()));
    7. settings.saveData();
    8. p.sendMessage(ChatColor.GREEN + "Teleporting you to spawn in 3 seconds, stand still!");
    9. new BukkitRunnable() {
    10. public void run() {
    11. if(p.getLocation().getX() == settings.getData().getDouble("stele." + "" + p.getName() + ".location" + ".x")){
    12. if(p.getLocation().getZ() == settings.getData().getDouble("stele." + "" + p.getName() + ".location" + ".z")){
    13. p.sendMessage(ChatColor.GREEN + "Teleporting!");
    14. }
    15. }
    16. }
    17. }.runTaskLater(plugin, 60);
    18. return true;

    Any ideas why this isn't working?
     
  2. Offline

    xTrollxDudex

  3. Offline

    HyrulesLegend

    Ooops! Just realized I was getting the wrong Double in my config, works now! :)
     
Thread Status:
Not open for further replies.

Share This Page