How do I disable this?

Discussion in 'Plugin Development' started by Jnorr44, Jun 18, 2012.

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

    Jnorr44

    Okay, so I have this bit of code in a class:

    Code:
                                    if (stream.getTypeId() == 11) {//TODO add an if statement for the config to enable/disable lava
                                        stream.setType(Material.STATIONARY_LAVA);
                                    }
    This is not my main class. How would I disable this if statement using a boolean in the config?
     
  2. You need to link the two classes (not sure what the term is). Create a new variable of your main class object within your secondary class ex:

    myMainClass plugin;

    Then make the constructor for the class:

    public mySecondaryClass( myMainClass instance )
    {
    plugin= instance
    }

    Now you can use all of myMainClass's functions within your secondary class. So to get a boolean from the config, you'd do

    plugin.getConfig().getBoolean("Path.To.Boolean");

    Hope this helps
     
Thread Status:
Not open for further replies.

Share This Page