use of com.github.sirblobman.combatlogx.api.expansion.Expansion.State in project CombatLogX by SirBlobman.
the class CommandCombatLogXAbout method sendExpansionInformation.
private void sendExpansionInformation(CommandSender sender, Expansion expansion) {
String name = expansion.getName();
String prefix = expansion.getPrefix();
State state = expansion.getState();
ExpansionDescription information = expansion.getDescription();
String description = information.getDescription();
List<String> authorList = information.getAuthors();
String authorString = String.join(", ", authorList);
String version = information.getVersion();
List<String> messageList = new ArrayList<>();
messageList.add("&f");
messageList.add("&f&lExpansion Information for &a" + name + "&f&l:");
messageList.add("&f&lDisplay Name: &7" + prefix);
messageList.add("&f&lVersion: &7" + version);
messageList.add("&f&lState: &7" + state);
messageList.add("&f");
messageList.add("&f&lDescription: &7" + description);
messageList.add("&f&lAuthors: &7" + authorString);
List<String> colorList = MessageUtility.colorList(messageList);
for (String message : colorList) {
sender.sendMessage(message);
}
}
use of com.github.sirblobman.combatlogx.api.expansion.Expansion.State in project CombatLogX by SirBlobman.
the class ExpansionManager method enableExpansion.
public void enableExpansion(Expansion expansion) {
State state = expansion.getState();
if (state == State.ENABLED)
return;
ICombatLogX plugin = getPlugin();
Logger logger = plugin.getLogger();
try {
ExpansionDescription description = expansion.getDescription();
String fullName = description.getFullName();
logger.info("Enabling expansion '" + fullName + "'...");
expansion.setState(State.ENABLED);
expansion.onEnable();
} catch (Exception ex) {
logger.log(Level.SEVERE, "An error occurred while enabling an expansion:", ex);
}
}
use of com.github.sirblobman.combatlogx.api.expansion.Expansion.State in project CombatLogX by SirBlobman.
the class ExpansionManager method disableExpansion.
public void disableExpansion(Expansion expansion) {
State state = expansion.getState();
if (state != State.ENABLED)
return;
ICombatLogX plugin = getPlugin();
Logger logger = plugin.getLogger();
try {
ExpansionDescription description = expansion.getDescription();
String fullName = description.getFullName();
logger.info("Disabling expansion '" + fullName + "'...");
List<Listener> listenerList = expansion.getListeners();
listenerList.forEach(HandlerList::unregisterAll);
listenerList.clear();
expansion.setState(State.DISABLED);
expansion.onDisable();
} catch (Exception ex) {
logger.log(Level.SEVERE, "An error occurred while enabling an expansion:", ex);
}
}
use of com.github.sirblobman.combatlogx.api.expansion.Expansion.State in project CombatLogX by SirBlobman.
the class HookPlaceholderAPI method getNewbieHelper.
private Expansion getNewbieHelper() {
ICombatLogX plugin = this.expansion.getPlugin();
ExpansionManager expansionManager = plugin.getExpansionManager();
Optional<Expansion> optionalExpansion = expansionManager.getExpansion("NewbieHelper");
if (optionalExpansion.isPresent()) {
Expansion expansion = optionalExpansion.get();
State state = expansion.getState();
if (state == State.ENABLED)
return expansion;
}
return null;
}
use of com.github.sirblobman.combatlogx.api.expansion.Expansion.State in project CombatLogX by SirBlobman.
the class HookMVdWPlaceholderAPI method getNewbieHelper.
private Expansion getNewbieHelper() {
ICombatLogX plugin = this.expansion.getPlugin();
ExpansionManager expansionManager = plugin.getExpansionManager();
Optional<Expansion> optionalExpansion = expansionManager.getExpansion("NewbieHelper");
if (optionalExpansion.isPresent()) {
Expansion expansion = optionalExpansion.get();
State state = expansion.getState();
if (state == State.ENABLED)
return expansion;
}
return null;
}
Aggregations