Code: Show/Hide TimerTask task = new TimerTask(){ public void run(){ m_botAction.sendUnfilteredPublicMessage("*flags"); } }; if( message.equals( "on" ) ){ tt.scheduleAtFixedRate(task, initialDelay, period); flagStatus = on; m_botAction.sendPrivateMessage( name, "Flag Announcing is ON" ); } else if( message.equals("off" ) ){ m_botAction.sendPrivateMessage( name, "Flag announcing off." ); running=false; tt.cancel(); tt=null; boolean cancel; flagStatus = off; } |
Code: Show/Hide timertask = new TimerTask(); |
Code: Show/Hide TimerTask task = new TimerTask()
{ public void run() { if(announceFlags) m_botAction.sendUnfilteredPublicMessage("*flags"); } }; |
Code: Show/Hide public void flags(String name, String message){ if(oplist.isSmod(name)){ Timer tt = new Timer(); int initialDelay = 5000; // start after 5 seconds int period = 600000; // repeat every 10 minutes TimerTask task = new TimerTask(){ public void run(){ m_botAction.sendUnfilteredPublicMessage("*flags"); } }; if( message.equals( "on" ) ){ tt.scheduleAtFixedRate(task, initialDelay, period); flagStatus = on; m_botAction.sendPrivateMessage( name, "Flag Announcing is ON" ); } else if( message.equals("off" ) ){ m_botAction.sendPrivateMessage( name, "Flag announcing off." ); tt.cancel(); m_botAction.cancelTasks(); flagStatus = off; } } } |