Plugin code help

Discussion in 'Plugin Development' started by Minecrafter_NL, Oct 25, 2013.

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

    Minecrafter_NL

    hello,
    im new to java but i know the basics.
    i am trying to code something that will check if end stone breaks.
    this is what i have now
    Code:java
    1. public void onBlockBreak(BlockBreakEvent event)
    2. {
    3. if (event.getBlock() = block().id(121))
    4. {
    5. //my code here
    6. }
    7. }


    but it says:
    The left-hand side of an assignment must be a variable

    what do i have to do?????
    thanks.
     
  2. You are using the assignment operator (=) instead of the comparison operator (==).
    Code:java
    1. public void onBlockBreak(BlockBreakEvent event)
    2. {
    3. if (event.getBlock() == block().id(121))
    4. {
    5. //my code here
    6. }
    7. }
     
  3. Offline

    PatoTheBest

    There may be some errors because I am not on eclispe, but it should be something like this:
    Code:java
    1. public void onBlockBreak(BlockBreakEvent event)
    2. {
    3. if (event.getBlock().getType() = Material.STONE)
    4. {
    5. //my code here
    6. }
    7. }
     
  4. Offline

    lewysryan

    lol did not see it. i deleted mine. would you not need to add @EventHandler though over the top?
     
  5. Offline

    PatoTheBest

  6. Offline

    The_Doctor_123

    You say you know the basics? The basics include knowing (most of) your operators.
     
    lewysryan and amhokies like this.
  7. Offline

    Minecrafter_NL

    Thanks all!
     
  8. Offline

    Necrodoom

    Removed offtopic posts.
     
    1Rogue likes this.
Thread Status:
Not open for further replies.

Share This Page