Skip to content

Commit e8655f9

Browse files
authored
Merge pull request #3 from FTBTeam/dev
Dev
2 parents 208802d + 81075a2 commit e8655f9

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [21.1.2]
8+
9+
### Added
10+
* Added `/ftbteambases setlobbypos <pos>` command to updated lobby spawn position
11+
712
## [21.1.1]
813

914
### Added

common/src/main/java/dev/ftb/mods/ftbteambases/command/CommandUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static void registerCommands(CommandDispatcher<CommandSourceStack> dispat
5656
.then(VisitCommand.registerNether())
5757
.then(ArchiveCommand.register())
5858
.then(PurgeCommand.register())
59+
.then(SetLobbyPosCommand.register())
5960
);
6061
}
6162

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package dev.ftb.mods.ftbteambases.command;
2+
3+
import com.mojang.brigadier.Command;
4+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
5+
import dev.ftb.mods.ftbteambases.config.ServerConfig;
6+
import dev.ftb.mods.ftbteambases.data.bases.BaseInstanceManager;
7+
import dev.ftb.mods.ftbteambases.util.MiscUtil;
8+
import net.minecraft.commands.CommandSourceStack;
9+
import net.minecraft.commands.Commands;
10+
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
11+
import net.minecraft.core.BlockPos;
12+
import net.minecraft.network.chat.Component;
13+
import net.minecraft.server.level.ServerLevel;
14+
15+
import static net.minecraft.commands.Commands.argument;
16+
import static net.minecraft.commands.Commands.literal;
17+
18+
public class SetLobbyPosCommand {
19+
public static LiteralArgumentBuilder<CommandSourceStack> register() {
20+
return literal("setlobbypos")
21+
.requires(ctx -> ctx.hasPermission(Commands.LEVEL_GAMEMASTERS))
22+
.then(argument("pos", BlockPosArgument.blockPos())
23+
.executes(ctx -> setLobbyPos(ctx.getSource(), BlockPosArgument.getBlockPos(ctx, "pos")))
24+
);
25+
}
26+
27+
private static int setLobbyPos(CommandSourceStack source, BlockPos pos) {
28+
BaseInstanceManager.get(source.getServer()).setLobbySpawnPos(pos);
29+
30+
source.sendSuccess(() -> Component.literal("lobby pos updated to " + MiscUtil.blockPosStr(pos)), false);
31+
32+
ServerConfig.lobbyDimension().ifPresent(dim -> {
33+
ServerLevel level = source.getServer().getLevel(dim);
34+
if (level != null) {
35+
level.setDefaultSpawnPos(pos, ServerConfig.LOBBY_PLAYER_YAW.get().floatValue());
36+
}
37+
});
38+
39+
return Command.SINGLE_SUCCESS;
40+
}
41+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ minecraft_version=1.21.1
44
enabled_platforms=fabric,neoforge
55

66
archives_base_name=ftb-team-bases
7-
mod_version=21.1.1
7+
mod_version=21.1.2
88
maven_group=dev.ftb.mods
99
mod_author=FTB Team
1010
readable_name=FTB Team Bases

0 commit comments

Comments
 (0)