Why does this line of code not activate?

Discussion in 'Plugin Development' started by PluginStudios, Mar 26, 2014.

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

    PluginStudios

    Hi bukkit forums! I have this line of code in a BlockPlaceEvent and it will not fire. I have checked the name and it is indeed STONE_PLATE. Some help, please? :(

    Code:
    if (e.getBlock().getType().equals("Pressure Plate") || e.getBlock().getType().equals("Stone Plate") || e.getBlock().getType().equals("STONE_PLATE")){
    Thank you in advanced!
     
  2. Offline

    skore87

    getType() returns Material and you're trying to compare a String to it... Why?
     
  3. Offline

    Lorinthio

    As mentioned above, you're comparing a Material to a string, instead of "STONE_PLATE" use what gaming grunts recommended and use
    Code:java
    1. e.getBlock().getType().equals(Material.STONE_PLATE)
     
  4. Offline

    PluginStudios

    Thank you all! Now I have another problem. This does not add to the config:
    (warpplate is a coordinate string)
    Code:
    getConfig().addDefault("WarpPlates." + warpplate + ".placement", warpplate)
    
    It does not create that. Why?
     
  5. Offline

    AoH_Ruthless

  6. Offline

    PluginStudios

    AoH_Ruthless
    I actually cant believe i forgot to put that,
    Thank you very much!
     
  7. Offline

    AoH_Ruthless

Thread Status:
Not open for further replies.

Share This Page