Solved Wall_SIGN problem

Discussion in 'Plugin Development' started by gamemakertim, Nov 21, 2012.

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

    gamemakertim

    I want my plugin a plate where a particular text on it.
    I tried this but it didnt work...
    PHP:
        public void SetSign(int xint yint z,World w){
            
    Location l = new Location(wxyz);
            
    Material s Material.WALL_SIGN;
            
    l.getBlock().setType(s);
        }
    Can enybody help me?
     
  2. Offline

    xDjBomber

    Material.WALL_SIGN.getId() << Think that should work?
     
  3. Offline

    V10lator

    xDjBomber So you want him to map a Integer to a Material? *facepalm*

    gamemakertim What exactly goes wrong? Does the sign pop off instantly? Set the correct data value! Else: Did you try to add debugging, like this:
    Code:java
    1. public void setSign(int x, int y, int z,World w){
    2. System.out.print("Setting sign");
    3. Location l = new Location(w, x, y, z);
    4. Material s = Material.WALL_SIGN;
    5. System.out.print(l.getBlock().getType());
    6. l.getBlock().setType(s);
    7. System.out.print(l.getBlock().getType());
    8. }

    Also are you sure the coordinates you pass to that function are correct?
     
  4. Offline

    desht

    You'll probably need to use block.setTypeIdAndData() to set the block id and data value simultaneously. If you just set the block id using block.setType() or block.setTypeId(), a physics check will be done and your sign will immediately pop off if the data value isn't correct (and the default 0 data is never correct for a wall sign).
    PHP:
    l.getBlock().setTypeIdAndData(Material.WALL_SIGN.getId(), datatrue);
     
  5. Offline

    gamemakertim

  6. Offline

    Lolmewn Retired Staff

    Yep, you should set the data values.
     
  7. Offline

    gamemakertim

    How to set it to north,south,east,west?
     
  8. Offline

    desht

  9. Offline

    gamemakertim

    Tanks :D
    it works...
    didnt get the clue that 0x2 that the 2 stands for the byte input
     
Thread Status:
Not open for further replies.

Share This Page