File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
src/main/java/com/datasiqn/commandcore/commands Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 8
8
import org .jetbrains .annotations .NotNull ;
9
9
10
10
public interface CommandSource {
11
- @ NotNull Result <Player , IllegalStateException > getPlayer ();
11
+ /**
12
+ * Gets the player executing command
13
+ * @return A result describing the player. This can be safely unwrapped if the command link {@link CommandLink#requiresPlayer() requiresPlayer}.
14
+ */
15
+ @ NotNull
16
+ Result <Player , String > getPlayer ();
12
17
13
- @ NotNull Result <Entity , IllegalStateException > getEntity ();
18
+ /**
19
+ * Gets the entity executing command
20
+ * @return A result describing the entity. This can be safely unwrapped if the command link {@link CommandLink#requiresEntity() requiresEntity}.
21
+ */
22
+ @ NotNull
23
+ Result <Entity , String > getEntity ();
14
24
15
25
@ NotNull CommandSender getSender ();
16
26
Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ public CommandSourceImpl(CommandSender sender) {
17
17
}
18
18
19
19
@ Override
20
- public @ NotNull Result <Player , IllegalStateException > getPlayer () {
21
- return Result .resolve (() -> (Player ) sender , error -> new IllegalStateException ( "Sender is not a player" ) );
20
+ public @ NotNull Result <Player , String > getPlayer () {
21
+ return Result .resolve (() -> (Player ) sender , error -> "Sender is not a player" );
22
22
}
23
23
24
24
@ Override
25
- public @ NotNull Result <Entity , IllegalStateException > getEntity () {
26
- return Result .resolve (() -> (Entity ) sender , error -> new IllegalStateException ( "Sender is not an entity" ) );
25
+ public @ NotNull Result <Entity , String > getEntity () {
26
+ return Result .resolve (() -> (Entity ) sender , error -> "Sender is not an entity" );
27
27
}
28
28
29
29
@ Override
You can’t perform that action at this time.
0 commit comments