mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 10:45:22 +01:00
Add placeholders. Put in defensive code against nulls.
This commit is contained in:
parent
2784f197cb
commit
4a972a86ae
@ -27,6 +27,7 @@ import world.bentobox.bentobox.util.Util;
|
||||
* </ul>
|
||||
*
|
||||
* @author tastybento
|
||||
* @since 2.6.0
|
||||
*/
|
||||
|
||||
public class AdminMaxHomesCommand extends ConfirmableCommand {
|
||||
|
@ -157,6 +157,15 @@ public enum GameModePlaceholder {
|
||||
* @since 1.5.0
|
||||
*/
|
||||
ISLAND_VISITORS_COUNT("island_visitors_count", (addon, user, island) -> island == null ? "" : String.valueOf(island.getVisitors().size())),
|
||||
/**
|
||||
* Returns the amount of players that are at least MEMBER on the island the player is standing on.
|
||||
* @since 2.6.0
|
||||
*/
|
||||
ISLAND_MAX_HOMES("island_max_homes",
|
||||
(addon, user, island) -> island == null ? ""
|
||||
: String.valueOf(
|
||||
island.getMaxHomes() == null ? addon.getPlugin().getIWM().getMaxHomes(island.getWorld())
|
||||
: island.getMaxHomes())),
|
||||
/**
|
||||
* Returns the amount of players banned from the island.
|
||||
* @since 1.5.0
|
||||
@ -281,6 +290,16 @@ public enum GameModePlaceholder {
|
||||
*/
|
||||
VISITED_ISLAND_MEMBERS_COUNT("visited_island_members_count", (addon, user, island) ->
|
||||
getVisitedIsland(addon, user).map(value -> String.valueOf(value.getMemberSet().size())).orElse("")),
|
||||
/**
|
||||
* Returns the amount of players that are at least MEMBER on the island the player is standing on.
|
||||
* @since 2.6.0
|
||||
*/
|
||||
VISITED_ISLAND_MAX_HOMES("visited_island_max_homes",
|
||||
(addon, user,
|
||||
island) -> getVisitedIsland(addon, user).map(value -> String.valueOf(
|
||||
island.getMaxHomes() == null ? addon.getPlugin().getIWM().getMaxHomes(island.getWorld())
|
||||
: island.getMaxHomes()))
|
||||
.orElse("")),
|
||||
/**
|
||||
* Returns the amount of players that are TRUSTED on the island the player is standing on.
|
||||
* @since 1.5.2
|
||||
|
@ -143,7 +143,9 @@ public class IslandInfo {
|
||||
// Show team members
|
||||
showMembers(user);
|
||||
}
|
||||
user.sendMessage("commands.admin.info.max-homes", TextVariables.NUMBER, String.valueOf(island.getMaxHomes()));
|
||||
int maxHomes = island.getMaxHomes() == null ? plugin.getIWM().getMaxHomes(island.getWorld())
|
||||
: island.getMaxHomes();
|
||||
user.sendMessage("commands.admin.info.max-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
|
||||
Vector location = island.getProtectionCenter().toVector();
|
||||
user.sendMessage("commands.admin.info.island-center", TextVariables.XYZ, Util.xyz(location));
|
||||
user.sendMessage("commands.admin.info.protection-range", RANGE, String.valueOf(island.getProtectionRange()));
|
||||
|
@ -0,0 +1,55 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.api.commands.admin;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DefaultAdminCommandTest {
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.DefaultAdminCommand#DefaultAdminCommand(world.bentobox.bentobox.api.addons.GameModeAddon)}.
|
||||
*/
|
||||
@Test
|
||||
public void testDefaultAdminCommand() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.DefaultAdminCommand#setup()}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetup() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.api.commands.admin.DefaultAdminCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExecuteUserStringListOfString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user