Finished max-islands (from WorldSettings)

This commit is contained in:
Florian CUNY 2018-12-09 14:19:53 +01:00
parent 260410a927
commit 76af2335e2
3 changed files with 11 additions and 2 deletions

View File

@ -37,6 +37,13 @@ public class IslandCreateCommand extends CompositeCommand {
user.sendMessage("general.errors.already-have-island"); user.sendMessage("general.errors.already-have-island");
return false; return false;
} }
if (getIWM().getMaxIslands(getWorld()) > 0
&& getIslands().getIslandCount(getWorld()) >= getIWM().getMaxIslands(getWorld())) {
// There is too many islands in the world :(
user.sendMessage("commands.island.create.too-many-islands");
return false;
}
user.sendMessage("commands.island.create.creating-island"); user.sendMessage("commands.island.create.creating-island");
try { try {
NewIsland.builder() NewIsland.builder()

View File

@ -100,6 +100,7 @@ public interface WorldSettings {
int getMaxHomes(); int getMaxHomes();
/** /**
* 0 or -1 is unlimited. It will block island creation if the island count for the world is higher than this.
* @return the maxIslands * @return the maxIslands
*/ */
int getMaxIslands(); int getMaxIslands();

View File

@ -31,7 +31,7 @@ general:
unknown-command: "&cUnknown command. Do &b/[label] help &cfor help." unknown-command: "&cUnknown command. Do &b/[label] help &cfor help."
warp-not-safe: "&cThat warp is not safe right now!" warp-not-safe: "&cThat warp is not safe right now!"
wrong-world: "&cYou are not in the right world to do that!" wrong-world: "&cYou are not in the right world to do that!"
you-must-wait: "&cYou must wait [number]s before you can do that command again" you-must-wait: "&cYou must wait [number]s before you can do that command again."
tips: tips:
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!" changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
@ -231,9 +231,10 @@ commands:
description: "teleport you to the spawn" description: "teleport you to the spawn"
create: create:
description: "create an island" description: "create an island"
too-many-islands: "&cThere are too many islands in this world: there isn't enough room for yours to be created."
unable-create-island: "&cYour island could not be generated, please contact an administrator." unable-create-island: "&cYour island could not be generated, please contact an administrator."
creating-island: "&aCreating your island..." creating-island: "&aCreating your island..."
pick-world: "&cPick a world from [worlds]" pick-world: "&cPick a world from [worlds]."
info: info:
description: "display info about your island" description: "display info about your island"
reset: reset: