mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 21:48:43 +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
|
* @return the old location
|
||||||
*/
|
*/
|
||||||
public Location getOldLocation() {
|
public Location getOldLocation() {
|
||||||
|
if (oldLocation.getWorld() == null) {
|
||||||
|
return Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||||
|
}
|
||||||
return oldLocation;
|
return oldLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,8 +430,9 @@ public class DPlayerData extends DREConfig {
|
|||||||
}
|
}
|
||||||
oldPotionEffects = (Collection<PotionEffect>) config.get(PREFIX_STATE_PERSISTENCE + "oldPotionEffects");
|
oldPotionEffects = (Collection<PotionEffect>) config.get(PREFIX_STATE_PERSISTENCE + "oldPotionEffects");
|
||||||
|
|
||||||
|
try {
|
||||||
oldLocation = (Location) config.get(PREFIX_STATE_PERSISTENCE + "oldLocation");
|
oldLocation = (Location) config.get(PREFIX_STATE_PERSISTENCE + "oldLocation");
|
||||||
if (oldLocation.getWorld() == null) {
|
} catch (IllegalArgumentException exception) {
|
||||||
oldLocation = Bukkit.getWorlds().get(0).getSpawnLocation();
|
oldLocation = Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user