mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-22 17:17:38 +01:00
Support GPS for location objectives, fixes #295
This commit is contained in:
parent
c07e361ec7
commit
e5e673be7c
BIN
lib/GPSAPI.jar
Normal file
BIN
lib/GPSAPI.jar
Normal file
Binary file not shown.
9
pom.xml
9
pom.xml
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<groupId>me.blackvein.quests</groupId>
|
<groupId>me.blackvein.quests</groupId>
|
||||||
<artifactId>quests</artifactId>
|
<artifactId>quests</artifactId>
|
||||||
<version>3.5.7</version>
|
<version>3.5.8</version>
|
||||||
<name>quests</name>
|
<name>quests</name>
|
||||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -186,6 +186,13 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/lib/CitizensBooks-2.4.7.jar</systemPath>
|
<systemPath>${project.basedir}/lib/CitizensBooks-2.4.7.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.live.bemmamin</groupId>
|
||||||
|
<artifactId>GPS</artifactId>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${project.basedir}/lib/GPSAPI.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -182,37 +182,7 @@ public class Quest {
|
|||||||
quester.updateJournal();
|
quester.updateJournal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*protected boolean updateGPS(Quester quester, Stage nextStage) {
|
protected boolean updateGPS(Quester quester) {
|
||||||
if (Quests.gpsapi == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!plugin.useCompass) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (nextStage == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Location targetLocation = null;
|
|
||||||
if (nextStage.citizensToInteract != null && nextStage.citizensToInteract.size() > 0) {
|
|
||||||
targetLocation = plugin.getNPCLocation(nextStage.citizensToInteract.getFirst());
|
|
||||||
} else if (nextStage.citizensToKill != null && nextStage.citizensToKill.size() > 0) {
|
|
||||||
targetLocation = plugin.getNPCLocation(nextStage.citizensToKill.getFirst());
|
|
||||||
} else if (nextStage.locationsToReach != null && nextStage.locationsToReach.size() > 0) {
|
|
||||||
targetLocation = nextStage.locationsToReach.getFirst();
|
|
||||||
}
|
|
||||||
if (targetLocation != null) {
|
|
||||||
if (targetLocation.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
|
||||||
Quests.gpsapi.addPoint("questsObjective-" + System.currentTimeMillis(), targetLocation);
|
|
||||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
|
||||||
Quests.gpsapi.startGPS(quester.getPlayer(), "questsObjective-" + System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return targetLocation != null;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*protected boolean startGPS(Quester quester) {
|
|
||||||
if (Quests.gpsapi == null) {
|
if (Quests.gpsapi == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -230,30 +200,30 @@ public class Quest {
|
|||||||
targetLocations.add(plugin.getNPCLocation(i));
|
targetLocations.add(plugin.getNPCLocation(i));
|
||||||
}
|
}
|
||||||
} else if (stage.locationsToReach != null && stage.locationsToReach.size() > 0) {
|
} else if (stage.locationsToReach != null && stage.locationsToReach.size() > 0) {
|
||||||
targetLocations = stage.locationsToReach;
|
targetLocations.addAll(stage.locationsToReach);
|
||||||
}
|
}
|
||||||
if (targetLocations != null && !targetLocations.isEmpty()) {
|
if (targetLocations != null && !targetLocations.isEmpty()) {
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
String pointName = "quests-" + quester.getPlayer().getUniqueId().toString();
|
||||||
for (Location l : targetLocations) {
|
for (Location l : targetLocations) {
|
||||||
if (l.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
if (l.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
||||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||||
System.out.println("adding point " + index);
|
Quests.gpsapi.addPoint(pointName + index, l);
|
||||||
Quests.gpsapi.addPoint("target" + index, l);
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 1 ; i < targetLocations.size(); i++) {
|
for (int i = 1 ; i < targetLocations.size(); i++) {
|
||||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||||
System.out.println("connecting point " + i + " and point " + (i + 1));
|
Quests.gpsapi.connect(pointName + i, pointName + (i + 1), true);
|
||||||
Quests.gpsapi.connect("target" + i, "target" + (i + 1), true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("destination set to " + "point " + (index - 1));
|
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||||
Quests.gpsapi.startGPS(quester.getPlayer(), "target1", "target" + (index - 1));
|
Quests.gpsapi.startGPS(quester.getPlayer(), pointName + (index - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return targetLocations != null && !targetLocations.isEmpty();
|
return targetLocations != null && !targetLocations.isEmpty();
|
||||||
}*/
|
}
|
||||||
|
|
||||||
public boolean updateCompass(Quester quester, Stage nextStage) {
|
public boolean updateCompass(Quester quester, Stage nextStage) {
|
||||||
if (!plugin.useCompass) {
|
if (!plugin.useCompass) {
|
||||||
@ -616,11 +586,11 @@ public class Quest {
|
|||||||
q.saveData();
|
q.saveData();
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
q.updateJournal();
|
q.updateJournal();
|
||||||
/*if (Quests.gpsapi != null) {
|
if (Quests.gpsapi != null) {
|
||||||
if (Quests.gpsapi.gpsIsActive(player)) {
|
if (Quests.gpsapi.gpsIsActive(player)) {
|
||||||
Quests.gpsapi.stopGPS(player);
|
Quests.gpsapi.stopGPS(player);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
q.findCompassTarget();
|
q.findCompassTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ public class Quester {
|
|||||||
stage.startEvent.fire(this, q);
|
stage.startEvent.fire(this, q);
|
||||||
}
|
}
|
||||||
q.updateCompass(this, stage);
|
q.updateCompass(this, stage);
|
||||||
//q.updateGPS(this, stage);
|
q.updateGPS(this);
|
||||||
saveData();
|
saveData();
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(q.failRequirements);
|
player.sendMessage(q.failRequirements);
|
||||||
@ -2701,11 +2701,11 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*if (Quests.gpsapi != null) {
|
if (Quests.gpsapi != null) {
|
||||||
if (Quests.gpsapi.gpsIsActive(this.getPlayer())) {
|
if (Quests.gpsapi.gpsIsActive(this.getPlayer())) {
|
||||||
Quests.gpsapi.stopGPS(this.getPlayer());
|
Quests.gpsapi.stopGPS(this.getPlayer());
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
import com.herocraftonline.heroes.Heroes;
|
import com.herocraftonline.heroes.Heroes;
|
||||||
import com.herocraftonline.heroes.characters.Hero;
|
import com.herocraftonline.heroes.characters.Hero;
|
||||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||||
|
import com.live.bemmamin.gps.api.GPSAPI;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
@ -119,7 +120,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public static Permission permission = null;
|
public static Permission permission = null;
|
||||||
public static WorldGuardPlugin worldGuard = null;
|
public static WorldGuardPlugin worldGuard = null;
|
||||||
public static mcMMO mcmmo = null;
|
public static mcMMO mcmmo = null;
|
||||||
//public static GPSAPI gpsapi = null;
|
public static GPSAPI gpsapi = null;
|
||||||
public static Heroes heroes = null;
|
public static Heroes heroes = null;
|
||||||
public static PhatLoots phatLoots = null;
|
public static PhatLoots phatLoots = null;
|
||||||
public static PlaceholderAPIPlugin placeholder = null;
|
public static PlaceholderAPIPlugin placeholder = null;
|
||||||
@ -429,9 +430,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
if (isPluginReady("mcMMO")) {
|
if (isPluginReady("mcMMO")) {
|
||||||
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
|
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
|
||||||
}
|
}
|
||||||
/*if (isPluginReady("GPS")) {
|
if (isPluginReady("GPS")) {
|
||||||
gpsapi = new GPSAPI(this);
|
gpsapi = new GPSAPI(this);
|
||||||
}*/
|
}
|
||||||
if (isPluginReady("Heroes")) {
|
if (isPluginReady("Heroes")) {
|
||||||
heroes = (Heroes) getServer().getPluginManager().getPlugin("Heroes");
|
heroes = (Heroes) getServer().getPluginManager().getPlugin("Heroes");
|
||||||
}
|
}
|
||||||
@ -459,11 +460,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
getLogger().info("Saving Quester data.");
|
getLogger().info("Saving Quester data.");
|
||||||
for (Player p : getServer().getOnlinePlayers()) {
|
for (Player p : getServer().getOnlinePlayers()) {
|
||||||
/*if (gpsapi != null) {
|
if (gpsapi != null) {
|
||||||
if (gpsapi.gpsIsActive(p)) {
|
if (gpsapi.gpsIsActive(p)) {
|
||||||
gpsapi.stopGPS(p);
|
gpsapi.stopGPS(p);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
Quester quester = getQuester(p.getUniqueId());
|
Quester quester = getQuester(p.getUniqueId());
|
||||||
quester.saveData();
|
quester.saveData();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user