Stuff from the common floobits workspace
Author: AuthMe-Team <AuthMeTeam@123NoEmail.com>
This commit is contained in:
@@ -4,6 +4,26 @@ package fr.xephi.authme.modules;
|
||||
*/
|
||||
public abstract class Module {
|
||||
|
||||
/**
|
||||
* Method getName.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Method getType.
|
||||
*
|
||||
* @return ModuleType
|
||||
*/
|
||||
public abstract ModuleType getType();
|
||||
|
||||
public void load() {
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
enum ModuleType {
|
||||
@@ -15,22 +35,4 @@ public abstract class Module {
|
||||
EMAILS,
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getName.
|
||||
|
||||
* @return String */
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Method getType.
|
||||
|
||||
* @return ModuleType */
|
||||
public abstract ModuleType getType();
|
||||
|
||||
public void load() {
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package fr.xephi.authme.modules;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@@ -11,10 +15,6 @@ import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ModuleManager {
|
||||
@@ -23,6 +23,7 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Constructor for ModuleManager.
|
||||
*
|
||||
* @param plugin AuthMe
|
||||
*/
|
||||
public ModuleManager(AuthMe plugin) {
|
||||
@@ -30,9 +31,10 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Method isModuleEnabled.
|
||||
*
|
||||
* @param name String
|
||||
|
||||
* @return boolean */
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isModuleEnabled(String name) {
|
||||
for (Module m : modules) {
|
||||
if (m.getName().equalsIgnoreCase(name))
|
||||
@@ -43,9 +45,10 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Method isModuleEnabled.
|
||||
*
|
||||
* @param type Module.ModuleType
|
||||
|
||||
* @return boolean */
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isModuleEnabled(Module.ModuleType type) {
|
||||
for (Module m : modules) {
|
||||
if (m.getType() == type)
|
||||
@@ -56,9 +59,10 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Method getModule.
|
||||
*
|
||||
* @param name String
|
||||
|
||||
* @return Module */
|
||||
* @return Module
|
||||
*/
|
||||
public Module getModule(String name) {
|
||||
for (Module m : modules) {
|
||||
if (m.getName().equalsIgnoreCase(name))
|
||||
@@ -69,9 +73,10 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Method getModule.
|
||||
*
|
||||
* @param type Module.ModuleType
|
||||
|
||||
* @return Module */
|
||||
* @return Module
|
||||
*/
|
||||
public Module getModule(Module.ModuleType type) {
|
||||
for (Module m : modules) {
|
||||
if (m.getType() == type)
|
||||
@@ -82,8 +87,9 @@ public class ModuleManager {
|
||||
|
||||
/**
|
||||
* Method loadModules.
|
||||
|
||||
* @return int */
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public int loadModules() {
|
||||
File dir = Settings.MODULE_FOLDER;
|
||||
int count = 0;
|
||||
@@ -142,13 +148,14 @@ public class ModuleManager {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void reloadModules(){
|
||||
public void reloadModules() {
|
||||
unloadModules();
|
||||
loadModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method unloadModule.
|
||||
*
|
||||
* @param name String
|
||||
*/
|
||||
public void unloadModule(String name) {
|
||||
|
||||
Reference in New Issue
Block a user