mirror of
https://github.com/SimplexDevelopment/FreedomNetworkSuite.git
synced 2025-07-05 06:56:40 +00:00
Upgrades
This commit is contained in:
@ -0,0 +1,44 @@
|
||||
package me.totalfreedom.base;
|
||||
|
||||
import me.totalfreedom.event.EventBus;
|
||||
import me.totalfreedom.service.FreedomExecutor;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CommonsBase extends JavaPlugin
|
||||
{
|
||||
private final EventBus eventBus = new EventBus(this);
|
||||
private final Registration registration = new Registration();
|
||||
private final FreedomExecutor executor = new FreedomExecutor();
|
||||
|
||||
public static CommonsBase getInstance()
|
||||
{
|
||||
return JavaPlugin.getPlugin(CommonsBase.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
getRegistrations().getServiceRegistry().register(this, eventBus);
|
||||
getExecutor().getSync()
|
||||
.execute(() -> getRegistrations()
|
||||
.getServiceRegistry()
|
||||
.startAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
getRegistrations().getServiceRegistry().stopAll();
|
||||
getRegistrations().getServiceRegistry().unregister(EventBus.class, eventBus);
|
||||
}
|
||||
|
||||
public Registration getRegistrations()
|
||||
{
|
||||
return registration;
|
||||
}
|
||||
|
||||
public FreedomExecutor getExecutor()
|
||||
{
|
||||
return executor;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package me.totalfreedom.base;
|
||||
|
||||
import me.totalfreedom.data.*;
|
||||
|
||||
public class Registration
|
||||
{
|
||||
private final CommandRegistry commandRegistry;
|
||||
private final EventRegistry eventRegistry;
|
||||
private final UserRegistry userRegistry;
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
private final ModuleRegistry moduleRegistry;
|
||||
private final GroupRegistry groupRegistry;
|
||||
|
||||
public Registration()
|
||||
{
|
||||
this.commandRegistry = new CommandRegistry();
|
||||
this.eventRegistry = new EventRegistry();
|
||||
this.userRegistry = new UserRegistry();
|
||||
this.serviceRegistry = new ServiceRegistry();
|
||||
this.moduleRegistry = new ModuleRegistry();
|
||||
this.groupRegistry = new GroupRegistry();
|
||||
}
|
||||
|
||||
public ModuleRegistry getModuleRegistry()
|
||||
{
|
||||
return moduleRegistry;
|
||||
}
|
||||
|
||||
public CommandRegistry getCommandRegistry()
|
||||
{
|
||||
return commandRegistry;
|
||||
}
|
||||
|
||||
public EventRegistry getEventRegistry()
|
||||
{
|
||||
return eventRegistry;
|
||||
}
|
||||
|
||||
public UserRegistry getUserRegistry()
|
||||
{
|
||||
return userRegistry;
|
||||
}
|
||||
|
||||
public ServiceRegistry getServiceRegistry()
|
||||
{
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
public GroupRegistry getGroupRegistry()
|
||||
{
|
||||
return groupRegistry;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user