File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/main/kotlin/com/mairwunnx/projectessentials/home/commands Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -36,3 +36,22 @@ inline val setHomeLiteral: LiteralArgumentBuilder<CommandSource>
3636 " home" , StringArgumentType .string()
3737 ).executes { SetHomeCommand .process(it) }
3838 ).executes { SetHomeCommand .process(it) }
39+
40+ inline val delHomeLiteral: LiteralArgumentBuilder <CommandSource >
41+ get() = literal<CommandSource >(" del-home" ).then(
42+ Commands .argument(
43+ " home" , StringArgumentType .string()
44+ ).suggests { ctx, builder ->
45+ ISuggestionProvider .suggest(
46+ getConfigurationByName<HomeConfiguration >(
47+ " home"
48+ ).take().let { model ->
49+ if (ctx.isPlayerSender()) {
50+ model.users.asSequence().find {
51+ it.name == ctx.getPlayer()!! .name.string || it.uuid == ctx.getPlayer()!! .uniqueID.toString()
52+ }?.homes?.asSequence()?.map { it.home }?.toList() ? : emptyList<String >()
53+ } else emptyList<String >()
54+ }, builder
55+ )
56+ }.executes { DelHomeCommand .process(it) }
57+ ).executes { DelHomeCommand .process(it) }
You can’t perform that action at this time.
0 commit comments