Refactor maple leaf logging

Not even sure anyone is using this system. Keeping it around just in case.
This commit is contained in:
P0nk
2022-01-03 19:12:04 +01:00
parent 1e53bc7d1f
commit 78f6ae7e6a
6 changed files with 37 additions and 32 deletions

View File

@@ -1,25 +0,0 @@
package tools;
import client.Character;
import java.text.SimpleDateFormat;
import java.util.Date;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
public class LogHelper {
public static String getTimeString(long then) {
long duration = System.currentTimeMillis() - then;
int seconds = (int) (duration / SECONDS.toMillis(1)) % 60;
int minutes = (int) ((duration / MINUTES.toMillis(1)) % 60);
return minutes + " Minutes and " + seconds + " Seconds";
}
public static void logLeaf(Character player, boolean gotPrize, String operation) {
String timeStamp = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss").format(new Date());
String log = player.getName() + (gotPrize ? " used a maple leaf to buy " + operation : " redeemed " + operation + " VP for a leaf") + " - " + timeStamp;
FilePrinter.print(FilePrinter.LOG_LEAF, log);
}
}