@@ -24,11 +24,13 @@ public class InactivityConversationCanceller implements ConversationCanceller {
|
||||
this.timeoutSeconds = timeoutSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConversation(@NotNull Conversation conversation) {
|
||||
this.conversation = conversation;
|
||||
startTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelBasedOnInput(@NotNull ConversationContext context, @NotNull String input) {
|
||||
// Reset the inactivity timer
|
||||
stopTimer();
|
||||
@@ -36,6 +38,7 @@ public class InactivityConversationCanceller implements ConversationCanceller {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ConversationCanceller clone() {
|
||||
return new InactivityConversationCanceller(plugin, timeoutSeconds);
|
||||
@@ -46,6 +49,7 @@ public class InactivityConversationCanceller implements ConversationCanceller {
|
||||
*/
|
||||
private void startTimer() {
|
||||
taskId = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (conversation.getState() == Conversation.ConversationState.UNSTARTED) {
|
||||
startTimer();
|
||||
|
||||
Reference in New Issue
Block a user