Additional checks when resetting compass location, see #1117

This commit is contained in:
PikaMug 2020-03-14 20:05:43 -04:00
parent 0fec3b35fe
commit 51179e6f5a

View File

@ -3559,19 +3559,23 @@ public class Quester {
* Will set to Quester's spawn location if bed spawn does not exist * Will set to Quester's spawn location if bed spawn does not exist
*/ */
public void resetCompass() { public void resetCompass() {
Player player = getPlayer();
if (player == null) {
return;
}
if (!getPlayer().hasPermission("quests.compass")) { if (!getPlayer().hasPermission("quests.compass")) {
return; return;
} }
Player player = getPlayer();
if (player == null)
return;
Location defaultLocation = player.getBedSpawnLocation(); Location defaultLocation = player.getBedSpawnLocation();
if (defaultLocation == null) { if (defaultLocation == null) {
defaultLocation = player.getWorld().getSpawnLocation(); defaultLocation = player.getWorld().getSpawnLocation();
} }
compassTargetQuestId = null; compassTargetQuestId = null;
if (defaultLocation != null) {
player.setCompassTarget(defaultLocation); player.setCompassTarget(defaultLocation);
} }
}
/** /**
* Update compass target to current stage of first available current quest, if possible * Update compass target to current stage of first available current quest, if possible