List of usage examples for org.joda.time DateTime getYear
public int getYear()
From source file:com.aionemu.gameserver.dataholders.InstanceCooltimeData.java
License:Open Source License
public long getInstanceEntranceCooltime(Player player, int worldId) { int instanceCooldownRate = InstanceService.getInstanceRate(player, worldId); long instanceCoolTime = 0; InstanceCooltime clt = getInstanceCooltimeByWorldId(worldId); if (clt != null) { instanceCoolTime = clt.getEntCoolTime(); if (clt.getCoolTimeType().isDaily()) { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), (int) (instanceCoolTime / 100), 0, 0); if (now.isAfter(repeatDate)) { repeatDate = repeatDate.plusHours(24); instanceCoolTime = repeatDate.getMillis(); } else { instanceCoolTime = repeatDate.getMillis(); }/*from w w w.j av a2s .c o m*/ } else if (clt.getCoolTimeType().isWeekly()) { String[] days = clt.getTypeValue().split(","); instanceCoolTime = getUpdateHours(days, (int) (instanceCoolTime / 100)); } else { instanceCoolTime = System.currentTimeMillis() + (instanceCoolTime * 60 * 1000); } } if (instanceCooldownRate != 1) { instanceCoolTime = System.currentTimeMillis() + ((instanceCoolTime - System.currentTimeMillis()) / instanceCooldownRate); } return instanceCoolTime; }
From source file:com.aionemu.gameserver.dataholders.InstanceCooltimeData.java
License:Open Source License
private long getUpdateHours(String[] days, int hour) { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), hour, 0, 0); int curentDay = now.getDayOfWeek(); for (String name : days) { int day = getDay(name); if (day < curentDay) { continue; }//from w w w . j a va2 s . c om if (day == curentDay) { if (now.isBefore(repeatDate)) { return repeatDate.getMillis(); } } else { repeatDate = repeatDate.plusDays(day - curentDay); return repeatDate.getMillis(); } } return repeatDate.plusDays((7 - curentDay) + getDay(days[0])).getMillis(); }
From source file:com.aionemu.gameserver.model.gameobjects.UseableItemObject.java
License:Open Source License
@Override public void onUse(final Player player) { if (!usingPlayer.compareAndSet(null, player)) { // The same player is using, return. It might be double-click if (usingPlayer.compareAndSet(player, player)) { return; }//ww w . j ava 2 s .c o m PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_OCCUPIED_BY_OTHER); return; } boolean isOwner = getOwnerHouse().getOwnerId() == player.getObjectId(); if (getObjectTemplate().isOwnerOnly() && !isOwner) { warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_IS_ONLY_FOR_OWNER_VALID); return; } boolean cdExpired = player.getHouseObjectCooldownList().isCanUseObject(getObjectId()); if (!cdExpired) { if (getObjectTemplate().getCd() != null && getObjectTemplate().getCd() != 0) { warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_CANNOT_USE_FLOWERPOT_COOLTIME); return; } if (getObjectTemplate().isOwnerOnly() && isOwner) { warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_CANT_USE_PER_DAY); return; } } final UseItemAction action = getObjectTemplate().getAction(); if (action == null) { // Some objects do not have actions; they are test items now warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_ALL_CANT_USE); return; } if (getObjectTemplate().getPlacementLimit() == LimitType.COOKING) { // Check if player already has an item if (player.getInventory().getItemCountByItemId(action.getRewardId()) > 0) { int nameId = DataManager.ITEM_DATA.getItemTemplate(action.getRewardId()).getNameId(); SM_SYSTEM_MESSAGE msg = SM_SYSTEM_MESSAGE.STR_MSG_CANNOT_USE_ALREADY_HAVE_REWARD_ITEM(nameId, getObjectTemplate().getNameId()); warnAndRelease(player, msg); return; } } final Integer useCount = getObjectTemplate().getUseCount(); int currentUseCount = 0; if (useCount != null) { // Counter is for both, but could be made custom from configs currentUseCount = getOwnerUsedCount() + getVisitorUsedCount(); if (currentUseCount >= useCount && !isOwner || currentUseCount > useCount && isOwner) { // if expiration is set then final reward has to be given for owner only // due to inventory full. If inventory was not full, the object had to be despawned, so // we wouldn't reach this check. if (!mustGiveLastReward || !isOwner) { warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_ACHIEVE_USE_COUNT); return; } } } final Integer requiredItem = getObjectTemplate().getRequiredItem(); if (mustGiveLastReward && !isOwner) { // Expired, waiting owner int descId = DataManager.ITEM_DATA.getItemTemplate(requiredItem).getNameId(); warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_DELETE_EXPIRE_TIME(descId)); return; } else if (requiredItem != null) { int checkType = action.getCheckType(); if (checkType == 1) { // equip item needed List<Item> items = player.getEquipment().getEquippedItemsByItemId(requiredItem); if (items.size() == 0) { int descId = DataManager.ITEM_DATA.getItemTemplate(requiredItem).getNameId(); warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_CANT_USE_HOUSE_OBJECT_ITEM_EQUIP(new DescriptionId(descId))); return; } } else if (player.getInventory().getItemCountByItemId(requiredItem) < action.getRemoveCount()) { int descId = DataManager.ITEM_DATA.getItemTemplate(requiredItem).getNameId(); warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_MSG_CANT_USE_HOUSE_OBJECT_ITEM_CHECK(new DescriptionId(descId))); return; } } if (player.getInventory().isFull()) { warnAndRelease(player, SM_SYSTEM_MESSAGE.STR_WAREHOUSE_TOO_MANY_ITEMS_INVENTORY); return; } final int delay = getObjectTemplate().getDelay(); final int ownerId = getOwnerHouse().getOwnerId(); final int usedCount = useCount == null ? 0 : currentUseCount + 1; final ItemUseObserver observer = new ItemUseObserver() { @Override public void abort() { PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), getObjectId(), 0, 9)); player.getObserveController().removeObserver(this); warnAndRelease(player, null); } @Override public void itemused(Item item) { abort(); } }; player.getObserveController().attach(observer); PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_USE(getObjectTemplate().getNameId())); PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), getObjectId(), delay, 8)); player.getController().addTask(TaskId.HOUSE_OBJECT_USE, ThreadPoolManager.getInstance().schedule(new Runnable() { @Override public void run() { try { PacketSendUtility.sendPacket(player, new SM_USE_OBJECT(player.getObjectId(), getObjectId(), 0, 9)); if (action.getRemoveCount() != null && action.getRemoveCount() != 0) { player.getInventory().decreaseByItemId(requiredItem, action.getRemoveCount()); } UseableItemObject myself = UseableItemObject.this; int rewardId = 0; boolean delete = false; if (useCount != null) { if (action.getFinalRewardId() != null && useCount + 1 == usedCount) { // visitors do not get final rewards rewardId = action.getFinalRewardId(); ItemService.addItem(player, rewardId, 1); delete = true; } else if (action.getRewardId() != null) { rewardId = action.getRewardId(); ItemService.addItem(player, rewardId, 1); if (useCount == usedCount) { PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_FLOWERPOT_GOAL( myself.getObjectTemplate().getNameId())); if (action.getFinalRewardId() == null) { delete = true; } else { myself.setMustGiveLastReward(true); myself.setExpireTime((int) (System.currentTimeMillis() / 1000)); myself.setPersistentState(PersistentState.UPDATE_REQUIRED); } } } } else if (action.getRewardId() != null) { rewardId = action.getRewardId(); ItemService.addItem(player, rewardId, 1); } if (usedCount > 0) { if (!delete) { if (player.getObjectId() == ownerId) { myself.incrementOwnerUsedCount(); } else { myself.incrementVisitorUsedCount(); } } PacketSendUtility.broadcastPacket(player, new SM_OBJECT_USE_UPDATE(player.getObjectId(), ownerId, usedCount, myself), true); } if (rewardId > 0) { int rewardNameId = DataManager.ITEM_DATA.getItemTemplate(rewardId).getNameId(); PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_REWARD_ITEM( myself.getObjectTemplate().getNameId(), rewardNameId)); } if (delete) { selfDestroy(player, SM_SYSTEM_MESSAGE.STR_MSG_HOUSING_OBJECT_DELETE_USE_COUNT_FINAL( getObjectTemplate().getNameId())); } else { Integer cd = myself.getObjectTemplate().getCd(); DateTime repeatDate; if (cd == null || cd == 0) { // use once per day DateTime tomorrow = DateTime.now().plusDays(1); repeatDate = new DateTime(tomorrow.getYear(), tomorrow.getMonthOfYear(), tomorrow.getDayOfMonth(), 0, 0, 0); cd = (int) (repeatDate.getMillis() - DateTime.now().getMillis()) / 1000; } player.getHouseObjectCooldownList().addHouseObjectCooldown(myself.getObjectId(), cd); } } finally { player.getObserveController().removeObserver(observer); warnAndRelease(player, null); } } }, delay)); }
From source file:com.aionemu.gameserver.services.LoginEventService.java
License:Open Source License
private static Timestamp autoAddTimeColumn() { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), 9, 0, 0); if (now.isAfter(repeatDate)) { repeatDate = repeatDate.plusHours(24); }//from w w w . j a v a2s. c o m return new Timestamp(repeatDate.getMillis()); }
From source file:com.aionemu.gameserver.services.LoginEventService.java
License:Open Source License
private static Timestamp countNextRepeatTime() { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), 9, 0, 0); if (now.isAfter(repeatDate)) { repeatDate = repeatDate.plusHours(24); }//from ww w . j av a 2 s.co m return new Timestamp(repeatDate.getMillis()); }
From source file:com.aionemu.gameserver.services.QuestService.java
License:Open Source License
private static Timestamp countNextRepeatTime(Player player, QuestTemplate template) { DateTime now = DateTime.now(); DateTime repeatDate = new DateTime(now.getYear(), now.getMonthOfYear(), now.getDayOfMonth(), 9, 0, 0); if (template.isDaily()) { if (now.isAfter(repeatDate)) { repeatDate = repeatDate.plusHours(24); }/*from ww w. j a v a2s. com*/ PacketSendUtility.sendPacket(player, new SM_SYSTEM_MESSAGE(1400855, "9")); } else { int daysToAdd = 7; int startDay = 7; for (QuestRepeatCycle weekDay : template.getRepeatCycle()) { int diff = weekDay.getDay() - repeatDate.getDayOfWeek(); if (diff > 0 && diff < daysToAdd) { daysToAdd = diff; } if (startDay > weekDay.getDay()) { startDay = weekDay.getDay(); } } if (startDay == daysToAdd) { daysToAdd = 7; } else if (daysToAdd == 7 && startDay < 7) { daysToAdd = 7 - repeatDate.getDayOfWeek() + startDay; } repeatDate = repeatDate.plusDays(daysToAdd); PacketSendUtility.sendPacket(player, new SM_SYSTEM_MESSAGE(1400857, new DescriptionId(1800667), "9")); } return new Timestamp(repeatDate.getMillis()); }
From source file:com.aliakseipilko.flightdutytracker.view.adapter.DayBarChartAdapter.java
License:Open Source License
private void processDutyHours() { List<BarEntry> barDutyEntries = new ArrayList<>(); float xValueCount = 0f; int maxDaysInMonth = 0; long startDay = new DateTime(flights.minDate("startDutyTime")).getDayOfMonth(); long currentYear = 0; long currentMonth = 0; long currentDay = 0; boolean isMonthWrapping = false; for (Flight flight : flights) { DateTime startDateTime = new DateTime(flight.getStartDutyTime()); DateTime endDateTime = new DateTime(flight.getEndDutyTime()); float decHoursDiff = (Seconds.secondsBetween(startDateTime, endDateTime).getSeconds() / 60f) / 60f; //Dont display stats for today as they will be malformed if (startDateTime.getDayOfYear() == DateTime.now().getDayOfYear() && startDateTime.getYear() == DateTime.now().getYear()) { continue; }/* w w w . j a v a2s .c om*/ if (currentYear == 0 && currentMonth == 0 && currentDay == 0) { currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); currentDay = startDateTime.getDayOfMonth(); maxDaysInMonth = determineDaysInMonth((int) currentMonth, (int) currentYear); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barDutyEntries.add(newEntry); xValueCount++; } else { //Check if month is wrapping if (currentDay + 1 >= maxDaysInMonth) { isMonthWrapping = true; } else { //Check if days are adjacent //Add skipped days onto xValueCount to display blank spaces in graph if (currentDay + 1 != startDateTime.getDayOfMonth()) { xValueCount += (startDateTime.getDayOfMonth() - currentDay) - 1; } } //Check if the date is the same as the previous flight // All flights are provided in an ordered list by the repo if (currentDay == startDateTime.getDayOfMonth() && currentMonth == startDateTime.getMonthOfYear() && currentYear == startDateTime.getYear()) { //Get last entry in list BarEntry lastEntry = barDutyEntries.get(barDutyEntries.size() - 1); //Add the additional hours in that day on, X value (the date) does not change lastEntry = new BarEntry(lastEntry.getX(), lastEntry.getY() + decHoursDiff); //Remove the last entry and add the modified entry instead of it barDutyEntries.remove(barDutyEntries.size() - 1); barDutyEntries.add(lastEntry); } else { //Check if days of month wrap around if (startDateTime.getMonthOfYear() != currentMonth) { isMonthWrapping = true; } //New day //Update these for the next iteration currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); currentDay = startDateTime.getDayOfMonth(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barDutyEntries.add(newEntry); xValueCount++; } } } IAxisValueFormatter xAxisValueFormatter = new DayAxisValueFormatter((int) (startDay - 1), maxDaysInMonth); IAxisValueFormatter yAxisValueFormatter = new DefaultAxisValueFormatter(2); BarDataSet dataSet = new BarDataSet(barDutyEntries, "Duty Hours"); dataSet.setValueTextSize(16f); BarData barDutyData = new BarData(dataSet); barDutyData.setBarWidth(0.9f); barDutyData.setHighlightEnabled(false); view.setupDutyBarChart(barDutyData, xAxisValueFormatter, yAxisValueFormatter); }
From source file:com.aliakseipilko.flightdutytracker.view.adapter.DayBarChartAdapter.java
License:Open Source License
private void processFlightHours() { List<BarEntry> barFlightEntries = new ArrayList<>(); float xValueCount = 0f; int maxDaysInMonth = 0; long startDay = new DateTime(flights.minDate("startFlightTime")).getDayOfMonth(); long currentYear = 0; long currentMonth = 0; long currentDay = 0; boolean isMonthWrapping = false; for (Flight flight : flights) { DateTime startDateTime = new DateTime(flight.getStartFlightTime()); DateTime endDateTime = new DateTime(flight.getEndFlightTime()); float decHoursDiff = (Seconds.secondsBetween(startDateTime, endDateTime).getSeconds() / 60f) / 60f; //Dont display stats for today as they will be malformed if (startDateTime.getDayOfYear() == DateTime.now().getDayOfYear() && startDateTime.getYear() == DateTime.now().getYear()) { continue; }// www .ja v a 2s . c o m if (currentYear == 0 && currentMonth == 0 && currentDay == 0) { currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); currentDay = startDateTime.getDayOfMonth(); maxDaysInMonth = determineDaysInMonth((int) currentMonth, (int) currentYear); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barFlightEntries.add(newEntry); xValueCount++; } else { //Check if month is wrapping if (currentDay + 1 >= maxDaysInMonth) { isMonthWrapping = true; } else { //Check if days are adjacent //Add skipped days onto xValueCount to display blank spaces in graph if (currentDay + 1 != startDateTime.getDayOfMonth()) { xValueCount = xValueCount + (startDateTime.getDayOfMonth() - currentDay) - 1; } } //Check if the date is the same as the previous flight // All flights are provided in an ordered list by the repo if (currentDay == startDateTime.getDayOfMonth() && currentMonth == startDateTime.getMonthOfYear() && currentYear == startDateTime.getYear()) { //Get last entry in list BarEntry lastEntry = barFlightEntries.get(barFlightEntries.size() - 1); //Add the additional hours in that day on, X value (the date) does not change lastEntry = new BarEntry(lastEntry.getX(), lastEntry.getY() + decHoursDiff); //Remove the last entry and add the modified entry instead of it barFlightEntries.remove(barFlightEntries.size() - 1); barFlightEntries.add(lastEntry); } else { //Check if days of month wrap around if (startDateTime.getMonthOfYear() != currentMonth) { isMonthWrapping = true; } //New day //Update these for the next iteration currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); currentDay = startDateTime.getDayOfMonth(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barFlightEntries.add(newEntry); xValueCount++; } } } IAxisValueFormatter xAxisValueFormatter = new DayAxisValueFormatter((int) (startDay - 1), maxDaysInMonth); IAxisValueFormatter yAxisValueFormatter = new DefaultAxisValueFormatter(2); BarDataSet dataSet = new BarDataSet(barFlightEntries, "Flight Hours"); dataSet.setValueTextSize(16f); BarData barFlightData = new BarData(dataSet); barFlightData.setBarWidth(0.9f); barFlightData.setHighlightEnabled(false); view.setupFlightBarChart(barFlightData, xAxisValueFormatter, yAxisValueFormatter); }
From source file:com.aliakseipilko.flightdutytracker.view.adapter.MonthBarChartAdapter.java
License:Open Source License
private void processDutyHours() { List<BarEntry> barDutyEntries = new ArrayList<>(); float xValueCount = 0f; long startMonth = new DateTime(flights.minDate("startDutyTime")).getMonthOfYear(); long currentYear = 0; long currentMonth = 0; for (Flight flight : flights) { DateTime startDateTime = new DateTime(flight.getStartDutyTime()); DateTime endDateTime = new DateTime(flight.getEndDutyTime()); float decHoursDiff = (Seconds.secondsBetween(startDateTime, endDateTime).getSeconds() / 60f) / 60f; if (currentYear == 0 && currentMonth == 0) { currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barDutyEntries.add(newEntry); xValueCount++;//from ww w . java2 s . com } else { if (currentMonth + 1 < 13) { //Add on any skipped months to xValueCount if (currentMonth + 1 != startDateTime.getMonthOfYear()) { xValueCount += (startDateTime.getMonthOfYear() - currentMonth) - 1; } } //Check if the month is the same as the previous flight // All flights are provided in an ordered list by the repo if (currentMonth == startDateTime.getMonthOfYear() && currentYear == startDateTime.getYear()) { //Get last entry in list BarEntry lastEntry = barDutyEntries.get(barDutyEntries.size() - 1); //Add the additional hours in that day on, X value (the date) does not change lastEntry = new BarEntry(lastEntry.getX(), lastEntry.getY() + decHoursDiff); //Remove the last entry and add the modified entry instead of it barDutyEntries.remove(barDutyEntries.size() - 1); barDutyEntries.add(lastEntry); } else { //Check if days of month wrap around if (startDateTime.getYear() != currentYear) { } //New month //Update these for the next iteration currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barDutyEntries.add(newEntry); xValueCount++; } } } IAxisValueFormatter xAxisValueFormatter = new MonthAxisValueFormatter(((int) startMonth - 1)); IAxisValueFormatter yAxisValueFormatter = new DefaultAxisValueFormatter(2); BarDataSet dataSet = new BarDataSet(barDutyEntries, "Duty Hours"); dataSet.setValueTextSize(16f); BarData barDutyData = new BarData(dataSet); barDutyData.setBarWidth(0.9f); barDutyData.setHighlightEnabled(false); view.setupDutyBarChart(barDutyData, xAxisValueFormatter, yAxisValueFormatter); }
From source file:com.aliakseipilko.flightdutytracker.view.adapter.MonthBarChartAdapter.java
License:Open Source License
private void processFlightHours() { List<BarEntry> barFlightEntries = new ArrayList<>(); float xValueCount = 0f; long startMonth = new DateTime(flights.minDate("startFlightTime")).getMonthOfYear(); long currentYear = 0; long currentMonth = 0; for (Flight flight : flights) { DateTime startDateTime = new DateTime(flight.getStartFlightTime()); DateTime endDateTime = new DateTime(flight.getEndFlightTime()); float decHoursDiff = (Seconds.secondsBetween(startDateTime, endDateTime).getSeconds() / 60f) / 60f; if (currentYear == 0 && currentMonth == 0) { currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barFlightEntries.add(newEntry); xValueCount++;/* w w w .j a v a 2 s . co m*/ } else { //Check if year wraps around if (currentMonth + 1 < 13) { //Add on any skipped months to xValueCount if (currentMonth + 1 != startDateTime.getMonthOfYear()) { xValueCount += (startDateTime.getMonthOfYear() - currentMonth) - 1; } } //Check if the month is the same as the previous flight // All flights are provided in an ordered list by the repo if (currentMonth == startDateTime.getMonthOfYear() && currentYear == startDateTime.getYear()) { //Get last entry in list BarEntry lastEntry = barFlightEntries.get(barFlightEntries.size() - 1); //Add the additional hours in that day on, X value (the date) does not change lastEntry = new BarEntry(lastEntry.getX(), lastEntry.getY() + decHoursDiff); //Remove the last entry and add the modified entry instead of it barFlightEntries.remove(barFlightEntries.size() - 1); barFlightEntries.add(lastEntry); } else { //Check if days of month wrap around if (startDateTime.getYear() != currentYear) { } //New month //Update these for the next iteration currentYear = startDateTime.getYear(); currentMonth = startDateTime.getMonthOfYear(); //Add new entry using day of month as x value BarEntry newEntry = new BarEntry(xValueCount, decHoursDiff); barFlightEntries.add(newEntry); xValueCount++; } } } IAxisValueFormatter xAxisValueFormatter = new MonthAxisValueFormatter(((int) startMonth - 1)); IAxisValueFormatter yAxisValueFormatter = new DefaultAxisValueFormatter(2); BarDataSet dataSet = new BarDataSet(barFlightEntries, "Flight Hours"); dataSet.setValueTextSize(16f); BarData barDutyData = new BarData(dataSet); barDutyData.setBarWidth(0.9f); barDutyData.setHighlightEnabled(false); view.setupFlightBarChart(barDutyData, xAxisValueFormatter, yAxisValueFormatter); }