package de.steamwar.bausystem.region;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.region.loader.RegionLoader;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.core.VersionedCallable;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import java.io.File;
@UtilityClass
public class RegionUtils {
public void actionBar(Region region, String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
}
static EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(file, pastePoint, pasteOptions), 15));
static EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(clipboard, pastePoint, pasteOptions), 15));
static void save(Region region) {
region.regionData.add("prototype", region.getPrototype().getName());
region.regionData.add("flagStorage", FlagStorage.toYAPION(region.getFlagStorage()));
RegionLoader.save();