Skip to content

Commit

Permalink
Merge remote-tracking branch 'charagarlnad/master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master committed Oct 13, 2023
2 parents c2c3248 + 45f09ae commit 128ee6b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main/java/lumien/custommainmenu/lib/StringReplacer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.lang.reflect.Field;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

Expand All @@ -14,23 +13,22 @@

public class StringReplacer {

static final String TIME_FORMAT = "HH:mm";
static final String forgeVersion = ForgeVersion.getVersion();
static final DateFormat dateFormat = DateFormat.getDateInstance(2, Locale.getDefault());
static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
static Field mcpversionField;
public static String mcpversion;

public static String replacePlaceholders(String source) {
int tModCount = Loader.instance().getModList().size();
int aModCount = Loader.instance().getActiveModList().size();
Calendar calendar = Calendar.getInstance();
String clock = timeFormat.format(calendar.getTime());
DateFormat formatter = DateFormat.getDateInstance(2, Locale.getDefault());
String date = formatter.format(new Date());
Loader.instance();
return source.replace("#date#", date).replace("#time#", clock).replace("#mcversion#", "1.7.10")
Date currentDate = new Date();
String time = timeFormat.format(currentDate.getTime());
String date = dateFormat.format(currentDate);
return source.replace("#date#", date).replace("#time#", time).replace("#mcversion#", "1.7.10")
.replace("#fmlversion#", Loader.instance().getFMLVersionString()).replace("#mcpversion#", mcpversion)
.replace("#modsloaded#", tModCount + "").replace("#modsactive#", aModCount + "")
.replace("#forgeversion#", ForgeVersion.getVersion())
.replace("#modsloaded#", Integer.toString(tModCount))
.replace("#modsactive#", Integer.toString(aModCount)).replace("#forgeversion#", forgeVersion)
.replace("#username#", Minecraft.getMinecraft().getSession().getUsername());
}

Expand Down

0 comments on commit 128ee6b

Please sign in to comment.