diff --git a/Minepacks/resources/lang/de.yml b/Minepacks/resources/lang/de.yml index f5f5f66..780fd81 100644 --- a/Minepacks/resources/lang/de.yml +++ b/Minepacks/resources/lang/de.yml @@ -71,6 +71,7 @@ Language: Reload: "Lädt die Konfigurationsdatei neu." Update: "Prüft auf neue Plugin-Updates." Backup: "Erstellt eine Sicherungskopie eines Rucksacks." + BackupEveryone: "Erstellt eine Sicherungskopie der Rucksäcke aller verbundenen Spieler." Restore: "Stellt eine Sicherungskopie eines Rucksacks wieder her." RestoreList: "Listet alle verfügbaren Sicherungskopien von Rucksäcken auf." Version: "Gibt die Versionsdetails über das Plugin und seine Abhängigkeiten aus." @@ -120,4 +121,4 @@ LanguageName: "german" Author: "GeorgH93" # Language file version. Don't touch it! -Version: 18 +Version: 19 diff --git a/Minepacks/resources/lang/en.yml b/Minepacks/resources/lang/en.yml index 0d54ada..59eabf9 100644 --- a/Minepacks/resources/lang/en.yml +++ b/Minepacks/resources/lang/en.yml @@ -73,6 +73,7 @@ Language: Update: "Checks for new plugin updates." Version: "Prints the version details about the plugin and it's dependencies." Backup: "Creates a backup of a players backpack." + BackupEveryone: "Creates a backup of everyone currently online." Restore: "Restores a backup." RestoreList: "Lists all available backups." Help: "Shows all available commands and their description." @@ -115,4 +116,4 @@ LanguageName: "english" Author: "GeorgH93" # Language file version. Don't touch it! -Version: 18 \ No newline at end of file +Version: 19 \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/BackupCommand.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/BackupCommand.java index 8461a2a..a959253 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/BackupCommand.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/BackupCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 GeorgH93 + * Copyright (C) 2021 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +26,9 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks; import at.pcgamingfreaks.Minepacks.Bukkit.Permissions; +import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -35,12 +37,14 @@ public class BackupCommand extends MinepacksCommand { private final Message messageCreated, messageNoBackpack; - private final String helpParam; + private final String helpParam, helpParamEveryone, descriptionEveryone; public BackupCommand(Minepacks plugin) { super(plugin, "backup", plugin.getLanguage().getTranslated("Commands.Description.Backup"), Permissions.BACKUP, plugin.getLanguage().getCommandAliases("Backup")); helpParam = "<" + plugin.getLanguage().get("Commands.PlayerNameVariable") + ">"; + helpParamEveryone = "!everyone!"; + descriptionEveryone = plugin.getLanguage().getTranslated("Commands.Description.BackupEveryone"); messageCreated = plugin.getLanguage().getMessage("Ingame.Backup.Created"); messageNoBackpack = plugin.getLanguage().getMessage("Ingame.Backup.NoBackpack"); } @@ -50,21 +54,18 @@ public void execute(final @NotNull CommandSender sender, final @NotNull String m { if(args.length == 1) { - //noinspection deprecation - getMinepacksPlugin().getBackpack(plugin.getServer().getOfflinePlayer(args[0]), new Callback() { - @Override - public void onResult(Backpack backpack) + if(args[0].equalsIgnoreCase("!everyone!")) + { + for(Player player : plugin.getServer().getOnlinePlayers()) { - ((at.pcgamingfreaks.Minepacks.Bukkit.Backpack) backpack).backup(); - messageCreated.send(sender); + backup(sender, player); } - - @Override - public void onFail() - { - messageNoBackpack.send(sender); - } - }, false); + } + else + { + //noinspection deprecation + backup(sender, plugin.getServer().getOfflinePlayer(args[0])); + } } else { @@ -72,6 +73,24 @@ public void onFail() } } + private void backup(final @NotNull CommandSender sender, final @NotNull OfflinePlayer offlinePlayer) + { + getMinepacksPlugin().getBackpack(offlinePlayer, new Callback() { + @Override + public void onResult(Backpack backpack) + { + ((at.pcgamingfreaks.Minepacks.Bukkit.Backpack) backpack).backup(); + messageCreated.send(sender); + } + + @Override + public void onFail() + { + messageNoBackpack.send(sender); + } + }, false); + } + @Override public List tabComplete(final @NotNull CommandSender sender, final @NotNull String mainCommandAlias, final @NotNull String alias, final @NotNull String[] args) { @@ -83,6 +102,7 @@ public List getHelp(final @NotNull CommandSender requester) { List help = new ArrayList<>(1); help.add(new HelpData(getTranslatedName(), helpParam, getDescription())); + help.add(new HelpData(getTranslatedName(), helpParamEveryone, descriptionEveryone)); return help; } } \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java index fc02774..49955cf 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Language.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 GeorgH93 + * Copyright (C) 2021 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ public class Language extends at.pcgamingfreaks.Bukkit.Language { - private static final int LANG_VERSION = 18, UPGRADE_THRESHOLD = LANG_VERSION; + private static final int LANG_VERSION = 19, UPGRADE_THRESHOLD = LANG_VERSION; public Language(JavaPlugin plugin) { diff --git a/pom.xml b/pom.xml index 29d82c7..fbcb834 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ pom - 2.4.3-RC1 + 2.4.3-RC2 UTF-8 UTF-8