Fixes, should be ready to merge

This commit is contained in:
Norbi Peti 2018-11-18 02:58:26 +01:00
parent 5ef5bf47a2
commit 81cb364ddc
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
8 changed files with 43 additions and 21 deletions

1
ButtonCore/lombok.config Normal file
View file

@ -0,0 +1 @@
lombok.var.flagUsage = ALLOW

View file

@ -72,6 +72,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </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> </plugins>
</build> </build>
<repositories> <repositories>

View file

@ -1,16 +1,15 @@
package buttondevteam.component.commands; package buttondevteam.component.commands;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import org.bukkit.plugin.java.JavaPlugin;
public class CommandComponent extends Component { //TODO: Do we just move everything here? public class CommandComponent extends Component { //TODO: Do we just move everything here?
@Override @Override
public void register(JavaPlugin plugin) { public void enable() {
} }
@Override @Override
public void unregister(JavaPlugin plugin) { public void disable() {
} }
} }

View file

@ -4,18 +4,17 @@ import buttondevteam.core.PrimeRestartCommand;
import buttondevteam.core.ScheduledRestartCommand; import buttondevteam.core.ScheduledRestartCommand;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCChatAPI;
import org.bukkit.plugin.java.JavaPlugin;
public class RestartComponent extends Component { public class RestartComponent extends Component {
@Override @Override
public void register(JavaPlugin plugin) { public void enable() {
//TODO: Separately (dis)allow commands //TODO: Permissions for the commands
TBMCChatAPI.AddCommand(plugin, ScheduledRestartCommand.class); TBMCChatAPI.AddCommand(getPlugin(), ScheduledRestartCommand.class);
TBMCChatAPI.AddCommand(plugin, PrimeRestartCommand.class); TBMCChatAPI.AddCommand(getPlugin(), PrimeRestartCommand.class);
} }
@Override @Override
public void unregister(JavaPlugin plugin) { public void disable() {
} }
} }

View file

@ -2,16 +2,15 @@ package buttondevteam.component.updater;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCChatAPI;
import org.bukkit.plugin.java.JavaPlugin;
public class PluginUpdaterComponent extends Component { public class PluginUpdaterComponent extends Component {
@Override @Override
public void register(JavaPlugin plugin) { public void enable() {
TBMCChatAPI.AddCommand(plugin, UpdatePluginCommand.class); TBMCChatAPI.AddCommand(getPlugin(), UpdatePluginCommand.class);
} }
@Override @Override
public void unregister(JavaPlugin plugin) { public void disable() { //TODO: Unregister commands and such
} }
} }

View file

@ -1,7 +1,10 @@
package buttondevteam.core; package buttondevteam.core;
import buttondevteam.component.restart.RestartComponent;
import buttondevteam.component.updater.PluginUpdater; import buttondevteam.component.updater.PluginUpdater;
import buttondevteam.component.updater.PluginUpdaterComponent;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.chat.Channel; import buttondevteam.lib.chat.Channel;
import buttondevteam.lib.chat.ChatRoom; import buttondevteam.lib.chat.ChatRoom;
import buttondevteam.lib.chat.Color; import buttondevteam.lib.chat.Color;
@ -40,6 +43,8 @@ public class MainPlugin extends JavaPlugin {
setupPermissions(); setupPermissions();
Test = getConfig().getBoolean("test", true); Test = getConfig().getBoolean("test", true);
saveConfig(); saveConfig();
Component.registerComponent(this, new PluginUpdaterComponent());
Component.registerComponent(this, new RestartComponent());
ComponentManager.enableComponents(); ComponentManager.enableComponents();
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this); TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class); TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);

View file

@ -144,20 +144,23 @@ public abstract class Component {
} }
/** /**
* Registers the module, when called by the JavaPlugin class. Call * Registers the module, when called by the JavaPlugin class.
* registerCommand() and registerListener() within this method. * 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 * Unregisters the module, when called by the JavaPlugin class.
* any cleanups needed within this method. * 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 * Enables the module, when called by the JavaPlugin class. Call

View file

@ -23,6 +23,14 @@
<compilerArgument>-proc:none</compilerArgument> <compilerArgument>-proc:none</compilerArgument>
</configuration> </configuration>
</plugin> </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> </plugins>
</build> </build>