slight cleanup
This commit is contained in:
parent
5b71982559
commit
b5cdf74aa9
3 changed files with 9 additions and 11 deletions
|
@ -19,7 +19,6 @@ public class ZombiesUtils {
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
public ZombiesUtils() {
|
public ZombiesUtils() {
|
||||||
instance = this;
|
instance = this;
|
||||||
System.out.println("Initialised zombies-utils");
|
|
||||||
}
|
}
|
||||||
public static ZombiesUtils getInstance() {
|
public static ZombiesUtils getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
|
|
|
@ -5,9 +5,10 @@ import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
|
||||||
import com.github.stachelbeere1248.zombiesutils.timer.recorder.TimesFile;
|
import com.github.stachelbeere1248.zombiesutils.timer.recorder.TimesFile;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RecordManager {
|
public class RecordManager {
|
||||||
public static void compareSegment(byte round, short roundTime, Category category) {
|
public static void compareSegment(byte round, short roundTime, @NotNull Category category) {
|
||||||
sendBar();
|
sendBar();
|
||||||
TimesFile timesFile = category.getByGameMode(GameMode.getCurrentGameMode());
|
TimesFile timesFile = category.getByGameMode(GameMode.getCurrentGameMode());
|
||||||
short bestSegment = timesFile.getBestSegment(round);
|
short bestSegment = timesFile.getBestSegment(round);
|
||||||
|
@ -29,12 +30,12 @@ public class RecordManager {
|
||||||
timesFile.setBestSegment(round, roundTime);
|
timesFile.setBestSegment(round, roundTime);
|
||||||
}
|
}
|
||||||
final String timeString = getTimeString(roundTime);
|
final String timeString = getTimeString(roundTime);
|
||||||
final String message = "\u00a7cRound " + round + "\u00a7e took \u00a7a" + timeString + " \u00a79\u03B4" + (double) (roundTime-bestSegment)/20;
|
final String message = "\u00a7cRound " + round + "\u00a7e took \u00a7a" + timeString + " \u00a79\u0394" + (double) (roundTime-bestSegment)/20;
|
||||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||||
}
|
}
|
||||||
sendBar();
|
sendBar();
|
||||||
}
|
}
|
||||||
public static void compareBest(byte round, int gameTime, Category category) {
|
public static void compareBest(byte round, int gameTime, @NotNull Category category) {
|
||||||
sendBar();
|
sendBar();
|
||||||
TimesFile timesFile = category.getByGameMode(GameMode.getCurrentGameMode());
|
TimesFile timesFile = category.getByGameMode(GameMode.getCurrentGameMode());
|
||||||
int personalBest = timesFile.getPersonalBest(round);
|
int personalBest = timesFile.getPersonalBest(round);
|
||||||
|
@ -58,7 +59,7 @@ public class RecordManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String timeString = getTimeString(gameTime);
|
final String timeString = getTimeString(gameTime);
|
||||||
final String message = "\u00a7cRound " + round + "\u00a7e finished at \u00a7a" + timeString + " \u00a79\u03B4" + (double) (gameTime-personalBest)/20;
|
final String message = "\u00a7cRound " + round + "\u00a7e finished at \u00a7a" + timeString + " \u00a79\u0394" + (double) (gameTime-personalBest)/20;
|
||||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.github.stachelbeere1248.zombiesutils.timer;
|
package com.github.stachelbeere1248.zombiesutils.timer;
|
||||||
|
|
||||||
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
||||||
import com.github.stachelbeere1248.zombiesutils.game.GameMode;
|
|
||||||
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
||||||
|
import com.github.stachelbeere1248.zombiesutils.game.GameMode;
|
||||||
import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
|
import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -22,9 +22,9 @@ public class Timer {
|
||||||
/**
|
/**
|
||||||
* Constructs a timer and saves it to {@link #instance}.
|
* Constructs a timer and saves it to {@link #instance}.
|
||||||
* @param serverNumber The game's server the timer should be bound to.
|
* @param serverNumber The game's server the timer should be bound to.
|
||||||
* @param enumMap The map the timer should be started for.
|
* @param map The map the timer should be started for.
|
||||||
*/
|
*/
|
||||||
public Timer (@NotNull String serverNumber, @NotNull Map enumMap) {
|
public Timer (@NotNull String serverNumber, @NotNull Map map) {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
savedTotalWorldTime = getCurrentTotalWorldTime();
|
savedTotalWorldTime = getCurrentTotalWorldTime();
|
||||||
|
@ -32,7 +32,7 @@ public class Timer {
|
||||||
else throw new RuntimeException("invalid servernumber");
|
else throw new RuntimeException("invalid servernumber");
|
||||||
|
|
||||||
this.category = new Category();
|
this.category = new Category();
|
||||||
GameMode.create(enumMap);
|
GameMode.create(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,8 +51,6 @@ public class Timer {
|
||||||
final int gameTime = gameTime();
|
final int gameTime = gameTime();
|
||||||
final short roundTime = (short) (gameTime - passedRoundsTickSum);
|
final short roundTime = (short) (gameTime - passedRoundsTickSum);
|
||||||
|
|
||||||
//short clearTime = (short) (roundTime - Waves.getLastWave(GameMode.getCurrentGameMode().getMap(), passedRound));
|
|
||||||
//ZombiesUtils.getInstance().getLogger().debug("ClearTime: " + clearTime);
|
|
||||||
ZombiesUtils.getInstance().getLogger().debug("Passed round: " + passedRound);
|
ZombiesUtils.getInstance().getLogger().debug("Passed round: " + passedRound);
|
||||||
|
|
||||||
RecordManager.compareSegment(passedRound, roundTime, category);
|
RecordManager.compareSegment(passedRound, roundTime, category);
|
||||||
|
|
Loading…
Add table
Reference in a new issue