Files
BoatParty/src/main/java/us/tss3/boatparty/util/LocationUtil.java
T
Michael BurgessandClaude Sonnet 5 8a6b835c50
CI / build (push) Failing after 45s
Add BoatParty ice-boat racing plugin for PaperMC
Gradle-based plugin targeting the latest Paper API (26.2), with
configurable races (laps, checkpoints, lobby/start, min players,
countdown), a /boatparty command suite, and lap/checkpoint tracking
via player movement. Includes Gitea Actions CI to build with JDK 25.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-08-08 08:38:54 -04:00

43 lines
1.3 KiB
Java

package us.tss3.boatparty.util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
public final class LocationUtil {
private LocationUtil() {
}
public static void write(ConfigurationSection section, String path, Location location) {
if (location == null) {
return;
}
ConfigurationSection s = section.createSection(path);
s.set("world", location.getWorld().getName());
s.set("x", location.getX());
s.set("y", location.getY());
s.set("z", location.getZ());
s.set("yaw", location.getYaw());
s.set("pitch", location.getPitch());
}
public static Location read(ConfigurationSection section, String path) {
ConfigurationSection s = section.getConfigurationSection(path);
if (s == null) {
return null;
}
String worldName = s.getString("world");
if (worldName == null || Bukkit.getWorld(worldName) == null) {
return null;
}
return new Location(
Bukkit.getWorld(worldName),
s.getDouble("x"),
s.getDouble("y"),
s.getDouble("z"),
(float) s.getDouble("yaw"),
(float) s.getDouble("pitch"));
}
}