Advertisement
tryashtar

function command

Jan 10th, 2021
1,022
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. public int execute(CommandFunction commandFunction, CommandSourceStack commandSourceStack) {
  2.     int n = this.getCommandLimit();
  3.     if (this.isInFunction) {
  4.         if (this.commandQueue.size() + this.nestedCalls.size() < n) {
  5.             this.nestedCalls.add(new QueuedCommand(this, commandSourceStack, new CommandFunction.FunctionEntry(commandFunction)));
  6.         }
  7.         return 0;
  8.     }
  9.     try {
  10.         int n2;
  11.         this.isInFunction = true;
  12.         int n3 = 0;
  13.         CommandFunction.Entry[] arrentry = commandFunction.getEntries();
  14.         for (n2 = arrentry.length - 1; n2 >= 0; --n2) {
  15.             this.commandQueue.push(new QueuedCommand(this, commandSourceStack, arrentry[n2]));
  16.         }
  17.         while (!this.commandQueue.isEmpty()) {
  18.             try {
  19.                 QueuedCommand queuedCommand = this.commandQueue.removeFirst();
  20.                 this.server.getProfiler().push(queuedCommand::toString);
  21.                 queuedCommand.execute(this.commandQueue, n);
  22.                 if (!this.nestedCalls.isEmpty()) {
  23.                     Lists.reverse(this.nestedCalls).forEach(this.commandQueue::addFirst);
  24.                     this.nestedCalls.clear();
  25.                 }
  26.             }
  27.             finally {
  28.                 this.server.getProfiler().pop();
  29.             }
  30.             if (++n3 < n) continue;
  31.             int n4 = n3;
  32.             return n4;
  33.         }
  34.         n2 = n3;
  35.         return n2;
  36.     }
  37.     finally {
  38.         this.commandQueue.clear();
  39.         this.nestedCalls.clear();
  40.         this.isInFunction = false;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement