Search in sources :

Example 1 with Settings

use of com.ebicep.warlords.player.Settings in project Warlords by ebicep.

the class ParticleQualityCommand method onCommand.

@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
    Player player = BaseCommand.requirePlayer(sender);
    if (player != null) {
        if (args.length == 0) {
            player.sendMessage(ChatColor.GREEN + "Possible Values: LOW, MEDIUM, HIGH");
            return true;
        }
        if (args[0] != null) {
            if (Arrays.stream(Settings.ParticleQuality.values()).anyMatch((t) -> t.name().equals(args[0].toUpperCase()))) {
                Settings.ParticleQuality newParticleQuality = Settings.ParticleQuality.valueOf(args[0].toUpperCase());
                PlayerSettings settings = Warlords.getPlayerSettings(player.getUniqueId());
                settings.setParticleQuality(newParticleQuality);
                DatabasePlayer databasePlayer = DatabaseManager.playerService.findByUUID(player.getUniqueId());
                databasePlayer.setParticleQuality(newParticleQuality);
                DatabaseManager.updatePlayerAsync(databasePlayer);
                sender.sendMessage(ChatColor.GREEN + "Particle Quality set to " + args[0].toUpperCase());
                return true;
            }
        }
        sender.sendMessage(ChatColor.RED + "Not found. Possible Values: LOW, MEDIUM, HIGH");
        return true;
    }
    return true;
}
Also used : Player(org.bukkit.entity.Player) DatabasePlayer(com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer) PlayerSettings(com.ebicep.warlords.player.PlayerSettings) DatabasePlayer(com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer) Settings(com.ebicep.warlords.player.Settings) PlayerSettings(com.ebicep.warlords.player.PlayerSettings)

Aggregations

DatabasePlayer (com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer)1 PlayerSettings (com.ebicep.warlords.player.PlayerSettings)1 Settings (com.ebicep.warlords.player.Settings)1 Player (org.bukkit.entity.Player)1