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 ActionBarUpdater method isDisabled.
private boolean isDisabled(Player player) {
if (isGlobalEnabled()) {
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
return !playerData.getBoolean("actionbar", true);
}
return true;
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class CommandCombatLogXToggle method toggleValue.
private void toggleValue(Player player, String value) {
ICombatLogX plugin = getCombatLogX();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
LanguageManager languageManager = getLanguageManager();
YamlConfiguration playerData = playerDataManager.get(player);
boolean currentValue = playerData.getBoolean(value, true);
playerData.set(value, !currentValue);
playerDataManager.save(player);
boolean status = playerData.getBoolean(value, true);
String statusPath = ("placeholder.toggle." + (status ? "enabled" : "disabled"));
String statusString = languageManager.getMessage(player, statusPath, null, true);
Replacer replacer = message -> message.replace("{status}", statusString);
String messagePath = ("command.combatlogx.toggle-" + value);
sendMessageWithPrefix(player, messagePath, replacer, true);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class ListenerDeath method onJoin.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onJoin(PlayerJoinEvent e) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("punish.yml");
String killTime = configuration.getString("kill-time");
if (killTime == null || !killTime.equalsIgnoreCase("join")) {
return;
}
Player player = e.getPlayer();
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration playerData = playerDataManager.get(player);
if (!playerData.getBoolean("kill-on-join", false)) {
return;
}
playerData.set("kill-on-join", false);
playerDataManager.save(player);
add(player);
player.setHealth(0.0D);
}
use of com.github.sirblobman.api.configuration.PlayerDataManager in project CombatLogX by SirBlobman.
the class CustomScoreboardManager method isDisabled.
private boolean isDisabled(Player player) {
if (isGlobalEnabled()) {
PlayerDataManager playerDataManager = getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
return !configuration.getBoolean("scoreboard", true);
}
return true;
}
Aggregations