First release of the 'redesign', organizing most features into components #54
8 changed files with 43 additions and 21 deletions
1
ButtonCore/lombok.config
Normal file
1
ButtonCore/lombok.config
Normal file
|
@ -0,0 +1 @@
|
|||
lombok.var.flagUsage = ALLOW
|
|
@ -72,6 +72,14 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<useSystemClassLoader>false
|
||||
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package buttondevteam.component.commands;
|
||||
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CommandComponent extends Component { //TODO: Do we just move everything here?
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
public void enable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(JavaPlugin plugin) {
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,18 +4,17 @@ import buttondevteam.core.PrimeRestartCommand;
|
|||
import buttondevteam.core.ScheduledRestartCommand;
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RestartComponent extends Component {
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
//TODO: Separately (dis)allow commands
|
||||
TBMCChatAPI.AddCommand(plugin, ScheduledRestartCommand.class);
|
||||
TBMCChatAPI.AddCommand(plugin, PrimeRestartCommand.class);
|
||||
public void enable() {
|
||||
//TODO: Permissions for the commands
|
||||
TBMCChatAPI.AddCommand(getPlugin(), ScheduledRestartCommand.class);
|
||||
TBMCChatAPI.AddCommand(getPlugin(), PrimeRestartCommand.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(JavaPlugin plugin) {
|
||||
public void disable() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,15 @@ package buttondevteam.component.updater;
|
|||
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PluginUpdaterComponent extends Component {
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
TBMCChatAPI.AddCommand(plugin, UpdatePluginCommand.class);
|
||||
public void enable() {
|
||||
TBMCChatAPI.AddCommand(getPlugin(), UpdatePluginCommand.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(JavaPlugin plugin) {
|
||||
public void disable() { //TODO: Unregister commands and such
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package buttondevteam.core;
|
||||
|
||||
import buttondevteam.component.restart.RestartComponent;
|
||||
import buttondevteam.component.updater.PluginUpdater;
|
||||
import buttondevteam.component.updater.PluginUpdaterComponent;
|
||||
import buttondevteam.lib.TBMCCoreAPI;
|
||||
import buttondevteam.lib.architecture.Component;
|
||||
import buttondevteam.lib.chat.Channel;
|
||||
import buttondevteam.lib.chat.ChatRoom;
|
||||
import buttondevteam.lib.chat.Color;
|
||||
|
@ -40,6 +43,8 @@ public class MainPlugin extends JavaPlugin {
|
|||
setupPermissions();
|
||||
Test = getConfig().getBoolean("test", true);
|
||||
saveConfig();
|
||||
Component.registerComponent(this, new PluginUpdaterComponent());
|
||||
Component.registerComponent(this, new RestartComponent());
|
||||
ComponentManager.enableComponents();
|
||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);
|
||||
|
|
|
@ -144,20 +144,23 @@ public abstract class Component {
|
|||
}
|
||||
|
||||
/**
|
||||
* Registers the module, when called by the JavaPlugin class. Call
|
||||
* registerCommand() and registerListener() within this method.
|
||||
* Registers the module, when called by the JavaPlugin class.
|
||||
* This gets fired when the plugin is enabled. Use {@link #enable()} to register commands and such.
|
||||
*
|
||||
* @param plugin Plugin class called to register commands and listeners
|
||||
* @param plugin Plugin object
|
||||
*/
|
||||
protected abstract void register(JavaPlugin plugin);
|
||||
protected void register(JavaPlugin plugin) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters the module, when called by the JavaPlugin class. Do
|
||||
* any cleanups needed within this method.
|
||||
* Unregisters the module, when called by the JavaPlugin class.
|
||||
* This gets fired when the plugin is disabled.
|
||||
* Do any cleanups needed within this method.
|
||||
*
|
||||
* @param plugin Plugin class called to register commands and listeners
|
||||
* @param plugin Plugin object
|
||||
*/
|
||||
protected abstract void unregister(JavaPlugin plugin);
|
||||
protected void unregister(JavaPlugin plugin) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the module, when called by the JavaPlugin class. Call
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
<compilerArgument>-proc:none</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<useSystemClassLoader>false
|
||||
</useSystemClassLoader> <!-- https://stackoverflow.com/a/53012553/2703239 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
Loading…
Reference in a new issue