mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-26 20:55:54 +01:00
! Fix NPE in player listeners
This commit is contained in:
parent
7783144b68
commit
2fbea95b39
@ -379,17 +379,21 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (quester.currentQuests.isEmpty() == false) {
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (quester.getCurrentStage(quest).chatEvents.isEmpty() == false) {
|
||||
if (currentStage.chatEvents.isEmpty() == false) {
|
||||
|
||||
String chat = evt.getMessage();
|
||||
for (String s : quester.getCurrentStage(quest).chatEvents.keySet()) {
|
||||
for (String s : currentStage.chatEvents.keySet()) {
|
||||
|
||||
if (s.equalsIgnoreCase(chat)) {
|
||||
|
||||
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
|
||||
|
||||
quester.getCurrentStage(quest).chatEvents.get(s).fire(quester, quest);
|
||||
currentStage.chatEvents.get(s).fire(quester, quest);
|
||||
quester.getQuestData(quest).eventFired.put(s, true);
|
||||
|
||||
}
|
||||
@ -873,13 +877,17 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
Stage currentStage = quester.getCurrentStage(quest);
|
||||
if (currentStage == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (quester.getCurrentStage(quest).delay > -1) {
|
||||
if (currentStage.delay > -1) {
|
||||
quester.stopStageTimer(quest);
|
||||
}
|
||||
|
||||
if (quester.getCurrentStage(quest).disconnectEvent != null) {
|
||||
quester.getCurrentStage(quest).disconnectEvent.fire(quester, quest);
|
||||
if (currentStage.disconnectEvent != null) {
|
||||
currentStage.disconnectEvent.fire(quester, quest);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user