Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Latest commit

 

History

History
36 lines (25 loc) · 870 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 870 Bytes

EnabledHandler

A simple utility to implement enabling and disabling into an object, such as a Module.

Usage

import wtf.monsoon.util.EnabledHandler;
    
public class Main {

    public static void main(String[] args) {
        Module superModule = new Module("Super Module!");

        superModule.setEnabled(false);

        if(superModule.isEnabled()) {
            System.out.println("Super Module is enabled!"); // Will not print, because it is not enabled.
        }

        superModule.setEnabled(true);

        if(superModule.isEnabled()) {
            System.out.println("Super Module is enabled!"); // This time, it will print, because it is now enabled.
        }
    }

    class Module extends EnabledHandler {
      
        private String name;

        public Module(String name) {
            this.name = name;
        }
    }
    
}