Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move conversation listener to separate class
- Loading branch information
Showing
2 changed files
with
33 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
main/src/main/java/me/blackvein/quests/listeners/ConvoListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package me.blackvein.quests.listeners; | ||
|
||
import me.blackvein.quests.util.Lang; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.conversations.ConversationAbandonedEvent; | ||
import org.bukkit.conversations.ConversationAbandonedListener; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ConvoListener implements ConversationAbandonedListener { | ||
|
||
@Override | ||
public void conversationAbandoned(@NotNull final ConversationAbandonedEvent abandonedEvent) { | ||
if (!abandonedEvent.gracefulExit()) { | ||
try { | ||
abandonedEvent.getContext().getForWhom().sendRawMessage(ChatColor.YELLOW | ||
+ Lang.get((Player) abandonedEvent.getContext().getForWhom(), "questTimeout")); | ||
} catch (final Exception e) { | ||
// Do nothing | ||
} | ||
} | ||
} | ||
} |