mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 11:45:31 +01:00
Removed "general.errors.unknown-player-name" : added a "[name]" textvariable in "general.errors.unknown-player"
Closes #263
This commit is contained in:
parent
13bc945b40
commit
02be048192
@ -6,6 +6,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
@ -32,7 +33,7 @@ public class AdminClearResetsCommand extends CompositeCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||
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.util.Util;
|
||||
@ -34,7 +35,7 @@ public class AdminDeleteCommand extends ConfirmableCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -42,7 +42,7 @@ public class AdminGetRankCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class AdminInfoCommand extends CompositeCommand {
|
||||
@ -38,7 +39,7 @@ public class AdminInfoCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||
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.util.Util;
|
||||
@ -38,7 +39,7 @@ public class AdminRegisterCommand extends ConfirmableCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
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.RanksManager;
|
||||
@ -39,7 +40,7 @@ public class AdminSetRankCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -8,6 +8,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.bentobox.util.teleport.SafeTeleportBuilder;
|
||||
@ -37,7 +38,7 @@ public class AdminTeleportCommand extends CompositeCommand {
|
||||
// Convert name to a UUID
|
||||
final UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
} else {
|
||||
if (getIslands().hasIsland(getWorld(), targetUUID) || getIslands().inTeam(getWorld(), targetUUID)) {
|
||||
|
@ -6,6 +6,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
@ -32,7 +33,7 @@ public class AdminUnregisterCommand extends CompositeCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -32,7 +32,7 @@ public class AdminRangeResetCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -34,7 +34,7 @@ public class AdminRangeSetCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -30,12 +30,12 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
// Get leader and target
|
||||
UUID leaderUUID = getPlayers().getUUID(args.get(0));
|
||||
if (leaderUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(0));
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(1));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(1));
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(1));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), leaderUUID)) {
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class AdminTeamDisbandCommand extends CompositeCommand {
|
||||
@ -29,7 +30,7 @@ public class AdminTeamDisbandCommand extends CompositeCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class AdminTeamKickCommand extends CompositeCommand {
|
||||
@ -30,7 +31,7 @@ public class AdminTeamKickCommand extends CompositeCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class AdminTeamMakeLeaderCommand extends CompositeCommand {
|
||||
@ -29,7 +30,7 @@ public class AdminTeamMakeLeaderCommand extends CompositeCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
|
||||
|
@ -51,7 +51,7 @@ public class IslandBanCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
// Player cannot ban themselves
|
||||
|
@ -47,7 +47,7 @@ public class IslandUnbanCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
// Player cannot unban themselves
|
||||
|
@ -51,7 +51,7 @@ public class IslandTeamCoopCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
return (getSettings().getCoopCooldown() <= 0 || !checkCooldown(user, targetUUID)) && coopCmd(user, targetUUID);
|
||||
|
@ -62,7 +62,7 @@ public class IslandTeamInviteCommand extends CompositeCommand {
|
||||
// Only online players can be invited
|
||||
UUID invitedPlayerUUID = getPlayers().getUUID(args.get(0));
|
||||
if (invitedPlayerUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
User invitedPlayer = User.getInstance(invitedPlayerUUID);
|
||||
|
@ -5,6 +5,7 @@ import java.util.UUID;
|
||||
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
|
||||
public class IslandTeamKickCommand extends ConfirmableCommand {
|
||||
@ -40,7 +41,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
|
||||
// Get target
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (targetUUID.equals(user.getUniqueId())) {
|
||||
|
@ -46,7 +46,7 @@ public class IslandTeamPromoteCommand extends CompositeCommand {
|
||||
// Get target
|
||||
User target = getPlayers().getUser(args.get(0));
|
||||
if (target == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return true;
|
||||
}
|
||||
if (!inTeam(getWorld(), target) || !getTeamLeader(getWorld(), user).equals(getTeamLeader(getWorld(), target))) {
|
||||
|
@ -8,6 +8,7 @@ import java.util.UUID;
|
||||
import world.bentobox.bentobox.api.commands.CompositeCommand;
|
||||
import world.bentobox.bentobox.api.events.IslandBaseEvent;
|
||||
import world.bentobox.bentobox.api.events.team.TeamEvent;
|
||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
|
||||
@ -42,7 +43,7 @@ public class IslandTeamSetownerCommand extends CompositeCommand {
|
||||
}
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
if (!getIslands().inTeam(getWorld(), playerUUID)) {
|
||||
|
@ -55,7 +55,7 @@ public class IslandTeamTrustCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
return (getSettings().getTrustCooldown() <= 0 || !checkCooldown(user, targetUUID)) && trustCmd(user, targetUUID);
|
||||
|
@ -55,7 +55,7 @@ public class IslandTeamUncoopCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
// Uncoop
|
||||
|
@ -55,7 +55,7 @@ public class IslandTeamUntrustCommand extends CompositeCommand {
|
||||
// Get target player
|
||||
UUID targetUUID = getPlayers().getUUID(args.get(0));
|
||||
if (targetUUID == null) {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
user.sendMessage("general.errors.unknown-player", TextVariables.NAME, args.get(0));
|
||||
return false;
|
||||
}
|
||||
// untrust
|
||||
|
@ -26,8 +26,7 @@ general:
|
||||
not-leader: "&cYou are not the leader of your island!"
|
||||
not-in-team: "&cThat player is not in your team!"
|
||||
offline-player: "&cThat player is offline or doesn't exist."
|
||||
unknown-player: "&cUnknown player!"
|
||||
unknown-player-name: "&c[name] is an unknown player!"
|
||||
unknown-player: "&c[name] is an unknown player!"
|
||||
general: "&cThat command is not ready yet - contact admin"
|
||||
unknown-command: "&cUnknown command. Do &b/[label] help &cfor help."
|
||||
warp-not-safe: "&cThat warp is not safe right now!"
|
||||
|
@ -26,7 +26,6 @@ general:
|
||||
not-in-team: "&cあの選手はあなたのチームにはいない!"
|
||||
offline-player: "&cそのプレイヤーはオフラインまたは存在しません。"
|
||||
unknown-player: "&c不明なプレイヤー!"
|
||||
unknown-player-name: "&c[name]は不明なプレイヤーです!"
|
||||
general: "&cそのコマンドはまだ準備ができていません-お問い合わせ管理"
|
||||
unknown-command: "&c不明なコマンドです。/[label] help を表示します。"
|
||||
warp-not-safe: "&cワープは安全じゃない!"
|
||||
|
@ -30,7 +30,6 @@ general:
|
||||
not-in-team: "&cTen gracz nie jest w twojej drużynie."
|
||||
offline-player: "&cTen gracz jest offline lub nie istnieje."
|
||||
unknown-player: "&cNieznany gracz!"
|
||||
unknown-player-name: "&c[name] jest nieznanym graczem!"
|
||||
general: "&cTo polecenie nie jest jeszcze gotowe - skontaktuj się z administratorem"
|
||||
unknown-command: "&cNieznane polecenie. Wpisz &b/[label] help &caby wyświetlić pomoc."
|
||||
warp-not-safe: "&cTen warp nie jest teraz bezpieczny!"
|
||||
|
@ -134,7 +134,7 @@ public class AdminClearResetsCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,7 +142,7 @@ public class AdminDeleteCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +137,7 @@ public class AdminInfoCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,7 @@ public class AdminRegisterCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ public class AdminUnregisterCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,10 +6,7 @@ package world.bentobox.bentobox.api.commands.admin.range;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@ -153,10 +150,9 @@ public class AdminRangeResetCommandTest {
|
||||
@Test
|
||||
public void testExecuteUnknownPlayer() {
|
||||
AdminRangeResetCommand arc = new AdminRangeResetCommand(ac);
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("tastybento");
|
||||
arc.execute(user, "", args);
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player");
|
||||
String[] name = {"tastybento"};
|
||||
arc.execute(user, "", Arrays.asList(name));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,10 +6,7 @@ package world.bentobox.bentobox.api.commands.admin.range;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@ -155,11 +152,9 @@ public class AdminRangeSetCommandTest {
|
||||
@Test
|
||||
public void testExecuteUnknownPlayer() {
|
||||
AdminRangeSetCommand arc = new AdminRangeSetCommand(ac);
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("tastybento");
|
||||
args.add("100");
|
||||
arc.execute(user, "", args);
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player");
|
||||
String[] args = {"tastybento", "100"};
|
||||
arc.execute(user, "", Arrays.asList(args));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", args[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,13 +143,13 @@ public class AdminTeamAddCommandTest {
|
||||
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(null);
|
||||
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID);
|
||||
assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "tastybento");
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "tastybento");
|
||||
|
||||
// Unknown target
|
||||
when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid);
|
||||
when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(null);
|
||||
assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "poslovich");
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "poslovich");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ public class AdminTeamDisbandCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,7 @@ public class AdminTeamKickCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ public class AdminTeamMakeLeaderCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ public class IslandBanCommandTest {
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
when(pm.getUUID(Mockito.anyString())).thenReturn(null);
|
||||
assertFalse(ibc.execute(user, ibc.getLabel(), Collections.singletonList("bill")));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player");
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "bill");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -166,7 +166,7 @@ public class IslandUnbanCommandTest {
|
||||
when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true);
|
||||
when(pm.getUUID(Mockito.anyString())).thenReturn(null);
|
||||
assertFalse(iubc.execute(user, iubc.getLabel(), Collections.singletonList("bill")));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player");
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "bill");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -169,7 +169,7 @@ public class IslandTeamCoopCommandTest {
|
||||
IslandTeamCoopCommand itl = new IslandTeamCoopCommand(ic);
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Collections.singletonList("tastybento")));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "tastybento");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,7 @@ public class IslandTeamInviteCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class IslandTeamKickCommandTest {
|
||||
String[] name = {"tastybento"};
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name)));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", name[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +169,7 @@ public class IslandTeamTrustCommandTest {
|
||||
IslandTeamTrustCommand itl = new IslandTeamTrustCommand(ic);
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Collections.singletonList("tastybento")));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "tastybento");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +169,7 @@ public class IslandTeamUncoopCommandTest {
|
||||
IslandTeamUncoopCommand itl = new IslandTeamUncoopCommand(ic);
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Collections.singletonList("tastybento")));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "tastybento");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +169,7 @@ public class IslandTeamUntrustCommandTest {
|
||||
IslandTeamUntrustCommand itl = new IslandTeamUntrustCommand(ic);
|
||||
when(pm.getUUID(Mockito.any())).thenReturn(null);
|
||||
assertFalse(itl.execute(user, itl.getLabel(), Collections.singletonList("tastybento")));
|
||||
Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player"));
|
||||
Mockito.verify(user).sendMessage("general.errors.unknown-player", "[name]", "tastybento");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user