Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Created September 4, 2012 21:11
Show Gist options
  • Save volgar1x/3626553 to your computer and use it in GitHub Desktop.
Save volgar1x/3626553 to your computer and use it in GitHub Desktop.
import org.shivas.server.core.plugins.Plugin
import org.shivas.server.core.plugins.Startable
import com.google.common.collect.Lists
import javax.swing.Timer
class PubManagerPlugin extends Plugin {
final String author = "Blackrush"
final String version = "alpha1"
final String help = "Sends pub message in global channel"
Collection<Startable> getServices() {
return Lists.newArrayList(new PubManagerService())
}
}
class PubManagerService implements Startable {
static final int RATE = 2 * 60
private Timer timer
String pubMessage
public PubManagerService() {
timer = new Timer(
RATE * 1000,
evt -> send()
)
}
private void send() {
Shivas.getGservice().system().send(null, pubMessage)
}
void start() {
timer.start()
}
void stop() {
timer.stop()
}
}
plugin = new PubManagerPlugin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment