Merge branch 'master' into spigot

This commit is contained in:
sekwah 2018-01-23 18:00:08 +00:00
commit fc32bb378a
7 changed files with 97 additions and 5 deletions

View File

@ -13,6 +13,8 @@
#
translatedata.lastchange=1.0.0
translatedata.translationsoutdated= Some of the translations from the current translation file \u00A7e%1$s\u00A7c are out of date.
translatedata.replacecommand= Use \u00A7e/portal transupdate\u00A7c to copy out a new default \u00A7een_GB\u00A7c file.
translatedata.replaced= A new \u00A7een_GB\u00A7c file has been copied to the data folder.
messageprefix.positive=\u00A7a[\u00A7eAdvancedPortals\u00A7a]
messageprefix.negative=\u00A7c[\u00A77AdvancedPortals\u00A7c]
@ -27,4 +29,9 @@ 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.
command.reload.help=Reloads portal data
command.reload.detailedhelp=Reloads all portal data from files in the data folder
command.version.help=Returns the current version of the plugin
command.subcommand.nopermission= Sorry but you don't have permission for that, please use \u00A7e/%1$s help \u00A7cif you would like a list of possible sub commands.

View File

@ -2,6 +2,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.ReloadSubCommand;
import com.sekwah.advancedportals.core.commands.subcommands.portal.TransUpdateSubCommand;
import com.sekwah.advancedportals.core.commands.subcommands.portal.VersionSubCommand;
import com.sekwah.advancedportals.core.util.Config;
import com.sekwah.advancedportals.core.util.DataStorage;
@ -35,6 +37,10 @@ public class AdvancedPortalsCore {
this.onEnable();
}
public static String getTranslationName() {
return instance.config.getTranslation();
}
private void onEnable() {
this.dataStorage.copyDefaultFile("lang/en_GB.lang", false);
@ -44,13 +50,15 @@ public class AdvancedPortalsCore {
this.registerPortalCommand();
this.registerDestinationCommand();
infoLogger.log(Lang.translate("logger.pluginenable"));
this.infoLogger.log(Lang.translate("logger.pluginenable"));
}
private void registerPortalCommand() {
this.portalCommand = new CommandWithSubCommands();
this.portalCommand.registerSubCommand("version", new VersionSubCommand());
this.portalCommand.registerSubCommand("transupdate", new TransUpdateSubCommand());
this.portalCommand.registerSubCommand("reload", new ReloadSubCommand());
this.commandRegister.registerCommand("portal", this.portalCommand);
}
@ -78,7 +86,7 @@ public class AdvancedPortalsCore {
}
public void onDisable() {
infoLogger.log(Lang.translate("logger.plugindisable"));
this.infoLogger.log(Lang.translate("logger.plugindisable"));
}
private static AdvancedPortalsCore getInstance() {

View File

@ -8,7 +8,10 @@ public class CoreListeners {
public void playerJoin(PlayerContainer player) {
if(player.isOp()) {
if(!Lang.translate("translatedata.lastchange").equals(AdvancedPortalsCore.lastTranslationUpdate)) {
player.sendMessage(Lang.translateColor("messageprefix.negative") + Lang.translateColor("translatedata.translationsoutdated"));
player.sendMessage(Lang.translateColor("messageprefix.negative"
+ Lang.translateInsertVariablesColor("translatedata.translationsoutdated", AdvancedPortalsCore.getTranslationName())));
player.sendMessage(Lang.translateColor("messageprefix.negative"
+ Lang.translateColor("translatedata.replacecommand")));
}
}
}

View File

@ -0,0 +1,34 @@
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 ReloadSubCommand implements SubCommand {
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp();
}
@Override
public List<String> onTabComplete(CommandSenderContainer sender, String[] args) {
return null;
}
@Override
public String getBasicHelpText() {
return Lang.translate("command.reload.help");
}
@Override
public String getDetailedHelpText() {
return Lang.translate("command.reload.detailedhelp");
}
}

View File

@ -0,0 +1,36 @@
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 TransUpdateSubCommand implements SubCommand {
@Override
public void onCommand(CommandSenderContainer sender, String[] args) {
AdvancedPortalsCore.getDataStorage().copyDefaultFile("lang/en_GB.lang", true);
sender.sendMessage(Lang.translateColor("messageprefix.positive") + Lang.translateColor("translatedata.replaced"));
}
@Override
public boolean hasPermission(CommandSenderContainer sender) {
return sender.isOp();
}
@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";
}
}

View File

@ -25,11 +25,11 @@ public class VersionSubCommand implements SubCommand {
@Override
public String getBasicHelpText() {
return "This is basic help text";
return Lang.translate("command.version.help");
}
@Override
public String getDetailedHelpText() {
return "This help text is a lot more detailed than the basic one";
return Lang.translate("command.version.help");
}
}

View File

@ -14,4 +14,8 @@ public class CommandSenderContainer {
public void sendMessage(String message) {
sender.sendMessage(message);
}
public boolean isOp() {
return false;
}
}