Add BlueInsetRegion management and implement TechareaCommand

This commit is contained in:
2025-06-12 19:27:56 +02:00
parent 3296d9ebb3
commit 37acbf0033
5 changed files with 69 additions and 0 deletions
@@ -28,6 +28,7 @@ import lombok.Getter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
@AllArgsConstructor @AllArgsConstructor
public class CheckedSchematic { public class CheckedSchematic {
@@ -59,6 +59,7 @@ public class Config {
public static final Region RedExtendRegion; public static final Region RedExtendRegion;
public static final Region ArenaRegion; public static final Region ArenaRegion;
public static final Region PlayerRegion; public static final Region PlayerRegion;
public static final Region BlueInsetRegion;
public static final Location TeamBlueSpawn; public static final Location TeamBlueSpawn;
public static final Location TeamRedSpawn; public static final Location TeamRedSpawn;
@@ -193,6 +194,11 @@ public class Config {
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", false); ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates", false);
UnlimitedPrepare = config.getBoolean("Schematic.UnlimitedPrepare", false); UnlimitedPrepare = config.getBoolean("Schematic.UnlimitedPrepare", false);
int schemInsetX = config.getInt("Schematic.Inset.x", 0);
int schemInsetZ = config.getInt("Schematic.Inset.z", 0);
int schemInsetBottom = config.getInt("Schematic.Inset.bottom", 0);
int schemInsetTop = config.getInt("Schematic.Inset.top", 0);
GameName = config.getString("GameName", "WarGear"); GameName = config.getString("GameName", "WarGear");
TeamChatDetection = config.getString("TeamChatPrefix", "+"); TeamChatDetection = config.getString("TeamChatPrefix", "+");
@@ -318,6 +324,8 @@ public class Config {
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0); ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ); PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ);
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + schemInsetX, BluePasteRegion.getMinY() + schemInsetBottom, BluePasteRegion.getMinZ() + schemInsetZ, BluePasteRegion.getMaxX() - schemInsetX, BluePasteRegion.getMaxY() - schemInsetTop, BluePasteRegion.getMaxZ() - schemInsetZ);
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
if(eventKampfID >= 1){ if(eventKampfID >= 1){
EventKampf = EventFight.get(eventKampfID); EventKampf = EventFight.get(eventKampfID);
@@ -177,6 +177,8 @@ public class FightSystem extends JavaPlugin {
Fight.getRedTeam().setSchem(unpreparedSchematicNode); Fight.getRedTeam().setSchem(unpreparedSchematicNode);
} }
} }
new TechareaCommand();
}else if(Config.mode == ArenaMode.PREPARE) { }else if(Config.mode == ArenaMode.PREPARE) {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID)); Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
} }
@@ -0,0 +1,49 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.entity.CWireframe;
import de.steamwar.entity.REntityServer;
import de.steamwar.fightsystem.Config;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class TechareaCommand extends SWCommand {
private final REntityServer server = new REntityServer();
private final CWireframe wireframe = new CWireframe(server);
public TechareaCommand() {
super("techarea");
wireframe.setPos1(Config.BlueInsetRegion.getMinLocation(Config.world));
wireframe.setPos2(Config.BlueInsetRegion.getMaxLocation(Config.world));
wireframe.setBlock(Material.RED_CONCRETE.createBlockData());
}
@Register
public void genericCommand(Player player) {
if (server.getPlayers().contains(player)) {
server.removePlayer(player);
} else {
server.addPlayer(player);
}
}
}
@@ -23,6 +23,7 @@ import de.steamwar.techhider.ProtocolUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import java.util.function.ObjIntConsumer; import java.util.function.ObjIntConsumer;
@@ -77,6 +78,14 @@ public class Region {
return ProtocolUtils.posToChunk(maxZ); return ProtocolUtils.posToChunk(maxZ);
} }
public Location getMinLocation(World world) {
return new Location(world, minX, minY, minZ);
}
public Location getMaxLocation(World world) {
return new Location(world, maxX, maxY, maxZ);
}
public boolean chunkOutside(int cX, int cZ) { public boolean chunkOutside(int cX, int cZ) {
return getMinChunkX() > cX || cX > getMaxChunkX() || return getMinChunkX() > cX || cX > getMaxChunkX() ||
getMinChunkZ() > cZ || cZ > getMaxChunkZ(); getMinChunkZ() > cZ || cZ > getMaxChunkZ();