mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-02 13:41:30 +01:00
Point the compass at the player's next target. TODO: Needs config options, etc.
This commit is contained in:
parent
ebfa61646a
commit
fccd3f03ec
@ -90,6 +90,8 @@ public class Quest {
|
||||
q.getPlayer().sendMessage(Quests.parseString(stageCompleteMessage, this));
|
||||
}
|
||||
|
||||
q.getPlayer().setCompassTarget(q.getPlayer().getWorld().getSpawnLocation());
|
||||
|
||||
if (q.getCurrentStage(this).delay < 0) {
|
||||
|
||||
Player player = q.getPlayer();
|
||||
@ -128,7 +130,7 @@ public class Quest {
|
||||
}
|
||||
|
||||
public void setStage(Quester quester, int stage) throws InvalidStageException {
|
||||
|
||||
org.bukkit.Bukkit.getLogger().info("SEt stage: " + stage);
|
||||
if (orderedStages.size() - 1 < stage) {
|
||||
throw new InvalidStageException(this, stage);
|
||||
}
|
||||
@ -147,9 +149,11 @@ public class Quest {
|
||||
/*if (quester.getCurrentStage(this).finishEvent != null) {
|
||||
quester.getCurrentStage(this).finishEvent.fire(quester);
|
||||
}*/
|
||||
if (quester.getCurrentStage(this).startEvent != null) {
|
||||
quester.getCurrentStage(this).startEvent.fire(quester, this);
|
||||
Stage nextStage = quester.getCurrentStage(this);
|
||||
if (nextStage.startEvent != null) {
|
||||
nextStage.startEvent.fire(quester, this);
|
||||
}
|
||||
updateCompass(quester, nextStage);
|
||||
|
||||
String msg = Lang.get("questObjectivesTitle");
|
||||
msg = msg.replaceAll("<quest>", name);
|
||||
@ -169,6 +173,22 @@ public class Quest {
|
||||
|
||||
}
|
||||
|
||||
public void updateCompass(Quester quester, Stage nextStage)
|
||||
{
|
||||
if (nextStage.citizensToInteract != null && nextStage.citizensToInteract.size() > 0)
|
||||
{
|
||||
quester.getPlayer().setCompassTarget(plugin.getNPCLocation(nextStage.citizensToInteract.getFirst()));
|
||||
}
|
||||
else if (nextStage.citizensToKill != null && nextStage.citizensToKill.size() > 0)
|
||||
{
|
||||
quester.getPlayer().setCompassTarget(plugin.getNPCLocation(nextStage.citizensToKill.getFirst()));
|
||||
}
|
||||
else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0)
|
||||
{
|
||||
quester.getPlayer().setCompassTarget(nextStage.locationsToReach.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -394,6 +394,7 @@ public class Quester {
|
||||
if (stage.startEvent != null) {
|
||||
stage.startEvent.fire(this, q);
|
||||
}
|
||||
q.updateCompass(this, stage);
|
||||
|
||||
saveData();
|
||||
|
||||
@ -3219,9 +3220,9 @@ if (quest != null) {
|
||||
boolean exists = false;
|
||||
|
||||
for (Quest q : plugin.quests) {
|
||||
|
||||
if (q.name.equalsIgnoreCase(quest.name)) {
|
||||
|
||||
Stage stage = getCurrentStage(quest);
|
||||
quest.updateCompass(this, stage);
|
||||
exists = true;
|
||||
if (q.equals(quest) == false) {
|
||||
|
||||
|
@ -4979,6 +4979,12 @@ try{
|
||||
|
||||
}
|
||||
|
||||
public Location getNPCLocation(int id) {
|
||||
|
||||
return citizens.getNPCRegistry().getById(id).getStoredLocation();
|
||||
|
||||
}
|
||||
|
||||
public String getNPCName(int id) {
|
||||
|
||||
return citizens.getNPCRegistry().getById(id).getName();
|
||||
|
Loading…
Reference in New Issue
Block a user