From 560fe3c539420a9d644df8f42756bdd3cab23fab Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 29 Sep 2011 10:44:20 +0800 Subject: [PATCH] Switch default center point for maps to spawn point --- .../org/dynmap/ClientConfigurationComponent.java | 8 +++++--- src/main/java/org/dynmap/DynmapPlugin.java | 3 ++- src/main/resources/templates/nether-hires.txt | 8 ++++---- src/main/resources/templates/nether-lowres.txt | 12 ++++++------ src/main/resources/templates/nether.txt | 8 ++++---- src/main/resources/templates/normal-hires.txt | 8 ++++---- src/main/resources/templates/normal-lowres.txt | 8 ++++---- src/main/resources/templates/normal.txt | 8 ++++---- src/main/resources/templates/skylands-hires.txt | 8 ++++---- src/main/resources/templates/skylands-lowres.txt | 8 ++++---- src/main/resources/templates/skylands.txt | 8 ++++---- 11 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/dynmap/ClientConfigurationComponent.java b/src/main/java/org/dynmap/ClientConfigurationComponent.java index 8e93fcd6..6ad5de40 100644 --- a/src/main/java/org/dynmap/ClientConfigurationComponent.java +++ b/src/main/java/org/dynmap/ClientConfigurationComponent.java @@ -3,6 +3,7 @@ package org.dynmap; import static org.dynmap.JSONUtils.a; import static org.dynmap.JSONUtils.s; +import org.bukkit.Location; import org.dynmap.Event.Listener; import org.json.simple.JSONObject; @@ -31,9 +32,10 @@ public class ClientConfigurationComponent extends Component { JSONObject wo = new JSONObject(); s(wo, "name", wn.getString("name")); s(wo, "title", wn.getString("title")); - s(wo, "center/x", wn.getFloat("center/x", 0.0f)); - s(wo, "center/y", wn.getFloat("center/y", 64.0f)); - s(wo, "center/z", wn.getFloat("center/z", 0.0f)); + Location spawn = world.world.getSpawnLocation(); + s(wo, "center/x", wn.getDouble("center/x", spawn.getX())); + s(wo, "center/y", wn.getDouble("center/y", spawn.getY())); + s(wo, "center/z", wn.getDouble("center/z", spawn.getZ())); s(wo, "bigworld", world.bigworld); s(wo, "extrazoomout", world.getExtraZoomOutLevels()); a(t, "worlds", wo); diff --git a/src/main/java/org/dynmap/DynmapPlugin.java b/src/main/java/org/dynmap/DynmapPlugin.java index e7c66680..20d6340a 100644 --- a/src/main/java/org/dynmap/DynmapPlugin.java +++ b/src/main/java/org/dynmap/DynmapPlugin.java @@ -787,7 +787,8 @@ public class DynmapPlugin extends JavaPlugin { } w = mapManager.getWorld(wname); if(w != null) { - Location loc = new Location(w.world, w.configuration.getFloat("center/x", 0.0f), w.configuration.getFloat("center/y", 64f), w.configuration.getFloat("center/z", 0.0f)); + Location spawn = w.world.getSpawnLocation(); + Location loc = new Location(w.world, w.configuration.getDouble("center/x", spawn.getX()), w.configuration.getDouble("center/y", spawn.getY()), w.configuration.getDouble("center/z", spawn.getZ())); mapManager.renderFullWorld(loc,sender, map); } else diff --git a/src/main/resources/templates/nether-hires.txt b/src/main/resources/templates/nether-hires.txt index 54d64e85..bab2765b 100644 --- a/src/main/resources/templates/nether-hires.txt +++ b/src/main/resources/templates/nether-hires.txt @@ -11,10 +11,10 @@ templates: enabled: true # Number of extra zoom-out levels for world (each level is twice as big as the previous one) extrazoomout: 2 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/nether-lowres.txt b/src/main/resources/templates/nether-lowres.txt index 9bee3dc7..e31bbd42 100644 --- a/src/main/resources/templates/nether-lowres.txt +++ b/src/main/resources/templates/nether-lowres.txt @@ -9,12 +9,12 @@ templates: # Nether world template (HDMap lowres) nether-lowres: enabled: true - # # Number of extra zoom-out levels for world (each level is twice as big as the previous one) - # extrazoomout: 3 - center: - x: 0 - y: 64 - z: 0 + # Number of extra zoom-out levels for world (each level is twice as big as the previous one) + extrazoomout: 2 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/nether.txt b/src/main/resources/templates/nether.txt index fcdc8144..f787b980 100644 --- a/src/main/resources/templates/nether.txt +++ b/src/main/resources/templates/nether.txt @@ -12,10 +12,10 @@ templates: # bigworld: true # # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # extrazoomout: 3 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.flat.FlatMap name: flat diff --git a/src/main/resources/templates/normal-hires.txt b/src/main/resources/templates/normal-hires.txt index dac90a77..aede4349 100644 --- a/src/main/resources/templates/normal-hires.txt +++ b/src/main/resources/templates/normal-hires.txt @@ -11,10 +11,10 @@ templates: enabled: true # Number of extra zoom-out levels for world (each level is twice as big as the previous one) extrazoomout: 2 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/normal-lowres.txt b/src/main/resources/templates/normal-lowres.txt index b1f775d6..1934ac63 100644 --- a/src/main/resources/templates/normal-lowres.txt +++ b/src/main/resources/templates/normal-lowres.txt @@ -11,10 +11,10 @@ templates: enabled: true # Number of extra zoom-out levels for world (each level is twice as big as the previous one) extrazoomout: 2 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/normal.txt b/src/main/resources/templates/normal.txt index d884bf0a..f370c564 100644 --- a/src/main/resources/templates/normal.txt +++ b/src/main/resources/templates/normal.txt @@ -12,10 +12,10 @@ templates: # bigworld: true # # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # extrazoomout: 3 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.flat.FlatMap name: flat diff --git a/src/main/resources/templates/skylands-hires.txt b/src/main/resources/templates/skylands-hires.txt index eba47136..9340788f 100644 --- a/src/main/resources/templates/skylands-hires.txt +++ b/src/main/resources/templates/skylands-hires.txt @@ -11,10 +11,10 @@ templates: enabled: true # Number of extra zoom-out levels for world (each level is twice as big as the previous one) extrazoomout: 2 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/skylands-lowres.txt b/src/main/resources/templates/skylands-lowres.txt index d0559cc7..8895adc3 100644 --- a/src/main/resources/templates/skylands-lowres.txt +++ b/src/main/resources/templates/skylands-lowres.txt @@ -11,10 +11,10 @@ templates: enabled: true # Number of extra zoom-out levels for world (each level is twice as big as the previous one) extrazoomout: 2 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.hdmap.HDMap name: flat diff --git a/src/main/resources/templates/skylands.txt b/src/main/resources/templates/skylands.txt index ac52cadf..2cb7348c 100644 --- a/src/main/resources/templates/skylands.txt +++ b/src/main/resources/templates/skylands.txt @@ -12,10 +12,10 @@ templates: # bigworld: true # # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # extrazoomout: 3 - center: - x: 0 - y: 64 - z: 0 + #center: + # x: 0 + # y: 64 + # z: 0 maps: - class: org.dynmap.flat.FlatMap name: flat