@@ -60,7 +60,7 @@ public final class ToolStats extends JavaPlugin {
6060 // used for tracking new elytras
6161 public final NamespacedKey newElytra = new NamespacedKey (this , "new" );
6262
63- public final SimpleDateFormat dateFormat = new SimpleDateFormat ( "M/dd/yyyy" , Locale . ENGLISH ) ;
63+ public SimpleDateFormat dateFormat ;
6464 public final DecimalFormat decimalFormat = new DecimalFormat ("#,###.00" , new DecimalFormatSymbols (Locale .getDefault ()));
6565 public final DecimalFormat commaFormat = new DecimalFormat ("#,###" , new DecimalFormatSymbols (Locale .getDefault ()));
6666 public BlocksMined blocksMined ;
@@ -130,6 +130,20 @@ public void loadConfig() {
130130 if (config .getInt ("config-version" ) != CONFIG_VERSION ) {
131131 logger .warning ("Your config file is outdated! Please regenerate the config." );
132132 }
133+
134+ String dateFormatConfig = config .getString ("date-format" );
135+ if (dateFormatConfig != null ) {
136+ try {
137+ dateFormat = new SimpleDateFormat (dateFormatConfig , Locale .getDefault ());
138+ } catch (IllegalArgumentException exception ) {
139+ logger .severe ("date-format is NOT a valid format! Using default American English format." );
140+ exception .printStackTrace ();
141+ dateFormat = new SimpleDateFormat ("M/dd/yyyy" , Locale .ENGLISH );
142+ }
143+ } else {
144+ logger .warning ("date-format is missing from your config! Using default American English format." );
145+ dateFormat = new SimpleDateFormat ("M/dd/yyyy" , Locale .ENGLISH );
146+ }
133147 }
134148
135149 public void checkForUpdates () {
0 commit comments