Package ch.njol.skript.util

Examples of ch.njol.skript.util.Task


 
  @Nullable
  static Task checkerTask = null;
 
  static void start() {
    checkerTask = new Task(Skript.getInstance(), 0, true) {
      @SuppressWarnings("null")
      @Override
      public void run() {
        if (!SkriptConfig.checkForNewVersion.value())
          return;
View Full Code Here


   
    Bukkit.getPluginManager().registerEvents(new Listener() {
      @EventHandler
      public void onJoin(final PlayerJoinEvent e) {
        if (e.getPlayer().hasPermission("skript.admin")) {
          new Task(Skript.this, 0) {
            @Override
            public void run() {
              Updater.stateLock.readLock().lock();
              try {
                final Player p = e.getPlayer();
View Full Code Here

      if (task != null) {
        return true;
      }
     
      // Begin hitting the server with glorious data
      task = new Task(plugin, 0, PING_INTERVAL * 1200, true) {
       
        private boolean firstPost = true;
       
        @Override
        public void run() {
View Full Code Here

   
    synchronized (fileLock) { // only synchronised because of the assertion in connect()
      connect();
    }
   
    saveTask = new Task(Skript.getInstance(), 5 * 60 * 20, 5 * 60 * 20, true) {
      @Override
      public void run() {
        if (changes.get() >= REQUIRED_CHANGES_FOR_RESAVE) {
          try {
            Variables.getReadLock().lock();
View Full Code Here

   *
   * @param finalSave whether this is the last save in this session or not.
   */
  public final void saveVariables(final boolean finalSave) {
    if (finalSave) {
      final Task st = saveTask;
      if (st != null)
        st.cancel();
      final Task bt = backupTask;
      if (bt != null)
        bt.cancel();
    }
    try {
      Variables.getReadLock().lock();
      synchronized (fileLock) {
        try {
View Full Code Here

 
  public void startBackupTask(final Timespan t) {
    final File file = this.file;
    if (file == null || t.getTicks() == 0)
      return;
    backupTask = new Task(Skript.getInstance(), t.getTicks(), t.getTicks(), true) {
      @Override
      public void run() {
        synchronized (fileLock) {
          disconnect();
          try {
View Full Code Here

      Skript.error("Cannot connect to the database '" + databaseName + "'!");
      return false;
    }
   
    // periodically executes queries to keep the collection alive
    final Task keepAlive = new Task(Skript.getInstance(), 20, 20, true) {
      @Override
      public void run() {
        synchronized (dbLock) {
          try {
            final Database db = (Database) DatabaseStorage.this.db;
View Full Code Here

        if (r != null)
          r.close();
      }
     
      if (!closed) { // Skript may have been disabled in the meantime // TODO not fixed
        new Task(Skript.getInstance(), (long) Math.ceil(2. * monitor_interval / 50) + 100, true) { // 2 times the interval + 5 seconds
          @Override
          public void run() {
            try {
              synchronized (dbLock) {
                if (closed || db == null)
View Full Code Here

TOP

Related Classes of ch.njol.skript.util.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.