Search in sources :

Example 1 with PlayerDataManager

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);
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

Example 2 with PlayerDataManager

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);
}
Also used : StoredInventory(combatlogx.expansion.compatibility.citizens.object.StoredInventory) PlayerInventory(org.bukkit.inventory.PlayerInventory) UUID(java.util.UUID) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) CitizensExpansion(combatlogx.expansion.compatibility.citizens.CitizensExpansion) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 3 with PlayerDataManager

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;
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

Example 4 with PlayerDataManager

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);
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

Example 5 with PlayerDataManager

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);
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

Aggregations

PlayerDataManager (com.github.sirblobman.api.configuration.PlayerDataManager)20 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)17 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)8 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)6 UUID (java.util.UUID)5 Player (org.bukkit.entity.Player)4 EventHandler (org.bukkit.event.EventHandler)3 LanguageManager (com.github.sirblobman.api.language.LanguageManager)2 Replacer (com.github.sirblobman.api.language.Replacer)2 CitizensExpansion (combatlogx.expansion.compatibility.citizens.CitizensExpansion)2 Collections (java.util.Collections)2 List (java.util.List)2 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)2 LivingEntity (org.bukkit.entity.LivingEntity)2 WorldXYZ (com.github.sirblobman.api.object.WorldXYZ)1 CombatLogPlayerCommand (com.github.sirblobman.combatlogx.api.command.CombatLogPlayerCommand)1 PlayerPunishEvent (com.github.sirblobman.combatlogx.api.event.PlayerPunishEvent)1 PlayerUntagEvent (com.github.sirblobman.combatlogx.api.event.PlayerUntagEvent)1 Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)1 ExpansionListener (com.github.sirblobman.combatlogx.api.expansion.ExpansionListener)1