use of com.github.sirblobman.api.configuration.PlayerDataManager 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.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class CombatNpcManager method saveData.
public void saveData(OfflinePlayer player) {
ICombatLogX plugin = getCombatLogX();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
playerDataManager.save(player);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class InventoryManager method getStoredInventory.
@Nullable
public StoredInventory getStoredInventory(OfflinePlayer player) {
Validate.notNull(player, "player must not be null!");
UUID playerId = player.getUniqueId();
if (this.storedInventoryMap.containsKey(playerId)) {
return this.storedInventoryMap.get(playerId);
}
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
String storagePath = ("citizens-compatibility.stored-inventory");
ConfigurationSection section = configuration.getConfigurationSection(storagePath);
if (section == null) {
return null;
}
CitizensExpansion expansion = getExpansion();
return StoredInventory.createFrom(expansion, section);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class InventoryManager method removeStoredInventory.
public void removeStoredInventory(OfflinePlayer player) {
Validate.notNull(player, "player must not be null!");
UUID playerId = player.getUniqueId();
this.storedInventoryMap.remove(playerId);
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
String storagePath = ("citizens-compatibility.stored-inventory");
configuration.set(storagePath, null);
playerDataManager.save(player);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class CombatNpcManager method getData.
public YamlConfiguration getData(OfflinePlayer player) {
ICombatLogX plugin = getCombatLogX();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
return playerDataManager.get(player);
}
Aggregations