--- a/net/minecraft/server/ServerFunctionManager.java
+++ b/net/minecraft/server/ServerFunctionManager.java
@@ -4,20 +4,23 @@
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.logging.LogUtils;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import java.util.Optional;
 import net.minecraft.commands.CommandResultCallback;
 import net.minecraft.commands.CommandSourceStack;
-import net.minecraft.commands.Commands;
 import net.minecraft.commands.FunctionInstantiationException;
 import net.minecraft.commands.execution.ExecutionContext;
 import net.minecraft.commands.functions.CommandFunction;
 import net.minecraft.commands.functions.InstantiatedFunction;
+import net.minecraft.nbt.CompoundTag;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.util.profiling.ProfilerFiller;
 import org.slf4j.Logger;
 
 public class ServerFunctionManager {
+
     private static final Logger LOGGER = LogUtils.getLogger();
     private static final ResourceLocation TICK_FUNCTION_TAG = ResourceLocation.withDefaultNamespace("tick");
     private static final ResourceLocation LOAD_FUNCTION_TAG = ResourceLocation.withDefaultNamespace("load");
@@ -33,46 +36,59 @@
     }
 
     public CommandDispatcher<CommandSourceStack> getDispatcher() {
-        return this.server.getCommands().getDispatcher();
+        return this.server.getCommands().getDispatcher(); // CraftBukkit // Paper - Don't override command dispatcher
     }
 
     public void tick() {
         if (this.server.tickRateManager().runsNormally()) {
             if (this.postReload) {
                 this.postReload = false;
-                Collection<CommandFunction<CommandSourceStack>> collection = this.library.getTag(LOAD_FUNCTION_TAG);
-                this.executeTagFunctions(collection, LOAD_FUNCTION_TAG);
+                Collection<CommandFunction<CommandSourceStack>> collection = this.library.getTag(ServerFunctionManager.LOAD_FUNCTION_TAG);
+
+                this.executeTagFunctions(collection, ServerFunctionManager.LOAD_FUNCTION_TAG);
             }
 
-            this.executeTagFunctions(this.ticking, TICK_FUNCTION_TAG);
+            this.executeTagFunctions(this.ticking, ServerFunctionManager.TICK_FUNCTION_TAG);
         }
     }
 
     private void executeTagFunctions(Collection<CommandFunction<CommandSourceStack>> functions, ResourceLocation label) {
-        this.server.getProfiler().push(label::toString);
+        ProfilerFiller gameprofilerfiller = this.server.getProfiler();
 
-        for (CommandFunction<CommandSourceStack> commandFunction : functions) {
-            this.execute(commandFunction, this.getGameLoopSender());
+        Objects.requireNonNull(label);
+        gameprofilerfiller.push(label::toString);
+        Iterator iterator = functions.iterator();
+
+        while (iterator.hasNext()) {
+            CommandFunction<CommandSourceStack> commandfunction = (CommandFunction) iterator.next();
+
+            this.execute(commandfunction, this.getGameLoopSender());
         }
 
         this.server.getProfiler().pop();
     }
 
     public void execute(CommandFunction<CommandSourceStack> function, CommandSourceStack source) {
-        ProfilerFiller profilerFiller = this.server.getProfiler();
-        profilerFiller.push(() -> "function " + function.id());
+        ProfilerFiller gameprofilerfiller = this.server.getProfiler();
+
+        gameprofilerfiller.push(() -> {
+            return "function " + String.valueOf(function.id());
+        });
 
         try {
-            InstantiatedFunction<CommandSourceStack> instantiatedFunction = function.instantiate(null, this.getDispatcher());
-            Commands.executeCommandInContext(
-                source, context -> ExecutionContext.queueInitialFunctionCall(context, instantiatedFunction, source, CommandResultCallback.EMPTY)
-            );
-        } catch (FunctionInstantiationException var9) {
-        } catch (Exception var10) {
-            LOGGER.warn("Failed to execute function {}", function.id(), var10);
+            InstantiatedFunction<CommandSourceStack> instantiatedfunction = function.instantiate((CompoundTag) null, this.getDispatcher());
+
+            net.minecraft.commands.Commands.executeCommandInContext(source, (executioncontext) -> {
+                ExecutionContext.queueInitialFunctionCall(executioncontext, instantiatedfunction, source, CommandResultCallback.EMPTY);
+            });
+        } catch (FunctionInstantiationException functioninstantiationexception) {
+            ;
+        } catch (Exception exception) {
+            ServerFunctionManager.LOGGER.warn("Failed to execute function {}", function.id(), exception);
         } finally {
-            profilerFiller.pop();
+            gameprofilerfiller.pop();
         }
+
     }
 
     public void replaceLibrary(ServerFunctionLibrary loader) {
@@ -81,7 +97,7 @@
     }
 
     private void postReload(ServerFunctionLibrary loader) {
-        this.ticking = ImmutableList.copyOf(loader.getTag(TICK_FUNCTION_TAG));
+        this.ticking = ImmutableList.copyOf(loader.getTag(ServerFunctionManager.TICK_FUNCTION_TAG));
         this.postReload = true;
     }
 
