use of com.elmakers.mine.bukkit.api.magic.MagicProperties in project MagicPlugin by elBukkit.
the class MageCommandExecutor method onMageDescribe.
public boolean onMageDescribe(CommandSender sender, Player player, String[] parameters) {
Mage mage = controller.getMage(player);
MageClass activeClass = mage.getActiveClass();
MagicProperties mageProperties = mage.getProperties();
if (parameters.length == 0) {
sender.sendMessage(ChatColor.BLUE + "Use " + ChatColor.AQUA + "/mage describe <property>" + ChatColor.BLUE + " for specific properties");
sender.sendMessage(ChatColor.BLUE + "Use " + ChatColor.AQUA + "/mage activate" + ChatColor.BLUE + " to change or clear the active class");
Collection<String> classKeys = mage.getClassKeys();
if (classKeys.size() > 0) {
Collection<String> coloredClasses = new ArrayList<>();
for (String classKey : classKeys) {
ChatColor color = mage.hasClassUnlocked(classKey) ? ChatColor.GREEN : ChatColor.GRAY;
coloredClasses.add(color + classKey);
}
sender.sendMessage(ChatColor.AQUA + "Classes: " + ChatColor.GREEN + StringUtils.join(coloredClasses, ","));
}
if (!mageProperties.isEmpty()) {
sender.sendMessage(ChatColor.AQUA + "Mage properties:");
mageProperties.describe(sender, BaseMagicProperties.HIDDEN_PROPERTY_KEYS);
}
if (activeClass != null) {
sender.sendMessage(ChatColor.AQUA + "Active class: " + ChatColor.GREEN + activeClass.getKey());
} else {
sender.sendMessage(ChatColor.DARK_GREEN + "No active class");
}
Set<Spell> activeSpells = mage.getActiveSpells();
if (activeSpells != null && !activeSpells.isEmpty()) {
Collection<String> spellNames = new ArrayList<>();
for (Spell spell : activeSpells) {
spellNames.add(spell.getName());
}
sender.sendMessage(ChatColor.AQUA + "Active spells: " + ChatColor.DARK_AQUA + StringUtils.join(spellNames, ","));
}
if (activeClass != null) {
activeClass.describe(sender, BaseMagicProperties.HIDDEN_PROPERTY_KEYS);
}
} else {
Object property = activeClass.getProperty(parameters[0]);
if (property == null) {
sender.sendMessage(ChatColor.DARK_AQUA + parameters[0] + ChatColor.GRAY + ": " + ChatColor.RED + "(Not Set)");
} else {
sender.sendMessage(ChatColor.DARK_AQUA + parameters[0] + ChatColor.GRAY + ": " + ChatColor.WHITE + InventoryUtils.describeProperty(property));
}
}
return true;
}
Aggregations