public static synchronized void SyncThreads() {
    // Return as soon as possible
    if (threads.size() == OrebfuscatorConfig.ProcessingThreads) {
      return;
    }

    // Less threads? Kill one
    else if (threads.size() > OrebfuscatorConfig.ProcessingThreads) {
      threads.getLast().kill.set(true);
      threads.getLast().interrupt();
      threads.removeLast();
      return;
    }

    // More threads? Start new one
    else {
      ChunkProcessingThread thread = new ChunkProcessingThread();
      thread.setName("Orebfuscator Processing Thread");
      try {
        thread.setPriority(OrebfuscatorConfig.OrebfuscatorPriority);
      } catch (Exception e) {
        thread.setPriority(Thread.MIN_PRIORITY);
      }
      thread.start();
      threads.add(thread);
    }
  }
 public static synchronized void KillAll() {
   for (ChunkProcessingThread thread : threads) {
     thread.kill.set(true);
     thread.interrupt();
   }
   threads.clear();
   queue.clear();
 }