Switch default center point for maps to spawn point

This commit is contained in:
Mike Primm 2011-09-29 10:44:20 +08:00 committed by mikeprimm
parent a0531f99ab
commit 1dad9e4272
11 changed files with 45 additions and 42 deletions

View file

@ -3,6 +3,7 @@ package org.dynmap;
import static org.dynmap.JSONUtils.a; import static org.dynmap.JSONUtils.a;
import static org.dynmap.JSONUtils.s; import static org.dynmap.JSONUtils.s;
import org.bukkit.Location;
import org.dynmap.Event.Listener; import org.dynmap.Event.Listener;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
@ -31,9 +32,10 @@ public class ClientConfigurationComponent extends Component {
JSONObject wo = new JSONObject(); JSONObject wo = new JSONObject();
s(wo, "name", wn.getString("name")); s(wo, "name", wn.getString("name"));
s(wo, "title", wn.getString("title")); s(wo, "title", wn.getString("title"));
s(wo, "center/x", wn.getFloat("center/x", 0.0f)); Location spawn = world.world.getSpawnLocation();
s(wo, "center/y", wn.getFloat("center/y", 64.0f)); s(wo, "center/x", wn.getDouble("center/x", spawn.getX()));
s(wo, "center/z", wn.getFloat("center/z", 0.0f)); 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, "bigworld", world.bigworld);
s(wo, "extrazoomout", world.getExtraZoomOutLevels()); s(wo, "extrazoomout", world.getExtraZoomOutLevels());
a(t, "worlds", wo); a(t, "worlds", wo);

View file

@ -787,7 +787,8 @@ public class DynmapPlugin extends JavaPlugin {
} }
w = mapManager.getWorld(wname); w = mapManager.getWorld(wname);
if(w != null) { 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); mapManager.renderFullWorld(loc,sender, map);
} }
else else

View file

@ -11,10 +11,10 @@ templates:
enabled: true enabled: true
# Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
extrazoomout: 2 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -9,12 +9,12 @@ templates:
# Nether world template (HDMap lowres) # Nether world template (HDMap lowres)
nether-lowres: nether-lowres:
enabled: true enabled: true
# # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
# extrazoomout: 3 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -12,10 +12,10 @@ templates:
# bigworld: true # bigworld: true
# # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
# extrazoomout: 3 # extrazoomout: 3
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.flat.FlatMap - class: org.dynmap.flat.FlatMap
name: flat name: flat

View file

@ -11,10 +11,10 @@ templates:
enabled: true enabled: true
# Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
extrazoomout: 2 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -11,10 +11,10 @@ templates:
enabled: true enabled: true
# Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
extrazoomout: 2 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -12,10 +12,10 @@ templates:
# bigworld: true # bigworld: true
# # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
# extrazoomout: 3 # extrazoomout: 3
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.flat.FlatMap - class: org.dynmap.flat.FlatMap
name: flat name: flat

View file

@ -11,10 +11,10 @@ templates:
enabled: true enabled: true
# Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
extrazoomout: 2 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -11,10 +11,10 @@ templates:
enabled: true enabled: true
# Number of extra zoom-out levels for world (each level is twice as big as the previous one) # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
extrazoomout: 2 extrazoomout: 2
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.hdmap.HDMap - class: org.dynmap.hdmap.HDMap
name: flat name: flat

View file

@ -12,10 +12,10 @@ templates:
# bigworld: true # bigworld: true
# # Number of extra zoom-out levels for world (each level is twice as big as the previous one) # # Number of extra zoom-out levels for world (each level is twice as big as the previous one)
# extrazoomout: 3 # extrazoomout: 3
center: #center:
x: 0 # x: 0
y: 64 # y: 64
z: 0 # z: 0
maps: maps:
- class: org.dynmap.flat.FlatMap - class: org.dynmap.flat.FlatMap
name: flat name: flat