mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Fix error handling if a referenced world is unloaded; resolves #410
This commit is contained in:
parent
b236431456
commit
186dd1192b
@ -110,6 +110,9 @@ public class DPlayerData extends DREConfig {
|
||||
* @return the old location
|
||||
*/
|
||||
public Location getOldLocation() {
|
||||
if (oldLocation.getWorld() == null) {
|
||||
return Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||
}
|
||||
return oldLocation;
|
||||
}
|
||||
|
||||
@ -427,8 +430,9 @@ public class DPlayerData extends DREConfig {
|
||||
}
|
||||
oldPotionEffects = (Collection<PotionEffect>) config.get(PREFIX_STATE_PERSISTENCE + "oldPotionEffects");
|
||||
|
||||
oldLocation = (Location) config.get(PREFIX_STATE_PERSISTENCE + "oldLocation");
|
||||
if (oldLocation.getWorld() == null) {
|
||||
try {
|
||||
oldLocation = (Location) config.get(PREFIX_STATE_PERSISTENCE + "oldLocation");
|
||||
} catch (IllegalArgumentException exception) {
|
||||
oldLocation = Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user