Added TextVariables.GAMEMODE constant

This commit is contained in:
tastybento 2020-09-01 16:58:13 -07:00
parent ea4ef1e21a
commit 9ff62dad2a
4 changed files with 8 additions and 3 deletions

View File

@ -173,7 +173,7 @@ public class IslandResetCommand extends ConfirmableCommand {
User member = User.getInstance(memberUUID);
// Send a "you're kicked" message if the member is not the island owner (send before removing!)
if (!memberUUID.equals(island.getOwner())) {
member.sendMessage("commands.island.reset.kicked-from-island", "[gamemode]", getAddon().getDescription().getName());
member.sendMessage("commands.island.reset.kicked-from-island", TextVariables.GAMEMODE, getAddon().getDescription().getName());
}
// Remove player
getIslands().removePlayer(getWorld(), memberUUID);

View File

@ -82,7 +82,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
private void kick(User user, UUID targetUUID) {
User target = User.getInstance(targetUUID);
target.sendMessage("commands.island.team.kick.owner-kicked", "[gamemode]", getAddon().getDescription().getName());
target.sendMessage("commands.island.team.kick.owner-kicked", TextVariables.GAMEMODE, getAddon().getDescription().getName());
Island oldIsland = getIslands().getIsland(getWorld(), targetUUID);
getIslands().removePlayer(getWorld(), targetUUID);
// Execute commands when leaving

View File

@ -25,4 +25,8 @@ public class TextVariables {
* @since 1.10.0
*/
public static final String UNIT = "[unit]";
/**
* @since 1.15.0
*/
public static final String GAMEMODE = "[gamemode]";
}

View File

@ -45,6 +45,7 @@ import world.bentobox.bentobox.api.addons.AddonDescription;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
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.BlueprintsManager;
@ -260,7 +261,7 @@ public class IslandResetCommandTest {
verify(pim, times(14)).callEvent(any(IslandBaseEvent.class));
// Verify messaging
verify(user).sendMessage("commands.island.create.creating-island");
verify(user, never()).sendMessage(eq("commands.island.reset.kicked-from-island"), eq("[gamemode]"), anyString());
verify(user, never()).sendMessage(eq("commands.island.reset.kicked-from-island"), eq(TextVariables.GAMEMODE), anyString());
// Only 11 because the leader should not see this
verify(pp, times(11)).sendMessage("commands.island.reset.kicked-from-island");
}