diff --git a/pom.xml b/pom.xml
index 55df222a7..76710660d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
me.blackvein.quests
quests
- 1.9.0
+ 2.0.0
quests
http://dev.bukkit.org/server-mods/quests/
jar
diff --git a/src/main/java/me/blackvein/quests/NpcEffectThread.java b/src/main/java/me/blackvein/quests/NpcEffectThread.java
index 4cc53b21d..a8cfab4bc 100644
--- a/src/main/java/me/blackvein/quests/NpcEffectThread.java
+++ b/src/main/java/me/blackvein/quests/NpcEffectThread.java
@@ -52,11 +52,11 @@ public class NpcEffectThread implements Runnable {
private static void showEffect(Player player, NPC npc) {
- if (Bukkit.getVersion().contains("1.7.2")) {
+ if (Bukkit.getBukkitVersion().contains("1.7.2")) {
showEffect_R1(player, npc);
- } else if (Bukkit.getVersion().contains("1.7.9")) {
+ } else if (Bukkit.getBukkitVersion().contains("1.7.9")) {
showEffect_R3(player, npc);
- } else if (Bukkit.getVersion().contains("1.7.10")) {
+ } else if (Bukkit.getBukkitVersion().contains("1.7.10")) {
showEffect_R4(player, npc);
}
diff --git a/src/main/java/me/blackvein/quests/NpcListener.java b/src/main/java/me/blackvein/quests/NpcListener.java
index 5882ae558..97eb7a7c5 100644
--- a/src/main/java/me/blackvein/quests/NpcListener.java
+++ b/src/main/java/me/blackvein/quests/NpcListener.java
@@ -92,10 +92,11 @@ public class NpcListener implements Listener {
if (quester.hasObjective(quest, "talkToNPC")) {
- quester.interactWithNPC(quest, evt.getNPC());
- if (quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
+ if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
hasObjective = true;
}
+
+ quester.interactWithNPC(quest, evt.getNPC());
}
@@ -111,7 +112,7 @@ public class NpcListener implements Listener {
continue;
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
- if (Quests.ignoreLockedQuests) {
+ if (Quests.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1)) {
if (q.testRequirements(quester)) {
npcQuests.add(q);
}
@@ -125,8 +126,7 @@ public class NpcListener implements Listener {
if (npcQuests.isEmpty() == false && npcQuests.size() > 1) {
if (plugin.questNPCGUIs.contains(evt.getNPC().getId())) {
-
- quester.showGUIDisplay(npcQuests);
+ quester.showGUIDisplay(evt.getNPC(), npcQuests);
return;
}
diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java
index b429e4ee1..1b97799e7 100644
--- a/src/main/java/me/blackvein/quests/PlayerListener.java
+++ b/src/main/java/me/blackvein/quests/PlayerListener.java
@@ -28,6 +28,7 @@ import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerFishEvent.State;
@@ -48,29 +49,31 @@ public class PlayerListener implements Listener, ColorUtil {
InventoryAction ac = evt.getAction();
- if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCurrentItem())) {
+ if(ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem())) {
if(ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)
|| ac.equals(InventoryAction.DROP_ALL_SLOT)
|| ac.equals(InventoryAction.DROP_ONE_SLOT)) {
evt.setCancelled(true);
+ return;
}
- } else if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCursor())) {
+ } else if(ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCursor())) {
if(ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)
|| ac.equals(InventoryAction.DROP_ALL_CURSOR)
|| ac.equals(InventoryAction.DROP_ONE_CURSOR)) {
evt.setCancelled(true);
+ return;
}
}
- if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCursor()) || evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCurrentItem())) {
+ if(ItemUtil.isItem(evt.getCurrentItem()) && ItemUtil.isJournal(evt.getCurrentItem()) || ItemUtil.isItem(evt.getCursor()) && ItemUtil.isJournal(evt.getCursor())) {
int upper = evt.getView().getTopInventory().getSize();
if(evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
@@ -80,6 +83,117 @@ public class PlayerListener implements Listener, ColorUtil {
if(relative < 0 || relative >= (lower)) {
evt.setCancelled(true);
+ return;
+ }
+
+ }
+
+ Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
+ Player player = (Player) evt.getWhoClicked();
+
+ if (evt.getInventory().getTitle().contains(Lang.get("quests"))) {
+
+ ItemStack clicked = evt.getCurrentItem();
+ if (clicked != null) {
+
+ for (Quest quest : plugin.quests) {
+
+ if (quest.guiDisplay != null) {
+
+ if (ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
+
+ if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) {
+
+ String msg = Lang.get("questMaxAllowed");
+ msg = msg.replaceAll("", String.valueOf(Quests.maxQuests));
+ player.sendMessage(YELLOW + msg);
+
+ } else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
+ String completed = Lang.get("questAlreadyCompleted");
+ completed = completed.replaceAll("", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
+ player.sendMessage(ChatColor.YELLOW + completed);
+ } else {
+
+ boolean takeable = true;
+
+ if (quester.completedQuests.contains(quest.name)) {
+
+ if (quester.getDifference(quest) > 0) {
+ String early = Lang.get("questTooEarly");
+ early = early.replaceAll("", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
+ early = early.replaceAll("