public class AnnoyingSender extends xyz.srnyx.javautilities.parents.Stringable implements Annoyable
AnnoyingCommand| Modifier and Type | Field and Description |
|---|---|
@Nullable java.lang.String[] |
args
The
Command's arguments that were used |
@NotNull org.bukkit.command.CommandSender |
cmdSender
The
CommandSender that was used to initialize this AnnoyingSender |
@Nullable org.bukkit.command.Command |
command
The
Command that was used |
boolean |
isPlayer
Whether the
cmdSender is a Player |
@Nullable java.lang.String |
label
The
Command's label that was used |
@NotNull AnnoyingPlugin |
plugin
The
AnnoyingPlugin instance |
| Constructor and Description |
|---|
AnnoyingSender(@NotNull AnnoyingPlugin plugin,
@NotNull org.bukkit.command.CommandSender cmdSender)
Constructs a new
AnnoyingSender without a Command |
AnnoyingSender(@NotNull AnnoyingPlugin plugin,
@NotNull org.bukkit.command.CommandSender cmdSender,
@Nullable org.bukkit.command.Command command,
@Nullable java.lang.String label,
@Nullable java.lang.String[] args)
Constructs a new
AnnoyingSender |
| Modifier and Type | Method and Description |
|---|---|
boolean |
argEquals(int index,
java.lang.String... strings)
Returns if the specified
args index is equal to any of the specified strings (case-insensitive) |
boolean |
checkPermission(@NotNull java.lang.String permission)
Checks if the
CommandSender has the specified permission. |
boolean |
checkPlayer()
Checks if the
CommandSender is a Player. |
boolean |
equalsSender(@NotNull org.bukkit.command.CommandSender sender)
Checks if the provided
CommandSender is the same as the cmdSender |
@NotNull AnnoyingPlugin |
getAnnoyingPlugin()
The
AnnoyingPlugin instance |
@NotNull org.bukkit.entity.Player |
getPlayer()
Casts the
CommandSender to a Player |
@Nullable org.bukkit.entity.Player |
getPlayerOrNull()
If the
CommandSender is a Player, it returns it as one. |
void |
invalidArgument(@Nullable java.lang.Object argument)
Sends the invalid argument message, replacing
%argument% with the specified argument |
void |
invalidArgumentByIndex(int index)
Sends the invalid argument message, replacing
%argument% with the specified argument |
void |
invalidArguments()
Sends the invalid arguments message
|
@NotNull public final @NotNull AnnoyingPlugin plugin
AnnoyingPlugin instance@NotNull public final @NotNull org.bukkit.command.CommandSender cmdSender
CommandSender that was used to initialize this AnnoyingSender@Nullable public final @Nullable org.bukkit.command.Command command
Command that was used@Nullable public final @Nullable java.lang.String label
Command's label that was used@Nullable public final @Nullable java.lang.String[] args
Command's arguments that were usedpublic final boolean isPlayer
cmdSender is a Playerpublic AnnoyingSender(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull org.bukkit.command.CommandSender cmdSender,
@Nullable
@Nullable org.bukkit.command.Command command,
@Nullable
@Nullable java.lang.String label,
@Nullable
@Nullable java.lang.String[] args)
AnnoyingSenderplugin - the AnnoyingPlugin instancecmdSender - the CommandSender to be usedcommand - the Command that was usedlabel - the Command's label that was usedargs - the Command's arguments that were usedpublic AnnoyingSender(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull org.bukkit.command.CommandSender cmdSender)
AnnoyingSender without a Commandplugin - the AnnoyingPlugin instancecmdSender - the CommandSender to be used@NotNull public @NotNull AnnoyingPlugin getAnnoyingPlugin()
AnnoyableAnnoyingPlugin instancegetAnnoyingPlugin in interface Annoyablepublic boolean equalsSender(@NotNull
@NotNull org.bukkit.command.CommandSender sender)
CommandSender is the same as the cmdSendersender - the CommandSender to checkCommandSender is the same as the cmdSenderpublic boolean argEquals(int index,
@Nullable
java.lang.String... strings)
args index is equal to any of the specified strings (case-insensitive)index - the argument indexstrings - the strings to compare totrue if the specified args index is equal to any of the specified strings (case-insensitive)public boolean checkPlayer()
CommandSender is a Player. If they aren't, it sends the MessagesOptions.MessageKeys#playerOnly messageCommandSender is a Playerpublic boolean checkPermission(@NotNull
@NotNull java.lang.String permission)
CommandSender has the specified permission. If they don't, it sends the MessagesOptions.MessageKeys#noPermission messagepermission - the permission to checkCommandSender has the specified permission@NotNull public @NotNull org.bukkit.entity.Player getPlayer()
CommandSender to a Player
Only use this if you know that the CommandSender is a Player, otherwise use getPlayerOrNull()
Player that was usedjava.lang.IllegalStateException - if the CommandSender is not a PlayergetPlayerOrNull()@Nullable public @Nullable org.bukkit.entity.Player getPlayerOrNull()
CommandSender is a Player, it returns it as one. Otherwise, it returns null
CommandSender is a Player, use getPlayer() insteadPlayer, or null if the CommandSender is not a PlayergetPlayer()public void invalidArgument(@Nullable
@Nullable java.lang.Object argument)
%argument% with the specified argumentargument - the argument to replace %argument% withpublic void invalidArgumentByIndex(int index)
%argument% with the specified argumentindex - the argument indexpublic void invalidArguments()