Advertisement
Guest User

Rs2GameEngine.java

a guest
Oct 1st, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. package com.runesource.engine;
  2.  
  3. import java.util.concurrent.Executors;
  4. import java.util.concurrent.ScheduledExecutorService;
  5. import java.util.concurrent.TimeUnit;
  6.  
  7. import com.runesource.engine.task.TaskHandler;
  8.  
  9. /**
  10.  * Constructs the game reactor on its own thread.
  11.  *
  12.  * @author Lare96
  13.  * @author Kadet
  14.  *
  15.  */
  16. public class Rs2GameEngine implements Runnable {
  17.  
  18.     /**
  19.      * Constructs a {@link ScheduledExecutorService} for the {@link Rs2GameEngine}.
  20.      */
  21.     private static final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
  22.    
  23.     /**
  24.      * Constructs the {@link Rs2GameEngine}.
  25.      */
  26.     private Rs2GameEngine() { }
  27.    
  28.     /**
  29.      * Initializes the {@link Rs2GameEngine}.
  30.      */
  31.     public static void initalize() {
  32.         executor.scheduleAtFixedRate(new Rs2GameEngine(), 0, 600,
  33.                 TimeUnit.MILLISECONDS);
  34.     }
  35.    
  36.     @Override
  37.     public void run() {
  38.         try {
  39.             //TODO: World Process
  40.             TaskHandler.process();
  41.         } catch (Exception exception) {
  42.             exception.printStackTrace();
  43.             //TODO: World Disconnect
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement