Solved Sending message twice onJoin

Discussion in 'Plugin Development' started by CrazyGuy3000, Jan 25, 2014.

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

    CrazyGuy3000

    Ok so,
    I have a variable in my main class called

    and I am checking if the games started in my onJoin event by putting
    Code:java
    1. if(main.gameStarted == true){
    2. player.sendMessage(ChatColor.BLUE + "Hello!");
    3. } else if(main.getStarted == false){
    4. player.sendMessage(ChatColor.GREEN + "Hello!");
    5. }

    For some reason it plays the message twice though and its driving me mad -_-
     
  2. Offline

    Carnes

    which message is displayed twice? If started, it shows the blue message twice? remove all the other plugins from your server and try just that one. My guess is you accidentally exported that plugin to a different name at some point. Both are now sending messages on that event.
     
  3. Offline

    Rocoty

    Sorry. Those few lines tell us nothing. You have to give us more code. How about the entire main class and listener class?
     
  4. Offline

    xize

    CrazyGuy3000
    == is not needed on a boolean though, if(boolean) means its true and else automatic false, however both ways should work fine so have you checked you don't overwrited a other plugin by acident?

    also how did you instanced the boolean from the main?
     
  5. Offline

    CrazyGuy3000

    I made it a static so its able to be accessed by other classes

    You my fine sir, are a genius...
     
  6. CrazyGuy3000
    To go with xize , you just need to do this:

    Code:java
    1. if(main.gameStarted){
    2. player.sendMessage(ChatColor.BLUE + "Hello!");
    3. }else{
    4. player.sendMessage(ChatColor.GREEN + "Hello!");
    5. }
     
Thread Status:
Not open for further replies.

Share This Page