Why isn`t this working?

Discussion in 'Plugin Development' started by Juancomaster1998, Jan 24, 2015.

Thread Status:
Not open for further replies.
  1. Hi, I`m trying to spawn an Item at a specific location, the item is spawning, but the location is a bit "random", it always spawn 1 or 2 blocks away from where it has to spawn.

    Code:
    double x = p.getLocation().getBlock().getLocation().getX()+0.5;
                        double z = p.getLocation().getBlock().getLocation().getZ()+2.5;
                        double y = p.getLocation().getBlock().getLocation().getY()+3;
                        Location loc = new Location(p.getWorld(), x, y, z);
                        Item i = p.getWorld().dropItem(loc, Rewards.reward(p, InventoryClick.cpchest.get(p)));
                        i.teleport(loc.getBlock().getLocation());
    I want it to spawn at the top of the block that is Z +2 from the player.

    There aren`t any crashes, Thanks ^^
     
    Last edited: Jan 24, 2015
  2. Offline

    Leo38638

    Change from Next Key to Next Keys
     
  3. haha, that's funny..., I told you that
    (he`s a partner)
     
  4. Offline

    1Rogue

    use getBlockZ() etc iustead of just getZ(). Additionally for the key thing just check if they're waiting on another key before giving them one in the command.
     
Thread Status:
Not open for further replies.

Share This Page