User:TLULbot/Source/SetStatus.java

package tLULbot_v3;

import java.io.IOException;

import jBot.WikiSession; import jBot.Core.*;

public class SetStatus {   public static class Online extends Task {       public void setWikiSession(WikiSession wiki) {           w = wiki; }       protected int getPrinterVersion {           return 1; }       protected int getMainVersion {           return 2; }       private Runnable r = new Runnable {           public void run {               try {                   if (!w.isLoggedIn) {                       w.p.errString("You must be logged in to a user to set your status."); return; }                   makeOnline; }               catch (IOException e1) {                   w.p.errString("IOException: " + e1.getMessage); }               catch (jBotException e1) {                   w.p.errString("Error: " + e1.getMessage); }           }        };        public Runnable getRunnable {           return r;        } public String getTaskCommand {           return "online"; }       public String getTaskName {           return "Set user status to online."; }       private WikiSession w = null; private void makeOnline throws IOException, jBotException {           w.setWiki("runescape"); w.getText("User:" + w.getCurrentUser + "/Status"); w.editText("User:" + w.getCurrentUser + "/Status", "Online", "Setting status to online - automated.", false); w.p.outString("Status set to online."); }   }    public static class Vacation extends Task {       public void setWikiSession(WikiSession wiki) {           w = wiki; }       protected int getPrinterVersion {           return 1; }       protected int getMainVersion {           return 2; }       private Runnable r = new Runnable {           public void run {               try {                   if (!w.isLoggedIn) {                       w.p.errString("You must be logged in to a user to set your status."); return; }                   makeVacation; }               catch (IOException e1) {                   w.p.errString("IOException: " + e1.getMessage); }               catch (jBotException e1) {                   w.p.errString("Error: " + e1.getMessage); }           }        };        public Runnable getRunnable {           return r;        } public String getTaskCommand {           return "vacation"; }       public String getTaskName {           return "Set user status to vacation."; }       private WikiSession w = null; private void makeVacation throws IOException, jBotException {           w.setWiki("runescape"); w.getText("User:" + w.getCurrentUser + "/Status"); w.editText("User:" + w.getCurrentUser + "/Status", "Vacation", "Setting status to vacation - automated.", false); w.p.outString("Status set to vacation."); }   }    public static class Offline extends Task {       public void setWikiSession(WikiSession wiki) {           w = wiki; }       protected int getPrinterVersion {           return 1; }       protected int getMainVersion {           return 2; }       private Runnable r = new Runnable {           public void run {               try {                   if (!w.isLoggedIn) {                       w.p.errString("You must be logged in to a user to set your status."); return; }                   makeOffline; }               catch (IOException e1) {                   w.p.errString("IOException: " + e1.getMessage); }               catch (jBotException e1) {                   w.p.errString("Error: " + e1.getMessage); }           }        };        public Runnable getRunnable {           return r;        } public String getTaskCommand {           return "offline"; }       public String getTaskName {           return "Set user status to offline."; }       private WikiSession w = null; private void makeOffline throws IOException, jBotException {           w.setWiki("runescape"); w.getText("User:" + w.getCurrentUser + "/Status"); w.editText("User:" + w.getCurrentUser + "/Status", "Offline", "Setting status to offline - automated.", false); w.p.outString("Status set to offline."); }   } }