forked from SteamWar/SteamWar
Add DynamicRegionVisualizer
This commit is contained in:
+13
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user