Skip to content

Commit

Permalink
Minor annotation changes in commands
Browse files Browse the repository at this point in the history
- Updated Command class
- Updated ImageCommandBridge class
  • Loading branch information
josemmo committed Oct 14, 2023
1 parent 14ac8ee commit 6a48a17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/io/josemmo/bukkit/plugin/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
Expand All @@ -19,8 +20,8 @@ public class Command {
private final String name;
private final List<Argument> arguments = new ArrayList<>();
private Predicate<CommandSender> requirementHandler = __ -> true;
private BiConsumer<CommandSender, Object[]> executesHandler = null;
private BiConsumer<Player, Object[]> executesPlayerHandler = null;
private @Nullable BiConsumer<CommandSender, Object[]> executesHandler;
private @Nullable BiConsumer<Player, Object[]> executesPlayerHandler;
private final List<Command> subcommands = new ArrayList<>();

/**
Expand Down Expand Up @@ -82,6 +83,7 @@ public Command(@NotNull String name) {
* @param handler Command handler
* @return This instance
*/
@SuppressWarnings("UnusedReturnValue")
public @NotNull Command executesPlayer(@NotNull BiConsumer<Player, Object[]> handler) {
executesPlayerHandler = handler;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static void register(@NotNull YamipaPlugin plugin) {
});
}

@SuppressWarnings("CodeBlock2Expr")
private static @NotNull Command getRootCommand() {
Command root = new Command(COMMAND_NAME);

Expand Down

0 comments on commit 6a48a17

Please sign in to comment.