Live map: plugin/mod chunk+player sync, admin panel Live Map section, launcher transport
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DjMbLQujBHunCCu5GpsHaT
This commit is contained in:
14 files changed
+769
-8
No files matched your search
@@ -37,6 +37,12 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
});
|
||||
Bukkit.getScheduler().runTaskTimer(this, integration::tick, 1, 1);
|
||||
|
||||
// Central Live Map: mirror chunks and player positions to the panel.
|
||||
if (getConfig().getBoolean("livemap.enabled", true)) {
|
||||
integration.enableLiveMap(Bukkit.getWorlds().get(0).getWorldFolder().toPath());
|
||||
Bukkit.getScheduler().runTaskTimer(this, this::snapshotPlayers, 40, 20);
|
||||
}
|
||||
|
||||
// Register /scopenet admin & help command
|
||||
ScopenetCommandHandler scopenetCmd = new ScopenetCommandHandler(this, integration);
|
||||
bindCommand("scopenet", scopenetCmd);
|
||||
@@ -107,6 +113,29 @@ public final class ScopenetPlugin extends JavaPlugin implements Listener {
|
||||
integration.reload(next);
|
||||
}
|
||||
|
||||
private void snapshotPlayers() {
|
||||
if (integration == null) return;
|
||||
java.util.List<LiveMapSync.Player> list = new java.util.ArrayList<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
Location at = p.getLocation();
|
||||
String dim = switch (at.getWorld().getEnvironment()) {
|
||||
case NETHER -> "minecraft:the_nether";
|
||||
case THE_END -> "minecraft:the_end";
|
||||
default -> "minecraft:overworld";
|
||||
};
|
||||
// Rounded so an idle roster doesn't look "changed" on every tick.
|
||||
list.add(new LiveMapSync.Player(p.getUniqueId().toString(), p.getName(), dim,
|
||||
Math.round(at.getX() * 10) / 10.0, Math.round(at.getY() * 10) / 10.0, Math.round(at.getZ() * 10) / 10.0,
|
||||
Math.round(at.getYaw()), Math.round(at.getPitch())));
|
||||
}
|
||||
integration.liveMapPlayers(list);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void worldSaved(org.bukkit.event.world.WorldSaveEvent event) {
|
||||
if (integration != null) integration.liveMapSaved();
|
||||
}
|
||||
|
||||
public static String dimension(World world) {
|
||||
return world.getKey().toString();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@ essentials:
|
||||
# RTP search radius
|
||||
rtp-radius: 2500
|
||||
|
||||
livemap:
|
||||
# Send world chunks and live player positions to the panel's central Live Map.
|
||||
# Players open it from the launcher; you don't run Vantage on this server.
|
||||
# It also needs "Live Map" switched on for this server in the panel.
|
||||
enabled: true
|
||||
|
||||
economy:
|
||||
# Server Economy commands (/balance, /pay, /baltop, /shop, /sell, /market, /orders, /trade, /transactions)
|
||||
enabled: true
|
||||
|
||||
Reference in new issue
Block a user