22
33import com .mojang .brigadier .context .CommandContext ;
44import com .mojang .brigadier .exceptions .CommandSyntaxException ;
5+ import dev .detpikachu .buildersvoid .logic .TeleportLogic ;
56import net .blay09 .mods .balm .api .command .BalmCommands ;
67import net .minecraft .commands .CommandSourceStack ;
78import net .minecraft .commands .Commands ;
@@ -24,7 +25,7 @@ public static void initialize(BalmCommands commands) {
2425 final var teleport = Commands .literal ("teleport" )
2526 .requires (BalmCommands .requirePermission (PERM_TELEPORT ))
2627 .then (Commands .argument ("target" , EntityArgument .player ())
27- .executes (ModCommands ::onTeleportTarget )
28+ .executes (ModCommands ::onTeleportTargetPlayer )
2829 )
2930 .then (Commands .argument ("source" , EntityArgument .player ())
3031 .then (Commands .argument ("target" , EntityArgument .player ())
@@ -38,21 +39,22 @@ public static void initialize(BalmCommands commands) {
3839 });
3940 }
4041
41- private static int onTeleportTarget (CommandContext <CommandSourceStack > context ) throws CommandSyntaxException {
42- final EntitySelector target = context .getArgument ("target" , EntitySelector .class );
43-
44- context . getSource (). sendSystemMessage ( target .findSinglePlayer (context .getSource ()). getName ());
42+ private static int onTeleportTargetPlayer (CommandContext <CommandSourceStack > context ) throws CommandSyntaxException {
43+ final var target = context .getArgument ("target" , EntitySelector .class );
44+ final var sourcePlayer = context . getSource (). getPlayer ();
45+ final var targetPlayer = target .findSinglePlayer (context .getSource ());
4546
47+ TeleportLogic .teleportIntoVoid (sourcePlayer , targetPlayer .getUUID (), false );
4648 return 0 ;
4749 }
4850
49- private static int onTeleportSourceToTarget (CommandContext <CommandSourceStack > context ) {
50- final EntitySelector source = context .getArgument ("source" , EntitySelector .class );
51- final EntitySelector target = context .getArgument ("target" , EntitySelector .class );
51+ private static int onTeleportSourceToTarget (CommandContext <CommandSourceStack > context ) throws CommandSyntaxException {
52+ final var source = context .getArgument ("source" , EntitySelector .class );
53+ final var sourcePlayer = source .findSinglePlayer (context .getSource ());
54+ final var target = context .getArgument ("target" , EntitySelector .class );
55+ final var targetPlayer = target .findSinglePlayer (context .getSource ());
5256
57+ TeleportLogic .teleportIntoVoid (sourcePlayer , targetPlayer .getUUID (), false );
5358 return 0 ;
5459 }
55-
56- private static void teleportSourceToTarget () {
57- }
5860}
0 commit comments