use of com.elmakers.mine.bukkit.api.entity.EntityData in project MagicPlugin by elBukkit.
the class MagicMobCommandExecutor method onListMobs.
protected void onListMobs(CommandSender sender) {
Map<String, Integer> mobCounts = new HashMap<>();
Collection<Mage> mages = new ArrayList<>(api.getController().getMobMages());
for (Mage mage : mages) {
EntityData entityData = mage.getEntityData();
if (entityData == null)
continue;
Integer mobCount = mobCounts.get(entityData.getKey());
if (mobCount == null) {
mobCounts.put(entityData.getKey(), 1);
} else {
mobCounts.put(entityData.getKey(), mobCount + 1);
}
}
Set<String> keys = api.getController().getMobKeys();
for (String key : keys) {
EntityData mobType = api.getController().getMob(key);
String message = ChatColor.AQUA + key + ChatColor.WHITE + " : " + ChatColor.DARK_AQUA + mobType.describe();
Integer mobCount = mobCounts.get(key);
if (mobCount != null) {
message = message + ChatColor.GRAY + " (" + ChatColor.GREEN + mobCount + ChatColor.DARK_GREEN + " Active" + ChatColor.GRAY + ")";
}
sender.sendMessage(message);
}
}
Aggregations