mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-21 20:22:45 +02:00
[Smell] Moved Components and Modules out of plugin classes
This commit is contained in:
parent
e08bd82575
commit
e6396f816f
|
@ -21,13 +21,6 @@ package com.djrapitops.plan;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.server.bukkit.BukkitServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.server.bukkit.BukkitSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
|
@ -36,62 +29,11 @@ import com.djrapitops.plan.utilities.metrics.BStatsBukkit;
|
|||
import com.djrapitops.plugin.BukkitPlugin;
|
||||
import com.djrapitops.plugin.benchmarking.Benchmark;
|
||||
import com.djrapitops.plugin.command.ColorScheme;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
BukkitPlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
BukkitServerPropertiesModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
BukkitSuperClassBindingModule.class
|
||||
})
|
||||
interface PlanComponent {
|
||||
|
||||
PlanCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(Plan plan);
|
||||
|
||||
PlanComponent build();
|
||||
}
|
||||
}
|
||||
|
||||
@Module
|
||||
class BukkitPlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(Plan plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main class for Bukkit that manages the plugin.
|
||||
*
|
||||
|
@ -105,7 +47,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
|
|||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PlanComponent component = DaggerPlanComponent.builder().plan(this).build();
|
||||
PlanBukkitComponent component = DaggerPlanBukkitComponent.builder().plan(this).build();
|
||||
try {
|
||||
timings.start("Enable");
|
||||
system = component.system();
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.djrapitops.plan;
|
||||
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.*;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.server.bukkit.BukkitServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.server.bukkit.BukkitSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger Component that constructs the plugin systems running on Bukkit.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
BukkitPlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
BukkitServerPropertiesModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
BukkitSuperClassBindingModule.class
|
||||
})
|
||||
public interface PlanBukkitComponent {
|
||||
|
||||
PlanCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(Plan plan);
|
||||
|
||||
PlanBukkitComponent build();
|
||||
}
|
||||
}
|
|
@ -6,13 +6,6 @@ package com.djrapitops.plan;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanBungeeCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.ProxySuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.bungee.BungeeServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.proxy.bungee.BungeeSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
|
@ -20,61 +13,10 @@ import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
|
|||
import com.djrapitops.plan.utilities.metrics.BStatsBungee;
|
||||
import com.djrapitops.plugin.BungeePlugin;
|
||||
import com.djrapitops.plugin.command.ColorScheme;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
BungeePlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ProxySuperClassBindingModule.class,
|
||||
BungeeSuperClassBindingModule.class,
|
||||
BungeeServerPropertiesModule.class
|
||||
})
|
||||
interface PlanBungeeComponent {
|
||||
|
||||
PlanBungeeCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanBungee plan);
|
||||
|
||||
PlanBungeeComponent build();
|
||||
}
|
||||
}
|
||||
|
||||
@Module
|
||||
class BungeePlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanBungee plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanBungeeCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bungee Main class.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.djrapitops.plan;
|
||||
|
||||
import com.djrapitops.plan.command.PlanBungeeCommand;
|
||||
import com.djrapitops.plan.modules.*;
|
||||
import com.djrapitops.plan.modules.proxy.ProxySuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.bungee.BungeeServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.proxy.bungee.BungeeSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger Component that constructs the plugin systems running on Bungee.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
BungeePlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ProxySuperClassBindingModule.class,
|
||||
BungeeSuperClassBindingModule.class,
|
||||
BungeeServerPropertiesModule.class
|
||||
})
|
||||
public interface PlanBungeeComponent {
|
||||
|
||||
PlanBungeeCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanBungee plan);
|
||||
|
||||
PlanBungeeComponent build();
|
||||
}
|
||||
}
|
|
@ -2,13 +2,6 @@ package com.djrapitops.plan;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.server.sponge.SpongeServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.server.sponge.SpongeSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
|
@ -16,12 +9,7 @@ import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
|
|||
import com.djrapitops.plan.utilities.metrics.BStatsSponge;
|
||||
import com.djrapitops.plugin.SpongePlugin;
|
||||
import com.djrapitops.plugin.command.ColorScheme;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.bstats.sponge.Metrics;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.api.Game;
|
||||
|
@ -33,55 +21,9 @@ import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
|||
import org.spongepowered.api.plugin.Dependency;
|
||||
import org.spongepowered.api.plugin.Plugin;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
SpongePlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
SpongeSuperClassBindingModule.class,
|
||||
SpongeServerPropertiesModule.class
|
||||
})
|
||||
interface PlanSpongeComponent {
|
||||
|
||||
PlanCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanSponge plan);
|
||||
|
||||
PlanSpongeComponent build();
|
||||
}
|
||||
}
|
||||
|
||||
@Module
|
||||
class SpongePlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanSponge plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
@Plugin(
|
||||
id = "plan",
|
||||
name = "Plan",
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.djrapitops.plan;
|
||||
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plan.modules.*;
|
||||
import com.djrapitops.plan.modules.server.ServerSuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.server.sponge.SpongeServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.server.sponge.SpongeSuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger Component that constructs the plugin systems running on Sponge.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
SpongePlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ServerSuperClassBindingModule.class,
|
||||
SpongeSuperClassBindingModule.class,
|
||||
SpongeServerPropertiesModule.class
|
||||
})
|
||||
interface PlanSpongeComponent {
|
||||
|
||||
PlanCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanSponge plan);
|
||||
|
||||
PlanSpongeComponent build();
|
||||
}
|
||||
}
|
|
@ -6,80 +6,22 @@ package com.djrapitops.plan;
|
|||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.command.PlanVelocityCommand;
|
||||
import com.djrapitops.plan.modules.APFModule;
|
||||
import com.djrapitops.plan.modules.FilesModule;
|
||||
import com.djrapitops.plan.modules.SuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.SystemObjectBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.ProxySuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.velocity.VelocityServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.proxy.velocity.VelocitySuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
|
||||
import com.djrapitops.plugin.VelocityPlugin;
|
||||
import com.djrapitops.plugin.command.ColorScheme;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
VelocityPlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ProxySuperClassBindingModule.class,
|
||||
VelocitySuperClassBindingModule.class,
|
||||
VelocityServerPropertiesModule.class
|
||||
})
|
||||
interface PlanVelocityComponent {
|
||||
|
||||
PlanVelocityCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanVelocity plan);
|
||||
|
||||
PlanVelocityComponent build();
|
||||
}
|
||||
}
|
||||
|
||||
@Module
|
||||
class VelocityPlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanVelocity plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanVelocityCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Velocity Main class.
|
||||
* <p>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.djrapitops.plan;
|
||||
|
||||
import com.djrapitops.plan.command.PlanVelocityCommand;
|
||||
import com.djrapitops.plan.modules.*;
|
||||
import com.djrapitops.plan.modules.proxy.ProxySuperClassBindingModule;
|
||||
import com.djrapitops.plan.modules.proxy.velocity.VelocityServerPropertiesModule;
|
||||
import com.djrapitops.plan.modules.proxy.velocity.VelocitySuperClassBindingModule;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger Component that constructs the plugin systems running on Velocity.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
VelocityPlanModule.class,
|
||||
SuperClassBindingModule.class,
|
||||
SystemObjectBindingModule.class,
|
||||
APFModule.class,
|
||||
FilesModule.class,
|
||||
ProxySuperClassBindingModule.class,
|
||||
VelocitySuperClassBindingModule.class,
|
||||
VelocityServerPropertiesModule.class
|
||||
})
|
||||
interface PlanVelocityComponent {
|
||||
|
||||
PlanVelocityCommand planCommand();
|
||||
|
||||
PlanSystem system();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
|
||||
@BindsInstance
|
||||
Builder plan(PlanVelocity plan);
|
||||
|
||||
PlanVelocityComponent build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.djrapitops.plan.modules;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger module for binding Plan instance.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Module
|
||||
public class BukkitPlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(Plan plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.djrapitops.plan.modules;
|
||||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.command.PlanBungeeCommand;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger module for binding PlanBungee instance.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Module
|
||||
public class BungeePlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanBungee plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanBungeeCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.djrapitops.plan.modules;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.PlanSponge;
|
||||
import com.djrapitops.plan.command.PlanCommand;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger module for binding PlanSponge instance.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Module
|
||||
public class SpongePlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanSponge plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.djrapitops.plan.modules;
|
||||
|
||||
import com.djrapitops.plan.PlanPlugin;
|
||||
import com.djrapitops.plan.PlanVelocity;
|
||||
import com.djrapitops.plan.command.PlanVelocityCommand;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Dagger module for binding PlanVelocity instance.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@Module
|
||||
public class VelocityPlanModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PlanPlugin providePlanPlugin(PlanVelocity plugin) {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("mainCommand")
|
||||
CommandNode provideMainCommand(PlanVelocityCommand command) {
|
||||
return command;
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ public class BukkitSystemTest {
|
|||
@ClassRule
|
||||
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
private PlanSystem bukkitSystem;
|
||||
private static PlanComponent COMPONENT;
|
||||
private static PlanBukkitComponent COMPONENT;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
|
@ -34,7 +34,7 @@ public class BukkitSystemTest {
|
|||
.withPluginDescription()
|
||||
.withResourceFetchingFromJar()
|
||||
.withServer();
|
||||
COMPONENT = DaggerPlanComponent.builder().plan(mockUtil.getPlanMock()).build();
|
||||
COMPONENT = DaggerPlanBukkitComponent.builder().plan(mockUtil.getPlanMock()).build();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -25,7 +25,7 @@ public class BungeeBukkitConnectionTest {
|
|||
|
||||
@ClassRule
|
||||
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
private static PlanComponent BUKKIT_COMPONENT;
|
||||
private static PlanBukkitComponent BUKKIT_COMPONENT;
|
||||
private static PlanBungeeComponent BUNGEE_COMPONENT;
|
||||
|
||||
@Rule
|
||||
|
@ -44,7 +44,7 @@ public class BungeeBukkitConnectionTest {
|
|||
.withPluginDescription()
|
||||
.withResourceFetchingFromJar()
|
||||
.withServer();
|
||||
BUKKIT_COMPONENT = DaggerPlanComponent.builder().plan(planBukkitMocker.getPlanMock()).build();
|
||||
BUKKIT_COMPONENT = DaggerPlanBukkitComponent.builder().plan(planBukkitMocker.getPlanMock()).build();
|
||||
|
||||
PlanBungeeMocker planBungeeMocker = PlanBungeeMocker.setUp()
|
||||
.withDataFolder(temporaryFolder.getRoot())
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package com.djrapitops.plan.system.settings.network;
|
||||
|
||||
import com.djrapitops.plan.DaggerPlanBungeeComponent;
|
||||
import com.djrapitops.plan.PlanBungeeComponent;
|
||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||
import com.djrapitops.plan.system.database.databases.sql.tables.ServerTable;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import org.junit.*;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import utilities.TestConstants;
|
||||
import utilities.mocks.SystemMockUtil;
|
||||
import utilities.mocks.PlanBungeeMocker;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
@ -15,18 +17,16 @@ public class NetworkSettingsTest {
|
|||
@ClassRule
|
||||
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
private static SQLDB db;
|
||||
private static PlanBungeeComponent COMPONENT;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
SystemMockUtil mockUtil = SystemMockUtil.setUp(temporaryFolder.getRoot())
|
||||
.enableConfigSystem();
|
||||
db = null; // TODO
|
||||
mockUtil.enableDatabaseSystem(db)
|
||||
.enableServerInfoSystem();
|
||||
|
||||
// Log.setErrorManager(new TestErrorManager());
|
||||
// Log.setDebugMode("console");
|
||||
// Settings.DEV_MODE.setTemporaryValue(true);
|
||||
PlanBungeeMocker planBungeeMocker = PlanBungeeMocker.setUp()
|
||||
.withDataFolder(temporaryFolder.getRoot())
|
||||
.withPluginDescription()
|
||||
.withResourceFetchingFromJar()
|
||||
.withProxy();
|
||||
COMPONENT = DaggerPlanBungeeComponent.builder().plan(planBungeeMocker.getPlanMock()).build();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
Loading…
Reference in New Issue
Block a user