use of com.github.sirblobman.combatlogx.api.ICombatLogX 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.ICombatLogX in project CombatLogX by SirBlobman.
the class HookPlaceholderAPI method getNewbieHelperPVPStatus.
private String getNewbieHelperPVPStatus(Player player) {
ICombatLogX plugin = this.expansion.getPlugin();
LanguageManager languageManager = plugin.getLanguageManager();
boolean pvp = true;
Expansion expansion = getNewbieHelper();
if (expansion != null) {
NewbieHelperExpansion newbieHelperExpansion = (NewbieHelperExpansion) expansion;
PVPManager pvpManager = newbieHelperExpansion.getPVPManager();
pvp = !pvpManager.isDisabled(player);
}
String messagePath = ("placeholder.pvp-status." + (pvp ? "enabled" : "disabled"));
return languageManager.getMessage(player, messagePath, null, true);
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class HookPlaceholderAPI method getEnemyPlaceholder.
private String getEnemyPlaceholder(Player player, String enemyPlaceholder) {
ICombatLogX plugin = this.expansion.getPlugin();
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy instanceof Player) {
Player playerEnemy = (Player) enemy;
String placeholder = String.format(Locale.US, "{%s}", enemyPlaceholder);
return PlaceholderAPI.setBracketPlaceholders(playerEnemy, placeholder);
}
return getUnknownEnemy(plugin, player);
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class SuperiorSkyblockExpansion method onEnable.
@Override
public void onEnable() {
if (!checkDependency("SuperiorSkyblock2", true)) {
ICombatLogX plugin = getPlugin();
ExpansionManager expansionManager = plugin.getExpansionManager();
expansionManager.disableExpansion(this);
return;
}
new ListenerSuperiorSkyblock(this).register();
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class PVPManager method isDisabled.
public boolean isDisabled(Player player) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
return false;
}
ConfigurationManager configurationManager = this.expansion.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
boolean defaultPvpState = configuration.getBoolean("pvp-toggle-default-status", true);
ICombatLogX plugin = this.expansion.getPlugin();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
return !playerData.getBoolean("newbie-helper.pvp-toggle", defaultPvpState);
}
Aggregations