SteamWar/FightSystem
Archiviert
13
1

Fix 1.18 world reset
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-04-11 19:06:54 +02:00
Ursprung d92cf9e800
Commit c24bc49f6d

Datei anzeigen

@ -29,9 +29,12 @@ import de.steamwar.fightsystem.utils.FlatteningWrapper;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class FightWorld extends StateDependent {
@ -65,10 +68,13 @@ public class FightWorld extends StateDependent {
}
public static void resetWorld(){
List<Entity> entities = new ArrayList<>();
Recording.iterateOverEntities(Objects::nonNull, entity -> {
if(entity.getType() != EntityType.PLAYER && (!Config.ArenaLeaveable || Config.ArenaRegion.inRegion(entity.getLocation())))
entity.remove();
entities.add(entity);
});
entities.forEach(Entity::remove);
entities.clear();
World backup = new WorldCreator(Config.world.getName() + "/backup").createWorld();
assert backup != null;