mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-29 14:06:30 +01:00
Synchronized world properties required by Async chat event.
This commit is contained in:
parent
b2f3b74062
commit
d05e2b500f
@ -60,7 +60,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
private static final int SPAWN_LOCATION_SEARCH_TOLERANCE = 16;
|
private static final int SPAWN_LOCATION_SEARCH_TOLERANCE = 16;
|
||||||
private static final int SPAWN_LOCATION_SEARCH_RADIUS = 16;
|
private static final int SPAWN_LOCATION_SEARCH_RADIUS = 16;
|
||||||
|
|
||||||
private static Map<String, String> propertyAliases;
|
private static final Map<String, String> propertyAliases;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
propertyAliases = new HashMap<String, String>();
|
propertyAliases = new HashMap<String, String>();
|
||||||
@ -350,6 +350,8 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Object propertyLock = new Object();
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// Begin properties
|
// Begin properties
|
||||||
@Property(description = "Sorry, 'hidden' must either be: true or false.")
|
@Property(description = "Sorry, 'hidden' must either be: true or false.")
|
||||||
@ -637,25 +639,27 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void setDefaults() {
|
protected void setDefaults() {
|
||||||
this.hidden = false;
|
synchronized (propertyLock) {
|
||||||
this.alias = new String();
|
this.hidden = false;
|
||||||
this.color = EnglishChatColor.WHITE;
|
this.alias = new String();
|
||||||
this.style = EnglishChatStyle.NORMAL;
|
this.color = EnglishChatColor.WHITE;
|
||||||
this.scale = getDefaultScale(environment);
|
this.style = EnglishChatStyle.NORMAL;
|
||||||
this.respawnWorld = new String();
|
this.scale = getDefaultScale(environment);
|
||||||
this.allowWeather = true;
|
this.respawnWorld = new String();
|
||||||
this.spawning = new SpawnSettings();
|
this.allowWeather = true;
|
||||||
this.entryfee = new EntryFee();
|
this.spawning = new SpawnSettings();
|
||||||
this.hunger = true;
|
this.entryfee = new EntryFee();
|
||||||
this.autoHeal = true;
|
this.hunger = true;
|
||||||
this.adjustSpawn = true;
|
this.autoHeal = true;
|
||||||
this.portalForm = AllowedPortalType.ALL;
|
this.adjustSpawn = true;
|
||||||
this.gameMode = GameMode.SURVIVAL;
|
this.portalForm = AllowedPortalType.ALL;
|
||||||
this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : new NullLocation();
|
this.gameMode = GameMode.SURVIVAL;
|
||||||
this.autoLoad = true;
|
this.spawnLocation = (world != null) ? new SpawnLocation(world.get().getSpawnLocation()) : new NullLocation();
|
||||||
this.bedRespawn = true;
|
this.autoLoad = true;
|
||||||
this.worldBlacklist = new ArrayList<String>();
|
this.bedRespawn = true;
|
||||||
this.generator = null;
|
this.worldBlacklist = new ArrayList<String>();
|
||||||
|
this.generator = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -713,20 +717,22 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getColoredWorldString() {
|
public String getColoredWorldString() {
|
||||||
if (alias.length() == 0) {
|
synchronized (propertyLock) {
|
||||||
alias = this.getName();
|
if (alias.length() == 0) {
|
||||||
|
alias = this.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((color == null) || (color.getColor() == null)) {
|
||||||
|
this.setPropertyValueUnchecked("color", EnglishChatColor.WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder nameBuilder = new StringBuilder().append(color.getColor());
|
||||||
|
if (style.getColor() != null)
|
||||||
|
nameBuilder.append(style.getColor());
|
||||||
|
nameBuilder.append(alias).append(ChatColor.WHITE).toString();
|
||||||
|
|
||||||
|
return nameBuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((color == null) || (color.getColor() == null)) {
|
|
||||||
this.setPropertyValueUnchecked("color", EnglishChatColor.WHITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder nameBuilder = new StringBuilder().append(color.getColor());
|
|
||||||
if (style.getColor() != null)
|
|
||||||
nameBuilder.append(style.getColor());
|
|
||||||
nameBuilder.append(alias).append(ChatColor.WHITE).toString();
|
|
||||||
|
|
||||||
return nameBuilder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -937,10 +943,12 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
if (this.alias == null || this.alias.length() == 0) {
|
synchronized (propertyLock) {
|
||||||
return this.name;
|
if (this.alias == null || this.alias.length() == 0) {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
return this.alias;
|
||||||
}
|
}
|
||||||
return this.alias;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1022,7 +1030,9 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return this.hidden;
|
synchronized (propertyLock) {
|
||||||
|
return this.hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1081,7 +1091,9 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ChatColor getColor() {
|
public ChatColor getColor() {
|
||||||
return this.color.getColor();
|
synchronized (propertyLock) {
|
||||||
|
return this.color.getColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1385,7 +1397,9 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ChatColor getStyle() {
|
public ChatColor getStyle() {
|
||||||
return style.getColor();
|
synchronized (propertyLock) {
|
||||||
|
return style.getColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user