Started adding the base of the command registry

This commit is contained in:
sekwah 2018-01-19 04:14:54 +00:00
parent b508e7e0cc
commit 56d46a763f
4 changed files with 63 additions and 4 deletions

View File

@ -1,26 +1,34 @@
package com.sekwah.advancedportals.core; package com.sekwah.advancedportals.core;
import com.sekwah.advancedportals.core.commands.DestiCommand;
import com.sekwah.advancedportals.core.commands.PortalCommand;
import com.sekwah.advancedportals.core.util.Config; import com.sekwah.advancedportals.core.util.Config;
import com.sekwah.advancedportals.core.util.DataStorage; import com.sekwah.advancedportals.core.util.DataStorage;
import com.sekwah.advancedportals.core.util.InfoLogger; import com.sekwah.advancedportals.core.util.InfoLogger;
import com.sekwah.advancedportals.coreconnector.command.CommandRegister;
public class AdvancedPortalsCore { public class AdvancedPortalsCore {
private static AdvancedPortalsCore instance; private static AdvancedPortalsCore instance;
private DataStorage dataStorage; private final CommandRegister commandRegister;
private InfoLogger infoLogger; private final DataStorage dataStorage;
private final InfoLogger infoLogger;
private Config config; private Config config;
public AdvancedPortalsCore(DataStorage dataStorage, InfoLogger infoLogger) { public AdvancedPortalsCore(DataStorage dataStorage, InfoLogger infoLogger, CommandRegister commandRegister) {
this.dataStorage = dataStorage; this.dataStorage = dataStorage;
this.infoLogger = infoLogger; this.infoLogger = infoLogger;
this.instance = this; this.instance = this;
this.commandRegister = commandRegister;
this.onEnable(); this.onEnable();
} }
private void onEnable() { private void onEnable() {
this.loadPortalData(); this.loadPortalData();
infoLogger.log("Advanced portals have been successfully enabled!"); infoLogger.log("Advanced portals have been successfully enabled!");
this.commandRegister.registerCommand("portal", new PortalCommand());
this.commandRegister.registerCommand("destination", new DestiCommand());
} }
/** /**

View File

@ -0,0 +1,18 @@
package com.sekwah.advancedportals.core.commands;
import com.sun.corba.se.impl.activation.CommandHandler;
import java.util.List;
public class DestiCommand implements CommandTemplate {
@Override
public void onCommand(CommandHandler sender, String[] args) {
}
@Override
public List<String> onTabComplete(CommandHandler sender, String[] args) {
return null;
}
}

View File

@ -1,4 +1,18 @@
package com.sekwah.advancedportals.core.commands; package com.sekwah.advancedportals.core.commands;
public class PortalCommand { import com.sun.corba.se.impl.activation.CommandHandler;
import java.util.List;
public class PortalCommand implements CommandTemplate {
@Override
public void onCommand(CommandHandler sender, String[] args) {
}
@Override
public List<String> onTabComplete(CommandHandler sender, String[] args) {
return null;
}
} }

View File

@ -0,0 +1,19 @@
package com.sekwah.advancedportals.coreconnector.command;
import com.sekwah.advancedportals.core.commands.CommandTemplate;
import com.sekwah.advancedportals.core.commands.PortalCommand;
/**
* Register the CommandTemplate files to the appropriate system
*/
public class CommandRegister {
/**
* Registers the command to the appropriate system
* @param commandName
* @param commandExecutor
*/
public void registerCommand(String commandName, CommandTemplate commandExecutor) {
}
}