mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-15 07:05:51 +01:00
Move related utility methods to dependency class, part 2
This commit is contained in:
parent
88f00621c1
commit
6af64c7eed
@ -14,6 +14,7 @@ package me.blackvein.quests;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
@ -226,6 +227,14 @@ public class Dependencies {
|
||||
return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester);
|
||||
}
|
||||
|
||||
public Location getNPCLocation(int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getStoredLocation();
|
||||
}
|
||||
|
||||
public String getNPCName(int id) {
|
||||
return citizens.getNPCRegistry().getById(id).getName();
|
||||
}
|
||||
|
||||
public int getMcmmoSkillLevel(SkillType st, String player) {
|
||||
McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||
if (mPlayer == null) {
|
||||
|
@ -289,9 +289,9 @@ public class Quest {
|
||||
}
|
||||
Location targetLocation = null;
|
||||
if (nextStage.citizensToInteract != null && nextStage.citizensToInteract.size() > 0) {
|
||||
targetLocation = plugin.getNPCLocation(nextStage.citizensToInteract.getFirst());
|
||||
targetLocation = plugin.getDependencies().getNPCLocation(nextStage.citizensToInteract.getFirst());
|
||||
} else if (nextStage.citizensToKill != null && nextStage.citizensToKill.size() > 0) {
|
||||
targetLocation = plugin.getNPCLocation(nextStage.citizensToKill.getFirst());
|
||||
targetLocation = plugin.getDependencies().getNPCLocation(nextStage.citizensToKill.getFirst());
|
||||
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
|
||||
targetLocation = nextStage.locationsToReach.getFirst();
|
||||
} else if (nextStage.itemDeliveryTargets != null && nextStage.itemDeliveryTargets.size() > 0) {
|
||||
|
@ -3706,12 +3706,18 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return getAction(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use Dependencies.getNPCLocation(int)
|
||||
*/
|
||||
public Location getNPCLocation(int id) {
|
||||
return depends.getCitizens().getNPCRegistry().getById(id).getStoredLocation();
|
||||
return depends.getNPCLocation(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use Dependencies.getNPCName(int)
|
||||
*/
|
||||
public String getNPCName(int id) {
|
||||
return depends.getCitizens().getNPCRegistry().getById(id).getName();
|
||||
return depends.getNPCName(id);
|
||||
}
|
||||
|
||||
public static int countInv(Inventory inv, Material m, int subtract) {
|
||||
@ -3728,15 +3734,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
|
||||
/**
|
||||
* Checks whether an NPC has a quest that the player may accept
|
||||
*
|
||||
* @param npc The giver NPC to check
|
||||
* @param quester The player to check
|
||||
* @return true if at least one quest is available
|
||||
* @return true if at least one quest is available and not yet completed
|
||||
*/
|
||||
public boolean hasQuest(NPC npc, Quester quester) {
|
||||
for (Quest q : quests) {
|
||||
// Return false for expired quests
|
||||
|
||||
// Return true if not yet completed
|
||||
if (q.npcStart != null && quester.completedQuests.contains(q.getName()) == false) {
|
||||
if (q.npcStart.getId() == npc.getId()) {
|
||||
boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||
|
Loading…
Reference in New Issue
Block a user