SteamWar/BauSystem2.0
Archiviert
12
0
Dieses Repository wurde am 2024-08-05 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
BauSystem2.0/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java

44 Zeilen
1.9 KiB
Java

package de.steamwar.bausystem.region;
2021-04-20 13:46:51 +02:00
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;
2021-04-20 13:46:51 +02:00
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;
2021-04-20 13:46:51 +02:00
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)));
}
2021-05-01 10:53:01 +02:00
public static void message(Region region, String s) {
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.sendMessage(s));
}
2021-04-20 13:46:51 +02:00
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) {
2021-04-22 19:44:32 +02:00
if (region.getPrototype() != null) {
region.regionData.add("prototype", region.getPrototype().getName());
}
2021-04-20 13:46:51 +02:00
region.regionData.add("flagStorage", FlagStorage.toYAPION(region.getFlagStorage()));
RegionLoader.save();
}
}