mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-15 15:16:41 +01:00
Clarify region start methods
This commit is contained in:
parent
6eecb62c0c
commit
fd04e25976
@ -55,11 +55,11 @@ public class Quest {
|
||||
private String name;
|
||||
protected String description;
|
||||
protected String finished;
|
||||
protected String region = null;
|
||||
protected ItemStack guiDisplay = null;
|
||||
private LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
||||
protected NPC npcStart;
|
||||
protected Location blockStart;
|
||||
protected String regionStart = null;
|
||||
protected Action initialAction;
|
||||
private Requirements reqs = new Requirements();
|
||||
private Planner pln = new Planner();
|
||||
@ -94,12 +94,26 @@ public class Quest {
|
||||
this.finished = finished;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
public String getRegionStart() {
|
||||
return regionStart;
|
||||
}
|
||||
|
||||
public void setRegionStart(String regionStart) {
|
||||
this.regionStart = regionStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRegionStart()}
|
||||
*/
|
||||
public String getRegion() {
|
||||
return getRegionStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setRegion(String)}
|
||||
*/
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
setRegionStart(region);
|
||||
}
|
||||
|
||||
public ItemStack getGUIDisplay() {
|
||||
@ -781,11 +795,11 @@ public class Quest {
|
||||
* @return true if player is in region
|
||||
*/
|
||||
private boolean isInRegion(Player player) {
|
||||
if (region == null) {
|
||||
if (regionStart == null) {
|
||||
return false;
|
||||
}
|
||||
if (plugin.getDependencies().getWorldGuardApi()
|
||||
.getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(region)) {
|
||||
.getApplicableRegionsIDs(player.getWorld(), player.getLocation()).contains(regionStart)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -528,8 +528,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (q.initialAction != null) {
|
||||
cc.setSessionData(CK.Q_INITIAL_EVENT, q.initialAction.getName());
|
||||
}
|
||||
if (q.region != null) {
|
||||
cc.setSessionData(CK.Q_REGION, q.region);
|
||||
if (q.regionStart != null) {
|
||||
cc.setSessionData(CK.Q_REGION, q.regionStart);
|
||||
}
|
||||
if (q.guiDisplay != null) {
|
||||
cc.setSessionData(CK.Q_GUIDISPLAY, q.guiDisplay);
|
||||
|
@ -3508,7 +3508,7 @@ public class Quester {
|
||||
return false;
|
||||
}
|
||||
if (canAcceptOffer(quest, giveReason)) {
|
||||
if (quest.getRegion() != null) {
|
||||
if (quest.getRegionStart() != null) {
|
||||
if (!quest.isInRegion(this)) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "questInvalidLocation");
|
||||
|
@ -1548,7 +1548,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (World world : getServer().getWorlds()) {
|
||||
if (getDependencies().getWorldGuardApi().getRegionManager(world) != null) {
|
||||
if (getDependencies().getWorldGuardApi().getRegionManager(world).hasRegion(region)) {
|
||||
quest.region = region;
|
||||
quest.regionStart = region;
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class PlayerListener implements Listener {
|
||||
takeable = false;
|
||||
}
|
||||
}
|
||||
if (quest.getRegion() != null) {
|
||||
if (quest.getRegionStart() != null) {
|
||||
if (!quest.isInRegion(quester)) {
|
||||
String invalidLoc = Lang.get(player, "questInvalidLocation");
|
||||
invalidLoc = invalidLoc.replace("<quest>", ChatColor.AQUA + quest.getName()
|
||||
|
Loading…
Reference in New Issue
Block a user