Skip to content

Commit 2dd7664

Browse files
committed
Cleanup
1 parent 9da8a5e commit 2dd7664

20 files changed

+121
-123
lines changed

common/src/main/kotlin/com/lambda/brigadier/ArgumentConstructor.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ typealias DefaultArgumentConstructor<S, T> =
3434
class ArgumentConstructor<S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>>(
3535
private val builder: B,
3636
val name: String,
37-
private val descriptor: D
37+
private val descriptor: D,
3838
) {
3939
/**
4040
* Converts this constructor into a required argument.
@@ -66,7 +66,7 @@ class ArgumentConstructor<S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*
6666
sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentDescriptor<*>, out A>(
6767
val builder: B,
6868
val name: String,
69-
val descriptor: D
69+
val descriptor: D,
7070
) {
7171
/**
7272
* Registers the argument on the [parentBuilder].
@@ -87,7 +87,7 @@ sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentD
8787
class Required<S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>>(
8888
builder: B,
8989
name: String,
90-
descriptor: D
90+
descriptor: D,
9191
) : CommandArgument<S, B, D, ArgumentAccessor<S, D>>(builder, name, descriptor) {
9292
/**
9393
* Registers the argument on the [parentBuilder]
@@ -102,7 +102,7 @@ sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentD
102102
@Suppress("OVERRIDE_BY_INLINE")
103103
override inline fun register(
104104
parentBuilder: ArgumentBuilder<S, *>,
105-
action: B.(ArgumentAccessor<S, D>) -> Unit
105+
action: B.(ArgumentAccessor<S, D>) -> Unit,
106106
) {
107107
builder.action {
108108
ArgumentReader(this, name, descriptor)
@@ -120,7 +120,7 @@ sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentD
120120
class Optional<S, D : ArgumentDescriptor<*>>(
121121
builder: ArgumentBuilder<S, *>,
122122
name: String,
123-
descriptor: D
123+
descriptor: D,
124124
) : CommandArgument<S, ArgumentBuilder<S, *>, D, ArgumentAccessor<S, D>?>(builder, name, descriptor) {
125125
/**
126126
* Registers the argument on the [parentBuilder]
@@ -142,7 +142,7 @@ sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentD
142142
@Suppress("OVERRIDE_BY_INLINE")
143143
override inline fun register(
144144
parentBuilder: ArgumentBuilder<S, *>,
145-
action: (ArgumentBuilder<S, *>.(ArgumentAccessor<S, D>?) -> Unit)
145+
action: (ArgumentBuilder<S, *>.(ArgumentAccessor<S, D>?) -> Unit),
146146
) {
147147
builder.action {
148148
ArgumentReader(this, name, descriptor)
@@ -163,7 +163,7 @@ sealed class CommandArgument<S, out B : ArgumentBuilder<S, *>, out D : ArgumentD
163163
fun <S, D : ArgumentDescriptor<A>, AT, A : ArgumentType<AT>> argument(
164164
name: String,
165165
argumentType: A,
166-
argumentDescriptor: D
166+
argumentDescriptor: D,
167167
): RequiredArgumentConstructor<S, D> {
168168
val builder = RequiredArgumentBuilder.argument<S, AT>(
169169
name,
@@ -181,7 +181,7 @@ fun <S, D : ArgumentDescriptor<A>, AT, A : ArgumentType<AT>> argument(
181181
@BrigadierDsl
182182
fun <S, AT, A : ArgumentType<AT>> argument(
183183
name: String,
184-
argumentType: A
184+
argumentType: A,
185185
): RequiredArgumentConstructor<S, DefaultArgumentDescriptor<A>> {
186186
return argument(name, argumentType, DefaultArgumentDescriptor())
187187
}
@@ -201,7 +201,7 @@ fun <S, AT, A : ArgumentType<AT>> argument(
201201
@BrigadierDsl
202202
inline fun <S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>> ArgumentBuilder<S, *>.required(
203203
constructor: ArgumentConstructor<S, B, D>,
204-
action: B.(ArgumentAccessor<S, D>) -> Unit
204+
action: B.(ArgumentAccessor<S, D>) -> Unit,
205205
) {
206206
constructor.required().register(this, action)
207207
}
@@ -226,7 +226,7 @@ inline fun <S, B : ArgumentBuilder<S, *>, D : ArgumentDescriptor<*>> ArgumentBui
226226
@BrigadierDsl
227227
inline fun <S, D : ArgumentDescriptor<*>> ArgumentBuilder<S, *>.optional(
228228
constructor: ArgumentConstructor<S, *, D>,
229-
action: ArgumentBuilder<S, *>.(ArgumentAccessor<S, D>?) -> Unit
229+
action: ArgumentBuilder<S, *>.(ArgumentAccessor<S, D>?) -> Unit,
230230
) {
231231
constructor.optional().register(this, action)
232232
}

common/src/main/kotlin/com/lambda/brigadier/ArgumentReader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typealias DefaultArgumentReader<T> = ArgumentReader<*, DefaultArgumentDescriptor
3737
class ArgumentReader<S, out D : ArgumentDescriptor<*>>(
3838
val context: CommandContext<S>,
3939
val name: String,
40-
private val argumentDescriptor: D
40+
private val argumentDescriptor: D,
4141
)
4242

4343
/**

common/src/main/kotlin/com/lambda/brigadier/BrigadierDsl.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ annotation class BrigadierDsl
1313
@BrigadierDsl
1414
fun <S> CommandDispatcher<S>.register(
1515
command: String,
16-
action: LiteralArgumentBuilder<S>.() -> Unit
16+
action: LiteralArgumentBuilder<S>.() -> Unit,
1717
) {
1818
val argument = LiteralArgumentBuilder.literal<S>(command)
1919
argument.apply(action)
@@ -22,7 +22,7 @@ fun <S> CommandDispatcher<S>.register(
2222

2323
@JvmName("getRequired")
2424
operator fun <S, D : ArgumentDescriptor<*>> CommandContext<S>.get(
25-
accessor: ArgumentAccessor<S, D>
25+
accessor: ArgumentAccessor<S, D>,
2626
): ArgumentReader<S, D> {
2727
return accessor()
2828
}
@@ -36,7 +36,7 @@ operator fun <S, D : ArgumentDescriptor<*>> CommandContext<S>.get(
3636
*/
3737
@JvmName("getOptional")
3838
operator fun <S, D : ArgumentDescriptor<*>> CommandContext<S>.get(
39-
accessor: ArgumentAccessor<S, D>?
39+
accessor: ArgumentAccessor<S, D>?,
4040
): ArgumentReader<S, D>? {
4141
return accessor?.invoke(this)
4242
}

common/src/main/kotlin/com/lambda/brigadier/CommandExecution.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ sealed class CommandResult {
3232
* Representation of successful completion with the return value of [result].
3333
*/
3434
class Success(
35-
val result: Int = Command.SINGLE_SUCCESS
35+
val result: Int = Command.SINGLE_SUCCESS,
3636
) : CommandResult()
3737

3838
/**
3939
* Representation of the command failing with the specified error [message].
4040
*/
4141
class Failure(
42-
val message: Text
42+
val message: Text,
4343
) : CommandResult()
4444

4545
companion object {

common/src/main/kotlin/com/lambda/brigadier/argument/BlockArguments.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
package com.lambda.brigadier.argument
2424

2525
import com.lambda.brigadier.*
26-
import com.lambda.brigadier.assumeSourceNotUsed
2726
import net.minecraft.block.pattern.CachedBlockPosition
2827
import net.minecraft.command.CommandRegistryAccess
2928
import net.minecraft.command.argument.BlockPredicateArgumentType
@@ -63,7 +62,7 @@ fun DefaultArgumentReader<BlockStateArgumentType>.value(): BlockStateArgument {
6362
@BrigadierDsl
6463
fun <S> blockPredicate(
6564
name: String,
66-
registryAccess: CommandRegistryAccess
65+
registryAccess: CommandRegistryAccess,
6766
): DefaultArgumentConstructor<S, BlockPredicateArgumentType> {
6867
return argument(name, BlockPredicateArgumentType.blockPredicate(registryAccess))
6968
}
@@ -76,7 +75,7 @@ fun <S> blockPredicate(
7675
@BrigadierDsl
7776
fun <S> blockState(
7877
name: String,
79-
registryAccess: CommandRegistryAccess
78+
registryAccess: CommandRegistryAccess,
8079
): DefaultArgumentConstructor<S, BlockStateArgumentType> {
8180
return argument(name, BlockStateArgumentType.blockState(registryAccess))
8281
}

common/src/main/kotlin/com/lambda/brigadier/argument/EntityArguments.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323
package com.lambda.brigadier.argument
2424

2525
import com.lambda.brigadier.*
26-
import com.lambda.brigadier.ArgumentDescriptor
27-
import com.lambda.brigadier.ArgumentReader
28-
import com.lambda.brigadier.BrigadierDsl
29-
import com.lambda.brigadier.DefaultArgumentConstructor
30-
import com.lambda.brigadier.DefaultArgumentReader
31-
import com.lambda.brigadier.RequiredArgumentConstructor
3226
import net.minecraft.command.argument.EntityAnchorArgumentType
3327
import net.minecraft.command.argument.EntityArgumentType
3428
import net.minecraft.entity.Entity
@@ -121,7 +115,7 @@ fun ArgumentReader<
121115
*/
122116
@BrigadierDsl
123117
fun <S> entityAnchor(
124-
name: String
118+
name: String,
125119
): DefaultArgumentConstructor<S, EntityAnchorArgumentType> {
126120
return argument(name, EntityAnchorArgumentType.entityAnchor())
127121
}
@@ -131,7 +125,7 @@ fun <S> entityAnchor(
131125
*/
132126
@BrigadierDsl
133127
fun <S> entities(
134-
name: String
128+
name: String,
135129
): RequiredArgumentConstructor<
136130
S,
137131
ListEntityArgumentDescriptor
@@ -144,7 +138,7 @@ fun <S> entities(
144138
*/
145139
@BrigadierDsl
146140
fun <S> entity(
147-
name: String
141+
name: String,
148142
): RequiredArgumentConstructor<
149143
S,
150144
SingleEntityArgumentDescriptor

common/src/main/kotlin/com/lambda/brigadier/argument/GeometricArguments.kt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ package com.lambda.brigadier.argument
2424

2525

2626
import com.lambda.brigadier.*
27-
import com.lambda.brigadier.ArgumentReader
28-
import com.lambda.brigadier.BrigadierDsl
29-
import com.lambda.brigadier.DefaultArgumentConstructor
30-
import com.lambda.brigadier.DefaultArgumentDescriptor
31-
import com.lambda.brigadier.DefaultArgumentReader
3227
import net.minecraft.command.argument.*
3328
import net.minecraft.server.command.ServerCommandSource
3429
import net.minecraft.util.math.*
@@ -199,7 +194,7 @@ fun DefaultArgumentReader<Vec3ArgumentType>.posArgument(): PosArgument {
199194
*/
200195
@BrigadierDsl
201196
fun <S> angle(
202-
name: String
197+
name: String,
203198
): DefaultArgumentConstructor<S, AngleArgumentType> {
204199
return argument(name, AngleArgumentType.angle())
205200
}
@@ -209,7 +204,7 @@ fun <S> angle(
209204
*/
210205
@BrigadierDsl
211206
fun <S> rotation(
212-
name: String
207+
name: String,
213208
): DefaultArgumentConstructor<S, RotationArgumentType> {
214209
return argument(name, RotationArgumentType.rotation())
215210
}
@@ -219,7 +214,7 @@ fun <S> rotation(
219214
*/
220215
@BrigadierDsl
221216
fun <S> swizzle(
222-
name: String
217+
name: String,
223218
): DefaultArgumentConstructor<S, SwizzleArgumentType> {
224219
return argument(name, SwizzleArgumentType.swizzle())
225220
}
@@ -229,7 +224,7 @@ fun <S> swizzle(
229224
*/
230225
@BrigadierDsl
231226
fun <S> blockPos(
232-
name: String
227+
name: String,
233228
): DefaultArgumentConstructor<S, BlockPosArgumentType> {
234229
return argument(name, BlockPosArgumentType.blockPos())
235230
}
@@ -239,7 +234,7 @@ fun <S> blockPos(
239234
*/
240235
@BrigadierDsl
241236
fun <S> columnPos(
242-
name: String
237+
name: String,
243238
): DefaultArgumentConstructor<S, ColumnPosArgumentType> {
244239
return argument(name, ColumnPosArgumentType.columnPos())
245240
}
@@ -252,7 +247,7 @@ fun <S> columnPos(
252247
@BrigadierDsl
253248
fun <S> vec2(
254249
name: String,
255-
centerIntegers: Boolean = false
250+
centerIntegers: Boolean = false,
256251
): DefaultArgumentConstructor<S, Vec2ArgumentType> {
257252
return argument(name, Vec2ArgumentType.vec2(centerIntegers))
258253
}
@@ -265,7 +260,7 @@ fun <S> vec2(
265260
@BrigadierDsl
266261
fun <S> vec3(
267262
name: String,
268-
centerIntegers: Boolean = false
263+
centerIntegers: Boolean = false,
269264
): DefaultArgumentConstructor<S, Vec3ArgumentType> {
270265
return argument(name, Vec3ArgumentType.vec3(centerIntegers))
271266
}

common/src/main/kotlin/com/lambda/brigadier/argument/NBTArguments.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package com.lambda.brigadier.argument
2424

2525

2626
import com.lambda.brigadier.*
27-
import com.lambda.brigadier.assumeSourceNotUsed
2827
import net.minecraft.command.argument.NbtCompoundArgumentType
2928
import net.minecraft.command.argument.NbtElementArgumentType
3029
import net.minecraft.command.argument.NbtPathArgumentType
@@ -73,17 +72,17 @@ fun DefaultArgumentReader<NbtPathArgumentType>.value(): NbtPath {
7372
*/
7473
@BrigadierDsl
7574
fun <S> nbtCompound(
76-
name: String
75+
name: String,
7776
): DefaultArgumentConstructor<S, NbtCompoundArgumentType> {
78-
return com.lambda.brigadier.argument(name, NbtCompoundArgumentType.nbtCompound())
77+
return argument(name, NbtCompoundArgumentType.nbtCompound())
7978
}
8079

8180
/**
8281
* Creates an NBT element argument with [name] as the parameter name.
8382
*/
8483
@BrigadierDsl
8584
fun <S> nbtElement(
86-
name: String
85+
name: String,
8786
): DefaultArgumentConstructor<S, NbtElementArgumentType> {
8887
return argument(name, NbtElementArgumentType.nbtElement())
8988
}
@@ -93,7 +92,7 @@ fun <S> nbtElement(
9392
*/
9493
@BrigadierDsl
9594
fun <S> nbtPath(
96-
name: String
95+
name: String,
9796
): DefaultArgumentConstructor<S, NbtPathArgumentType> {
9897
return argument(name, NbtPathArgumentType.nbtPath())
9998
}

common/src/main/kotlin/com/lambda/brigadier/argument/PlayerArguments.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fun ArgumentReader<
138138
*/
139139
@BrigadierDsl
140140
fun <S> gameProfile(
141-
name: String
141+
name: String,
142142
): DefaultArgumentConstructor<S, GameProfileArgumentType> {
143143
return argument(name, GameProfileArgumentType.gameProfile())
144144
}
@@ -148,7 +148,7 @@ fun <S> gameProfile(
148148
*/
149149
@BrigadierDsl
150150
fun <S> team(
151-
name: String
151+
name: String,
152152
): DefaultArgumentConstructor<S, TeamArgumentType> {
153153
return argument(name, TeamArgumentType.team())
154154
}
@@ -158,7 +158,7 @@ fun <S> team(
158158
*/
159159
@BrigadierDsl
160160
fun <S> player(
161-
name: String
161+
name: String,
162162
): RequiredArgumentConstructor<
163163
S,
164164
SinglePlayerArgumentDescriptor
@@ -171,7 +171,7 @@ fun <S> player(
171171
*/
172172
@BrigadierDsl
173173
fun <S> players(
174-
name: String
174+
name: String,
175175
): RequiredArgumentConstructor<
176176
S,
177177
ListPlayerArgumentDescriptor

0 commit comments

Comments
 (0)