mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 18:45:27 +01:00
Fix extra message when adding location. Begin GPS support. Bump version
This commit is contained in:
parent
4c00d0f766
commit
477bca5a69
9
pom.xml
9
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>3.5.5</version>
|
||||
<version>3.5.6</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
@ -186,6 +186,13 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/CitizensBooks-2.4.7.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.live.bemmamin</groupId>
|
||||
<artifactId>GPS</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/GPS.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -57,6 +57,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@ -188,7 +189,10 @@ public class PlayerListener implements Listener {
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent evt) {
|
||||
EquipmentSlot e = evt.getHand(); //Get the hand of the event and set it to 'e'.
|
||||
if (e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand)
|
||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||
|
||||
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
final Player player = evt.getPlayer();
|
||||
@ -280,6 +284,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
|
@ -182,13 +182,87 @@ public class Quest {
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
public boolean updateCompass(Quester quester, Stage nextStage) {
|
||||
if (!plugin.useCompass)
|
||||
/*protected boolean updateGPS(Quester quester, Stage nextStage) {
|
||||
if (Quests.gpsapi == null) {
|
||||
return false;
|
||||
Location targetLocation = null;
|
||||
}
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
Stage stage = quester.getCurrentStage(this);
|
||||
LinkedList<Location> targetLocations = new LinkedList<Location>();
|
||||
if (stage == null) {
|
||||
return false;
|
||||
}
|
||||
if (stage.citizensToInteract != null && stage.citizensToInteract.size() > 0) {
|
||||
for (Integer i : stage.citizensToInteract) {
|
||||
targetLocations.add(plugin.getNPCLocation(i));
|
||||
}
|
||||
} else if (stage.citizensToKill != null && stage.citizensToKill.size() > 0) {
|
||||
for (Integer i : stage.citizensToKill) {
|
||||
targetLocations.add(plugin.getNPCLocation(i));
|
||||
}
|
||||
} else if (stage.locationsToReach != null && stage.locationsToReach.size() > 0) {
|
||||
targetLocations = stage.locationsToReach;
|
||||
}
|
||||
if (targetLocations != null && !targetLocations.isEmpty()) {
|
||||
int index = 1;
|
||||
for (Location l : targetLocations) {
|
||||
if (l.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||
System.out.println("adding point " + index);
|
||||
Quests.gpsapi.addPoint("target" + index, l);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 1 ; i < targetLocations.size(); i++) {
|
||||
if (!Quests.gpsapi.gpsIsActive(quester.getPlayer())) {
|
||||
System.out.println("connecting point " + i + " and point " + (i + 1));
|
||||
Quests.gpsapi.connect("target" + i, "target" + (i + 1), true);
|
||||
}
|
||||
}
|
||||
System.out.println("destination set to " + "point " + (index - 1));
|
||||
Quests.gpsapi.startGPS(quester.getPlayer(), "target1", "target" + (index - 1));
|
||||
}
|
||||
return targetLocations != null && !targetLocations.isEmpty();
|
||||
}*/
|
||||
|
||||
public boolean updateCompass(Quester quester, Stage nextStage) {
|
||||
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) {
|
||||
@ -542,6 +616,11 @@ public class Quest {
|
||||
q.saveData();
|
||||
player.updateInventory();
|
||||
q.updateJournal();
|
||||
if (Quests.gpsapi != null) {
|
||||
if (Quests.gpsapi.gpsIsActive(player)) {
|
||||
Quests.gpsapi.stopGPS(player);
|
||||
}
|
||||
}
|
||||
q.findCompassTarget();
|
||||
}
|
||||
|
||||
|
@ -437,6 +437,7 @@ public class Quester {
|
||||
stage.startEvent.fire(this, q);
|
||||
}
|
||||
q.updateCompass(this, stage);
|
||||
//q.updateGPS(this, stage);
|
||||
saveData();
|
||||
} else {
|
||||
player.sendMessage(q.failRequirements);
|
||||
@ -746,7 +747,7 @@ public class Quester {
|
||||
*
|
||||
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
|
||||
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
|
||||
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocations
|
||||
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocation
|
||||
*
|
||||
* @deprecated Use containsObjective() instead
|
||||
* @param quest The quest to check objectives of
|
||||
@ -762,7 +763,7 @@ public class Quester {
|
||||
*
|
||||
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
|
||||
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
|
||||
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocations
|
||||
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocation
|
||||
*
|
||||
* @param quest The quest to check objectives of
|
||||
* @param s The type of objective to check for
|
||||
@ -802,7 +803,7 @@ public class Quester {
|
||||
return !getCurrentStage(quest).sheepToShear.isEmpty();
|
||||
} else if (s.equalsIgnoreCase("password")) {
|
||||
return !getCurrentStage(quest).passwordPhrases.isEmpty();
|
||||
} else if (s.equalsIgnoreCase("reachLocations")) {
|
||||
} else if (s.equalsIgnoreCase("reachLocation")) {
|
||||
return !getCurrentStage(quest).locationsToReach.isEmpty();
|
||||
} else {
|
||||
return false;
|
||||
@ -1148,6 +1149,12 @@ public class Quester {
|
||||
}
|
||||
|
||||
public void reachLocation(Quest quest, Location l) {
|
||||
if (getQuestData(quest).locationsReached == null) {
|
||||
return;
|
||||
}
|
||||
if (getQuestData(quest).locationsReached.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Location location : getQuestData(quest).locationsReached) {
|
||||
try {
|
||||
int index = getQuestData(quest).locationsReached.indexOf(location);
|
||||
@ -2693,6 +2700,11 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*if (Quests.gpsapi != null) {
|
||||
if (Quests.gpsapi.gpsIsActive(this.getPlayer())) {
|
||||
Quests.gpsapi.stopGPS(this.getPlayer());
|
||||
}
|
||||
}*/
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||
import com.live.bemmamin.gps.api.GPSAPI;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
@ -119,6 +120,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public static Permission permission = null;
|
||||
public static WorldGuardPlugin worldGuard = null;
|
||||
public static mcMMO mcmmo = null;
|
||||
public static GPSAPI gpsapi = null;
|
||||
public static Heroes heroes = null;
|
||||
public static PhatLoots phatLoots = null;
|
||||
public static PlaceholderAPIPlugin placeholder = null;
|
||||
@ -428,6 +430,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (isPluginReady("mcMMO")) {
|
||||
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
|
||||
}
|
||||
if (isPluginReady("GPS")) {
|
||||
gpsapi = new GPSAPI(this);
|
||||
}
|
||||
if (isPluginReady("Heroes")) {
|
||||
heroes = (Heroes) getServer().getPluginManager().getPlugin("Heroes");
|
||||
}
|
||||
@ -455,6 +460,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void onDisable() {
|
||||
getLogger().info("Saving Quester data.");
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
/*if (gpsapi != null) {
|
||||
if (gpsapi.gpsIsActive(p)) {
|
||||
gpsapi.stopGPS(p);
|
||||
}
|
||||
}*/
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
quester.saveData();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ description: An extensive questing system.
|
||||
website: https://www.spigotmc.org/resources/quests.3711/
|
||||
dev-url: https://github.com/FlyingPikachu/Quests
|
||||
author: HappyPikachu
|
||||
softdepend: [Citizens, CitizensBooks, Denizen, Heroes, mcMMO, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
|
||||
softdepend: [Citizens, CitizensBooks, Denizen, GPS, Heroes, mcMMO, PhatLoots, PlaceholderAPI, Vault, WorldGuard]
|
||||
permissions:
|
||||
quests.quest:
|
||||
description: View current quest objectives
|
||||
|
Loading…
Reference in New Issue
Block a user