use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class ProtectionManager method isProtected.
public boolean isProtected(Player player) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
return false;
}
ICombatLogX plugin = this.expansion.getPlugin();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
if (!configuration.getBoolean("newbie-helper.protected")) {
return false;
}
long expireTime = configuration.getLong("newbie-helper.protection-expire-time", 0L);
long systemTime = System.currentTimeMillis();
if (systemTime < expireTime) {
return true;
}
setProtected(player, false);
LanguageManager languageManager = this.expansion.getPlugin().getLanguageManager();
languageManager.sendMessage(player, "expansion.newbie-helper.protection-disabled.expired", null, true);
return false;
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class RewardExpansion method onEnable.
@Override
public void onEnable() {
ICombatLogX plugin = getPlugin();
ExpansionManager expansionManager = plugin.getExpansionManager();
if (!checkDependency("Vault", true)) {
expansionManager.disableExpansion(this);
return;
}
this.hookVault = new HookVault(this);
if (!this.hookVault.setupEconomy()) {
expansionManager.disableExpansion(this);
return;
}
RewardManager rewardManager = getRewardManager();
rewardManager.loadRewards();
new ListenerRewards(this).register();
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class VanishNoPacketExpansion method onEnable.
@Override
public void onEnable() {
if (!checkDependency("VanishNoPacket", true, "3")) {
ICombatLogX plugin = getPlugin();
ExpansionManager expansionManager = plugin.getExpansionManager();
expansionManager.disableExpansion(this);
return;
}
new ListenerVanish(this).register();
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class ListenerLands method getNewbieHelperExpansion.
private NewbieHelperExpansion getNewbieHelperExpansion() {
ICombatLogX combatLogX = getCombatLogX();
ExpansionManager expansionManager = combatLogX.getExpansionManager();
Optional<Expansion> optionalExpansion = expansionManager.getExpansion("NewbieHelper");
if (!optionalExpansion.isPresent()) {
throw new IllegalArgumentException("NewbieHelper expansion is missing.");
}
Expansion expansion = optionalExpansion.get();
if (!(expansion instanceof NewbieHelperExpansion)) {
throw new IllegalArgumentException("NewbieHelper expansion is not a proper instance.");
}
return (NewbieHelperExpansion) expansion;
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class HookMVdWPlaceholderAPI method onPlaceholderReplace.
@Override
public String onPlaceholderReplace(PlaceholderReplaceEvent e) {
ICombatLogX plugin = this.expansion.getPlugin();
Player player = e.getPlayer();
if (player == null)
return null;
String id = e.getPlaceholder();
if (!id.startsWith("combatlogx_"))
return null;
String placeholder = id.substring("combatlogx_".length());
switch(placeholder) {
case "time_left":
return getTimeLeft(plugin, player);
case "in_combat":
return getInCombat(plugin, player);
case "status":
return getStatus(plugin, player);
case "punishment_count":
return getPunishmentCount(plugin, player);
case "newbie_helper_pvp_status":
return getNewbieHelperPVPStatus(player);
case "newbie_helper_protected":
return getNewbieHelperProtected(player);
default:
break;
}
if (placeholder.startsWith("enemy_")) {
String enemyPlaceholder = placeholder.substring("enemy_".length());
switch(enemyPlaceholder) {
case "name":
return getEnemyName(plugin, player);
case "type":
return getEnemyType(plugin, player);
case "display_name":
return getEnemyDisplayName(plugin, player);
case "health":
return getEnemyHealth(plugin, player);
case "health_rounded":
return getEnemyHealthRounded(plugin, player);
case "hearts":
return getEnemyHearts(plugin, player);
case "hearts_count":
return getEnemyHeartsCount(plugin, player);
case "world":
return getEnemyWorld(plugin, player);
case "x":
return getEnemyX(plugin, player);
case "y":
return getEnemyY(plugin, player);
case "z":
return getEnemyZ(plugin, player);
default:
break;
}
return getEnemyPlaceholder(player, enemyPlaceholder);
}
return null;
}
Aggregations