mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-10-06 11:37:50 +02:00
Merge branch 'master' into spigot
This commit is contained in:
commit
750a5348d3
@ -22,6 +22,7 @@ logger.plugindisable=Advanced portals are being disabled!
|
||||
logger.plugincrafterror=This version of craftbukkit is not yet supported or something went wrong, please post this message with the version number and the above stacktrace in an issue on GitHub v:%1$s
|
||||
|
||||
command.noargs= Sorry but you need to specify a sub command, please use \u00A7e/%1$s help \u00A7cif you would like a list of possible sub commands.
|
||||
command.subcommand.invalid= Sorry but that is not a valid sub command.
|
||||
|
||||
command.help.header=\u00A7e--------- \u00A7a%1$s Help - Page %2$s of %3$s\u00A7e ---------------
|
||||
command.help.invalidnum= Sorry but \u00A7e%1$s\u00A7c is not a valid page number.
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.sekwah.advancedportals.core;
|
||||
|
||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||
import com.sekwah.advancedportals.core.commands.CommandWithSubCommands;
|
||||
import com.sekwah.advancedportals.core.commands.subcommands.portal.VersionSubCommand;
|
||||
import com.sekwah.advancedportals.core.util.Config;
|
||||
import com.sekwah.advancedportals.core.util.DataStorage;
|
||||
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||
@ -21,6 +23,9 @@ public class AdvancedPortalsCore {
|
||||
private CommandWithSubCommands portalCommand;
|
||||
private CommandWithSubCommands destiCommand;
|
||||
|
||||
public static final String version = "1.0.0";
|
||||
public static final String lastTranslationUpdate = "1.0.0";
|
||||
|
||||
public AdvancedPortalsCore(DataStorage dataStorage, InfoLogger infoLogger, CommandRegister commandRegister) {
|
||||
this.dataStorage = dataStorage;
|
||||
this.infoLogger = infoLogger;
|
||||
@ -36,14 +41,33 @@ public class AdvancedPortalsCore {
|
||||
this.loadPortalConfig();
|
||||
Lang.loadLanguage(config.getTranslation());
|
||||
|
||||
this.portalCommand = new CommandWithSubCommands();
|
||||
this.destiCommand = new CommandWithSubCommands();
|
||||
this.commandRegister.registerCommand("portal", this.portalCommand);
|
||||
this.commandRegister.registerCommand("destination", this.destiCommand);
|
||||
this.registerPortalCommand();
|
||||
this.registerDestinationCommand();
|
||||
|
||||
infoLogger.log(Lang.translate("logger.pluginenable"));
|
||||
}
|
||||
|
||||
private void registerPortalCommand() {
|
||||
this.portalCommand = new CommandWithSubCommands();
|
||||
|
||||
this.portalCommand.registerSubCommand("version", new VersionSubCommand());
|
||||
|
||||
this.commandRegister.registerCommand("portal", this.portalCommand);
|
||||
}
|
||||
|
||||
private void registerDestinationCommand() {
|
||||
this.destiCommand = new CommandWithSubCommands();
|
||||
this.commandRegister.registerCommand("destination", this.destiCommand);
|
||||
}
|
||||
|
||||
public static boolean registerDestiSubCommand(String arg, SubCommand subCommand) {
|
||||
return instance.destiCommand.registerSubCommand(arg, subCommand);
|
||||
}
|
||||
|
||||
public static boolean registerPortalSubCommand(String arg, SubCommand subCommand) {
|
||||
return instance.portalCommand.registerSubCommand(arg, subCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the portal config into the memory and saves from the memory to check in case certain things have changed
|
||||
* (basically if values are missing or whatever)
|
||||
|
@ -7,7 +7,7 @@ public class CoreListeners {
|
||||
|
||||
public void playerJoin(PlayerContainer player) {
|
||||
if(player.isOp()) {
|
||||
if(!Lang.translate("translatedata.lastchange").equals("1.0.0")) {
|
||||
if(!Lang.translate("translatedata.lastchange").equals(AdvancedPortalsCore.lastTranslationUpdate)) {
|
||||
player.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translateColor("translatedata.translationsoutdated"));
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public interface SubCommand {
|
||||
* @param args arguments including the subcommand that has been specified.
|
||||
* @return if the command has worked (if false it will just display a message from the command suggesting to check help)
|
||||
*/
|
||||
boolean onCommand(CommandSenderContainer sender, String[] args);
|
||||
void onCommand(CommandSenderContainer sender, String[] args);
|
||||
|
||||
boolean hasPermission(CommandSenderContainer sender);
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class CommandWithSubCommands implements CommandTemplate {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translateColor("command.subcommand.invalid"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -0,0 +1,4 @@
|
||||
package com.sekwah.advancedportals.core.commands.subcommands.desti;
|
||||
|
||||
public class TestSubCommand {
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.sekwah.advancedportals.core.commands.subcommands.portal;
|
||||
|
||||
import com.sekwah.advancedportals.core.AdvancedPortalsCore;
|
||||
import com.sekwah.advancedportals.core.api.commands.SubCommand;
|
||||
import com.sekwah.advancedportals.core.util.Lang;
|
||||
import com.sekwah.advancedportals.coreconnector.container.CommandSenderContainer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VersionSubCommand implements SubCommand {
|
||||
@Override
|
||||
public void onCommand(CommandSenderContainer sender, String[] args) {
|
||||
sender.sendMessage(Lang.translateColor("messageprefix.positive") + " Advanced Portals v" + AdvancedPortalsCore.version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSenderContainer sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBasicHelpText() {
|
||||
return "This is basic help text";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDetailedHelpText() {
|
||||
return "This help text is a lot more detailed than the basic one";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user