Have per-world control of sending player position and health, prevent
player icon flicker on addplayer (even when not on world or position is obfuscated)
This commit is contained in:
parent
6a50b2ebcd
commit
38163133cb
6 changed files with 17 additions and 6 deletions
|
|
@ -41,8 +41,8 @@ public class ClientUpdateComponent extends Component {
|
|||
s(jp, "name", ChatColor.stripColor(p.getDisplayName()));
|
||||
s(jp, "account", p.getName());
|
||||
/* Don't leak player location for world not visible on maps, or if sendposition disbaled */
|
||||
boolean player_visible = MapManager.mapman.worldsLookup.containsKey(p.getWorld().getName());
|
||||
if(configuration.getBoolean("sendpositon", true) && player_visible) {
|
||||
DynmapWorld pworld = MapManager.mapman.worldsLookup.get(p.getWorld().getName());
|
||||
if(configuration.getBoolean("sendpositon", true) && (pworld != null) && pworld.sendposition) {
|
||||
s(jp, "world", p.getWorld().getName());
|
||||
s(jp, "x", pl.getX());
|
||||
s(jp, "y", pl.getY());
|
||||
|
|
@ -55,7 +55,7 @@ public class ClientUpdateComponent extends Component {
|
|||
s(jp, "z", 0.0);
|
||||
}
|
||||
/* Only send health if enabled AND we're on visible world */
|
||||
if (configuration.getBoolean("sendhealth", false) && player_visible) {
|
||||
if (configuration.getBoolean("sendhealth", false) && (pworld != null) && pworld.sendhealth) {
|
||||
s(jp, "health", p.getHealth());
|
||||
s(jp, "armor", Armor.getArmorPoints(p));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,6 @@ public class DynmapWorld {
|
|||
public ConfigurationNode configuration;
|
||||
public List<Location> seedloc;
|
||||
public int servertime;
|
||||
public boolean sendposition;
|
||||
public boolean sendhealth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -295,6 +295,8 @@ public class MapManager {
|
|||
List<ConfigurationNode> loclist = worldConfiguration.getNodes("fullrenderlocations");
|
||||
dynmapWorld.seedloc = new ArrayList<Location>();
|
||||
dynmapWorld.servertime = (int)(w.getTime() % 24000);
|
||||
dynmapWorld.sendposition = worldConfiguration.getBoolean("sendposition", true);
|
||||
dynmapWorld.sendhealth = worldConfiguration.getBoolean("sendhealth", true);
|
||||
if(loclist != null) {
|
||||
for(ConfigurationNode loc : loclist) {
|
||||
Location lx = new Location(w, loc.getDouble("x", 0), loc.getDouble("y", 64), loc.getDouble("z", 0));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue