Add option to multiple Zündphasen #256
@ -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()) {
|
||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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)));
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.world.regions;
|
||||
|
||||
public enum RegionExtensionType {
|
||||
public enum RegionExtensionType {
|
||||
NORMAL,
|
||||
EXTENSION
|
||||
}
|
||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.world.regions;
|
||||
|
||||
public enum RegionSelectionType {
|
||||
GLOBAL,
|
||||
LOCAL
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren