Skip to content

Commit

Permalink
More features for SpecialCommandSender
Browse files Browse the repository at this point in the history
  • Loading branch information
ARVIN3108 committed Mar 31, 2024
1 parent 4dc4745 commit e6c7877
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public boolean isConsole() {
return sender instanceof ConsoleCommandSender;
}

public ConsoleCommandSender getConsole() {
return (ConsoleCommandSender) sender;
}

public <T> boolean isAs(Class<T> type) {
return sender.getClass().isAssignableFrom(type);
}

@SuppressWarnings("unchecked")
public <T extends CommandSender> T getAs(Class<T> type) {
return (T) sender;
}

public void sendMessage(@NotNull String s) {
TextUtils.send(sender, s);
}
Expand Down

0 comments on commit e6c7877

Please sign in to comment.