diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/server/commands/SetSpawnCommand.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/server/commands/SetSpawnCommand.java.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/server/commands/SetSpawnCommand.java.patch b/patch-remap/mache-spigotflower/net/minecraft/server/commands/SetSpawnCommand.java.patch new file mode 100644 index 0000000000..da58e30d0a --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/server/commands/SetSpawnCommand.java.patch @@ -0,0 +1,70 @@ +--- a/net/minecraft/server/commands/SetSpawnCommand.java ++++ b/net/minecraft/server/commands/SetSpawnCommand.java +@@ -7,7 +7,6 @@ + import java.util.Collections; + import java.util.Iterator; + import net.minecraft.commands.CommandSourceStack; +-import net.minecraft.commands.Commands; + import net.minecraft.commands.arguments.AngleArgument; + import net.minecraft.commands.arguments.EntityArgument; + import net.minecraft.commands.arguments.coordinates.BlockPosArgument; +@@ -21,42 +20,42 @@ + + public SetSpawnCommand() {} + +- public static void register(CommandDispatcher<CommandSourceStack> commanddispatcher) { +- commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) Commands.literal("spawnpoint").requires((commandsourcestack) -> { +- return commandsourcestack.hasPermission(2); ++ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { ++ dispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.Commands.literal("spawnpoint").requires((commandlistenerwrapper) -> { ++ return commandlistenerwrapper.hasPermission(2); + })).executes((commandcontext) -> { + return setSpawn((CommandSourceStack) commandcontext.getSource(), Collections.singleton(((CommandSourceStack) commandcontext.getSource()).getPlayerOrException()), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()), 0.0F); +- })).then(((RequiredArgumentBuilder) Commands.argument("targets", EntityArgument.players()).executes((commandcontext) -> { ++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("targets", EntityArgument.players()).executes((commandcontext) -> { + return setSpawn((CommandSourceStack) commandcontext.getSource(), EntityArgument.getPlayers(commandcontext, "targets"), BlockPos.containing(((CommandSourceStack) commandcontext.getSource()).getPosition()), 0.0F); +- })).then(((RequiredArgumentBuilder) Commands.argument("pos", BlockPosArgument.blockPos()).executes((commandcontext) -> { ++ })).then(((RequiredArgumentBuilder) net.minecraft.commands.Commands.argument("pos", BlockPosArgument.blockPos()).executes((commandcontext) -> { + return setSpawn((CommandSourceStack) commandcontext.getSource(), EntityArgument.getPlayers(commandcontext, "targets"), BlockPosArgument.getSpawnablePos(commandcontext, "pos"), 0.0F); +- })).then(Commands.argument("angle", AngleArgument.angle()).executes((commandcontext) -> { ++ })).then(net.minecraft.commands.Commands.argument("angle", AngleArgument.angle()).executes((commandcontext) -> { + return setSpawn((CommandSourceStack) commandcontext.getSource(), EntityArgument.getPlayers(commandcontext, "targets"), BlockPosArgument.getSpawnablePos(commandcontext, "pos"), AngleArgument.getAngle(commandcontext, "angle")); + }))))); + } + +- private static int setSpawn(CommandSourceStack commandsourcestack, Collection<ServerPlayer> collection, BlockPos blockpos, float f) { +- ResourceKey<Level> resourcekey = commandsourcestack.getLevel().dimension(); +- Iterator iterator = collection.iterator(); ++ private static int setSpawn(CommandSourceStack source, Collection<ServerPlayer> targets, BlockPos pos, float angle) { ++ ResourceKey<Level> resourcekey = source.getLevel().dimension(); ++ Iterator iterator = targets.iterator(); + + while (iterator.hasNext()) { +- ServerPlayer serverplayer = (ServerPlayer) iterator.next(); ++ ServerPlayer entityplayer = (ServerPlayer) iterator.next(); + +- serverplayer.setRespawnPosition(resourcekey, blockpos, f, true, false); ++ entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.COMMAND); // CraftBukkit + } + + String s = resourcekey.location().toString(); + +- if (collection.size() == 1) { +- commandsourcestack.sendSuccess(() -> { +- return Component.translatable("commands.spawnpoint.success.single", blockpos.getX(), blockpos.getY(), blockpos.getZ(), f, s, ((ServerPlayer) collection.iterator().next()).getDisplayName()); ++ if (targets.size() == 1) { ++ source.sendSuccess(() -> { ++ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName()); + }, true); + } else { +- commandsourcestack.sendSuccess(() -> { +- return Component.translatable("commands.spawnpoint.success.multiple", blockpos.getX(), blockpos.getY(), blockpos.getZ(), f, s, collection.size()); ++ source.sendSuccess(() -> { ++ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size()); + }, true); + } + +- return collection.size(); ++ return targets.size(); + } + } |