Location location location....

Discussion in 'Plugin Development' started by unforgiven5232, Feb 24, 2013.

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

    unforgiven5232

    Ok so i need to get the location of a Block (in my case the button). So i put in the coordinates of where the button would be and then the coding works only for the button under the coordinates. Thanks
     
  2. Offline

    gamerzap

    You really should try first. Do as much as you can and then we will help you.
     
  3. Offline

    StyL_TwisT

    gamerzap I agree, If you want someone to make a plugin for you, then you are in the wrong forum, If so please navigate to the "Plugin Requests" forum.
     
  4. Offline

    unforgiven5232

    I understand that, and that is what i did. Tbh this is as far as i got with getting the location of the block | Block block = world.getBlockAt(100, 100, 100);|
     
  5. Offline

    gamerzap

    Well, we really need to know more before we can help you. Post your code, and a very precise definiton of what you want to do.
     
  6. Offline

    unforgiven5232

    Code:
    @EventHandler
        public void onPlayerInteract(PlayerInteractEvent e) {
            if(e.getClickedBlock().getType() == Material.STONE_BUTTON
            && e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                Location loc = e.getPlayer().getLocation();
                World w = loc.getWorld();
                loc.setX(loc.getX() + 4);
                loc.setZ(loc.getZ() + -3);
               
                Block b = w.getBlockAt(loc);
                b.setTypeId(20);
    So, If i right click a stone button then the desired position is replaced by glass. But what i the issue is that my the replaced blocks makes it so i HAVE to by standing in a certain postion to get the location of what i want, So i want the button to create the glass blocks of where i want regardless of where my players position is...
     
  7. Offline

    gamerzap

    Replace e.getPlayer().getLocation() with e.getClickedBlock().getLocation();
    (If I understood what you meant correctly)
     
  8. Offline

    unforgiven5232

Thread Status:
Not open for further replies.

Share This Page