forked from RepoMirrors/kami-blue
close #428
This commit is contained in:
parent
13800b3c8b
commit
bad089b958
|
@ -37,6 +37,7 @@ public class InfoOverlay extends Module {
|
|||
private Setting<ColourUtils.ColourCode> secondColour = register(Settings.e("Second Colour", ColourUtils.ColourCode.BLUE));
|
||||
private Setting<TimeUtil.TimeType> timeTypeSetting = register(Settings.e("Time Format", TimeUtil.TimeType.HHMMSS));
|
||||
private Setting<TimeUtil.TimeUnit> timeUnitSetting = register(Settings.e("Time Unit", TimeUtil.TimeUnit.h12));
|
||||
private Setting<Boolean> doLocale = register(Settings.b("Show AMPM", true));
|
||||
|
||||
private enum SpeedUnit {
|
||||
MpS, KmH
|
||||
|
@ -72,7 +73,7 @@ public class InfoOverlay extends Module {
|
|||
infoContents.add(textColour(firstColour.getValue()) + "Welcome" + textColour(secondColour.getValue()) + " " + mc.player.getName() + "!");
|
||||
}
|
||||
if (time.getValue()) {
|
||||
infoContents.add(textColour(firstColour.getValue()) + TimeUtil.getFinalTime(secondColour.getValue(), firstColour.getValue(), timeUnitSetting.getValue(), timeTypeSetting.getValue()) + TextFormatting.RESET);
|
||||
infoContents.add(textColour(firstColour.getValue()) + TimeUtil.getFinalTime(secondColour.getValue(), firstColour.getValue(), timeUnitSetting.getValue(), timeTypeSetting.getValue(), doLocale.getValue()) + TextFormatting.RESET);
|
||||
}
|
||||
if (tps.getValue()) {
|
||||
infoContents.add(textColour(firstColour.getValue()) + InfoCalculator.tps() + textColour(secondColour.getValue()) + " tps");
|
||||
|
|
|
@ -22,6 +22,7 @@ public class ChatTimestamp extends Module {
|
|||
private Setting<ColourUtils.ColourCode> secondColour = register(Settings.e("Second Colour", ColourUtils.ColourCode.WHITE));
|
||||
private Setting<TimeUtil.TimeType> timeTypeSetting = register(Settings.e("Time Format", TimeUtil.TimeType.HHMM));
|
||||
private Setting<TimeUtil.TimeUnit> timeUnitSetting = register(Settings.e("Time Unit", TimeUtil.TimeUnit.h12));
|
||||
private Setting<Boolean> doLocale = register(Settings.b("Show AMPM", true));
|
||||
|
||||
@EventHandler
|
||||
public Listener<PacketEvent.Receive> listener = new Listener<>(event -> {
|
||||
|
@ -36,7 +37,7 @@ public class ChatTimestamp extends Module {
|
|||
});
|
||||
|
||||
private boolean addTime(String message) {
|
||||
Command.sendRawChatMessage("<" + TimeUtil.getFinalTime(secondColour.getValue(), firstColour.getValue(), timeUnitSetting.getValue(), timeTypeSetting.getValue()) + TextFormatting.RESET + "> " + message);
|
||||
Command.sendRawChatMessage("<" + TimeUtil.getFinalTime(secondColour.getValue(), firstColour.getValue(), timeUnitSetting.getValue(), timeTypeSetting.getValue(), doLocale.getValue()) + TextFormatting.RESET + "> " + message);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -46,15 +46,15 @@ public class TimeUtil {
|
|||
return formatter;
|
||||
}
|
||||
|
||||
public static String getFinalTime(ColourUtils.ColourCode colourCode2, ColourUtils.ColourCode colourCode1, TimeUnit timeUnit, TimeType timeType) {
|
||||
public static String getFinalTime(ColourUtils.ColourCode colourCode2, ColourUtils.ColourCode colourCode1, TimeUnit timeUnit, TimeType timeType, Boolean doLocale) {
|
||||
String formatted = ColourUtils.getStringColour(colourCode2) + ":" + ColourUtils.getStringColour(colourCode1);
|
||||
String locale = "";
|
||||
String time = time(TimeUtil.dateFormatter(TimeUnit.h24, TimeType.HH));
|
||||
if (timeUnit == TimeUnit.h12) {
|
||||
if (timeUnit == TimeUnit.h12 && doLocale) {
|
||||
if ((Integer.parseInt(time)) - 12 >= 0) { // checks if the 24 hour time minus 12 is negative or 0, if it is it's pm
|
||||
locale = " pm";
|
||||
locale = "pm";
|
||||
} else {
|
||||
locale = " am";
|
||||
locale = "am";
|
||||
}
|
||||
}
|
||||
return ColourUtils.getStringColour(colourCode1) + time(dateFormatter(timeUnit, timeType)).replace(":", formatted) + ColourUtils.getStringColour(colourCode2) + locale;
|
||||
|
|
Loading…
Reference in New Issue