Plugin Help Need help with decimal teleport!

Discussion in 'Plugin Help/Development/Requests' started by jkctech, Jan 16, 2015.

Thread Status:
Not open for further replies.
  1. Hello, im working on a plugin which teleports players, but the problem is, it needs to be decimal, and so far, it doesn't work. it only teleports to the whole numbers.

    This is how it sets it to the config:
    Code:
    double x = p.getLocation().getX();
    double y = p.getLocation().getY();
    double z = p.getLocation().getZ();
    float pitch = p.getLocation().getPitch();
    float yaw   = p.getLocation().getYaw();
     String world = p.getWorld().getName();
    
    getConfig().set("settings.Hub.world", world);
    getConfig().set("settings.Hub.spawnX", x);
    getConfig().set("settings.Hub.spawnY", y);
    getConfig().set("settings.Hub.spawnZ", z);
    getConfig().set("settings.Hub.pitch", pitch);
    getConfig().set("settings.Hub.yaw", yaw);
    saveConfig();
    p.sendMessage(Color(prefix+"&aSpawn has been set!"));
    This is how it is in the config:
    Code:
    settings:
      Hub:
        world: world
        spawnX: 213.91097185324685
        spawnY: 82.98935642780542
        spawnZ: 224.58736211026385
        pitch: 33.64759
        yaw: 59.157562
    This is the teleporter:
    Code:
    float x = getConfig().getInt("settings.Hub.spawnX");
    float y = getConfig().getInt("settings.Hub.spawnY");
    float z = getConfig().getInt("settings.Hub.spawnZ");
    float pitch = getConfig().getInt("settings.Hub.pitch");
    float yaw = getConfig().getInt("settings.Hub.yaw");
    String configWorld = getConfig().getString("settings.Hub.world");
    World world = getServer().getWorld(configWorld);
                  
                    Location location = new Location(world, x, y, z, pitch, yaw);
                    p.teleport(location);
    I really don't get it :/
    it only teleports to the whole numbers and the whole yaw and pitch.
    Help would be appreciated :)
     
  2. Offline

    pie_flavor

    Well, I hate to say duh, but duh.
    You keep saying getInt when you should be saying getDouble.
     
  3. @pie_flavor OUCH :( sry, didn't saw that, still thanks tho!
     
Thread Status:
Not open for further replies.

Share This Page