Check if player has island when inviting players

This commit is contained in:
Len 2024-02-10 22:16:26 +01:00
parent f4bf8e8964
commit 3cdf57192c
2 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,10 @@ public class IslandInvite extends PlayerSubCommand {
@Override
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
MessageConfiguration.Commands.Island.Invite invite = plugin.messagesConfiguration().get().commands().island().invite();
if (islandPlayer.islandId() == 0) {
player.sendRichMessage(invite.noIsland());
return true;
}
if (args.length < 1) {
player.sendRichMessage(plugin.messagesConfiguration().get().commands().island().commandUsage());
return true;

View File

@ -98,6 +98,7 @@ public class MessageConfiguration implements Configuration {
@ConfigSerializable @Getter
public static class Invite {
String inviteSelf = "<red>You can not invite yourself to this island.";
String noIsland = "<red>You need an island to run this command.";
String targetOffline = "<red><target> not found, is the player online?";
String targetHasIsland = "<red><target> already has an island and can not be invited.";
}