SteamWar/BauSystem2.0
Archiviert
12
0

Fix FreezeListener again
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-29 22:36:41 +02:00
Ursprung c304fc034f
Commit e428006b6c
2 geänderte Dateien mit 41 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -109,6 +109,15 @@ public class FreezeListener implements Listener {
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if (Core.getVersion() < 19) return;
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
event.setCancelled(true);
event.getBlock().setType(event.getItemInHand().getType(), false);
}
}
@EventHandler
public void onFluidLevelChange(FluidLevelChangeEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
@ -129,4 +138,11 @@ public class FreezeListener implements Listener {
event.setCancelled(true);
}
}
@EventHandler
public void onSpongeAbsorb(SpongeAbsorbEvent event) {
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
event.setCancelled(true);
}
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.region;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
@ -29,6 +30,7 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.SizedStack;
import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.core.Core;
import de.steamwar.sql.SchematicNode;
import lombok.AccessLevel;
import lombok.Getter;
@ -44,6 +46,7 @@ import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.ObjIntConsumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -572,4 +575,26 @@ public class Region {
if (files == null || files.length == 0) return null;
return files[0];
}
public void forEachChunk(ObjIntConsumer<Integer> executor) {
for (int x = (int) Math.floor(minPoint.getX() / 16.0); x <= (int) Math.ceil(maxPoint.getX() / 16.0); x++) {
for (int z = (int) Math.floor(minPoint.getZ() / 16.0); z <= (int) Math.ceil(maxPoint.getZ() / 16.0); z++) {
executor.accept(x, z);
}
}
}
public boolean chunkOutside(int chunkX, int chunkY) {
return Math.floor(minPoint.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPoint.getX() / 16.0) ||
Math.floor(minPoint.getZ() / 16.0) > chunkY || chunkY >= Math.ceil(maxPoint.getZ() / 16.0);
}
public File gameModeConfig() {
File baseFile = new File(BauSystem.getInstance().getDataFolder().getParentFile(), "FightSystem");
for (int version = Core.getVersion(); version > 15; version--) {
File specific = new File(baseFile, getDisplayName() + version + ".yml");
if (specific.exists()) return specific;
}
return null;
}
}