How to call BlockPlaceEvent?

Discussion in 'Plugin Development' started by Helfull, May 10, 2012.

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

    Helfull

    hey

    i am tried to call the BlockPlaceEvent with the following code:

    Code:
    private void callSignPlace(Player player, Block b, ItemStack i){
            Location tempLoc = b.getLocation();
            Block tempBlock = tempLoc.getBlock();
            tempLoc.setX(tempLoc.getX() + 1);
            tempBlock.setType(Material.SIGN);
     
            BlockPlaceEvent e = new BlockPlaceEvent(tempBlock, b.getState(), b, i, player, true);
            plugin.getServer().getPluginManager().callEvent(e);
        }
    what happen with this code is that the clicked sign changes to a Staircase and after some secs i get dced and the server crashes.

    I want to make a it able by clicking with a Paper on a sign it should place a sign and open the GUI to edit the sign where is clicked on.

    What i mean:


    Player right clicks with a Paper in hand to a sign
    a tempory sign is placed by the player
    gui open and lines set to the sign clicked on
    player done editting
    clickedSign new lines = tempSign lines
    tempSign removed

    the part where the player clicks with paper i have done with out problems but i cant get the BlockPlaceEvent called. :(

    someone have an idea?

    greetz
    helfull
     
  2. Offline

    nisovin

    Calling an event doesn't do anything but call plugin event handlers. It doesn't affect the server or client in any way (unless the plugins have code that does so).
     
Thread Status:
Not open for further replies.

Share This Page