This commit is contained in:
Paul Reilly
2023-05-15 01:30:37 -05:00
parent 5a395554cf
commit 6f400e505c
57 changed files with 699 additions and 10 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}