Solved Simple Multi-class Boolean Help

Discussion in 'Plugin Development' started by tuidog, May 7, 2014.

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

    tuidog

    I currently have two classes Main and Command.
    They are both inside of the package emerica.simple
    So the classpath is emerica.simple.Main and emerica.simple.Command

    In main I define a Boolean called spyblock


    Code:
    public class Main extends JavaPlugin{
        public static boolean spyblock = true;
    In command I am trying to access it and change it




    Code:
    public class Command implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("spyblocks")) {
                return true;
                if (Main.spyblock == true) {
                   
                    Main.spyblock = false;
                }
                else {
                    Main.spyblock = true;
                }
            }
            else
            {
                return false;
            }
        }



    Hoe can I change this code so it works? I am trying to toggle main.spyblock this the command "Spyblocks"
     
  2. Offline

    Aqua

    tuidog
    Can you post your complete Main class?
     
Thread Status:
Not open for further replies.

Share This Page