mirror of
https://github.com/songoda/EpicAnchors.git
synced 2024-10-31 23:59:35 +01:00
Added warning for non whole numbers.
This commit is contained in:
parent
23fbd64734
commit
ecefc17481
@ -24,12 +24,21 @@ public class CommandGive extends AbstractCommand {
|
|||||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||||
if (args.length != 2) return ReturnType.SYNTAX_ERROR;
|
if (args.length != 2) return ReturnType.SYNTAX_ERROR;
|
||||||
|
|
||||||
|
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
if (target == null && !args[0].trim().toLowerCase().equals("all")) {
|
if (target == null && !args[0].trim().toLowerCase().equals("all")) {
|
||||||
instance.getLocale().newMessage("&cThat is not a player...").sendMessage(sender);
|
instance.getLocale().newMessage("&cThat is not a player...").sendPrefixedMessage(sender);
|
||||||
return ReturnType.SYNTAX_ERROR;
|
return ReturnType.SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer.parseInt(args[1]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
instance.getLocale().newMessage("&cYou can only use whole numbers...").sendPrefixedMessage(sender);
|
||||||
|
return ReturnType.FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ItemStack itemStack = instance.makeAnchorItem(Integer.parseInt(args[1]) * 20 * 60 * 60);
|
ItemStack itemStack = instance.makeAnchorItem(Integer.parseInt(args[1]) * 20 * 60 * 60);
|
||||||
|
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user