Fix error on quit during timer event, fixes #348. Bump version number

This commit is contained in:
HappyPikachu 2018-04-13 16:17:22 -04:00
parent 25be6a0e69
commit 995a7d8839
2 changed files with 15 additions and 9 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId> <artifactId>quests</artifactId>
<version>3.3.0</version> <version>3.3.1</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>

View File

@ -22,6 +22,7 @@ import java.util.Map.Entry;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -504,14 +505,19 @@ public class Quest {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void failQuest(Quester q) { public void failQuest(Quester q) {
Player player = plugin.getServer().getPlayer(q.id); if (plugin.getServer().getPlayer(q.id) != null) {
String title = Lang.get(player, "questTitle"); Player player = plugin.getServer().getPlayer(q.id);
title = title.replaceAll("<quest>", ChatColor.DARK_PURPLE + name + ChatColor.AQUA); String title = Lang.get(player, "questTitle");
player.sendMessage(ChatColor.AQUA + title); title = title.replaceAll("<quest>", ChatColor.DARK_PURPLE + name + ChatColor.AQUA);
player.sendMessage(ChatColor.RED + Lang.get(player, "questFailed")); player.sendMessage(ChatColor.AQUA + title);
q.hardQuit(this); player.sendMessage(ChatColor.RED + Lang.get(player, "questFailed"));
q.saveData(); q.hardQuit(this);
player.updateInventory(); q.saveData();
player.updateInventory();
} else {
q.hardQuit(this);
q.saveData();
}
q.updateJournal(); q.updateJournal();
} }