Scoreboard!

Discussion in 'Plugin Development' started by ItsMees, Nov 26, 2013.

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

    ItsMees

    Hi Guys,
    I have an problem with an projet i'm working on!
    I want it that the plugin get your scoreboard score and check if it is more that the thirth line of an sign!
    My Code:
    Code:java
    1. Score score = Bukkit.getScoreboardManager().getMainScoreboard().getObjective("C-Shop").getScore(player);
    2. if (score.getScore() <= ((Sign) block.getState()).getLine(3)){
    3.  
    4. }

    The error:
    Code:
    The operator <= is undefined for the argument type(s) int, String
    I hope someone can help me out!
     
  2. Offline

    Barnyard_Owl

    You need to convert the string to an integer to compare it against the score. Use Integer.parseInt(yourString);.
    Code:java
    1. Score score = Bukkit.getScoreboardManager( ).getMainScoreboard( ).getObjective( "C-Shop" ).getScore( player );
    2. if( score.getScore( ) <= Integer.parseInt( ( ( Sign ) block.getState( ) ).getLine( 3 ) ) ) {
    3.  
    4. }
     
    xbrokerchan likes this.
Thread Status:
Not open for further replies.

Share This Page