Merge branch 'develop' into 1.16.5_lts
This commit is contained in:
commit
54ddd633d1
|
@ -35,33 +35,36 @@ import world.bentobox.bentobox.util.Util;
|
|||
public class AdminSettingsCommand extends CompositeCommand {
|
||||
|
||||
private static final String SPAWN_ISLAND = "spawn-island";
|
||||
private final List<String> PROTECTION_FLAG_NAMES;
|
||||
private List<String> protectionFlagNames;
|
||||
private Island island;
|
||||
private final List<String> SETTING_FLAG_NAMES;
|
||||
private final List<String> WORLD_SETTING_FLAG_NAMES;
|
||||
private List<String> settingFlagNames;
|
||||
private List<String> worldSettingFlagNames;
|
||||
private @NonNull Optional<Flag> flag = Optional.empty();
|
||||
private boolean activeState;
|
||||
private int rank;
|
||||
private final GameModeAddon gameMode;
|
||||
|
||||
public AdminSettingsCommand(CompositeCommand islandCommand) {
|
||||
super(islandCommand, "settings", "flags", "options");
|
||||
// make constants
|
||||
GameModeAddon gameMode = getPlugin().getIWM().getAddon(getWorld()).orElse(null);
|
||||
PROTECTION_FLAG_NAMES = getPlugin().getFlagsManager().getFlags().stream()
|
||||
gameMode = getPlugin().getIWM().getAddon(getWorld()).orElse(null);
|
||||
}
|
||||
|
||||
private void makeLists() {
|
||||
protectionFlagNames = getPlugin().getFlagsManager().getFlags().stream()
|
||||
.filter(f -> f.getType().equals(Type.PROTECTION))
|
||||
.filter(f -> f.getGameModes().isEmpty() || gameMode == null || f.getGameModes().contains(gameMode))
|
||||
.map(Flag::getID)
|
||||
.collect(Collectors.toList());
|
||||
SETTING_FLAG_NAMES = getPlugin().getFlagsManager().getFlags().stream()
|
||||
.toList();
|
||||
settingFlagNames = getPlugin().getFlagsManager().getFlags().stream()
|
||||
.filter(f -> f.getType().equals(Type.SETTING))
|
||||
.filter(f -> f.getGameModes().isEmpty() || gameMode == null || f.getGameModes().contains(gameMode))
|
||||
.map(Flag::getID)
|
||||
.collect(Collectors.toList());
|
||||
WORLD_SETTING_FLAG_NAMES = getPlugin().getFlagsManager().getFlags().stream()
|
||||
.toList();
|
||||
worldSettingFlagNames = getPlugin().getFlagsManager().getFlags().stream()
|
||||
.filter(f -> f.getType().equals(Type.WORLD_SETTING))
|
||||
.filter(f -> f.getGameModes().isEmpty() || gameMode == null || f.getGameModes().contains(gameMode))
|
||||
.map(Flag::getID)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +82,7 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
}
|
||||
if (args.size() > 1) {
|
||||
// Command
|
||||
return checkSyntax(user, args);
|
||||
return checkSyntax(user, args);
|
||||
}
|
||||
return getIsland(user, args);
|
||||
}
|
||||
|
@ -112,10 +115,12 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
* @return true if the syntax is correct
|
||||
*/
|
||||
private boolean checkSyntax(User user, List<String> args) {
|
||||
// Update the flag lists
|
||||
this.makeLists();
|
||||
if (args.size() == 2) {
|
||||
// Should be a world setting
|
||||
// If world settings, then active/disabled, otherwise player flags
|
||||
if (WORLD_SETTING_FLAG_NAMES.contains(args.get(0).toUpperCase(Locale.ENGLISH))) {
|
||||
if (worldSettingFlagNames.contains(args.get(0).toUpperCase(Locale.ENGLISH))) {
|
||||
if (checkActiveDisabled(user, args.get(1))) {
|
||||
flag = getPlugin().getFlagsManager().getFlag(args.get(0).toUpperCase(Locale.ENGLISH));
|
||||
return true;
|
||||
|
@ -130,17 +135,17 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!SETTING_FLAG_NAMES.contains(args.get(1).toUpperCase(Locale.ENGLISH))
|
||||
&& !PROTECTION_FLAG_NAMES.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
||||
if (!settingFlagNames.contains(args.get(1).toUpperCase(Locale.ENGLISH))
|
||||
&& !protectionFlagNames.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
||||
user.sendMessage("commands.admin.settings.unknown-flag", TextVariables.NAME, args.get(2));
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// Set flag
|
||||
flag = getPlugin().getFlagsManager().getFlag(args.get(1).toUpperCase(Locale.ENGLISH));
|
||||
// Check settings
|
||||
if (flag.isPresent()) {
|
||||
if (flag.get().getType().equals(Type.SETTING)) {
|
||||
return checkActiveDisabled(user, args.get(2));
|
||||
return checkActiveDisabled(user, args.get(2));
|
||||
} else {
|
||||
// Protection flag
|
||||
return checkRank(user, String.join(" ", args.subList(2, args.size())));
|
||||
|
@ -175,7 +180,7 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
String disabled = ChatColor.stripColor(user.getTranslation("protection.panel.flag-item.setting-disabled"));
|
||||
if (!string.equalsIgnoreCase(active) && !string.equalsIgnoreCase(disabled)) {
|
||||
user.sendMessage("commands.admin.settings.unknown-setting", TextVariables.NAME, string);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
activeState = string.equalsIgnoreCase(active);
|
||||
return true;
|
||||
|
@ -199,7 +204,7 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
f.setSetting(getWorld(), activeState);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
});
|
||||
user.sendMessage("general.success");
|
||||
|
@ -236,36 +241,38 @@ public class AdminSettingsCommand extends CompositeCommand {
|
|||
|
||||
@Override
|
||||
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
||||
// Update with the latest lists
|
||||
this.makeLists();
|
||||
String active = ChatColor.stripColor(user.getTranslation("protection.panel.flag-item.setting-active"));
|
||||
String disabled = ChatColor.stripColor(user.getTranslation("protection.panel.flag-item.setting-disabled"));
|
||||
List<String> options = new ArrayList<>();
|
||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||
if (args.size() == 2) {
|
||||
// Player names or world settings
|
||||
// Player names or world settings
|
||||
options = Util.tabLimit(Util.getOnlinePlayerList(user), lastArg);
|
||||
options.addAll(WORLD_SETTING_FLAG_NAMES);
|
||||
options.addAll(worldSettingFlagNames);
|
||||
if (getIslands().getSpawn(getWorld()).isPresent()) {
|
||||
options.add(SPAWN_ISLAND);
|
||||
}
|
||||
} else if (args.size() == 3) {
|
||||
// If world settings, then active/disabled, otherwise player flags
|
||||
if (WORLD_SETTING_FLAG_NAMES.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
||||
if (worldSettingFlagNames.contains(args.get(1).toUpperCase(Locale.ENGLISH))) {
|
||||
options = Arrays.asList(active, disabled);
|
||||
} else {
|
||||
// Flag IDs
|
||||
options.addAll(PROTECTION_FLAG_NAMES);
|
||||
options.addAll(SETTING_FLAG_NAMES);
|
||||
options.addAll(protectionFlagNames);
|
||||
options.addAll(settingFlagNames);
|
||||
}
|
||||
} else if (args.size() == 4) {
|
||||
// Get flag in previous argument
|
||||
options = getPlugin().getFlagsManager().getFlag(args.get(2).toUpperCase(Locale.ENGLISH)).map(f -> switch (f.getType()) {
|
||||
case PROTECTION -> getPlugin().getRanksManager()
|
||||
.getRanks().entrySet().stream()
|
||||
.filter(en -> en.getValue() > RanksManager.BANNED_RANK && en.getValue() <= RanksManager.OWNER_RANK)
|
||||
.map(Entry::getKey)
|
||||
.map(user::getTranslation).collect(Collectors.toList());
|
||||
case SETTING -> Arrays.asList(active, disabled);
|
||||
default -> Collections.<String>emptyList();
|
||||
case PROTECTION -> getPlugin().getRanksManager()
|
||||
.getRanks().entrySet().stream()
|
||||
.filter(en -> en.getValue() > RanksManager.BANNED_RANK && en.getValue() <= RanksManager.OWNER_RANK)
|
||||
.map(Entry::getKey)
|
||||
.map(user::getTranslation).collect(Collectors.toList());
|
||||
case SETTING -> Arrays.asList(active, disabled);
|
||||
default -> Collections.<String>emptyList();
|
||||
}).orElse(Collections.emptyList());
|
||||
}
|
||||
return Optional.of(Util.tabLimit(options, lastArg));
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package world.bentobox.bentobox.listeners.flags.protection;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Barrel;
|
||||
import org.bukkit.block.Beacon;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.Dropper;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.Hopper;
|
||||
|
@ -20,6 +22,7 @@ import org.bukkit.event.EventPriority;
|
|||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.flags.FlagListener;
|
||||
import world.bentobox.bentobox.lists.Flags;
|
||||
|
||||
|
@ -72,25 +75,29 @@ public class InventoryListener extends FlagListener {
|
|||
else if (inventoryHolder instanceof ShulkerBox) {
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.SHULKER_BOX);
|
||||
}
|
||||
else if (inventoryHolder instanceof Chest chestInventoryHolder) {
|
||||
// To differentiate between a Chest and a Trapped Chest we need to get the Block corresponding to the inventory
|
||||
try {
|
||||
if (chestInventoryHolder.getType() == Material.TRAPPED_CHEST) {
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.TRAPPED_CHEST);
|
||||
} else {
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.CHEST);
|
||||
}
|
||||
} catch (IllegalStateException ignored) {
|
||||
// Thrown if the Chest corresponds to a block that isn't placed (how did we get here?)
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.CHEST);
|
||||
}
|
||||
else if (inventoryHolder instanceof Chest c) {
|
||||
checkInvHolder(c.getLocation(), e, player);
|
||||
}
|
||||
else if (inventoryHolder instanceof DoubleChest dc) {
|
||||
checkInvHolder(dc.getLocation(), e, player);
|
||||
}
|
||||
else if (inventoryHolder instanceof StorageMinecart) {
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.CHEST);
|
||||
}
|
||||
else if (!(inventoryHolder instanceof Player)) {
|
||||
BentoBox.getInstance().logDebug(inventoryHolder.getClass().toGenericString());
|
||||
// All other containers
|
||||
checkIsland(e, player, e.getInventory().getLocation(), Flags.CONTAINER);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkInvHolder(Location l, InventoryClickEvent e, Player player) {
|
||||
if (l.getBlock().getType().equals(Material.TRAPPED_CHEST)) {
|
||||
checkIsland(e, player, l, Flags.TRAPPED_CHEST);
|
||||
} else {
|
||||
checkIsland(e, player, l, Flags.CHEST);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,27 +136,27 @@ public class SettingsTab implements Tab, ClickHandler {
|
|||
}
|
||||
// Add the mode icon
|
||||
switch (plugin.getPlayers().getFlagsDisplayMode(user.getUniqueId())) {
|
||||
case ADVANCED -> icons.put(7, new PanelItemBuilder().icon(Material.GOLD_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.advanced.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.advanced.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.expert.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
case EXPERT -> icons.put(7, new PanelItemBuilder().icon(Material.NETHER_BRICK)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.expert.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.expert.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.basic.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
default -> icons.put(7, new PanelItemBuilder().icon(Material.IRON_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.basic.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.basic.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.advanced.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
case ADVANCED -> icons.put(7, new PanelItemBuilder().icon(Material.GOLD_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.advanced.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.advanced.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.expert.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
case EXPERT -> icons.put(7, new PanelItemBuilder().icon(Material.NETHER_BRICK)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.expert.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.expert.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.basic.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
default -> icons.put(7, new PanelItemBuilder().icon(Material.IRON_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.basic.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.basic.description"), "",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.advanced.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
}
|
||||
// Add the reset everything to default - it's only in the player's settings panel
|
||||
if (island != null && user.getUniqueId().equals(island.getOwner())) {
|
||||
|
|
|
@ -1308,7 +1308,7 @@ management:
|
|||
&a I když většina jeho funkcí poběží správně,
|
||||
&6 mohou se očekávat chyby nebo problémy
|
||||
&6 specifické pro platformu &a .
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Běžím na &e [name] [version]&a .
|
||||
|
||||
&a BentoBox právě běží na &c &l NEKOMPATIBILNÍM
|
||||
|
@ -1347,7 +1347,7 @@ catalog:
|
|||
install-now: Nainstalovat nyní!
|
||||
empty-here:
|
||||
name: '&b Tady to vypadá nějak prázdně...'
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox se nemohl připojit na GitHub.
|
||||
|
||||
&a Povol pluginu BentoBox v připojení na GitHub
|
||||
|
@ -1362,7 +1362,7 @@ panel:
|
|||
&a Příspěvky: &b [commits]
|
||||
empty-here:
|
||||
name: '&c Tady to vypadá nějak prázdně...'
|
||||
description: |+
|
||||
description: |
|
||||
&c Pluginu BentoBox se nepodařilo najít přispěvatele
|
||||
&c pro tento Doplňek.
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ commands:
|
|||
days: "days"
|
||||
hours: "hours"
|
||||
minutes: "minutes"
|
||||
header: |+
|
||||
header: |
|
||||
&f --- &a Team details &f ---
|
||||
&a Members: &b [total]&7 /&b [max]
|
||||
&a Online members: &b [online]
|
||||
|
@ -1359,7 +1359,7 @@ protection:
|
|||
click-to-switch: "&e Click &7 to switch to the &r [next]&r &7 ."
|
||||
reset-to-default:
|
||||
name: "&c Reset to default"
|
||||
description: |+
|
||||
description: |
|
||||
&a Resets &c &l ALL &r &a the settings to their
|
||||
&a default value.
|
||||
PROTECTION:
|
||||
|
@ -1427,7 +1427,7 @@ management:
|
|||
description: "&a Opens the Admin Blueprint menu."
|
||||
gamemode:
|
||||
name: "&f [name]"
|
||||
description: |+
|
||||
description: |
|
||||
&a Islands: &b [islands]
|
||||
addons:
|
||||
name: "&6 Addons"
|
||||
|
@ -1453,7 +1453,7 @@ management:
|
|||
state:
|
||||
name: "&6 Compatibility"
|
||||
description:
|
||||
COMPATIBLE: |+
|
||||
COMPATIBLE: |
|
||||
&a Running &e [name] [version]&a .
|
||||
|
||||
&a BentoBox is currently running on a
|
||||
|
@ -1462,7 +1462,7 @@ management:
|
|||
|
||||
&a Its features are fully designed to
|
||||
&a run in this environment.
|
||||
SUPPORTED: |+
|
||||
SUPPORTED: |
|
||||
&a Running &e [name] [version]&a .
|
||||
|
||||
&a BentoBox is currently running on a
|
||||
|
@ -1471,7 +1471,7 @@ management:
|
|||
|
||||
&a Most of its features will run smoothly
|
||||
&a in this environment.
|
||||
NOT_SUPPORTED: |+
|
||||
NOT_SUPPORTED: |
|
||||
&a Running &e [name] [version]&a .
|
||||
|
||||
&a BentoBox is currently running on a
|
||||
|
@ -1481,7 +1481,7 @@ management:
|
|||
&a While most of its features will run
|
||||
&a correctly, &6 platform-specific bugs or
|
||||
&6 issues are to be expected&a .
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Running &e [name] [version]&a .
|
||||
|
||||
&a BentoBox is currently running on an
|
||||
|
@ -1500,16 +1500,16 @@ catalog:
|
|||
views:
|
||||
gamemodes:
|
||||
name: "&6 Gamemodes"
|
||||
description: |+
|
||||
description: |
|
||||
&e Click &a to browse through the
|
||||
&a available official Gamemodes.
|
||||
addons:
|
||||
name: "&6 Addons"
|
||||
description: |+
|
||||
description: |
|
||||
&e Click &a to browse through the
|
||||
&a available official Addons.
|
||||
icon:
|
||||
description-template: |+
|
||||
description-template: |
|
||||
&8 [topic]
|
||||
&a [install]
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ catalog:
|
|||
|
||||
empty-here:
|
||||
name: "&b This looks empty here..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox could not connect to GitHub.
|
||||
|
||||
&a Allow BentoBox to connect to GitHub in
|
||||
|
@ -1568,14 +1568,14 @@ panel:
|
|||
&a Commits: &b [commits]
|
||||
empty-here:
|
||||
name: "&c This looks empty here..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox could not gather the Contributors
|
||||
&c for this Addon.
|
||||
|
||||
&a Allow BentoBox to connect to GitHub in
|
||||
&a the configuration or try again later.
|
||||
|
||||
successfully-loaded: |
|
||||
successfully-loaded: |2
|
||||
|
||||
&6 ____ _ ____
|
||||
&6 | _ \ | | | _ \ &7 by &a tastybento &7 and &a Poslovitch
|
||||
|
|
|
@ -1437,7 +1437,7 @@ catalog:
|
|||
install-now: Instalar ahora!
|
||||
empty-here:
|
||||
name: "&bEsto se ve vacío aquí..."
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBox no pudo conectarse a GitHub.
|
||||
&aPermitir que BentoBox se conecte a GitHub en
|
||||
&aLa configuración o vuelva a intentarlo más tarde.
|
||||
|
@ -1450,7 +1450,7 @@ panel:
|
|||
description: "&aCommits: &b[commits]\n"
|
||||
empty-here:
|
||||
name: "&cEsto parece vacío aquí..."
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBox no pudo reunir a los contribuyentes
|
||||
&cpara este complemento.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ catalog:
|
|||
ADDONS:
|
||||
title: Catalogue d'addons
|
||||
empty-here:
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox n'a pas pu se connecter à son GitHub.
|
||||
|
||||
&a Autorisez BentoBox à se connecter à son GitHub dans
|
||||
|
|
|
@ -4,7 +4,7 @@ catalog:
|
|||
ADDONS:
|
||||
title: Catalogo Addons
|
||||
empty-here:
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBox non è riuscito a connettersi a GitHub.
|
||||
|
||||
&aPermetti a BentoBox di connettersi a GitHub
|
||||
|
@ -773,7 +773,7 @@ management:
|
|||
|
||||
&aLe sue caratteristiche sono state progettate
|
||||
&aper essere eseguite su questo ambiente.
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&aIn esecuzione &e[name] [version]&a.
|
||||
|
||||
&aBentoBox è in esecuzione su un
|
||||
|
|
|
@ -1452,7 +1452,7 @@ catalog:
|
|||
install-now: 今すぐインストール!
|
||||
empty-here:
|
||||
name: "&bこれはここでは空に見えます..."
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBoxはGitHubに接続できませんでした。
|
||||
|
||||
&aBentoBoxでGitHubに接続できるようにする
|
||||
|
@ -1466,7 +1466,7 @@ panel:
|
|||
description: "&aCommits:&b [commits]\n"
|
||||
empty-here:
|
||||
name: "&cこれはここでは空に見えます..."
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBoxは貢献者を収集できませんでした
|
||||
このアドオン用。
|
||||
|
||||
|
|
|
@ -1337,7 +1337,7 @@ catalog:
|
|||
install-now: 지금 설치해보세요!
|
||||
empty-here:
|
||||
name: "&b 이곳엔 아무것도 없네요..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox 가 깃헙에 연결할수 없습니다
|
||||
|
||||
&a BentoBox가 구성에서 GitHub에 연결하도록 허용하거나 나중에 다시 시도하십시오.
|
||||
|
|
|
@ -4,7 +4,7 @@ catalog:
|
|||
ADDONS:
|
||||
title: Papildinājumu Katalogs
|
||||
empty-here:
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBox nevarēja sazināties ar GitHub.
|
||||
|
||||
&aAtļauj BentoBox savienoties ar GitHub
|
||||
|
@ -764,7 +764,7 @@ management:
|
|||
|
||||
&aVisas funkcionalitātes tika radītas
|
||||
&atieši šai videi.
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&aPalaista &e[name] [version]&a.
|
||||
|
||||
&aBentoBox šobrīd strādā ar
|
||||
|
|
|
@ -1486,7 +1486,7 @@ management:
|
|||
&a Terwijl de meeste functies werken
|
||||
&a correct, &6 platformspecifieke bugs of
|
||||
&6 problemen zijn te verwachten &a.
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Running &e [name] [version] &a.
|
||||
|
||||
&a BentoBox draait momenteel op een
|
||||
|
@ -1526,7 +1526,7 @@ catalog:
|
|||
install-now: Installeer nu!
|
||||
empty-here:
|
||||
name: "&b Dit ziet er hier leeg uit ..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox kon geen verbinding maken met GitHub.
|
||||
|
||||
&a Sta BentoBox toe om verbinding te maken met GitHub in
|
||||
|
@ -1570,7 +1570,7 @@ panel:
|
|||
description: "&a Commits: &b [commits]\n"
|
||||
empty-here:
|
||||
name: "&c Dit ziet er hier leeg uit ..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox kon de bijdragers niet verzamelen
|
||||
&c voor deze add-on.
|
||||
|
||||
|
|
|
@ -1369,7 +1369,7 @@ management:
|
|||
&a działać poprawnie, należy spodziewać się
|
||||
&6&l błędów lub problemów specyficznych
|
||||
&6&l dla platformy&a.
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Serwer działa na &e [name] [version]&a .
|
||||
|
||||
&a BentoBox aktualnie działa na
|
||||
|
@ -1409,7 +1409,7 @@ catalog:
|
|||
install-now: Zainstaluj teraz!
|
||||
empty-here:
|
||||
name: '&b Trochę tu pusto...'
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox nie mógł połączyć się z GitHubem.
|
||||
|
||||
&a Pozwól BentoBoxowi połączyć się z GitHubem
|
||||
|
@ -1424,7 +1424,7 @@ panel:
|
|||
&a Commity: &b [commits]
|
||||
empty-here:
|
||||
name: '&c Trochę tu pusto...'
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox nie mógł zebrać współautorów
|
||||
&c tego dodatku.
|
||||
|
||||
|
|
|
@ -1398,7 +1398,7 @@ management:
|
|||
&a Enquanto a maior parte de suas funcionalidades rodarão
|
||||
&a corretamente, &6 problemas específicos a plataforma ou
|
||||
&6 erros são esperados &a .
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Rodando &e [name] [version]&a .
|
||||
|
||||
&a BentoBox no momento está rodando em um
|
||||
|
@ -1437,7 +1437,7 @@ catalog:
|
|||
install-now: Instalar agora!
|
||||
empty-here:
|
||||
name: '&b Isso parece vazio...'
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox não pôde se conectar ao GitHub.
|
||||
|
||||
&a Permita que BentoBox se conecte ao GitHub na
|
||||
|
@ -1452,7 +1452,7 @@ panel:
|
|||
&a Commits: &b [commits]
|
||||
empty-here:
|
||||
name: '&c Isso parece vazio...'
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox não pôde juntar os contribuidores
|
||||
&c para esse Addon.
|
||||
|
||||
|
|
|
@ -1455,7 +1455,7 @@ management:
|
|||
&a În timp ce majoritatea funcțiilor sale vor rula
|
||||
&a corect, &6 erori specifice platformei sau
|
||||
&6 probleme sunt de așteptat &a.
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Running &e [name] [version] &a.
|
||||
|
||||
&a BentoBox rulează în prezent pe un
|
||||
|
@ -1495,7 +1495,7 @@ catalog:
|
|||
install-now: Instaleaza acum!
|
||||
empty-here:
|
||||
name: "&b Aici pare gol aici ..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox nu s-a putut conecta la GitHub.
|
||||
|
||||
&o Permiteți BentoBox să se conecteze la GitHub în
|
||||
|
@ -1509,7 +1509,7 @@ panel:
|
|||
description: "&a Commits: &b [commits]\n"
|
||||
empty-here:
|
||||
name: "&c Acesta pare gol aici ..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox nu a putut să adune Contribuitorii
|
||||
&c pentru acest Addon.
|
||||
|
||||
|
|
|
@ -1446,7 +1446,7 @@ catalog:
|
|||
install-now: Şimdi yükle!
|
||||
empty-here:
|
||||
name: "&9Burası boş gibi gözüküyor..."
|
||||
description: |+
|
||||
description: |
|
||||
&cBentoBox github'a bağlanamadı!
|
||||
|
||||
&aBentoBox'un konfigürasyondaki GitHub'a
|
||||
|
|
|
@ -1486,7 +1486,7 @@ management:
|
|||
&a Phần lớn tính năng vẫn sẽ chạy
|
||||
&a bình thường, nhưng &6 lỗi nền tảng
|
||||
&6 có thể xảy ra&a .
|
||||
INCOMPATIBLE: |+
|
||||
INCOMPATIBLE: |
|
||||
&a Đang chạy &e [name] [version]&a .
|
||||
|
||||
&a BentoBox đang chạy trên một máy chủ có
|
||||
|
@ -1525,7 +1525,7 @@ catalog:
|
|||
install-now: Cài đặt ngay!
|
||||
empty-here:
|
||||
name: "&c Hơi trống ở đây..."
|
||||
description: |+
|
||||
description: |
|
||||
&c Bentobox không thể kết nối Github.
|
||||
|
||||
&a Cho phép BentoBox kết nối GitHub trong
|
||||
|
@ -1569,7 +1569,7 @@ panel:
|
|||
description: "&a Commits: &b [commits]\n"
|
||||
empty-here:
|
||||
name: "&c Hơi trống ở đây..."
|
||||
description: |+
|
||||
description: |
|
||||
&c BentoBox không thể lấy người đống góp
|
||||
&c cho tiện ích này.
|
||||
|
||||
|
|
|
@ -1448,7 +1448,7 @@ catalog:
|
|||
install-now: 现在安装!
|
||||
empty-here:
|
||||
name: "&b&l这里空空如也..."
|
||||
description: |+
|
||||
description: |
|
||||
&c&lBentoBox&r &c无法连接到 GitHub。
|
||||
|
||||
&a请修改配置允许&b&lBentoBox&a连接
|
||||
|
|
|
@ -0,0 +1,336 @@
|
|||
package world.bentobox.bentobox.api.commands.admin;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFactory;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.Settings;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.flags.Flag.Mode;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.managers.CommandsManager;
|
||||
import world.bentobox.bentobox.managers.FlagsManager;
|
||||
import world.bentobox.bentobox.managers.IslandWorldManager;
|
||||
import world.bentobox.bentobox.managers.IslandsManager;
|
||||
import world.bentobox.bentobox.managers.LocalesManager;
|
||||
import world.bentobox.bentobox.managers.PlayersManager;
|
||||
import world.bentobox.bentobox.managers.RanksManager;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class})
|
||||
public class AdminSettingsCommandTest {
|
||||
|
||||
private AdminSettingsCommand asc;
|
||||
@Mock
|
||||
private CompositeCommand ac;
|
||||
@Mock
|
||||
private User user;
|
||||
@Mock
|
||||
private IslandsManager im;
|
||||
@Mock
|
||||
private PlayersManager pm;
|
||||
private UUID notUUID;
|
||||
@Mock
|
||||
private Player p;
|
||||
@Mock
|
||||
private IslandWorldManager iwm;
|
||||
@Mock
|
||||
private Island island;
|
||||
@Mock
|
||||
private Location spawnPoint;
|
||||
@Mock
|
||||
private World world;
|
||||
@Mock
|
||||
private World netherWorld;
|
||||
@Mock
|
||||
private World endWorld;
|
||||
@Mock
|
||||
private PluginManager pluginManager;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// Set up plugin
|
||||
BentoBox plugin = mock(BentoBox.class);
|
||||
Whitebox.setInternalState(BentoBox.class, "instance", plugin);
|
||||
Util.setPlugin(plugin);
|
||||
|
||||
// Command manager
|
||||
CommandsManager cm = mock(CommandsManager.class);
|
||||
when(plugin.getCommandsManager()).thenReturn(cm);
|
||||
|
||||
// Player
|
||||
when(user.isOp()).thenReturn(false);
|
||||
UUID uuid = UUID.randomUUID();
|
||||
notUUID = UUID.randomUUID();
|
||||
while(notUUID.equals(uuid)) {
|
||||
notUUID = UUID.randomUUID();
|
||||
}
|
||||
when(user.getUniqueId()).thenReturn(uuid);
|
||||
when(user.getPlayer()).thenReturn(p);
|
||||
when(user.getName()).thenReturn("tastybento");
|
||||
when(user.isPlayer()).thenReturn(true);
|
||||
User.setPlugin(plugin);
|
||||
|
||||
// Parent command has no aliases
|
||||
when(ac.getSubCommandAliases()).thenReturn(new HashMap<>());
|
||||
when(ac.getTopLabel()).thenReturn("bskyblock");
|
||||
when(ac.getWorld()).thenReturn(world);
|
||||
|
||||
// World
|
||||
when(world.getEnvironment()).thenReturn(Environment.NORMAL);
|
||||
when(netherWorld.getEnvironment()).thenReturn(Environment.NETHER);
|
||||
when(endWorld.getEnvironment()).thenReturn(Environment.THE_END);
|
||||
// Server & Scheduler
|
||||
BukkitScheduler sch = mock(BukkitScheduler.class);
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
when(Bukkit.getScheduler()).thenReturn(sch);
|
||||
|
||||
// Locales
|
||||
LocalesManager lm = mock(LocalesManager.class);
|
||||
when(lm.get(any(), any())).thenReturn("mock translation");
|
||||
when(plugin.getLocalesManager()).thenReturn(lm);
|
||||
|
||||
when(user.getTranslation(anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
when(user.getTranslation(anyString(), anyString(), anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
when(user.getTranslation(anyString(), anyString(), anyString(), anyString(), anyString())).thenAnswer((Answer<String>) invocation -> invocation.getArgument(0, String.class));
|
||||
|
||||
// IWM
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
// Players manager
|
||||
when(plugin.getPlayers()).thenReturn(pm);
|
||||
when(pm.getFlagsDisplayMode(any())).thenReturn(Mode.BASIC);
|
||||
//Island Manager
|
||||
when(plugin.getIslands()).thenReturn(im);
|
||||
// Island - player has island
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(island);
|
||||
when(im.hasIsland(any(), any(UUID.class))).thenReturn(true);
|
||||
|
||||
// Util
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.getUUID(anyString())).thenReturn(uuid);
|
||||
when(Util.tabLimit(any(), any())).thenCallRealMethod();
|
||||
|
||||
// Settings
|
||||
Settings settings = new Settings();
|
||||
when(plugin.getSettings()).thenReturn(settings);
|
||||
|
||||
// Bukkit
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
// Mock item factory (for itemstacks)
|
||||
ItemFactory itemFactory = mock(ItemFactory.class);
|
||||
ItemMeta bannerMeta = mock(ItemMeta.class);
|
||||
when(itemFactory.getItemMeta(any())).thenReturn(bannerMeta);
|
||||
when(Bukkit.getItemFactory()).thenReturn(itemFactory);
|
||||
Inventory inventory = mock(Inventory.class);
|
||||
when(Bukkit.createInventory(eq(null), Mockito.anyInt(), any())).thenReturn(inventory);
|
||||
when(Bukkit.createInventory(eq(null), any(InventoryType.class), any())).thenReturn(inventory);
|
||||
// Flags manager
|
||||
when(Bukkit.getPluginManager()).thenReturn(pluginManager);
|
||||
FlagsManager fm = new FlagsManager(plugin);
|
||||
when(plugin.getFlagsManager()).thenReturn(fm);
|
||||
|
||||
// RnksManager
|
||||
when(plugin.getRanksManager()).thenReturn(new RanksManager());
|
||||
|
||||
|
||||
|
||||
asc = new AdminSettingsCommand(ac);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
User.clearUsers();
|
||||
Mockito.framework().clearInlineMocks();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#setup()}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetup() {
|
||||
assertFalse(asc.isOnlyPlayer());
|
||||
assertEquals("admin.settings", asc.getPermission());
|
||||
assertEquals("commands.admin.settings.parameters", asc.getParameters());
|
||||
assertEquals("commands.admin.settings.description", asc.getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteEmpty() {
|
||||
assertTrue(asc.canExecute(user, "", Collections.emptyList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgUnknownPlayer() {
|
||||
when(Util.getUUID(anyString())).thenReturn(null);
|
||||
assertFalse(asc.canExecute(user, "", Collections.singletonList("tastybento")));
|
||||
verify(user).sendMessage("general.errors.unknown-player", TextVariables.NAME, "tastybento");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgKnownPlayerNoIsland() {
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(null);
|
||||
assertFalse(asc.canExecute(user, "", Collections.singletonList("tastybento")));
|
||||
verify(user).sendMessage("general.errors.player-has-no-island");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgKnownPlayerIslandNotOwner() {
|
||||
when(im.hasIsland(any(), any(UUID.class))).thenReturn(false);
|
||||
assertFalse(asc.canExecute(user, "", Collections.singletonList("tastybento")));
|
||||
verify(user).sendMessage("general.errors.player-has-no-island");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgKnownPlayer() {
|
||||
assertTrue(asc.canExecute(user, "", Collections.singletonList("tastybento")));
|
||||
verify(user, never()).sendMessage(anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgSpawnNoSpawn() {
|
||||
when(Util.getUUID(anyString())).thenReturn(null);
|
||||
assertFalse(asc.canExecute(user, "", Collections.singletonList("spawn-island")));
|
||||
verify(user).sendMessage("general.errors.unknown-player", TextVariables.NAME, "spawn-island");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCanExecuteOneArgSpawnSpawn() {
|
||||
when(im.getSpawn(any())).thenReturn(Optional.of(island));
|
||||
assertTrue(asc.canExecute(user, "", Collections.singletonList("spawn-island")));
|
||||
verify(user, never()).sendMessage(anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgsConsole() {
|
||||
when(user.isPlayer()).thenReturn(false);
|
||||
assertFalse(asc.execute(user, "", Collections.emptyList()));
|
||||
verify(user).sendMessage("general.errors.use-in-game");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringNoArgs() {
|
||||
assertTrue(asc.execute(user, "", Collections.emptyList()));
|
||||
verify(pm).setFlagsDisplayMode(user.getUniqueId(), Mode.EXPERT);
|
||||
// Open panel
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfStringArgs() {
|
||||
assertTrue(asc.execute(user, "", Arrays.asList("blah","blah")));
|
||||
verify(user).sendMessage("general.success");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#tabComplete(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testTabCompleteUserStringListOfStringTwoArgs() {
|
||||
Optional<List<String>> r = asc.tabComplete(user, "", Arrays.asList("b","WORLD_TNT"));
|
||||
assertFalse(r.isEmpty());
|
||||
assertEquals("WORLD_TNT_DAMAGE", r.get().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#tabComplete(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testTabCompleteUserStringListOfStringThreeArgs() {
|
||||
Optional<List<String>> r = asc.tabComplete(user, "", Arrays.asList("b","WORLD_TNT", "BEACO"));
|
||||
assertFalse(r.isEmpty());
|
||||
assertEquals("BEACON", r.get().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.AdminSettingsCommand#tabComplete(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testTabCompleteUserStringListOfStringFourArgs() {
|
||||
Optional<List<String>> r = asc.tabComplete(user, "", Arrays.asList("b","b", "PVP_OVERWORLD", "t"));
|
||||
assertFalse(r.isEmpty());
|
||||
// TODO - finish this.
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue