Add DynamicRegionVisualizer

This commit is contained in:
2026-09-07 11:42:22 +02:00
parent 4be46139c2
commit c1de1cf779
4 changed files with 166 additions and 2 deletions
@@ -29,6 +29,7 @@ import de.steamwar.command.AbstractSWCommand;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.core.SWPlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -44,6 +45,18 @@ public class DynamicRegionCommand extends SWCommand {
super("");
}
@Register({"dynamic", "visualize"})
public void visualizeRegions(Player player) {
Tile tile = Tile.fromLocation(player.getLocation()).orElse(null);
if (tile == null) return;
SWPlayer swPlayer = SWPlayer.of(player);
if (swPlayer.hasComponent(DynamicRegionVisualizer.class)) {
swPlayer.removeComponent(DynamicRegionVisualizer.class);
} else {
swPlayer.setComponent(new DynamicRegionVisualizer());
}
}
@Register({"dynamic", "place"})
public void placeRegion(Player player, @Mapper("regionType") String regionType) {
Region region = DynamicRegionSystem.INSTANCE.get(player.getLocation());