From 67aba9081bb73aeaa822b059e8ca6defc8352a2f Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 6 Sep 2025 23:11:25 -0400 Subject: rename pacakges dev.tylerm -> cat.freya --- .../java/cat/freya/khs/command/map/Status.java | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/main/java/cat/freya/khs/command/map/Status.java (limited to 'src/main/java/cat/freya/khs/command/map/Status.java') diff --git a/src/main/java/cat/freya/khs/command/map/Status.java b/src/main/java/cat/freya/khs/command/map/Status.java new file mode 100644 index 0000000..e62e10d --- /dev/null +++ b/src/main/java/cat/freya/khs/command/map/Status.java @@ -0,0 +1,79 @@ +package cat.freya.khs.command.map; + +import cat.freya.khs.command.util.ICommand; +import cat.freya.khs.configuration.Config; +import cat.freya.khs.configuration.Localization; +import cat.freya.khs.configuration.Map; +import cat.freya.khs.configuration.Maps; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.stream.Collectors; + +public class Status implements ICommand { + + public void execute(Player sender, String[] args) { + + String msg = Localization.message("SETUP").toString(); + int count = 0; + Map map = Maps.getMap(args[0]); + if(map == null) { + sender.sendMessage(Config.errorPrefix + Localization.message("INVALID_MAP")); + return; + } + if (map.getSpawn().getBlockX() == 0 && map.getSpawn().getBlockY() == 0 && map.getSpawn().getBlockZ() == 0 || !map.getSpawn().exists()) { + msg = msg + "\n" + Localization.message("SETUP_GAME"); + count++; + } + if (map.getLobby().getBlockX() == 0 && map.getLobby().getBlockY() == 0 && map.getLobby().getBlockZ() == 0 || !map.getLobby().exists()) { + msg = msg + "\n" + Localization.message("SETUP_LOBBY"); + count++; + } + if (map.getSeekerLobby().getBlockX() == 0 && map.getSeekerLobby().getBlockY() == 0 && map.getSeekerLobby().getBlockZ() == 0 || !map.getSeekerLobby().exists()) { + msg = msg + "\n" + Localization.message("SETUP_SEEKER_LOBBY"); + count++; + } + if (Config.exitPosition.getBlockX() == 0 && Config.exitPosition.getBlockY() == 0 && Config.exitPosition.getBlockZ() == 0 || !Config.exitPosition.exists()) { + msg = msg + "\n" + Localization.message("SETUP_EXIT"); + count++; + } + if (map.isBoundsNotSetup()) { + msg = msg + "\n" + Localization.message("SETUP_BOUNDS"); + count++; + } + if (Config.mapSaveEnabled && !map.getGameSpawn().exists()) { + msg = msg + "\n" + Localization.message("SETUP_SAVEMAP"); + count++; + } + if (map.isBlockHuntEnabled() && map.getBlockHunt().isEmpty()) { + msg = msg + "\n" + Localization.message("SETUP_BLOCKHUNT"); + count++; + } + if (count < 1) { + sender.sendMessage(Config.messagePrefix + Localization.message("SETUP_COMPLETE")); + } else { + sender.sendMessage(msg); + } + } + + public String getLabel() { + return "status"; + } + + public String getUsage() { + return ""; + } + + public String getDescription() { + return "Shows what needs to be setup on a map"; + } + + public List autoComplete(@NotNull String parameter, @NotNull String typed) { + if(parameter.equals("map")) { + return Maps.getAllMaps().stream().map(Map::getName).collect(Collectors.toList()); + } + return null; + } + +} -- cgit v1.2.3-freya