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]>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user