package watson.analysis;

import watson.Controller;
import watson.chat.ChatClassifier;
import watson.chat.MethodChatHandler;
import watson.chat.TagDispatchChatHandler;

// ----------------------------------------------------------------------------
/**
 * Use (abuse) the {@link Analysis} mechanism to turn Watson displays on and off
 * when entering and leaving ModMode.
 */
public class ModModeAnalysis extends Analysis
{
  // --------------------------------------------------------------------------
  /**
   * Watch for mod.entermodmode and mod.leavemodmode and switch on and off
   * Watson displays.
   */
  @Override
  public void registerAnalysis(TagDispatchChatHandler tagDispatchChatHandler)
  {
    tagDispatchChatHandler.addChatHandler("mod.entermodmode",
      new MethodChatHandler(this, "changeModMode"));
    tagDispatchChatHandler.addChatHandler("mod.leavemodmode",
      new MethodChatHandler(this, "changeModMode"));
  } // registerAnalysis

  // --------------------------------------------------------------------------
  /**
   * This method is called by the {@link ChatClassifier} when a chat line is
   * assigned the "mod.entermodmode" or "mod.leavemodmode" category.
   */
  @SuppressWarnings("unused")
  private void changeModMode(watson.chat.ChatLine line)
  {
    Controller.instance.getDisplaySettings().setDisplayed(
      line.getCategory().getTag().equals("mod.entermodmode"));
  }
} // class ModModeAnalysis
@@ -363,18 +363,84 @@
  ModMode
+ or duties mode for the ModMode or Duties%0A * plugins, respectively
 .%0A
-
  */%0Apubl
@@ -996,16 +996,253 @@
 ode%22));%0A
+    tagDispatchChatHandler.addChatHandler(%22mod.enabledutymode%22,%0A      new MethodChatHandler(this, %22changeDutyMode%22));%0A    tagDispatchChatHandler.addChatHandler(%22mod.disabledutymode%22,%0A      new MethodChatHandler(this, %22changeDutyMode%22));%0A
   %7D // r
@@ -1645,16 +1645,16 @@
 played(%0A
-
       li
@@ -1711,16 +1711,479 @@
 %22));%0A  %7D
+%0A%0A  // --------------------------------------------------------------------------%0A  /**%0A   * This method is called by the %7B@link ChatClassifier%7D when a chat line is%0A   * assigned the %22mod.enabledutymode%22 or %22mod.disabledutymode%22 category.%0A   */%0A  @SuppressWarnings(%22unused%22)%0A  private void changeDutyMode(watson.chat.ChatLine line)%0A  %7B%0A    Controller.instance.getDisplaySettings().setDisplayed(%0A      line.getCategory().getTag().equals(%22mod.enabledutymode%22));%0A  %7D
 %0A%7D // cl

Allow the default Duties plugin /dutymode messages to enable/disable the Watson display.