NexonExecutor - Library for Developers

Discussion in 'Resources' started by Canownueasy, Apr 5, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Canownueasy

    NexonExecutor
    The simple future logic executor.
    Explanation & Usage
    NexonExecutor executes runnable logic pieces in the future. For example, when somebody hits a block, you wish for a message to show 1 second later.​
    You could create this example environment with the following code:​
    Code:
    FutureExecutor.schedule(new Runnable() {
        @Override
        public void run() {
            player.sendMessage("Hey there!");
        }
    }, 1000);
    or, if you wish to specify the time unit​
    Code:
    FutureExecutor.schedule(new Runnable() {
        @Override
        public void run() {
            player.sendMessage("Hey there!");
        }
    }, 1000, TimeUnit.MILLISECONDS);
    Installation
    Simply add this runtime argument
    Code:
    -cp nexonexecutor.jar


     
  2. Offline

    rcjrrjcr

    Doesn't the Bukkit scheduler already do that? I don't see any new features compared to that.
     
  3. Offline

    LRFLEW

    what about java's default timer?
     
  4. Offline

    rcjrrjcr

    Decompiling this results in:
    Code:
    package com.nappo.util;
    
    import java.util.concurrent.Executors;
    import java.util.concurrent.ScheduledExecutorService;
    import java.util.concurrent.ScheduledFuture;
    import java.util.concurrent.TimeUnit;
    
    public final class FutureExecutor
    {
      private static final ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
    
      public static ScheduledFuture<?> schedule(Runnable logic, int delay, TimeUnit unit)
      {
        return service.schedule(logic, delay, unit);
      }
    
      public static ScheduledFuture<?> schedule(Runnable logic, int delay)
      {
        return schedule(logic, delay, TimeUnit.MILLISECONDS);
      }
    }
    
    What is the advantage of using this over directly using java.util.concurrent in plugins?
     
  5. Offline

    petteyg359

    A candidate for forum 63?
     
  6. Offline

    SpaceManiac

    This isn't any different than just using java.util.concurrent, which you shouldn't be anyways because there's BukkitScheduler.
     
  7. Offline

    rcjrrjcr

    Well, at least s?he didn't repackage jars like Neon Volcom.
     
  8. Offline

    Sammy

    Wow that's amazing, what's next ? a way to send msg to a player ? maybe cake ? [creeper]
    oh well, it made me laugh :D
     
  9. Offline

    Canownueasy

    The only advantage over using java.util.concurrent in plugins is this is far easier to declare.

    Other than that, it is just an implementation. I am very sorry if this is not the type of library you seek for :(
     
  10. Offline

    rcjrrjcr

    Plugins shouldn't use java.util.concurrent. For scheduling tasks, use the Bukkit scheduler. So, this library won't be used by anyone. Nice try at helping us though!:D
     
Thread Status:
Not open for further replies.

Share This Page