mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-07 03:19:54 +01:00
Started adding the base of the command registry
This commit is contained in:
parent
b508e7e0cc
commit
56d46a763f
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user