Updated API
API Version 2.0.0 Modules no longer have to keep track of their enabled status, the ModuleLoader is now responsible for this. This allows for easier module development and finer control over modules through the loader and the debugger. More features to follow in a future update.
This commit is contained in:
parent
b0358d6235
commit
ca849074aa
@ -1,6 +1,6 @@
|
|||||||
package com.redstoner.coremods.moduleLoader;
|
package com.redstoner.coremods.moduleLoader;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -21,11 +21,11 @@ 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 = 3, revision = 2, compatible = -1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = -1)
|
||||||
public final class ModuleLoader implements CoreModule
|
public final class ModuleLoader implements CoreModule
|
||||||
{
|
{
|
||||||
private static ModuleLoader instance;
|
private static ModuleLoader instance;
|
||||||
private static final ArrayList<Module> modules = new ArrayList<Module>();
|
private static final HashMap<Module, Boolean> modules = new HashMap<Module, Boolean>();
|
||||||
|
|
||||||
private ModuleLoader()
|
private ModuleLoader()
|
||||||
{}
|
{}
|
||||||
@ -47,7 +47,7 @@ public final class ModuleLoader implements CoreModule
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Module module = clazz.newInstance();
|
Module module = clazz.newInstance();
|
||||||
modules.add(module);
|
modules.put(module, false);
|
||||||
}
|
}
|
||||||
catch (InstantiationException | IllegalAccessException e)
|
catch (InstantiationException | IllegalAccessException e)
|
||||||
{
|
{
|
||||||
@ -60,13 +60,13 @@ public final class ModuleLoader implements CoreModule
|
|||||||
public static final void enableModules()
|
public static final void enableModules()
|
||||||
{
|
{
|
||||||
Debugger.notifyMethod();
|
Debugger.notifyMethod();
|
||||||
for (Module module : modules)
|
for (Module module : modules.keySet())
|
||||||
{
|
{
|
||||||
if (module.enabled())
|
if (modules.get(module))
|
||||||
continue;
|
continue;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (module.enable())
|
if (module.onEnable())
|
||||||
{
|
{
|
||||||
CommandManager.registerCommand(module.getCommandString(), module, Main.plugin);
|
CommandManager.registerCommand(module.getCommandString(), module, Main.plugin);
|
||||||
if (module.getClass().isAnnotationPresent(AutoRegisterListener.class)
|
if (module.getClass().isAnnotationPresent(AutoRegisterListener.class)
|
||||||
@ -74,6 +74,7 @@ public final class ModuleLoader implements CoreModule
|
|||||||
{
|
{
|
||||||
Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin);
|
Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin);
|
||||||
}
|
}
|
||||||
|
modules.put(module, true);
|
||||||
Utils.log("Loaded module " + module.getClass().getName());
|
Utils.log("Loaded module " + module.getClass().getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -95,22 +96,24 @@ public final class ModuleLoader implements CoreModule
|
|||||||
public static final boolean enableModule(Class<? extends Module> clazz)
|
public static final boolean enableModule(Class<? extends Module> clazz)
|
||||||
{
|
{
|
||||||
Debugger.notifyMethod(clazz);
|
Debugger.notifyMethod(clazz);
|
||||||
for (Module m : modules)
|
for (Module module : modules.keySet())
|
||||||
{
|
{
|
||||||
if (m.getClass().equals(clazz))
|
if (module.getClass().equals(clazz))
|
||||||
{
|
{
|
||||||
if (m.enable())
|
if (module.onEnable())
|
||||||
{
|
{
|
||||||
if (m.getClass().isAnnotationPresent(AutoRegisterListener.class) && (m instanceof Listener))
|
if (module.getClass().isAnnotationPresent(AutoRegisterListener.class)
|
||||||
|
&& (module instanceof Listener))
|
||||||
{
|
{
|
||||||
Bukkit.getPluginManager().registerEvents((Listener) m, Main.plugin);
|
Bukkit.getPluginManager().registerEvents((Listener) module, Main.plugin);
|
||||||
}
|
}
|
||||||
Utils.log("Loaded module " + m.getClass().getName());
|
Utils.log("Loaded module " + module.getClass().getName());
|
||||||
|
modules.put(module, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Utils.error("Failed to load module " + m.getClass().getName());
|
Utils.error("Failed to load module " + module.getClass().getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,9 +121,8 @@ public final class ModuleLoader implements CoreModule
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Module m = clazz.newInstance();
|
Module m = clazz.newInstance();
|
||||||
modules.add(m);
|
modules.put(m, false);
|
||||||
m.onEnable();
|
if (m.onEnable())
|
||||||
if (m.enabled())
|
|
||||||
{
|
{
|
||||||
if (m.getClass().isAnnotationPresent(AutoRegisterListener.class) && (m instanceof Listener))
|
if (m.getClass().isAnnotationPresent(AutoRegisterListener.class) && (m instanceof Listener))
|
||||||
{
|
{
|
||||||
@ -165,11 +167,11 @@ public final class ModuleLoader implements CoreModule
|
|||||||
{
|
{
|
||||||
Utils.sendModuleHeader(sender);
|
Utils.sendModuleHeader(sender);
|
||||||
StringBuilder sb = new StringBuilder("Modules:\n");
|
StringBuilder sb = new StringBuilder("Modules:\n");
|
||||||
for (Module m : modules)
|
for (Module module : modules.keySet())
|
||||||
{
|
{
|
||||||
String[] classPath = m.getClass().getName().split("\\.");
|
String[] classPath = module.getClass().getName().split("\\.");
|
||||||
String classname = classPath[classPath.length - 1];
|
String classname = classPath[classPath.length - 1];
|
||||||
sb.append(m.enabled() ? "&a" : "&c");
|
sb.append(modules.get(module) ? "&a" : "&c");
|
||||||
sb.append(classname);
|
sb.append(classname);
|
||||||
sb.append(", ");
|
sb.append(", ");
|
||||||
}
|
}
|
||||||
@ -181,9 +183,9 @@ public final class ModuleLoader implements CoreModule
|
|||||||
|
|
||||||
public static void disableModules()
|
public static void disableModules()
|
||||||
{
|
{
|
||||||
for (Module module : modules)
|
for (Module module : modules.keySet())
|
||||||
{
|
{
|
||||||
if (module.enabled())
|
if (modules.get(module))
|
||||||
{
|
{
|
||||||
module.onDisable();
|
module.onDisable();
|
||||||
}
|
}
|
||||||
|
@ -7,21 +7,16 @@ import com.redstoner.annotations.Version;
|
|||||||
* Examples are the ModuleLoader and the Debugger.
|
* Examples are the ModuleLoader and the Debugger.
|
||||||
*
|
*
|
||||||
* @author Pepich */
|
* @author Pepich */
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = -1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = -1)
|
||||||
public interface CoreModule extends Module
|
public interface CoreModule extends Module
|
||||||
{
|
{
|
||||||
/** Core modules should always be enabled. */
|
/** Core modules don't need to be enabled. */
|
||||||
@Override
|
@Override
|
||||||
public default boolean enabled()
|
public default boolean onEnable()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Core modules don't need to be enabled. */
|
|
||||||
@Override
|
|
||||||
public default void onEnable()
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** Core modules don't need to be disabled. */
|
/** Core modules don't need to be disabled. */
|
||||||
@Override
|
@Override
|
||||||
public default void onDisable()
|
public default void onDisable()
|
||||||
|
@ -9,25 +9,11 @@ import com.redstoner.annotations.Version;
|
|||||||
public interface Module
|
public interface Module
|
||||||
{
|
{
|
||||||
/** Will be called when the module gets enabled. */
|
/** Will be called when the module gets enabled. */
|
||||||
public void onEnable();
|
public boolean onEnable();
|
||||||
|
|
||||||
/** Will be called when the module gets disabled. */
|
/** Will be called when the module gets disabled. */
|
||||||
public void onDisable();
|
public void onDisable();
|
||||||
|
|
||||||
/** Will be called to check if a module is enabled or not.
|
|
||||||
*
|
|
||||||
* @return The status of the module, true when enabled, false when not. */
|
|
||||||
public boolean enabled();
|
|
||||||
|
|
||||||
/** Default implementation for the enable() method, returning weather the module was enabled or not.
|
|
||||||
*
|
|
||||||
* @return */
|
|
||||||
public default boolean enable()
|
|
||||||
{
|
|
||||||
onEnable();
|
|
||||||
return enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gets called on registration of the module.
|
/** Gets called on registration of the module.
|
||||||
*
|
*
|
||||||
* @return The String used for the CommandManager to register the commands. */
|
* @return The String used for the CommandManager to register the commands. */
|
||||||
|
@ -19,10 +19,9 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Abot implements Module, Listener
|
public class Abot implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private File answerFile = new File(Main.plugin.getDataFolder(), "abot.json");
|
private File answerFile = new File(Main.plugin.getDataFolder(), "abot.json");
|
||||||
JSONArray answers;
|
JSONArray answers;
|
||||||
|
|
||||||
@ -59,23 +58,15 @@ public class Abot implements Module, Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
loadAnswers(Bukkit.getConsoleSender());
|
loadAnswers(Bukkit.getConsoleSender());
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,17 +24,16 @@ import com.redstoner.modules.Module;
|
|||||||
*
|
*
|
||||||
* @author Pepich */
|
* @author Pepich */
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 6, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Adminchat implements Module, Listener
|
public class Adminchat implements Module, Listener
|
||||||
{
|
{
|
||||||
private static final char defaultKey = ',';
|
private static final char defaultKey = ',';
|
||||||
private boolean enabled = false;
|
|
||||||
private static final File keysLocation = new File(Main.plugin.getDataFolder(), "adminchat_keys.json");
|
private static final File keysLocation = new File(Main.plugin.getDataFolder(), "adminchat_keys.json");
|
||||||
private ArrayList<UUID> actoggled;
|
private ArrayList<UUID> actoggled;
|
||||||
private static JSONObject keys;
|
private static JSONObject keys;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
keys = JsonManager.getObject(keysLocation);
|
keys = JsonManager.getObject(keysLocation);
|
||||||
if (keys == null)
|
if (keys == null)
|
||||||
@ -43,20 +42,12 @@ public class Adminchat implements Module, Listener
|
|||||||
saveKeys();
|
saveKeys();
|
||||||
}
|
}
|
||||||
actoggled = new ArrayList<UUID>();
|
actoggled = new ArrayList<UUID>();
|
||||||
this.enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
this.enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,20 +19,19 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 3, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class AdminNotes implements Module, Listener
|
public class AdminNotes implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
JSONArray notes;
|
JSONArray notes;
|
||||||
File saveFile = new File(Main.plugin.getDataFolder(), "adminnotes.json");
|
File saveFile = new File(Main.plugin.getDataFolder(), "adminnotes.json");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
notes = JsonManager.getArray(saveFile);
|
notes = JsonManager.getArray(saveFile);
|
||||||
if (notes == null)
|
if (notes == null)
|
||||||
notes = new JSONArray();
|
notes = new JSONArray();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -51,7 +50,6 @@ public class AdminNotes implements Module, Listener
|
|||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveNotes();
|
saveNotes();
|
||||||
enabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -102,12 +100,6 @@ public class AdminNotes implements Module, Listener
|
|||||||
JsonManager.save(notes, saveFile);
|
JsonManager.save(notes, saveFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
public String getCommandString()
|
public String getCommandString()
|
||||||
|
@ -13,33 +13,25 @@ import com.redstoner.misc.Main;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 2, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Challenge implements Module
|
public class Challenge implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private File challengeLocation = new File(Main.plugin.getDataFolder(), "challenges.json");
|
private File challengeLocation = new File(Main.plugin.getDataFolder(), "challenges.json");
|
||||||
private JSONArray challenges;
|
private JSONArray challenges;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
challenges = JsonManager.getArray(challengeLocation);
|
challenges = JsonManager.getArray(challengeLocation);
|
||||||
if (challenges == null)
|
if (challenges == null)
|
||||||
challenges = new JSONArray();
|
challenges = new JSONArray();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveChallenges();
|
saveChallenges();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -26,25 +26,24 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 1, revision = 2, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Chatalias implements Module, Listener
|
public class Chatalias implements Module, Listener
|
||||||
{
|
{
|
||||||
// to export chatalias data to json:
|
// to export chatalias data to json:
|
||||||
// pyeval [save_json_file("aliases/" + uuid, shared['modules']['chatalias'].data[uuid]) for uuid in shared['modules']['chatalias'].data]
|
// pyeval [save_json_file("aliases/" + uuid, shared['modules']['chatalias'].data[uuid]) for uuid in shared['modules']['chatalias'].data]
|
||||||
// HANDLE WITH CARE! This will create an array of null entries the size of len(data)!
|
// HANDLE WITH CARE! This will create an array of null entries the size of len(data)!
|
||||||
private boolean enabled = false;
|
|
||||||
private final String[] commands = new String[] {"e?r", "e?m .+? ", "e?t", "e?w", "e?msg .+? ", "e?message .+? ",
|
private final String[] commands = new String[] {"e?r", "e?m .+? ", "e?t", "e?w", "e?msg .+? ", "e?message .+? ",
|
||||||
"e?whisper .+? ", "e?me", "cg say", "ac"};
|
"e?whisper .+? ", "e?me", "cg say", "ac"};
|
||||||
private JSONObject aliases = new JSONObject();
|
private JSONObject aliases = new JSONObject();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
loadAliases(p.getUniqueId());
|
loadAliases(p.getUniqueId());
|
||||||
}
|
}
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,13 +54,6 @@ public class Chatalias implements Module, Listener
|
|||||||
UUID uuid = UUID.fromString((String) key);
|
UUID uuid = UUID.fromString((String) key);
|
||||||
saveAliases(uuid);
|
saveAliases(uuid);
|
||||||
}
|
}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -26,7 +26,7 @@ import com.redstoner.modules.Module;
|
|||||||
*
|
*
|
||||||
* @author Pepich */
|
* @author Pepich */
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 3, revision = 2, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Chatgroups implements Module, Listener
|
public class Chatgroups implements Module, Listener
|
||||||
{
|
{
|
||||||
private static final char defaultKey = ':';
|
private static final char defaultKey = ':';
|
||||||
@ -34,10 +34,9 @@ public class Chatgroups implements Module, Listener
|
|||||||
private static final File keysLocation = new File(Main.plugin.getDataFolder(), "chatgroup_keys.json");
|
private static final File keysLocation = new File(Main.plugin.getDataFolder(), "chatgroup_keys.json");
|
||||||
private ArrayList<UUID> cgtoggled;
|
private ArrayList<UUID> cgtoggled;
|
||||||
private static JSONObject groups, keys;
|
private static JSONObject groups, keys;
|
||||||
private boolean enabled = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
groups = JsonManager.getObject(groupsLocation);
|
groups = JsonManager.getObject(groupsLocation);
|
||||||
if (groups == null)
|
if (groups == null)
|
||||||
@ -52,7 +51,7 @@ public class Chatgroups implements Module, Listener
|
|||||||
saveKeys();
|
saveKeys();
|
||||||
}
|
}
|
||||||
cgtoggled = new ArrayList<UUID>();
|
cgtoggled = new ArrayList<UUID>();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,13 +59,6 @@ public class Chatgroups implements Module, Listener
|
|||||||
{
|
{
|
||||||
saveKeys();
|
saveKeys();
|
||||||
saveGroups();
|
saveGroups();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
|
@ -31,21 +31,19 @@ import com.redstoner.misc.mysql.elements.MysqlDatabase;
|
|||||||
import com.redstoner.misc.mysql.elements.MysqlTable;
|
import com.redstoner.misc.mysql.elements.MysqlTable;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 7, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Check implements Module, Listener
|
public class Check implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
MysqlTable table;
|
MysqlTable table;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
Map<Serializable, Serializable> config = JSONManager.getConfiguration("check.json");
|
Map<Serializable, Serializable> config = JSONManager.getConfiguration("check.json");
|
||||||
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
||||||
{
|
{
|
||||||
Utils.error("Could not load the Check config file, disabling!");
|
Utils.error("Could not load the Check config file, disabling!");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -56,10 +54,9 @@ public class Check implements Module, Listener
|
|||||||
catch (NullPointerException e)
|
catch (NullPointerException e)
|
||||||
{
|
{
|
||||||
Utils.error("Could not use the Check config, disabling!");
|
Utils.error("Could not use the Check config, disabling!");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -228,12 +225,6 @@ public class Check implements Module, Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
public String getCommandString()
|
public String getCommandString()
|
||||||
@ -251,7 +242,5 @@ public class Check implements Module, Listener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,28 +9,18 @@ import com.redstoner.annotations.Version;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Clear implements Module
|
public class Clear implements Module
|
||||||
{
|
{
|
||||||
boolean enabled;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(hook = "clear")
|
@Command(hook = "clear")
|
||||||
public boolean clearInventory(CommandSender sender)
|
public boolean clearInventory(CommandSender sender)
|
||||||
|
@ -17,10 +17,9 @@ import com.redstoner.misc.Main;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class ClearOnJoin implements Module, Listener
|
public class ClearOnJoin implements Module, Listener
|
||||||
{
|
{
|
||||||
boolean enabled = false;
|
|
||||||
private File listLocation = new File(Main.plugin.getDataFolder(), "clearonjoins.json");
|
private File listLocation = new File(Main.plugin.getDataFolder(), "clearonjoins.json");
|
||||||
private JSONArray list;
|
private JSONArray list;
|
||||||
|
|
||||||
@ -75,26 +74,19 @@ public class ClearOnJoin implements Module, Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
|
||||||
list = JsonManager.getArray(listLocation);
|
list = JsonManager.getArray(listLocation);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
list = new JSONArray();
|
list = new JSONArray();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(this, Main.plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(this, Main.plugin);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveList();
|
saveList();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
|
@ -22,33 +22,25 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Cycle implements Module, Listener
|
public class Cycle implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private File cycleFile = new File(Main.plugin.getDataFolder(), "cycle.json");
|
private File cycleFile = new File(Main.plugin.getDataFolder(), "cycle.json");
|
||||||
private JSONArray no_cyclers;
|
private JSONArray no_cyclers;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
no_cyclers = JsonManager.getArray(cycleFile);
|
no_cyclers = JsonManager.getArray(cycleFile);
|
||||||
if (no_cyclers == null)
|
if (no_cyclers == null)
|
||||||
no_cyclers = new JSONArray();
|
no_cyclers = new JSONArray();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveCyclers();
|
saveCyclers();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCyclers()
|
private void saveCyclers()
|
||||||
|
@ -37,10 +37,9 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 1, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class DamnSpam implements Module, Listener
|
public class DamnSpam implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
File configFile = new File(Main.plugin.getDataFolder(), "DamnSpam.json");
|
File configFile = new File(Main.plugin.getDataFolder(), "DamnSpam.json");
|
||||||
Map<String, SpamInput> inputs;
|
Map<String, SpamInput> inputs;
|
||||||
boolean changingInput = false;
|
boolean changingInput = false;
|
||||||
@ -51,7 +50,7 @@ public class DamnSpam implements Module, Listener
|
|||||||
String timeoutErrorString = "&cThe timeout must be -1 or within 0 and " + maxTimeout;
|
String timeoutErrorString = "&cThe timeout must be -1 or within 0 and " + maxTimeout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
loadInputs();
|
loadInputs();
|
||||||
acceptedInputs = new ArrayList<Material>();
|
acceptedInputs = new ArrayList<Material>();
|
||||||
@ -64,7 +63,7 @@ public class DamnSpam implements Module, Listener
|
|||||||
attachedBlocks.put(Material.WOOD_BUTTON,
|
attachedBlocks.put(Material.WOOD_BUTTON,
|
||||||
new int[][] {{0, 8}, {5, 6, 7, 13, 14, 15}, {4, 12}, {3, 11}, {2, 10}, {1, 9}});
|
new int[][] {{0, 8}, {5, 6, 7, 13, 14, 15}, {4, 12}, {3, 11}, {2, 10}, {1, 9}});
|
||||||
players = new HashMap<Player, SpamInput>();
|
players = new HashMap<Player, SpamInput>();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadInputs()
|
public void loadInputs()
|
||||||
@ -344,17 +343,9 @@ public class DamnSpam implements Module, Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,10 +10,9 @@ import com.redstoner.annotations.Version;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 2, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Illumination implements Module
|
public class Illumination implements Module
|
||||||
{
|
{
|
||||||
boolean enabled = false;
|
|
||||||
PotionEffect effect = new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false);
|
PotionEffect effect = new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false);
|
||||||
|
|
||||||
@Command(hook = "illuminate")
|
@Command(hook = "illuminate")
|
||||||
@ -33,22 +32,14 @@ public class Illumination implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,12 +7,13 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.nemez.cmdmgr.Command;
|
import com.nemez.cmdmgr.Command;
|
||||||
|
import com.redstoner.annotations.Version;
|
||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Imout implements Module
|
public class Imout implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
List<String> imout_toggle_list = new ArrayList<String>();
|
List<String> imout_toggle_list = new ArrayList<String>();
|
||||||
|
|
||||||
@Command(hook = "imout")
|
@Command(hook = "imout")
|
||||||
@ -42,22 +43,14 @@ public class Imout implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enabled()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
return enabled;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
enabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,10 +16,9 @@ import com.redstoner.annotations.Version;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class LagChunks implements Module
|
public class LagChunks implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private List<LaggyChunk> laggyChunks = new ArrayList<LaggyChunk>();
|
private List<LaggyChunk> laggyChunks = new ArrayList<LaggyChunk>();
|
||||||
|
|
||||||
private void scan(int amount)
|
private void scan(int amount)
|
||||||
@ -79,22 +78,14 @@ public class LagChunks implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enabled()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
return enabled;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
enabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,23 +34,21 @@ import com.redstoner.misc.mysql.types.text.VarChar;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 3, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class LoginSecurity implements Module, Listener
|
public class LoginSecurity implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
protected static Map<UUID, Location> loggingIn;
|
protected static Map<UUID, Location> loggingIn;
|
||||||
private MysqlTable table;
|
private MysqlTable table;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
Map<Serializable, Serializable> config = JSONManager.getConfiguration("loginsecurity.json");
|
Map<Serializable, Serializable> config = JSONManager.getConfiguration("loginsecurity.json");
|
||||||
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
||||||
{
|
{
|
||||||
Utils.sendErrorMessage(Bukkit.getConsoleSender(), null,
|
Utils.sendErrorMessage(Bukkit.getConsoleSender(), null,
|
||||||
"Could not load the LoginSecurity config file, disabling!");
|
"Could not load the LoginSecurity config file, disabling!");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -64,12 +62,11 @@ public class LoginSecurity implements Module, Listener
|
|||||||
{
|
{
|
||||||
Utils.sendErrorMessage(Bukkit.getConsoleSender(), null,
|
Utils.sendErrorMessage(Bukkit.getConsoleSender(), null,
|
||||||
"Could not use the LoginSecurity config, disabling!");
|
"Could not use the LoginSecurity config, disabling!");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
loggingIn = new HashMap<>();
|
loggingIn = new HashMap<>();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new CancelledEventsHandler(this), Main.plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new CancelledEventsHandler(this), Main.plugin);
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<UUID, Location> getLoggingIn()
|
public static Map<UUID, Location> getLoggingIn()
|
||||||
@ -263,17 +260,9 @@ public class LoginSecurity implements Module, Listener
|
|||||||
return table.insert(player.getUniqueId().toString(), toInsert);
|
return table.insert(player.getUniqueId().toString(), toInsert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,31 +23,23 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 4, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Mentio implements Module, Listener
|
public class Mentio implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private File mentioLocation = new File(Main.plugin.getDataFolder(), "mentio.json");
|
private File mentioLocation = new File(Main.plugin.getDataFolder(), "mentio.json");
|
||||||
private JSONObject mentios;
|
private JSONObject mentios;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
loadMentios();
|
loadMentios();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveMentios();
|
saveMentios();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -18,29 +18,20 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 4, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Misc implements Module, Listener
|
public class Misc implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private final String[] sudoBlacklist = new String[] {".*:?esudo", ".*:?sudo", ".*:?script.*", ".*:?stop"};
|
private final String[] sudoBlacklist = new String[] {".*:?esudo", ".*:?sudo", ".*:?script.*", ".*:?stop"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFirstJoin(PlayerJoinEvent event)
|
public void onFirstJoin(PlayerJoinEvent event)
|
||||||
|
@ -12,10 +12,9 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Motd implements Module
|
public class Motd implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private String default_motd, motd;
|
private String default_motd, motd;
|
||||||
|
|
||||||
@Command(hook = "setmotd")
|
@Command(hook = "setmotd")
|
||||||
@ -43,23 +42,15 @@ public class Motd implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
default_motd = Bukkit.getMotd();
|
default_motd = Bukkit.getMotd();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,28 +16,18 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Nametags implements Module, Listener
|
public class Nametags implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
|
@ -22,11 +22,9 @@ import net.minecraft.server.v1_11_R1.EntityHuman;
|
|||||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutOpenWindow;
|
import net.minecraft.server.v1_11_R1.PacketPlayOutOpenWindow;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 3, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Naming implements Module
|
public class Naming implements Module
|
||||||
{
|
{
|
||||||
boolean enabled = false;
|
|
||||||
|
|
||||||
@Command(hook = "anvil")
|
@Command(hook = "anvil")
|
||||||
public void anvil(CommandSender sender)
|
public void anvil(CommandSender sender)
|
||||||
{
|
{
|
||||||
@ -90,22 +88,14 @@ public class Naming implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,29 +19,20 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Pmtoggle implements Module, Listener
|
public class Pmtoggle implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled;
|
|
||||||
HashMap<Player, String> toggles = new HashMap<Player, String>();
|
HashMap<Player, String> toggles = new HashMap<Player, String>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(hook = "pmtoggle_off", async = AsyncType.ALWAYS)
|
@Command(hook = "pmtoggle_off", async = AsyncType.ALWAYS)
|
||||||
public boolean pmtoggle_off(CommandSender sender)
|
public boolean pmtoggle_off(CommandSender sender)
|
||||||
|
@ -13,6 +13,7 @@ import org.json.simple.JSONArray;
|
|||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import com.nemez.cmdmgr.Command;
|
import com.nemez.cmdmgr.Command;
|
||||||
|
import com.redstoner.annotations.Version;
|
||||||
import com.redstoner.misc.JsonManager;
|
import com.redstoner.misc.JsonManager;
|
||||||
import com.redstoner.misc.Main;
|
import com.redstoner.misc.Main;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
@ -22,94 +23,79 @@ import net.md_5.bungee.api.ChatColor;
|
|||||||
/** Report module. Allows reports to be created and handled by staff
|
/** Report module. Allows reports to be created and handled by staff
|
||||||
*
|
*
|
||||||
* @author Redempt */
|
* @author Redempt */
|
||||||
public class Reports implements Module {
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
|
public class Reports implements Module
|
||||||
private boolean enabled = false;
|
{
|
||||||
private int task = 0;
|
private int task = 0;
|
||||||
|
|
||||||
private JSONArray reports;
|
private JSONArray reports;
|
||||||
private JSONArray archived;
|
private JSONArray archived;
|
||||||
|
|
||||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd kk:mm");
|
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd kk:mm");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public boolean onEnable()
|
||||||
enabled = true;
|
{
|
||||||
//Load reports
|
|
||||||
reports = JsonManager.getArray(new File(Main.plugin.getDataFolder(), "reports.json"));
|
reports = JsonManager.getArray(new File(Main.plugin.getDataFolder(), "reports.json"));
|
||||||
archived = JsonManager.getArray(new File(Main.plugin.getDataFolder(), "archived_reports.json"));
|
archived = JsonManager.getArray(new File(Main.plugin.getDataFolder(), "archived_reports.json"));
|
||||||
if (reports == null) {
|
if (reports == null)
|
||||||
|
{
|
||||||
reports = new JSONArray();
|
reports = new JSONArray();
|
||||||
}
|
}
|
||||||
if (archived == null) {
|
if (archived == null)
|
||||||
|
{
|
||||||
archived = new JSONArray();
|
archived = new JSONArray();
|
||||||
}
|
}
|
||||||
//Notify online staff of open reports
|
// Notify online staff of open reports
|
||||||
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.plugin, () -> {
|
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.plugin, () ->
|
||||||
if (reports.size() <= 0) {
|
{
|
||||||
|
if (reports.size() <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
if (player.hasPermission("utils.report")) {
|
{
|
||||||
player.sendMessage(ChatColor.RED + "There are " + ChatColor.YELLOW + reports.size() + ChatColor.RED + " open reports!");
|
if (player.hasPermission("utils.report"))
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.RED + "There are " + ChatColor.YELLOW + reports.size() + ChatColor.RED
|
||||||
|
+ " open reports!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 2400, 2400);
|
} , 2400, 2400);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable()
|
||||||
enabled = false;
|
{
|
||||||
//Save reports, cancel notifier task
|
// Save reports, cancel notifier task
|
||||||
Bukkit.getScheduler().cancelTask(task);
|
Bukkit.getScheduler().cancelTask(task);
|
||||||
JsonManager.save(reports, new File(Main.plugin.getDataFolder(), "reports.json"));
|
JsonManager.save(reports, new File(Main.plugin.getDataFolder(), "reports.json"));
|
||||||
JsonManager.save(archived, new File(Main.plugin.getDataFolder(), "archived_reports.json"));
|
JsonManager.save(archived, new File(Main.plugin.getDataFolder(), "archived_reports.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandString() {
|
public String getCommandString()
|
||||||
return "command report {"
|
{
|
||||||
+ "[string:message...] {"
|
return "command report {" + "[string:message...] {" + "type player;" + "help Report a player or incident;"
|
||||||
+ "type player;"
|
+ "run report message;" + "}" + "}" + "command rp {" + "perm utils.report;" + "open {"
|
||||||
+ "help Report a player or incident;"
|
+ "help List all open reports;" + "run report_open;" + "}" + "close [int:id] {" + "help Close a report;"
|
||||||
+ "run report message;"
|
+ "run report_close id;" + "}" + "tp [int:id] {" + "help Teleport to the location of a report;"
|
||||||
+ "}"
|
+ "run report_tp id;" + "type player;" + "}" + "}";
|
||||||
+ "}"
|
|
||||||
+ "command rp {"
|
|
||||||
+ "perm utils.report;"
|
|
||||||
+ "open {"
|
|
||||||
+ "help List all open reports;"
|
|
||||||
+ "run report_open;"
|
|
||||||
+ "}"
|
|
||||||
+ "close [int:id] {"
|
|
||||||
+ "help Close a report;"
|
|
||||||
+ "run report_close id;"
|
|
||||||
+ "}"
|
|
||||||
+ "tp [int:id] {"
|
|
||||||
+ "help Teleport to the location of a report;"
|
|
||||||
+ "run report_tp id;"
|
|
||||||
+ "type player;"
|
|
||||||
+ "}"
|
|
||||||
+ "}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(hook = "report_tp")
|
@Command(hook = "report_tp")
|
||||||
public void tpReport(CommandSender sender, int id) {
|
public void tpReport(CommandSender sender, int id)
|
||||||
//Check for invalid ID
|
{
|
||||||
|
// Check for invalid ID
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (id > reports.size() - 1 || id < 0) {
|
if (id > reports.size() - 1 || id < 0)
|
||||||
|
{
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid ID!");
|
sender.sendMessage(ChatColor.RED + "Invalid ID!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject report = (JSONObject) reports.get(id);
|
JSONObject report = (JSONObject) reports.get(id);
|
||||||
String loc = (String) report.get("location");
|
String loc = (String) report.get("location");
|
||||||
String[] split = loc.split(";");
|
String[] split = loc.split(";");
|
||||||
//Location from string
|
// Location from string
|
||||||
int x = Integer.parseInt(split[0]);
|
int x = Integer.parseInt(split[0]);
|
||||||
int y = Integer.parseInt(split[1]);
|
int y = Integer.parseInt(split[1]);
|
||||||
int z = Integer.parseInt(split[2]);
|
int z = Integer.parseInt(split[2]);
|
||||||
@ -120,13 +106,15 @@ public class Reports implements Module {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Command(hook = "report_close")
|
@Command(hook = "report_close")
|
||||||
public void closeReport(CommandSender sender, int id) {
|
public void closeReport(CommandSender sender, int id)
|
||||||
//Check for invalid ID
|
{
|
||||||
if (id > reports.size() - 1 || id < 0) {
|
// Check for invalid ID
|
||||||
|
if (id > reports.size() - 1 || id < 0)
|
||||||
|
{
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid ID!");
|
sender.sendMessage(ChatColor.RED + "Invalid ID!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Move report to archived reports
|
// Move report to archived reports
|
||||||
JSONObject report = (JSONObject) reports.get(id);
|
JSONObject report = (JSONObject) reports.get(id);
|
||||||
reports.remove(id);
|
reports.remove(id);
|
||||||
archived.add(report);
|
archived.add(report);
|
||||||
@ -134,9 +122,11 @@ public class Reports implements Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(hook = "report_open")
|
@Command(hook = "report_open")
|
||||||
public void listOpen(CommandSender sender) {
|
public void listOpen(CommandSender sender)
|
||||||
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Object object : reports) {
|
for (Object object : reports)
|
||||||
|
{
|
||||||
JSONObject report = (JSONObject) object;
|
JSONObject report = (JSONObject) object;
|
||||||
String message = "";
|
String message = "";
|
||||||
message += ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + i + ChatColor.DARK_GRAY + "]";
|
message += ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + i + ChatColor.DARK_GRAY + "]";
|
||||||
@ -146,26 +136,28 @@ public class Reports implements Module {
|
|||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i == 0)
|
||||||
|
{
|
||||||
sender.sendMessage(ChatColor.GREEN + "There are no open reports.");
|
sender.sendMessage(ChatColor.GREEN + "There are no open reports.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Command(hook = "report")
|
@Command(hook = "report")
|
||||||
public void report(CommandSender sender, String message) {
|
public void report(CommandSender sender, String message)
|
||||||
|
{
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
//Create report JSONObject
|
// Create report JSONObject
|
||||||
JSONObject report = new JSONObject();
|
JSONObject report = new JSONObject();
|
||||||
report.put("name", player.getName());
|
report.put("name", player.getName());
|
||||||
report.put("time", dateFormat.format(new Date()));
|
report.put("time", dateFormat.format(new Date()));
|
||||||
report.put("message", message);
|
report.put("message", message);
|
||||||
String loc = "";
|
String loc = "";
|
||||||
//Location to string
|
// Location to string
|
||||||
loc += player.getLocation().getBlockX() + ";" + player.getLocation().getBlockY() + ";" + player.getLocation().getBlockZ() + ";" + player.getLocation().getWorld().getName();
|
loc += player.getLocation().getBlockX() + ";" + player.getLocation().getBlockY() + ";"
|
||||||
|
+ player.getLocation().getBlockZ() + ";" + player.getLocation().getWorld().getName();
|
||||||
report.put("location", loc);
|
report.put("location", loc);
|
||||||
reports.add(report);
|
reports.add(report);
|
||||||
sender.sendMessage(ChatColor.GREEN + "Report created!");
|
sender.sendMessage(ChatColor.GREEN + "Report created!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,34 +15,26 @@ import com.redstoner.misc.Main;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 6, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Saylol implements Module
|
public class Saylol implements Module
|
||||||
{
|
{
|
||||||
private long lastLol = 0;
|
private long lastLol = 0;
|
||||||
private boolean enabled = false;
|
|
||||||
private File lolLocation = new File(Main.plugin.getDataFolder(), "lol.json");
|
private File lolLocation = new File(Main.plugin.getDataFolder(), "lol.json");
|
||||||
private JSONArray lols;
|
private JSONArray lols;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
lols = JsonManager.getArray(lolLocation);
|
lols = JsonManager.getArray(lolLocation);
|
||||||
if (lols == null)
|
if (lols == null)
|
||||||
lols = new JSONArray();
|
lols = new JSONArray();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveLols();
|
saveLols();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -8,11 +8,9 @@ import com.redstoner.annotations.Version;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Scriptutils implements Module
|
public class Scriptutils implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
|
|
||||||
/** Prints Bukkit restart message
|
/** Prints Bukkit restart message
|
||||||
* arg 0 timeout
|
* arg 0 timeout
|
||||||
* arg 1 $(whoami);
|
* arg 1 $(whoami);
|
||||||
@ -175,22 +173,14 @@ public class Scriptutils implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,6 @@ import com.redstoner.modules.Module;
|
|||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
public class SkullClick implements Module, Listener
|
public class SkullClick implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private boolean seen = false;
|
private boolean seen = false;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -54,22 +53,14 @@ public class SkullClick implements Module, Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enabled()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
return enabled;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
enabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandString()
|
public String getCommandString()
|
||||||
|
@ -17,33 +17,25 @@ import com.redstoner.misc.Main;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 0, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Tag implements Module
|
public class Tag implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled;
|
|
||||||
private File tagLocation = new File(Main.plugin.getDataFolder(), "tag.json");
|
private File tagLocation = new File(Main.plugin.getDataFolder(), "tag.json");
|
||||||
private JSONObject tags;
|
private JSONObject tags;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
tags = JsonManager.getObject(tagLocation);
|
tags = JsonManager.getObject(tagLocation);
|
||||||
if (tags == null)
|
if (tags == null)
|
||||||
tags = new JSONObject();
|
tags = new JSONObject();
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
saveTags();
|
saveTags();
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation", "unchecked"})
|
@SuppressWarnings({"deprecation", "unchecked"})
|
||||||
|
@ -19,10 +19,9 @@ import com.redstoner.misc.Utils;
|
|||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@AutoRegisterListener
|
@AutoRegisterListener
|
||||||
@Version(major = 1, minor = 0, revision = 3, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Vanish implements Module, Listener
|
public class Vanish implements Module, Listener
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private ArrayList<UUID> vanished = new ArrayList<UUID>();
|
private ArrayList<UUID> vanished = new ArrayList<UUID>();
|
||||||
private HashMap<UUID, ArrayList<UUID>> vanishOthers = new HashMap<UUID, ArrayList<UUID>>();
|
private HashMap<UUID, ArrayList<UUID>> vanishOthers = new HashMap<UUID, ArrayList<UUID>>();
|
||||||
|
|
||||||
@ -201,22 +200,14 @@ public class Vanish implements Module, Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,11 +8,9 @@ import com.redstoner.annotations.Version;
|
|||||||
import com.redstoner.misc.Utils;
|
import com.redstoner.misc.Utils;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 0, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class Warn implements Module
|
public class Warn implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
|
|
||||||
@Command(hook = "warn")
|
@Command(hook = "warn")
|
||||||
public void warn_normal(CommandSender sender)
|
public void warn_normal(CommandSender sender)
|
||||||
{
|
{
|
||||||
@ -28,22 +26,14 @@ public class Warn implements Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,17 +22,16 @@ import com.redstoner.misc.mysql.elements.MysqlDatabase;
|
|||||||
import com.redstoner.misc.mysql.elements.MysqlTable;
|
import com.redstoner.misc.mysql.elements.MysqlTable;
|
||||||
import com.redstoner.modules.Module;
|
import com.redstoner.modules.Module;
|
||||||
|
|
||||||
@Version(major = 1, minor = 1, revision = 1, compatible = 1)
|
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||||
public class WebToken implements Module
|
public class WebToken implements Module
|
||||||
{
|
{
|
||||||
private boolean enabled = false;
|
|
||||||
private static final int TOKEN_LENGTH = 6;
|
private static final int TOKEN_LENGTH = 6;
|
||||||
private static final String CONSONANTS = "bcdfghjklmnpqrstvwxyz";
|
private static final String CONSONANTS = "bcdfghjklmnpqrstvwxyz";
|
||||||
private static final String VOWELS = "aeiou";
|
private static final String VOWELS = "aeiou";
|
||||||
private MysqlTable table;
|
private MysqlTable table;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public boolean onEnable()
|
||||||
{
|
{
|
||||||
Config config;
|
Config config;
|
||||||
try
|
try
|
||||||
@ -42,16 +41,14 @@ public class WebToken implements Module
|
|||||||
catch (IOException | ParseException e1)
|
catch (IOException | ParseException e1)
|
||||||
{
|
{
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
if (config == null || !config.containsKey("database") || !config.containsKey("table"))
|
||||||
{
|
{
|
||||||
Utils.error("Could not load the WebToken config file, disabling!");
|
Utils.error("Could not load the WebToken config file, disabling!");
|
||||||
config.put("database", "redstoner");
|
config.put("database", "redstoner");
|
||||||
config.put("table", "webtoken");
|
config.put("table", "webtoken");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -61,10 +58,9 @@ public class WebToken implements Module
|
|||||||
catch (NullPointerException e)
|
catch (NullPointerException e)
|
||||||
{
|
{
|
||||||
Utils.error("Could not use the WebToken config, disabling!");
|
Utils.error("Could not use the WebToken config, disabling!");
|
||||||
enabled = false;
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
enabled = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNextId() throws Exception
|
private String getNextId() throws Exception
|
||||||
@ -206,15 +202,7 @@ public class WebToken implements Module
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{}
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enabled()
|
|
||||||
{
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @noformat
|
// @noformat
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user