private void infoCommand(CommandSender sender) {
// Get String of Registered Economy Services
String registeredEcons = null;
Collection<RegisteredServiceProvider<Economy>> econs = this.getServer().getServicesManager().getRegistrations(Economy.class);
for (RegisteredServiceProvider<Economy> econ : econs) {
Economy e = econ.getProvider();
if (registeredEcons == null) {
registeredEcons = e.getName();
} else {
registeredEcons += ", " + e.getName();
}
}
// Get String of Registered Permission Services
String registeredPerms = null;
Collection<RegisteredServiceProvider<Permission>> perms = this.getServer().getServicesManager().getRegistrations(Permission.class);
for (RegisteredServiceProvider<Permission> perm : perms) {
Permission p = perm.getProvider();
if (registeredPerms == null) {
registeredPerms = p.getName();
} else {
registeredPerms += ", " + p.getName();
}
}
String registeredChats = null;
Collection<RegisteredServiceProvider<Chat>> chats = this.getServer().getServicesManager().getRegistrations(Chat.class);
for (RegisteredServiceProvider<Chat> chat : chats) {
Chat c = chat.getProvider();
if (registeredChats == null) {
registeredChats = c.getName();
} else {
registeredChats += ", " + c.getName();
}
}
// Get Economy & Permission primary Services
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
Economy econ = null;
if (rsp != null) {
econ = rsp.getProvider();
}
Permission perm = null;
RegisteredServiceProvider<Permission> rspp = getServer().getServicesManager().getRegistration(Permission.class);
if (rspp != null) {
perm = rspp.getProvider();
}
Chat chat = null;
RegisteredServiceProvider<Chat> rspc = getServer().getServicesManager().getRegistration(Chat.class);
if (rspc != null) {
chat = rspc.getProvider();
}
// Send user some info!
sender.sendMessage(String.format("[%s] Vault v%s Information", getDescription().getName(), getDescription().getVersion()));
sender.sendMessage(String.format("[%s] Economy: %s [%s]", getDescription().getName(), econ == null ? "None" : econ.getName(), registeredEcons));
sender.sendMessage(String.format("[%s] Permission: %s [%s]", getDescription().getName(), perm == null ? "None" : perm.getName(), registeredPerms));
sender.sendMessage(String.format("[%s] Chat: %s [%s]", getDescription().getName(), chat == null ? "None" : chat.getName(), registeredChats));
}