Exemplo n.º 1
0
 @Deprecated
 public boolean next() {
   int amount = Settings.QUEUE.PARALLEL_THREADS;
   ExecutorCompletionService service = SetQueue.IMP.getCompleterService();
   long time = 20; // 30ms
   return next(amount, service, time);
 }
 @Command(
     aliases = {"/getlighting"},
     desc = "Get the light at a position",
     min = 0,
     max = 0)
 @CommandPermissions("worldedit.light.fix")
 public void getlighting(Player player, EditSession editSession) throws WorldEditException {
   FawePlayer fp = FawePlayer.wrap(player);
   final FaweLocation loc = fp.getLocation();
   FaweQueue queue = SetQueue.IMP.getNewQueue(loc.world, true, false);
   fp.sendMessage(
       "Light: "
           + queue.getEmmittedLight(loc.x, loc.y, loc.z)
           + " | "
           + queue.getSkyLight(loc.x, loc.y, loc.z));
 }
Exemplo n.º 3
0
 /** Lock the thread until the queue is empty */
 public void flush(int time) {
   if (size() > 0) {
     if (Fawe.get().isMainThread()) {
       SetQueue.IMP.flush(this);
     } else {
       if (enqueue()) {
         while (!isEmpty() && getStage() == SetQueue.QueueStage.ACTIVE) {
           synchronized (this) {
             try {
               this.wait(time);
             } catch (InterruptedException e) {
               e.printStackTrace();
             }
           }
         }
       }
     }
   }
 }
 @Command(
     aliases = {"/setskylight"},
     desc = "Set sky lighting in a selection",
     min = 1,
     max = 1)
 @CommandPermissions("worldedit.light.set")
 public void setskylighting(
     Player player, EditSession editSession, @Selection Region region, int value) {
   FawePlayer fp = FawePlayer.wrap(player);
   final FaweLocation loc = fp.getLocation();
   final int cx = loc.x >> 4;
   final int cz = loc.z >> 4;
   final NMSMappedFaweQueue queue =
       (NMSMappedFaweQueue) SetQueue.IMP.getNewQueue(fp.getWorld(), true, false);
   for (Vector pt : region) {
     queue.setSkyLight((int) pt.x, (int) pt.y, (int) pt.z, value);
   }
   int count = 0;
   for (Vector2D chunk : region.getChunks()) {
     queue.sendChunk(queue.getFaweChunk(chunk.getBlockX(), chunk.getBlockZ()));
     count++;
   }
   BBC.UPDATED_LIGHTING_SELECTION.send(fp, count);
 }
Exemplo n.º 5
0
 public void dequeue() {
   SetQueue.IMP.dequeue(this);
 }
Exemplo n.º 6
0
 public boolean enqueue() {
   return SetQueue.IMP.enqueue(this);
 }