diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
index 829132c..3b44fea 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java
@@ -95,6 +95,7 @@ public class BauSystem extends JavaPlugin implements Listener {
new CommandWorldSpawn();
new CommandRegion();
new CommandSelect();
+ new CommandKillAll();
VersionedRunnable.call(new VersionedRunnable(() -> {
if (Region.buildAreaEnabled()) {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandKillAll.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandKillAll.java
new file mode 100644
index 0000000..b8bdfc6
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandKillAll.java
@@ -0,0 +1,67 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2020 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 .
+ */
+
+package de.steamwar.bausystem.commands;
+
+import de.steamwar.bausystem.world.regions.*;
+import de.steamwar.command.SWCommand;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+
+public class CommandKillAll extends SWCommand {
+
+ private static final World WORLD = Bukkit.getWorlds().get(0);
+
+ public CommandKillAll() {
+ super("killall", "removeall");
+ }
+
+ @Register(help = true)
+ public void genericHelp(Player player, String... args) {
+ player.sendMessage("§8/§ekillall §8- §7Entferne alle Entities aus deiner Region");
+ player.sendMessage("§8/§ekillall §8[§7Global§8/Local§7] §8- §7Entferne alle Entities aus deiner Region oder global");
+ }
+
+ @Register
+ public void genericCommand(Player player) {
+ genericCommand(player, RegionSelectionType.LOCAL);
+ }
+
+ @Register
+ public void genericCommand(Player player, RegionSelectionType regionSelectionType) {
+ Region region = Region.getRegion(player.getLocation());
+ if (regionSelectionType == RegionSelectionType.GLOBAL || GlobalRegion.isGlobalRegion(region)) {
+ long removedEntities = WORLD.getEntities()
+ .stream()
+ .filter(e -> !(e instanceof Player))
+ .peek(Entity::remove).count();
+ RegionUtils.actionBar(GlobalRegion.getInstance(), "§a" + removedEntities + " Entities aus der Welt entfernt");
+ } else {
+ long removedEntities = WORLD.getEntities()
+ .stream()
+ .filter(e -> !(e instanceof Player))
+ .filter(e -> region.inRegion(e.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
+ .peek(Entity::remove).count();
+ RegionUtils.actionBar(region, "§a" + removedEntities + " Entities aus der Region entfernt");
+ }
+ }
+
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/RegionUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/RegionUtils.java
index 1d9dc60..1c78303 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/commands/RegionUtils.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/RegionUtils.java
@@ -33,7 +33,7 @@ public class RegionUtils {
public static void actionBar(Region region, String s) {
if (GlobalRegion.isGlobalRegion(region)) {
- Bukkit.getOnlinePlayers().stream().filter(player -> Region.getRegion(player.getLocation()) == null).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
+ Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
} else {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionExtensionType.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionExtensionType.java
index b2194e0..28be3b6 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionExtensionType.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionExtensionType.java
@@ -19,7 +19,7 @@
package de.steamwar.bausystem.world.regions;
-public enum RegionExtensionType {
+public enum RegionExtensionType {
NORMAL,
EXTENSION
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionSelectionType.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionSelectionType.java
new file mode 100644
index 0000000..40cb2f2
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/RegionSelectionType.java
@@ -0,0 +1,25 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2020 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 .
+ */
+
+package de.steamwar.bausystem.world.regions;
+
+public enum RegionSelectionType {
+ GLOBAL,
+ LOCAL
+}