Started setting up guice

This commit is contained in:
Sekwah 2021-05-26 02:25:32 +01:00
parent 40e4b2fc7a
commit 9262d50f90
No known key found for this signature in database
GPG Key ID: C3BE2E6C861A461A
6 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package com.sekwah.advancedportals.core;
import com.google.inject.Injector;
public class AdvancedPortalsCore {
private Injector injector;
public void onEnable() {
AdvancedPortalsModule module = new AdvancedPortalsModule(this);
injector = module.getInjector();
}
public void onDisable() {
}
}

View File

@ -0,0 +1,38 @@
package com.sekwah.advancedportals.core;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.sekwah.advancedportals.core.config.Config;
import com.sekwah.advancedportals.core.config.ConfigHandler;
import javax.annotation.Nonnull;
public class AdvancedPortalsModule extends AbstractModule {
private Injector injector;
private AdvancedPortalsCore advancedPortalsCore;
public AdvancedPortalsModule(AdvancedPortalsCore advancedPortalsCore) {
this.advancedPortalsCore = advancedPortalsCore;
}
@Override
protected void configure() {
// Instances
bind(AdvancedPortalsCore.class).toInstance(advancedPortalsCore);
// Providers
bind(Config.class).toProvider(ConfigHandler.class);
}
public Injector createInjector() {
return Guice.createInjector(this);
}
@Nonnull
public Injector getInjector() {
return injector;
}
}

View File

@ -0,0 +1,4 @@
package com.sekwah.advancedportals.core.api.commands;
public interface SubCommand {
}

View File

@ -0,0 +1,34 @@
package com.sekwah.advancedportals.core.config;
/**
* To store the data for config
*/
public class Config {
public boolean useOnlySpecialAxe = true;
public String selectorMaterial = "IRON_AXE";
public boolean portalProtection = true;
public int portalProtectionRaduis = 5;
public String defaultTriggerBlock = "PORTAL";
public boolean stopWaterFlow = true;
public int portalCooldown = 5;
public String warpParticles = "ENDER";
public String warpSound = "ENDER";
public String selectionBlock = "RED_STAINED_GLASS";
public String translationFile = "en_GB";
//public String selectionBlock_BELOW_1_13 = "STAINED_GLASS";
// public int selectionSubID_BELOW_1_13 = 14;
}

View File

@ -0,0 +1,10 @@
package com.sekwah.advancedportals.core.config;
import com.google.inject.Provider;
public class ConfigHandler implements Provider<Config> {
@Override
public Config get() {
return null;
}
}

View File

@ -0,0 +1,13 @@
package com.sekwah.advancedportals.core.data;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
public class DataStorage {
private Gson gson = new GsonBuilder().setPrettyPrinting().create();
private File dataFolder;
}