--- a/net/minecraft/server/commands/TriggerCommand.java
+++ b/net/minecraft/server/commands/TriggerCommand.java
@@ -3,17 +3,20 @@
 import com.google.common.collect.Lists;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.arguments.IntegerArgumentType;
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+import com.mojang.brigadier.builder.RequiredArgumentBuilder;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
 import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
 import com.mojang.brigadier.suggestion.Suggestions;
 import com.mojang.brigadier.suggestion.SuggestionsBuilder;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import net.minecraft.commands.CommandSourceStack;
-import net.minecraft.commands.Commands;
 import net.minecraft.commands.SharedSuggestionProvider;
 import net.minecraft.commands.arguments.ObjectiveArgument;
 import net.minecraft.network.chat.Component;
+import net.minecraft.server.ServerScoreboard;
 import net.minecraft.server.level.ServerPlayer;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.scores.Objective;
@@ -22,39 +25,47 @@
 import net.minecraft.world.scores.criteria.ObjectiveCriteria;
 
 public class TriggerCommand {
+
     private static final SimpleCommandExceptionType ERROR_NOT_PRIMED = new SimpleCommandExceptionType(Component.translatable("commands.trigger.failed.unprimed"));
     private static final SimpleCommandExceptionType ERROR_INVALID_OBJECTIVE = new SimpleCommandExceptionType(Component.translatable("commands.trigger.failed.invalid"));
 
+    public TriggerCommand() {}
+
     public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
-        dispatcher.register(Commands.literal("trigger").then(Commands.argument("objective", ObjectiveArgument.objective()).suggests((context, builder) -> {
-            return suggestObjectives(context.getSource(), builder);
-        }).executes((context) -> {
-            return simpleTrigger(context.getSource(), getScore(context.getSource().getPlayerOrException(), ObjectiveArgument.getObjective(context, "objective")));
-        }).then(Commands.literal("add").then(Commands.argument("value", IntegerArgumentType.integer()).executes((context) -> {
-            return addValue(context.getSource(), getScore(context.getSource().getPlayerOrException(), ObjectiveArgument.getObjective(context, "objective")), IntegerArgumentType.getInteger(context, "value"));
-        }))).then(Commands.literal("set").then(Commands.argument("value", IntegerArgumentType.integer()).executes((context) -> {
-            return setValue(context.getSource(), getScore(context.getSource().getPlayerOrException(), ObjectiveArgument.getObjective(context, "objective")), IntegerArgumentType.getInteger(context, "value"));
+        dispatcher.register((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("trigger").then(((RequiredArgumentBuilder) ((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("objective", ObjectiveArgument.objective()).suggests((commandcontext, suggestionsbuilder) -> {
+            return TriggerCommand.suggestObjectives((CommandSourceStack) commandcontext.getSource(), suggestionsbuilder);
+        }).executes((commandcontext) -> {
+            return TriggerCommand.simpleTrigger((CommandSourceStack) commandcontext.getSource(), TriggerCommand.getScore(((CommandSourceStack) commandcontext.getSource()).getPlayerOrException(), ObjectiveArgument.getObjective(commandcontext, "objective")));
+        })).then(net.minecraft.commands.Commands.literal("add").then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer()).executes((commandcontext) -> {
+            return TriggerCommand.addValue((CommandSourceStack) commandcontext.getSource(), TriggerCommand.getScore(((CommandSourceStack) commandcontext.getSource()).getPlayerOrException(), ObjectiveArgument.getObjective(commandcontext, "objective")), IntegerArgumentType.getInteger(commandcontext, "value"));
+        })))).then(net.minecraft.commands.Commands.literal("set").then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer()).executes((commandcontext) -> {
+            return TriggerCommand.setValue((CommandSourceStack) commandcontext.getSource(), TriggerCommand.getScore(((CommandSourceStack) commandcontext.getSource()).getPlayerOrException(), ObjectiveArgument.getObjective(commandcontext, "objective")), IntegerArgumentType.getInteger(commandcontext, "value"));
         })))));
     }
 
     public static CompletableFuture<Suggestions> suggestObjectives(CommandSourceStack source, SuggestionsBuilder builder) {
         Entity entity = source.getEntity();
         List<String> list = Lists.newArrayList();
+
         if (entity != null) {
-            Scoreboard scoreboard = source.getServer().getScoreboard();
-            String string = entity.getScoreboardName();
+            ServerScoreboard scoreboardserver = source.getServer().getScoreboard();
+            String s = entity.getScoreboardName();
+            Iterator iterator = scoreboardserver.getObjectives().iterator();
 
-            for(Objective objective : scoreboard.getObjectives()) {
-                if (objective.getCriteria() == ObjectiveCriteria.TRIGGER && scoreboard.hasPlayerScore(string, objective)) {
-                    Score score = scoreboard.getOrCreatePlayerScore(string, objective);
-                    if (!score.isLocked()) {
-                        list.add(objective.getName());
+            while (iterator.hasNext()) {
+                Objective scoreboardobjective = (Objective) iterator.next();
+
+                if (scoreboardobjective.getCriteria() == ObjectiveCriteria.TRIGGER && scoreboardserver.hasPlayerScore(s, scoreboardobjective)) {
+                    Score scoreboardscore = scoreboardserver.getOrCreatePlayerScore(s, scoreboardobjective);
+
+                    if (!scoreboardscore.isLocked()) {
+                        list.add(scoreboardobjective.getName());
                     }
                 }
             }
         }
 
-        return SharedSuggestionProvider.suggest(list, builder);
+        return SharedSuggestionProvider.suggest((Iterable) list, builder);
     }
 
     private static int addValue(CommandSourceStack source, Score score, int value) {
@@ -77,19 +88,21 @@
 
     private static Score getScore(ServerPlayer player, Objective objective) throws CommandSyntaxException {
         if (objective.getCriteria() != ObjectiveCriteria.TRIGGER) {
-            throw ERROR_INVALID_OBJECTIVE.create();
+            throw TriggerCommand.ERROR_INVALID_OBJECTIVE.create();
         } else {
-            Scoreboard scoreboard = player.getScoreboard();
-            String string = player.getScoreboardName();
-            if (!scoreboard.hasPlayerScore(string, objective)) {
-                throw ERROR_NOT_PRIMED.create();
+            Scoreboard scoreboard = player.getServer().getScoreboard(); // CraftBukkit - SPIGOT-6917: use main scoreboard
+            String s = player.getScoreboardName();
+
+            if (!scoreboard.hasPlayerScore(s, objective)) {
+                throw TriggerCommand.ERROR_NOT_PRIMED.create();
             } else {
-                Score score = scoreboard.getOrCreatePlayerScore(string, objective);
-                if (score.isLocked()) {
-                    throw ERROR_NOT_PRIMED.create();
+                Score scoreboardscore = scoreboard.getOrCreatePlayerScore(s, objective);
+
+                if (scoreboardscore.isLocked()) {
+                    throw TriggerCommand.ERROR_NOT_PRIMED.create();
                 } else {
-                    score.setLocked(true);
-                    return score;
+                    scoreboardscore.setLocked(true);
+                    return scoreboardscore;
                 }
             }
         }
