use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class PVPManager method setPVP.
public void setPVP(Player player, boolean pvp) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
return;
}
ICombatLogX plugin = this.expansion.getPlugin();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
playerData.set("newbie-helper.pvp-toggle", pvp);
playerDataManager.save(player);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class InventoryManager method storeInventory.
public void storeInventory(Player player) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
throw new IllegalArgumentException("player must not be an NPC!");
}
PlayerInventory playerInventory = player.getInventory();
StoredInventory storedInventory = StoredInventory.createFrom(playerInventory);
UUID playerId = player.getUniqueId();
this.storedInventoryMap.put(playerId, storedInventory);
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
ConfigurationSection section = configuration.createSection("citizens-compatibility.stored-inventory");
CitizensExpansion expansion = getExpansion();
storedInventory.save(expansion, section);
playerDataManager.save(player);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class BossBarUpdater method isDisabled.
private boolean isDisabled(Player player) {
if (isGlobalEnabled()) {
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
return !playerData.getBoolean("bossbar", true);
}
return true;
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class ProtectionManager method setProtected.
public void setProtected(Player player, boolean protect) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
return;
}
ICombatLogX plugin = this.expansion.getPlugin();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
if (!protect) {
playerData.set("newbie-helper.protected", false);
playerData.set("newbie-helper.protection-expire-time", null);
playerDataManager.save(player);
return;
}
long newExpireTime = getProtectionExpireTime();
playerData.set("newbie-helper.protected", true);
playerData.set("newbie-helper.protection-expire-time", newExpireTime);
playerDataManager.save(player);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class PunishManager method getPunishmentCount.
@Override
public long getPunishmentCount(OfflinePlayer player) {
ConfigurationManager configurationManager = this.plugin.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("punish.yml");
if (!configuration.getBoolean("enable-punishment-counter")) {
return 0L;
}
PlayerDataManager playerDataManager = this.plugin.getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
return playerData.getLong("punishment-count", 0L);
}
Aggregations