public class CommandUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.bukkit.Location |
getLocation(org.bukkit.command.CommandSender sender)
Gets the location that is "~ ~ ~" for a command sender.
|
static org.bukkit.Location |
getLocation(org.bukkit.command.CommandSender sender,
String x,
String y,
String z)
Parses coordinates that may be absolute or relative.
|
static org.bukkit.Location |
getLocation(org.bukkit.Location location,
String relativeX,
String relativeY,
String relativeZ)
Gets the relative location based on the given axis values (x/y/z) based on tilde
notation.
|
static String |
getName(org.bukkit.command.CommandSender sender)
Gets the name of a command sender.
|
static String |
getName(org.bukkit.entity.Entity entity)
Gets the name of an entity.
|
static org.bukkit.Location |
getRotation(org.bukkit.Location location,
String yawRelative,
String pitchRelative)
Gets the relative location based on the given rotation values (yaw/relative) based on
tilde notation.
|
static GlowWorld |
getWorld(org.bukkit.command.CommandSender sender)
Returns the world that the given command sender is referring to when not specifying one.
|
static boolean |
isPhysical(org.bukkit.command.CommandSender sender) |
static BlockStateData |
readState(org.bukkit.command.CommandSender sender,
org.bukkit.Material type,
String state)
Parses a block state from a string.
|
static String |
toNamespaced(String input)
Returns the input unchanged if it already has a namespace prefix; otherwise, adds the
NamespacedKey.MINECRAFT prefix. |
public static BlockStateData readState(org.bukkit.command.CommandSender sender, org.bukkit.Material type, String state)
sender - the target who should receive an error message if state is
invalidtype - the block typestate - a string specifying a block statetype and state, or null if none matchpublic static GlowWorld getWorld(org.bukkit.command.CommandSender sender)
sender - a command senderpublic static org.bukkit.Location getLocation(org.bukkit.command.CommandSender sender)
sender - a command senderpublic static org.bukkit.Location getLocation(org.bukkit.command.CommandSender sender,
String x,
String y,
String z)
sender - the command senderx - the x coordinate specifiery - the y coordinate specifierz - the z coordinate specifierpublic static org.bukkit.Location getLocation(org.bukkit.Location location,
String relativeX,
String relativeY,
String relativeZ)
Gets the relative location based on the given axis values (x/y/z) based on tilde notation.
For instance, using axis values of ~10 ~ ~15 will return the location with the offset of the given rotation values.
location - the initial locationrelativeX - the relative x-axis (if there is no tilde [~], then the literal
value is used)relativeY - the relative y-axis (if there is no tilde [~], then the literal
value is used)relativeZ - the relative z-axis (if there is no tilde [~], then the literal
value is used)public static org.bukkit.Location getRotation(org.bukkit.Location location,
String yawRelative,
String pitchRelative)
Gets the relative location based on the given rotation values (yaw/relative) based on tilde notation.
For instance, using rotations of ~10 ~15 will return the location with the offset of the given rotation values.
location - the initial locationyawRelative - the relative yaw (if there is no tilde [~], then the literal value
is used)pitchRelative - the relative pitch (if there is no tilde [~], then the literal
value is used)public static String getName(org.bukkit.command.CommandSender sender)
sender - the senderpublic static String getName(org.bukkit.entity.Entity entity)
entity - an entityentity.getCustomName(), entity.getName(), entity.getType().getName()public static boolean isPhysical(org.bukkit.command.CommandSender sender)
public static String toNamespaced(String input)
NamespacedKey.MINECRAFT prefix.input - a namespaced-key name, or prefix of one, that may or may not be namespacedCopyright © 2021. All rights reserved.