1- package ch .hutch79 ;
2-
3- import ch .hutch79 .command .Command ;
4- import ch .hutch79 .command .CommandTab ;
5- import ch .hutch79 .events .EventHandler ;
1+ package ch .hutch79 .application ;
2+
3+ import ch .hutch79 .application .command .Command ;
4+ import ch .hutch79 .application .command .CommandTab ;
5+ import ch .hutch79 .application .configManager .ConfigManager ;
6+ import ch .hutch79 .application .configManager .ConfigMigrator ;
7+ import ch .hutch79 .application .events .EventRecivers ;
8+ import ch .hutch79 .application .guice .DiContainerInstances ;
9+ import ch .hutch79 .application .messages .ConsoleMessanger ;
10+ import com .google .inject .Guice ;
11+ import com .google .inject .Injector ;
612import org .bukkit .Bukkit ;
713import org .bukkit .entity .Player ;
814import org .bukkit .plugin .PluginDescriptionFile ;
915import org .bukkit .plugin .java .JavaPlugin ;
1016import org .bstats .bukkit .Metrics ;
11- import com .jeff_media .updatechecker .*;
17+ import com .jeff_media .updatechecker .UpdateChecker ;
18+ import com .jeff_media .updatechecker .UpdateCheckSource ;
19+ import com .jeff_media .updatechecker .UserAgentBuilder ;
20+
1221import java .util .Objects ;
1322
1423public final class FCommand extends JavaPlugin {
1524 PluginDescriptionFile pdf = this .getDescription ();
1625 private static FCommand instance ;
17- private static EventHandler eventHandler ;
1826 private boolean isPlaceholderApiInstalled = false ;
19- private static boolean debug ;
2027
2128 @ Override
2229 public void onEnable () {
23- instance = this ;
24-
25- eventHandler = new EventHandler ();
26-
27- // getConfig().options().copyDefaults();
30+ getConfig ().options ().copyDefaults ();
2831 saveDefaultConfig ();
29- reloadConfig ();
32+ instance = this ;
33+ Injector injector = Guice .createInjector (new DiContainerInstances (instance ));
34+ injector .getInstance (ConfigMigrator .class );
3035
31- eventHandler .eventListenerInit ();
32- Bukkit .getPluginManager ().registerEvents (eventHandler , this );
36+ new ConsoleMessanger (injector .getInstance (ConfigManager .class )); // Give ConfigManager Instance to ConsoleMessanger
3337
34- Objects .requireNonNull (getCommand ("fcommand" )).setExecutor (new Command ( ));
38+ Objects .requireNonNull (getCommand ("fcommand" )).setExecutor (injector . getInstance ( Command . class ));
3539 Objects .requireNonNull (getCommand ("fcommand" )).setTabCompleter (new CommandTab ());
40+ Bukkit .getPluginManager ().registerEvents (injector .getInstance (EventRecivers .class ), this );
3641
3742 new Metrics (this , 17738 ); // bStats
3843
39- debug = getConfig ().getBoolean ("debug" );
40-
4144 final int SPIGOT_RESOURCE_ID = 108009 ; // Update checker
4245
4346 new UpdateChecker (this , UpdateCheckSource .SPIGET , "" + SPIGOT_RESOURCE_ID + "" )
@@ -51,8 +54,6 @@ public void onEnable() {
5154 .checkNow ();
5255
5356
54-
55-
5657 if (pdf .getVersion ().contains ("Beta" )) {
5758 getLogger ().warning ("It seems you're using a dev Build" );
5859 getLogger ().warning ("You can use this Build on Production Servers but for some reasons i would not recommend that." );
@@ -95,23 +96,10 @@ public static FCommand getInstance() {
9596 return instance ;
9697 }
9798
98- public static EventHandler getListener () {
99- return eventHandler ;
100- }
101-
102- public static boolean getDebug () {
103- return debug ;
104- }
105-
106- public static void setDebug (Boolean value ) {
107- debug = value ;
108- }
109-
11099 public String replacePlaceholders (Player player , String input ) {
111100 if (isPlaceholderApiInstalled ) {
112101 return me .clip .placeholderapi .PlaceholderAPI .setPlaceholders (player , input );
113102 }
114103 return input ;
115104 }
116-
117105}
0 commit comments