0

Made moduleloader notify modules on disable

This commit is contained in:
Pepich 2017-02-02 18:05:06 +01:00
parent b083135a7a
commit 0fe41a40a9
2 changed files with 17 additions and 2 deletions

View File

@ -21,7 +21,7 @@ import com.redstoner.modules.Module;
/** The module loader, mother of all modules. Responsible for loading and taking care of all modules. /** The module loader, mother of all modules. Responsible for loading and taking care of all modules.
* *
* @author Pepich */ * @author Pepich */
@Version(major = 1, minor = 1, revision = 3, compatible = -1) @Version(major = 1, minor = 2, revision = 0, compatible = -1)
public final class ModuleLoader implements CoreModule public final class ModuleLoader implements CoreModule
{ {
private static ModuleLoader instance; private static ModuleLoader instance;
@ -169,4 +169,13 @@ public final class ModuleLoader implements CoreModule
Utils.sendMessage(sender, " §7", "For more detailed information, consult the debugger."); Utils.sendMessage(sender, " §7", "For more detailed information, consult the debugger.");
return true; return true;
} }
public static void disableModules()
{
for (Module m : modules)
{
if (m.enabled())
m.onDisable();
}
}
} }

View File

@ -18,7 +18,7 @@ import com.redstoner.modules.warn.Warn;
/** Main class. Duh. /** Main class. Duh.
* *
* @author Pepich */ * @author Pepich */
@Version(major = 1, minor = 1, revision = 6, compatible = -1) @Version(major = 1, minor = 2, revision = 0, compatible = -1)
public class Main extends JavaPlugin public class Main extends JavaPlugin
{ {
public static JavaPlugin plugin; public static JavaPlugin plugin;
@ -42,4 +42,10 @@ public class Main extends JavaPlugin
// And enable them // And enable them
ModuleLoader.enableModules(); ModuleLoader.enableModules();
} }
@Override
public void onDisable()
{
ModuleLoader.disableModules();
}
} }