How would I make a boolean kind of condition? ?

Discussion in 'Plugin Development' started by ShadowWizardMC, Sep 14, 2014.

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

    ShadowWizardMC

    So I decided to make a GameAPI for the Bukkit Community so that making a Minigame would be alot easier to make but I'm I want to know how to make a condition kind of thing so example:

    BlockBreak Class:

    Code:java
    1. @EventHandler
    2. public void bb(BlockBreakEvent e) {
    3. e.setCancelled(true);
    4. }


    I want it to have a boolean kind of thing please.
    Your Game Class:

    Code:java
    1. public class myPlugin extends GameAPI {
    2.  
    3. public void startGame() {
    4. set bb(true);
    5. // Meaning if its true then you can break blocks else if its false then you can break blocks
    6. // A boolean kind of thing
    7. }
    8. }
     
  2. Offline

    _Filip

    Learn basic java.
     
    Rocoty and masons123456 like this.
  3. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
    Monkey_Swag and Goblom like this.
  4. Offline

    ShadowWizardMC

    _Filip zombiekiller753 OK fair enough but specifically what am I suppose to look over ... Its been almost a full month since I last coded anything everything's just fuzzy :(
     
  5. Offline

    Deleted user

    -
     
    Last edited by a moderator: Jan 23, 2015
  6. Offline

    ShadowWizardMC

    Thanks zombie, all the help appreciated :). I'll be sure to have a responce soon!
     
  7. Offline

    KaitouKidFTW

    ShadowWizardMC

    > Make a public boolean.
    > When the game starts, change to boolean to true
    > When a player tries to break a block, check if the boolean is true and allow breaking
     
  8. Hi! I'd like to introduce you to a friend of mine. KaitouKidFTW this is encapsulation. Encapsulation, this is KaitouKidFTW.
     
  9. Offline

    Monkey_Swag

    Bbevent e){
    if(yourBoolean == false){
    Return;
    } else {
    //code
    }

    Sorry for the lousy code, I'm on my phone
     
  10. Offline

    Konato_K

    KaitouKidFTW I thought public booleans are against OOP?
     
Thread Status:
Not open for further replies.

Share This Page