Make the time bottle tooltip text more readable.
This commit is contained in:
parent
d87f646192
commit
f65c6cf132
2 changed files with 13 additions and 12 deletions
|
@ -12,6 +12,7 @@ public class Bottles {
|
|||
|
||||
public static final String TAG_MESSAGE_STORED_TIME = "msg_storedTime";
|
||||
public static final String TAG_MESSAGE_ACCUMULATED_TIME = "msg_accumulatedTime";
|
||||
public static final String TAG_TOTAL_USES = "msg_totalUses";
|
||||
|
||||
|
||||
|
||||
|
@ -21,8 +22,9 @@ public class Bottles {
|
|||
public int avgRandomTicks = 512;
|
||||
public int maxTimeRate = 8;
|
||||
public int maxTime = (60 * 60 * 24 * 30); // 30 days is the default
|
||||
public String storedTimeStr = "!Dark_Green!Stored Time: [0]:[1]:[2]";
|
||||
public String accumulatedTimeStr = "!Gray!Total Accumulated Time: [0]:[1]:[2]";
|
||||
public String storedTimeStr = "!Dark_Green!Stored Time: [0]";
|
||||
public String accumulatedTimeStr = "!Gray!Total Accumulated Time: [0]";
|
||||
public String totalUses = "!Dark_Red!Total available uses: [0]";
|
||||
|
||||
|
||||
|
||||
|
@ -35,6 +37,7 @@ public class Bottles {
|
|||
tag.putInt(TAG_MAX_TIME_RATE, maxTimeRate);
|
||||
tag.putString(TAG_MESSAGE_STORED_TIME, storedTimeStr);
|
||||
tag.putString(TAG_MESSAGE_ACCUMULATED_TIME, accumulatedTimeStr);
|
||||
tag.putString(TAG_TOTAL_USES, totalUses);
|
||||
tag.putInt(TAG_STORED_TIME, maxTime);
|
||||
|
||||
|
||||
|
@ -67,6 +70,9 @@ public class Bottles {
|
|||
if(tag.contains(TAG_STORED_TIME))
|
||||
bottles.maxTime = tag.getInt(TAG_STORED_TIME);
|
||||
|
||||
if(tag.contains(TAG_TOTAL_USES))
|
||||
bottles.totalUses = tag.getString(TAG_TOTAL_USES);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.essentials.items.implementation;
|
||||
|
||||
import dev.zontreck.ariaslib.util.TimeUtil;
|
||||
import dev.zontreck.essentials.configs.NBTKeys;
|
||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||
import dev.zontreck.essentials.items.abstraction.AbstractBottle;
|
||||
|
@ -42,20 +43,14 @@ public class TimeBottle extends AbstractBottle
|
|||
super.appendHoverText(itemStack, world, tooltip, flag);
|
||||
|
||||
int storedTime = this.getStoredEnergy(itemStack);
|
||||
int storedSeconds = storedTime / AEServerConfig.getInstance().bottles.ticks;
|
||||
int hours = storedSeconds / 3600;
|
||||
int minutes = (storedSeconds % 3600) / 60;
|
||||
int seconds = storedSeconds % 60;
|
||||
|
||||
int totalAccumulatedTime = this.getTotalAccumulatedTime(itemStack);
|
||||
int totalAccumulatedTimeSeconds = totalAccumulatedTime / AEServerConfig.getInstance().bottles.ticks;
|
||||
int totalAccumulatedHours = totalAccumulatedTimeSeconds / 3600;
|
||||
int totalAccumulatedMinutes = (totalAccumulatedTimeSeconds % 3600) / 60;
|
||||
int totalAccumulatedSeconds = totalAccumulatedTimeSeconds % 60;
|
||||
|
||||
tooltip.add(ChatHelpers.macro(AEServerConfig.getInstance().bottles.storedTimeStr, "" + hours, "" + minutes, "" + seconds));
|
||||
tooltip.add(ChatHelpers.macro(AEServerConfig.getInstance().bottles.storedTimeStr, TimeUtil.secondsToTimeNotation(TimeUtil.ticksToSeconds(storedTime, AEServerConfig.getInstance().bottles.ticks)).toString()));
|
||||
|
||||
tooltip.add(ChatHelpers.macro(AEServerConfig.getInstance().bottles.accumulatedTimeStr, "" + totalAccumulatedHours, "" + totalAccumulatedMinutes, "" + totalAccumulatedSeconds));
|
||||
tooltip.add(ChatHelpers.macro(AEServerConfig.getInstance().bottles.accumulatedTimeStr, TimeUtil.secondsToTimeNotation(TimeUtil.ticksToSeconds(totalAccumulatedTime, AEServerConfig.getInstance().bottles.ticks)).toString()));
|
||||
|
||||
tooltip.add(ChatHelpers.macro(AEServerConfig.getInstance().bottles.totalUses, "" + TimeUtil.ticksToSeconds(storedTime, AEServerConfig.getInstance().bottles.ticks) / AEServerConfig.getInstance().bottles.eachUseDuration));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue