mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-15 07:05:36 +01:00
Started setting up guice
This commit is contained in:
parent
40e4b2fc7a
commit
9262d50f90
@ -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() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.sekwah.advancedportals.core.api.commands;
|
||||
|
||||
public interface SubCommand {
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user