diff --git a/pom.xml b/pom.xml index 00c5b0340..314e88114 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ me.blackvein.quests quests - 3.5.5 + 3.5.6 quests https://github.com/FlyingPikachu/Quests/ jar @@ -186,6 +186,13 @@ system ${project.basedir}/lib/CitizensBooks-2.4.7.jar + + com.live.bemmamin + GPS + 2.2.2 + system + ${project.basedir}/lib/GPS.jar + diff --git a/src/main/java/me/blackvein/quests/PlayerListener.java b/src/main/java/me/blackvein/quests/PlayerListener.java index eccc72d2b..df544d870 100644 --- a/src/main/java/me/blackvein/quests/PlayerListener.java +++ b/src/main/java/me/blackvein/quests/PlayerListener.java @@ -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,97 +189,101 @@ public class PlayerListener implements Listener { @SuppressWarnings("deprecation") // since 1.13 @EventHandler public void onPlayerInteract(PlayerInteractEvent evt) { - 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(); - boolean hasObjective = false; - for (Quest quest : quester.currentQuests.keySet()) { - if (quester.containsObjective(quest, "useBlock")) { - ItemStack i = new ItemStack(evt.getClickedBlock().getType(), 1, evt.getClickedBlock().getState().getData().toItemStack().getDurability()); - quester.useBlock(quest, i); - hasObjective = true; - } - } - if (!hasObjective) { - if (plugin.questFactory.selectedBlockStarts.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.questFactory.selectedBlockStarts.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.eventFactory.selectedMobLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType()))+ ChatColor.GOLD + ")"); - } else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.questFactory.selectedKillLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer().getUniqueId())) { - Block block = evt.getClickedBlock(); - Location loc = block.getLocation(); - plugin.questFactory.selectedReachLocations.put(evt.getPlayer().getUniqueId(), block); - evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")"); - } else if (player.isConversing() == false) { - for (final Quest q : plugin.quests) { - if (q.blockStart != null) { - if (q.blockStart.equals(evt.getClickedBlock().getLocation())) { - if (quester.currentQuests.size() >= plugin.maxQuests && plugin.maxQuests > 0) { - String msg = Lang.get(player, "questMaxAllowed"); - msg = msg.replaceAll("", String.valueOf(plugin.maxQuests)); - player.sendMessage(ChatColor.YELLOW + msg); - } else { - if (quester.completedQuests.contains(q.getName())) { - if (q.cooldownPlanner > -1 && (quester.getDifference(q)) > 0) { - String early = Lang.get(player, "questTooEarly"); - early = early.replaceAll("", ChatColor.AQUA + q.getName() + ChatColor.YELLOW); - early = early.replaceAll("