Merge branch 'master' into spigot

This commit is contained in:
sekwah 2018-01-19 02:40:21 +00:00
commit 1dc4edca9c
4 changed files with 45 additions and 9 deletions

View File

@ -7,9 +7,9 @@ import com.sekwah.advancedportals.core.util.InfoLogger;
public class AdvancedPortalsCore {
private static AdvancedPortalsCore instance;
private static DataStorage dataStorage;
private static InfoLogger infoLogger;
private static Config config;
private DataStorage dataStorage;
private InfoLogger infoLogger;
private Config config;
public AdvancedPortalsCore(DataStorage dataStorage, InfoLogger infoLogger) {
this.dataStorage = dataStorage;
@ -19,12 +19,20 @@ public class AdvancedPortalsCore {
}
private void onEnable() {
config = dataStorage.loadJson(Config.class, "config.json");
infoLogger.log("\u00A7aAdvanced portals have been successfully enabled!");
this.loadPortalData();
infoLogger.log("Advanced portals have been successfully enabled!");
}
/**
* Can be used for in /portal reload as well.
*/
private void loadPortalData() {
this.config = this.dataStorage.loadJson(Config.class, "config.json");
this.dataStorage.storeJson(this.config, "config.json");
}
public void onDisable() {
infoLogger.log("\u00A7cAdvanced portals are being disabled!");
infoLogger.log("Advanced portals are being disabled!");
}
private static AdvancedPortalsCore getInstance() {
@ -32,10 +40,10 @@ public class AdvancedPortalsCore {
}
public static DataStorage getDataStorage() {
return dataStorage;
return instance.dataStorage;
}
public static InfoLogger getInfoLogger() {
return infoLogger;
return instance.infoLogger;
}
}

View File

@ -5,7 +5,7 @@ import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer
import java.util.List;
/**
* Subcommand that can be registered to parts.
* Subcommand that can be registered under e.g. /portal show or /portal edit
*
* @author sekwah41
*/

View File

@ -0,0 +1,24 @@
package com.sekwah.advancedportals.core.commands;
import com.sun.corba.se.impl.activation.CommandHandler;
import java.util.List;
/**
* Already know spigot's auto complete possibilities
*
* Sponge https://docs.spongepowered.org/stable/en/plugin/commands/arguments.html#custom-command-elements
*/
public interface CommandTemplate {
void onCommand(CommandHandler sender, String[] args);
/**
* Fired when someone asks for a tab complete action.
* @param sender
* @param args
* @return
*/
List<String> onTabComplete(CommandHandler sender, String[] args);
}

View File

@ -0,0 +1,4 @@
package com.sekwah.advancedportals.core.commands;
public class PortalCommand {
}