Skip to content
Permalink
Browse files

improve armor command output clarity

  • Loading branch information...
mcmonkey4eva committed Apr 9, 2019
1 parent b598b93 commit e04b03ac04e73fdb3ce95de07cb21a70fec1734a
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/main/java/org/mcmonkey/sentinel/commands/SentinelHealthCommands.java
@@ -4,6 +4,7 @@
import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.command.Requirements;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,7 +25,21 @@ public void armor(CommandContext args, CommandSender sender, SentinelTrait senti
double d = Double.parseDouble(args.getString(1));
if (d <= 1) {
sentinel.armor = d;
sender.sendMessage(SentinelCommand.prefixGood + "Armor set!");
String armorInfo;
if (d == 0) {
armorInfo = "no armor";
}
else if (d < 0) {
armorInfo = "automatic armor calculation";
}
else if (d == 1) {
armorInfo = "100%, invincible armor";
}
else {
armorInfo = (d * 100) + "%";
}
sender.sendMessage(SentinelCommand.prefixGood + "Armor set to " + ChatColor.AQUA + d
+ SentinelCommand.colorBasic + "! (" + armorInfo + ")");
}
else {
throw new NumberFormatException("Number out of range (must be <= 1).");

0 comments on commit e04b03a

Please sign in to comment.
You can’t perform that action at this time.