Heli SST, heli splits
This commit is contained in:
parent
5c882edfb0
commit
0e2a366fbb
18 changed files with 207 additions and 154 deletions
|
@ -14,7 +14,6 @@ The timer automatically splits every round. The PB/Segment recorder automaticall
|
||||||
- Language: The selected Hypixel language. Currently supports EN,FR,DE.
|
- Language: The selected Hypixel language. Currently supports EN,FR,DE.
|
||||||
- Timer:
|
- Timer:
|
||||||
- Default Category: The record-category to be selected when starting the game.
|
- Default Category: The record-category to be selected when starting the game.
|
||||||
- Paste Delta: Whether to include +- relative to PB when clicking the round summaries to paste it in chat.
|
|
||||||
- PB Announcements: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
|
- PB Announcements: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
|
||||||
- SST:
|
- SST:
|
||||||
- Enabled: Enables / disables this feature.
|
- Enabled: Enables / disables this feature.
|
||||||
|
|
|
@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g
|
||||||
baseGroup = com.github.stachelbeere1248.zombiesutils
|
baseGroup = com.github.stachelbeere1248.zombiesutils
|
||||||
mcVersion = 1.8.9
|
mcVersion = 1.8.9
|
||||||
modid = zombiesutils
|
modid = zombiesutils
|
||||||
version = 1.3.1-PREVIEW_4
|
version = 1.3.2
|
|
@ -40,10 +40,9 @@ public class ZombiesUtils {
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(@NotNull FMLPreInitializationEvent event) {
|
public void preInit(@NotNull FMLPreInitializationEvent event) {
|
||||||
logger = event.getModLog();
|
this.logger = event.getModLog();
|
||||||
this.config = new ZombiesUtilsConfig(new Configuration(
|
this.config = new ZombiesUtilsConfig(new Configuration(
|
||||||
event.getSuggestedConfigurationFile(),
|
event.getSuggestedConfigurationFile())
|
||||||
"1.2.4")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ public class ZombiesUtilsConfig {
|
||||||
private Property defaultCategory;
|
private Property defaultCategory;
|
||||||
private Property language;
|
private Property language;
|
||||||
private Property auditory;
|
private Property auditory;
|
||||||
private Property copyDelta;
|
|
||||||
private Property cpsCounter;
|
private Property cpsCounter;
|
||||||
private Property announcePB;
|
private Property announcePB;
|
||||||
private Property playerVis;
|
private Property playerVis;
|
||||||
|
@ -93,12 +92,6 @@ public class ZombiesUtilsConfig {
|
||||||
"general",
|
"general",
|
||||||
"name of the category to be selected unless specified using /runCategory"
|
"name of the category to be selected unless specified using /runCategory"
|
||||||
);
|
);
|
||||||
copyDelta = config.get(
|
|
||||||
"timer",
|
|
||||||
"copy delta",
|
|
||||||
false,
|
|
||||||
"Also copy the delta-time when clicking the round-end message?"
|
|
||||||
);
|
|
||||||
announcePB = config.get(
|
announcePB = config.get(
|
||||||
"timer",
|
"timer",
|
||||||
"announce",
|
"announce",
|
||||||
|
@ -154,7 +147,6 @@ public class ZombiesUtilsConfig {
|
||||||
private List<IConfigElement> getTimerElements() {
|
private List<IConfigElement> getTimerElements() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
new CustomConfigElement("Default category", defaultCategory),
|
new CustomConfigElement("Default category", defaultCategory),
|
||||||
new CustomConfigElement("Paste delta", copyDelta),
|
|
||||||
new CustomConfigElement("PB announcements", announcePB)
|
new CustomConfigElement("PB announcements", announcePB)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -209,10 +201,6 @@ public class ZombiesUtilsConfig {
|
||||||
return sstHud.getBoolean();
|
return sstHud.getBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCopyDelta() {
|
|
||||||
return copyDelta.getBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getCpsToggle() {
|
public boolean getCpsToggle() {
|
||||||
return cpsCounter.getBoolean();
|
return cpsCounter.getBoolean();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.github.stachelbeere1248.zombiesutils.game.enums.Difficulty;
|
||||||
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
|
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class GameMode {
|
public class GameMode {
|
||||||
private final Map map;
|
private final Map map;
|
||||||
private Difficulty difficulty;
|
private Difficulty difficulty;
|
||||||
|
@ -41,4 +43,7 @@ public class GameMode {
|
||||||
public boolean is(Map map, Difficulty difficulty) {
|
public boolean is(Map map, Difficulty difficulty) {
|
||||||
return this.getDifficulty() == difficulty && this.getMap() == map;
|
return this.getDifficulty() == difficulty && this.getMap() == map;
|
||||||
}
|
}
|
||||||
|
public boolean is(Map map) {
|
||||||
|
return this.getMap() == map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,7 @@ public class SLA {
|
||||||
player.posY - offset[1],
|
player.posY - offset[1],
|
||||||
player.posZ - offset[2]
|
player.posZ - offset[2]
|
||||||
};
|
};
|
||||||
for (Room room : rooms
|
for (Room room : rooms) {
|
||||||
) {
|
|
||||||
room.resetActiveWindowCount();
|
room.resetActiveWindowCount();
|
||||||
for (Window window : room.getWindows()
|
for (Window window : room.getWindows()
|
||||||
) {
|
) {
|
||||||
|
@ -91,7 +90,8 @@ public class SLA {
|
||||||
}
|
}
|
||||||
|
|
||||||
// (2x)²+(2y)²+(2z)² = 4(x²+y²+z²) = 4d²
|
// (2x)²+(2y)²+(2z)² = 4(x²+y²+z²) = 4d²
|
||||||
if (distanceDoubledThenSquared < 6400) {
|
final int slaRange = 40;
|
||||||
|
if (distanceDoubledThenSquared < 4 * slaRange * slaRange) {
|
||||||
window.setActive(true);
|
window.setActive(true);
|
||||||
room.increaseActiveWindowCount();
|
room.increaseActiveWindowCount();
|
||||||
} else window.setActive(false);
|
} else window.setActive(false);
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class Waves {
|
||||||
deadEndWaveTimes = {{10, 20}, {10, 20}, {10, 20, 35}, {10, 20, 35}, {10, 22, 37}, {10, 22, 44}, {10, 25, 47}, {10, 25, 50}, {10, 22, 38}, {10, 24, 45}, {10, 25, 48}, {10, 25, 50}, {10, 25, 50}, {10, 25, 45}, {10, 25, 46}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 49}, {10, 23, 44}, {10, 23, 45}, {10, 23, 42}, {10, 23, 43}, {10, 23, 43}, {10, 23, 36}, {10, 24, 44}, {10, 24, 42}, {10, 24, 42}, {10, 24, 45}},
|
deadEndWaveTimes = {{10, 20}, {10, 20}, {10, 20, 35}, {10, 20, 35}, {10, 22, 37}, {10, 22, 44}, {10, 25, 47}, {10, 25, 50}, {10, 22, 38}, {10, 24, 45}, {10, 25, 48}, {10, 25, 50}, {10, 25, 50}, {10, 25, 45}, {10, 25, 46}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 49}, {10, 23, 44}, {10, 23, 45}, {10, 23, 42}, {10, 23, 43}, {10, 23, 43}, {10, 23, 36}, {10, 24, 44}, {10, 24, 42}, {10, 24, 42}, {10, 24, 45}},
|
||||||
badBloodWaveTimes = {{10, 22}, {10, 22}, {10, 22}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 24, 38}, {10, 24, 38}, {10, 22, 34}, {10, 24, 38}, {10, 22, 34}},
|
badBloodWaveTimes = {{10, 22}, {10, 22}, {10, 22}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 24, 38}, {10, 24, 38}, {10, 22, 34}, {10, 24, 38}, {10, 22, 34}},
|
||||||
alienArcadiumWaveTimes = {{10, 13, 16, 19}, {10, 14, 18, 22}, {10, 13, 16, 19}, {10, 14, 17, 21, 25, 28}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10, 15, 19, 23, 27, 31}, {10, 15, 20, 25, 30, 35}, {10, 14, 19, 23, 28, 32}, {10, 16, 22, 27, 33, 38}, {10, 16, 21, 27, 32, 38}, {10, 16, 22, 28, 34, 40}, {10, 16, 22, 28, 34, 40}, {10, 16, 21, 26, 31, 36}, {10, 17, 24, 31, 38, 46}, {10, 16, 22, 27, 33, 38}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 32}, {10, 14, 18, 22, 26, 30}, {10, 15, 21, 26, 31, 36}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 34}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10}, {10, 23, 36}, {10, 22, 34}, {10, 20, 30}, {10, 24, 38}, {10, 22, 34}, {10, 22, 34}, {10, 21, 32}, {10, 22, 34}, {10, 22, 34}, {10}, {10, 22, 34}, {10, 20, 31}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34, 37, 45}, {10, 21, 32}, {10, 22, 34}, {10, 13, 22, 25, 34, 37}, {10, 22, 34}, {10, 22, 34, 35}, {10, 21, 32, 35}, {10, 20, 30}, {10, 20, 30, 33}, {10, 21, 32}, {10, 22, 34, 37}, {10, 20, 30, 33}, {10, 22, 34, 37}, {10, 22, 34, 37}, {10, 20, 32, 35, 39}, {10, 16, 22, 28, 34, 40}, {10, 14, 18}, {10, 14, 18}, {10, 22, 34, 37, 38}, {10, 14, 18, 22, 26, 30}, {10, 20, 30, 33}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {5}, {5}, {5}, {5}, {5}},
|
alienArcadiumWaveTimes = {{10, 13, 16, 19}, {10, 14, 18, 22}, {10, 13, 16, 19}, {10, 14, 17, 21, 25, 28}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10, 15, 19, 23, 27, 31}, {10, 15, 20, 25, 30, 35}, {10, 14, 19, 23, 28, 32}, {10, 16, 22, 27, 33, 38}, {10, 16, 21, 27, 32, 38}, {10, 16, 22, 28, 34, 40}, {10, 16, 22, 28, 34, 40}, {10, 16, 21, 26, 31, 36}, {10, 17, 24, 31, 38, 46}, {10, 16, 22, 27, 33, 38}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 32}, {10, 14, 18, 22, 26, 30}, {10, 15, 21, 26, 31, 36}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 34}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10}, {10, 23, 36}, {10, 22, 34}, {10, 20, 30}, {10, 24, 38}, {10, 22, 34}, {10, 22, 34}, {10, 21, 32}, {10, 22, 34}, {10, 22, 34}, {10}, {10, 22, 34}, {10, 20, 31}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34, 37, 45}, {10, 21, 32}, {10, 22, 34}, {10, 13, 22, 25, 34, 37}, {10, 22, 34}, {10, 22, 34, 35}, {10, 21, 32, 35}, {10, 20, 30}, {10, 20, 30, 33}, {10, 21, 32}, {10, 22, 34, 37}, {10, 20, 30, 33}, {10, 22, 34, 37}, {10, 22, 34, 37}, {10, 20, 32, 35, 39}, {10, 16, 22, 28, 34, 40}, {10, 14, 18}, {10, 14, 18}, {10, 22, 34, 37, 38}, {10, 14, 18, 22, 26, 30}, {10, 20, 30, 33}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {5}, {5}, {5}, {5}, {5}},
|
||||||
prisonWaveTimes = {{10, 20}, {10, 20, 30}, {10, 17, 24, 31}, {10, 17, 24, 31}, {10, 20, 30}, {10, 20, 30}, {10, 20, 30}, {10, 25, 40}, {10, 25, 35}, {10, 25, 45}, {10, 25, 40}, {10, 25, 37}, {10, 22, 34}, {10, 25, 37}, {10, 25, 40}, {10, 22, 37}, {10, 22, 42}, {10, 25, 45}, {10, 25, 45}, {10, 25, 40}, {10, 20, 35, 55, 75}, {10, 25, 40}, {10, 30, 50}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 30, 55}, {10}};
|
prisonWaveTimes = {{10, 20}, {10, 20, 30}, {10, 17, 24, 31}, {10, 17, 24, 31}, {10, 20, 30}, {10, 20, 30}, {10, 20, 30}, {10, 25, 40}, {10, 25, 35}, {10, 25, 45}, {10, 25, 40}, {10, 25, 37}, {10, 22, 34}, {10, 25, 37}, {10, 25, 40}, {10, 22, 37}, {10, 22, 42}, {10, 25, 45}, {10, 25, 45}, {10, 25, 40}, {10, 20, 35, 55, 75}, {10, 25, 40}, {10, 30, 50}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 30, 55}, {10}, {0, 15, 30, 45, 60, 75, 90, 105}};
|
||||||
|
|
||||||
@Contract(pure = true)
|
@Contract(pure = true)
|
||||||
public static byte[] get(@NotNull Map map, int round) {
|
public static byte[] get(@NotNull Map map, int round) {
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class ChatHandler {
|
||||||
game.getGameMode().changeDifficulty(Difficulty.HARD);
|
game.getGameMode().changeDifficulty(Difficulty.HARD);
|
||||||
} else if (LanguageSupport.containsRIP(message)) {
|
} else if (LanguageSupport.containsRIP(message)) {
|
||||||
game.getGameMode().changeDifficulty(Difficulty.RIP);
|
game.getGameMode().changeDifficulty(Difficulty.RIP);
|
||||||
|
} else if (LanguageSupport.isHelicopterIncoming(message)) {
|
||||||
|
game.helicopter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,10 +15,10 @@ public class Handlers {
|
||||||
public void registerAll() {
|
public void registerAll() {
|
||||||
MinecraftForge.EVENT_BUS.register(ZombiesUtils.getInstance().getConfig());
|
MinecraftForge.EVENT_BUS.register(ZombiesUtils.getInstance().getConfig());
|
||||||
MinecraftForge.EVENT_BUS.register(renderer);
|
MinecraftForge.EVENT_BUS.register(renderer);
|
||||||
|
MinecraftForge.EVENT_BUS.register(renderPlayerHandler);
|
||||||
MinecraftForge.EVENT_BUS.register(new TickHandler());
|
MinecraftForge.EVENT_BUS.register(new TickHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new ChatHandler());
|
MinecraftForge.EVENT_BUS.register(new ChatHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new KeyInputHandler());
|
MinecraftForge.EVENT_BUS.register(new KeyInputHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new RenderPlayerHandler());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderGameOverlayHandler getRenderer() {
|
public RenderGameOverlayHandler getRenderer() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class KeyInputHandler {
|
||||||
if (event instanceof InputEvent.KeyInputEvent) {
|
if (event instanceof InputEvent.KeyInputEvent) {
|
||||||
if (Keyboard.getEventKey() == '\0') return;
|
if (Keyboard.getEventKey() == '\0') return;
|
||||||
if (Keyboard.getEventKeyState()) {
|
if (Keyboard.getEventKeyState()) {
|
||||||
Hotkeys hotkeys = ZombiesUtils.getInstance().getHotkeys();
|
final Hotkeys hotkeys = ZombiesUtils.getInstance().getHotkeys();
|
||||||
if (Keyboard.getEventKey() == hotkeys.getChatMacro().getKeyCode()) Minecraft.getMinecraft().thePlayer
|
if (Keyboard.getEventKey() == hotkeys.getChatMacro().getKeyCode()) Minecraft.getMinecraft().thePlayer
|
||||||
.sendChatMessage(ZombiesUtils.getInstance().getConfig().getChatMacro());
|
.sendChatMessage(ZombiesUtils.getInstance().getConfig().getChatMacro());
|
||||||
else if (Keyboard.getEventKey() == hotkeys.getRlSpawn().getKeyCode()) {
|
else if (Keyboard.getEventKey() == hotkeys.getRlSpawn().getKeyCode()) {
|
||||||
|
|
|
@ -47,7 +47,6 @@ public class RenderGameOverlayHandler {
|
||||||
public void onRenderGameOverlay(RenderGameOverlayEvent.@NotNull Post event) {
|
public void onRenderGameOverlay(RenderGameOverlayEvent.@NotNull Post event) {
|
||||||
if (event.type != RenderGameOverlayEvent.ElementType.TEXT) return;
|
if (event.type != RenderGameOverlayEvent.ElementType.TEXT) return;
|
||||||
|
|
||||||
|
|
||||||
ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(
|
ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(
|
||||||
game -> {
|
game -> {
|
||||||
renderTime(game.getTimer().getRoundTime());
|
renderTime(game.getTimer().getRoundTime());
|
||||||
|
@ -61,7 +60,7 @@ public class RenderGameOverlayHandler {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms()));
|
if (!Minecraft.getMinecraft().gameSettings.showDebugInfo) SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms()));
|
||||||
if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS();
|
if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.github.stachelbeere1248.zombiesutils.handlers;
|
package com.github.stachelbeere1248.zombiesutils.handlers;
|
||||||
|
|
||||||
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
||||||
import com.github.stachelbeere1248.zombiesutils.config.ZombiesUtilsConfig;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||||
|
@ -9,7 +8,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class RenderPlayerHandler {
|
public class RenderPlayerHandler {
|
||||||
private boolean visible = ZombiesUtils.getInstance().getConfig().getPlayerVis();
|
private boolean visible;
|
||||||
|
|
||||||
|
public RenderPlayerHandler() {
|
||||||
|
this.visible = ZombiesUtils.getInstance().getConfig().getPlayerVis();
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onRender(RenderPlayerEvent.@NotNull Pre event) {
|
public void onRender(RenderPlayerEvent.@NotNull Pre event) {
|
||||||
if (event.entityPlayer.isPlayerSleeping() || event.entityPlayer.isUser()) return;
|
if (event.entityPlayer.isPlayerSleeping() || event.entityPlayer.isUser()) return;
|
||||||
|
|
|
@ -1,27 +1,36 @@
|
||||||
package com.github.stachelbeere1248.zombiesutils.handlers;
|
package com.github.stachelbeere1248.zombiesutils.handlers;
|
||||||
|
|
||||||
import com.github.stachelbeere1248.zombiesutils.timer.Timer;
|
import com.github.stachelbeere1248.zombiesutils.timer.Timer;
|
||||||
import net.minecraft.entity.Entity;
|
import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard;
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
import net.minecraft.entity.monster.EntityZombie;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class Round1Correction {
|
public class Round1Correction {
|
||||||
|
|
||||||
private final Timer TIMER;
|
private final Timer timer;
|
||||||
|
private final String serverNumber;
|
||||||
|
|
||||||
public Round1Correction(Timer timer) {
|
public Round1Correction(Timer timer, String serverNumber) {
|
||||||
TIMER = timer;
|
this.timer = timer;
|
||||||
|
this.serverNumber = serverNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onWaveSpawn(@NotNull EntityJoinWorldEvent event) {
|
public void onWaveSpawn(@NotNull EntityJoinWorldEvent event) {
|
||||||
final Entity entity = event.entity;
|
if (!(event.entity instanceof EntityZombie)) return;
|
||||||
if (entity instanceof EntityZombie) {
|
if (Scoreboard.isNotZombies()) return;
|
||||||
TIMER.correctStartTick();
|
final Optional<String> s = Scoreboard.getServerNumber();
|
||||||
|
if (!s.isPresent()) return;
|
||||||
|
if (!s.get().equals(serverNumber)) {
|
||||||
|
MinecraftForge.EVENT_BUS.unregister(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.timer.correctStartTick();
|
||||||
MinecraftForge.EVENT_BUS.unregister(this);
|
MinecraftForge.EVENT_BUS.unregister(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -9,49 +9,47 @@ import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
|
||||||
import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.CategoryFile;
|
import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.CategoryFile;
|
||||||
import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.GameFile;
|
import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.GameFile;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.event.ClickEvent;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.ChatStyle;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.jetbrains.annotations.Contract;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Game {
|
public class Game {
|
||||||
private final Timer TIMER;
|
private final Timer timer;
|
||||||
private final GameMode GAME_MODE;
|
private final GameMode gameMode;
|
||||||
private final GameFile GAME_FILE;
|
private final GameFile gameFile;
|
||||||
private final boolean roundOneRecorded;
|
private final boolean roundOneRecorded;
|
||||||
private int round;
|
private int round;
|
||||||
private Category category;
|
private Category category;
|
||||||
|
private boolean escaping;
|
||||||
|
|
||||||
public Game(@NotNull final Map map, final String serverNumber) {
|
public Game(@NotNull final Map map, final String serverNumber) {
|
||||||
this.GAME_MODE = new GameMode(map);
|
this.gameMode = new GameMode(map);
|
||||||
this.TIMER = new Timer();
|
this.timer = new Timer();
|
||||||
this.GAME_FILE = new GameFile(serverNumber, map);
|
this.gameFile = new GameFile(serverNumber, map);
|
||||||
this.category = new Category();
|
this.category = new Category();
|
||||||
this.round = 1;
|
this.round = 1;
|
||||||
this.roundOneRecorded = true;
|
this.roundOneRecorded = true;
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new Round1Correction(TIMER));
|
MinecraftForge.EVENT_BUS.register(new Round1Correction(this.timer, serverNumber));
|
||||||
if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map);
|
if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map);
|
||||||
}
|
}
|
||||||
public Game(@NotNull final Map map, final String serverNumber, final int round) {
|
public Game(@NotNull final Map map, final String serverNumber, final int round) {
|
||||||
this.GAME_MODE = new GameMode(map);
|
this.gameMode = new GameMode(map);
|
||||||
this.TIMER = new Timer();
|
this.timer = new Timer();
|
||||||
this.GAME_FILE = new GameFile(serverNumber, map);
|
this.gameFile = new GameFile(serverNumber, map);
|
||||||
this.category = new Category();
|
this.category = new Category();
|
||||||
this.round = round;
|
this.round = round;
|
||||||
this.roundOneRecorded = (round == 1);
|
this.roundOneRecorded = (round == 1);
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new Round1Correction(TIMER));
|
MinecraftForge.EVENT_BUS.register(new Round1Correction(this.timer, serverNumber));
|
||||||
if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map);
|
if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timer getTimer() {
|
public Timer getTimer() {
|
||||||
return this.TIMER;
|
return this.timer;
|
||||||
};
|
}
|
||||||
|
|
||||||
public void setCategory(Category category) {
|
public void setCategory(Category category) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
|
@ -60,11 +58,11 @@ public class Game {
|
||||||
return round;
|
return round;
|
||||||
}
|
}
|
||||||
public GameMode getGameMode() {
|
public GameMode getGameMode() {
|
||||||
return GAME_MODE;
|
return gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pass(int round) {
|
public void pass(int round) {
|
||||||
if ((round == 0) || (this.round == round + 1) || (this.TIMER.getRoundTime() < 100)) {
|
if ((round == 0) || (this.round == round + 1) || (this.timer.getRoundTime() < 100)) {
|
||||||
ZombiesUtils.getInstance().getLogger().debug("SPLIT CANCELLED");
|
ZombiesUtils.getInstance().getLogger().debug("SPLIT CANCELLED");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,105 +70,51 @@ public class Game {
|
||||||
record();
|
record();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ZombiesUtils.getInstance().getLogger().error(ExceptionUtils.getStackTrace(e));
|
ZombiesUtils.getInstance().getLogger().error(ExceptionUtils.getStackTrace(e));
|
||||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Error recording splits"));
|
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cError recording splits"));
|
||||||
}
|
}
|
||||||
this.TIMER.split();
|
this.timer.split();
|
||||||
this.round = round + 1;
|
this.round = round + 1;
|
||||||
}
|
}
|
||||||
|
public void helicopter() {
|
||||||
|
if (!gameMode.is(Map.PRISON)) {
|
||||||
|
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cEscaping without playing prison???"));
|
||||||
|
ZombiesUtils.getInstance().getLogger().error(Thread.currentThread().getStackTrace());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.escaping = true;
|
||||||
|
this.pass(30);
|
||||||
|
}
|
||||||
|
|
||||||
private void record() {
|
private void record() {
|
||||||
this.compareSegment();
|
this.compareSegment();
|
||||||
if (this.roundOneRecorded) this.compareBest();
|
if (this.roundOneRecorded) this.compareBest();
|
||||||
this.GAME_FILE.setSegment(this.round, this.TIMER.getRoundTime());
|
this.gameFile.setSegment(this.round, this.timer.getRoundTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String bar = "§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬";
|
|
||||||
|
|
||||||
public void compareSegment() throws IndexOutOfBoundsException {
|
public void compareSegment() throws IndexOutOfBoundsException {
|
||||||
final CategoryFile categoryFile = this.category.getByGameMode(this.GAME_MODE);
|
if (this.escaping) return;
|
||||||
|
final CategoryFile categoryFile = this.category.getByGameMode(this.gameMode);
|
||||||
final short bestSegment = categoryFile.getBestSegment(round);
|
final short bestSegment = categoryFile.getBestSegment(round);
|
||||||
final int roundTime = this.getTimer().getRoundTime();
|
final int roundTime = this.getTimer().getRoundTime();
|
||||||
|
|
||||||
final String timeString = formattedTime(roundTime);
|
if (bestSegment == (short) 0) categoryFile.setBestSegment(round, roundTime);
|
||||||
String segmentMessage = Game.bar + "\n§e Category: §d" + category.getName();
|
else if (roundTime < bestSegment) categoryFile.setBestSegment(round, roundTime);
|
||||||
String deltaString = "";
|
final RecordMessageSender recordMessageSender = new RecordMessageSender(this.category.getName(), round, false, roundTime, bestSegment);
|
||||||
|
recordMessageSender.roundSplit();
|
||||||
|
recordMessageSender.sendRecordMessage();
|
||||||
if (bestSegment == (short) 0) {
|
|
||||||
categoryFile.setBestSegment(round, roundTime);
|
|
||||||
|
|
||||||
if (ZombiesUtils.getInstance().getConfig().getAnnouncePB())
|
|
||||||
segmentMessage += "\n§e§l***§6§l NEW BEST SEGMENT! §e§l***";
|
|
||||||
segmentMessage += "\n§cRound " + round + "§e took §a" + timeString + "§e!";
|
|
||||||
} else {
|
|
||||||
if (roundTime < bestSegment) {
|
|
||||||
if (ZombiesUtils.getInstance().getConfig().getAnnouncePB())
|
|
||||||
segmentMessage += "\n§e§l***§6§l NEW BEST SEGMENT! §e§l***";
|
|
||||||
categoryFile.setBestSegment(round, roundTime);
|
|
||||||
}
|
|
||||||
deltaString = formattedDelta(roundTime, bestSegment);
|
|
||||||
segmentMessage += "\n§cRound " + round + "§e took §a" + timeString + " §9" + deltaString;
|
|
||||||
if (ZombiesUtils.getInstance().getConfig().getCopyDelta()) deltaString = " (" + deltaString + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
segmentMessage += "\n" + Game.bar;
|
|
||||||
final ChatComponentText message = new ChatComponentText(segmentMessage);
|
|
||||||
|
|
||||||
String copyString = String.format("Round %s took %s%s!", round, timeString, deltaString);
|
|
||||||
message.setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, copyString)));
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().thePlayer.addChatMessage(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void compareBest() throws IndexOutOfBoundsException {
|
public void compareBest() throws IndexOutOfBoundsException {
|
||||||
final CategoryFile categoryFile = this.category.getByGameMode(this.GAME_MODE);
|
final CategoryFile categoryFile = this.category.getByGameMode(this.gameMode);
|
||||||
|
final int round = this.escaping ? 31 : this.round;
|
||||||
final int personalBest = categoryFile.getPersonalBest(round);
|
final int personalBest = categoryFile.getPersonalBest(round);
|
||||||
final int gameTime = this.TIMER.getGameTime();
|
final int gameTime = this.timer.getGameTime();
|
||||||
String deltaString = "";
|
|
||||||
|
|
||||||
String bestMessage = Game.bar + "\n§e Category: §d" + category.getName();
|
if (personalBest == 0) categoryFile.setPersonalBest(round, gameTime);
|
||||||
final String timeString = formattedTime(gameTime);
|
else if (gameTime < personalBest) categoryFile.setPersonalBest(round, gameTime);
|
||||||
|
final RecordMessageSender recordMessageSender = new RecordMessageSender(category.getName(), round, true, gameTime, personalBest);
|
||||||
if (personalBest == 0) {
|
if (!escaping) recordMessageSender.gameSplit();
|
||||||
categoryFile.setPersonalBest(round, gameTime);
|
else recordMessageSender.helicopterSplit();
|
||||||
|
recordMessageSender.sendRecordMessage();
|
||||||
if (ZombiesUtils.getInstance().getConfig().getAnnouncePB())
|
|
||||||
bestMessage += "\n§e§l***§6§l NEW PERSONAL BEST! §e§l***";
|
|
||||||
bestMessage += "\n§cRound " + round + "§e finished at §a" + timeString + "§e!";
|
|
||||||
} else {
|
|
||||||
if (gameTime < personalBest) {
|
|
||||||
if (ZombiesUtils.getInstance().getConfig().getAnnouncePB())
|
|
||||||
bestMessage += "\n§e§l***§6§l NEW PERSONAL BEST! §e§l***";
|
|
||||||
categoryFile.setPersonalBest(round, gameTime);
|
|
||||||
}
|
|
||||||
deltaString = formattedDelta(gameTime, personalBest);
|
|
||||||
bestMessage += "\n§cRound " + round + "§e finished at §a" + timeString + " §9" + deltaString;
|
|
||||||
if (ZombiesUtils.getInstance().getConfig().getCopyDelta()) deltaString = " (" + deltaString + ")";
|
|
||||||
}
|
|
||||||
bestMessage += "\n" + Game.bar;
|
|
||||||
final ChatComponentText message = new ChatComponentText(bestMessage);
|
|
||||||
|
|
||||||
String copyString = String.format("Round %s finished at %s%s!", round, timeString, deltaString);
|
|
||||||
message.setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, copyString)));
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().thePlayer.addChatMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
private String formattedTime(int gameTime) {
|
|
||||||
gameTime *= 50;
|
|
||||||
return String.format("%d:%02d.%d%d",
|
|
||||||
gameTime / 60000,
|
|
||||||
(gameTime % 60000) / 1000,
|
|
||||||
(gameTime % 1000) / 100,
|
|
||||||
(gameTime % 100) / 10
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Contract(pure = true)
|
|
||||||
private static @NotNull String formattedDelta(int newTime, int prevTime) {
|
|
||||||
final double delta = (double) (newTime - prevTime) / 20;
|
|
||||||
return String.format("%+.2f", delta);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@ public class GameManager {
|
||||||
switch (game.getGameMode().getMap()) {
|
switch (game.getGameMode().getMap()) {
|
||||||
case DEAD_END:
|
case DEAD_END:
|
||||||
case BAD_BLOOD:
|
case BAD_BLOOD:
|
||||||
case PRISON: //TODO: Escape
|
case PRISON:
|
||||||
game.pass((byte) 30);
|
game.pass(30);
|
||||||
break;
|
break;
|
||||||
case ALIEN_ARCADIUM:
|
case ALIEN_ARCADIUM:
|
||||||
game.pass((byte) 105);
|
game.pass(105);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
package com.github.stachelbeere1248.zombiesutils.timer;
|
||||||
|
|
||||||
|
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.event.ClickEvent;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.ChatStyle;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
|
|
||||||
|
public class RecordMessageSender {
|
||||||
|
private final StringBuilder recordMessage;
|
||||||
|
private final int roundTime;
|
||||||
|
private final int gameTime;
|
||||||
|
private final int oldPB;
|
||||||
|
private final int oldBS;
|
||||||
|
private final int round;
|
||||||
|
private final String deltaString;
|
||||||
|
private final String timeString;
|
||||||
|
private final boolean cumulative;
|
||||||
|
private String copyString;
|
||||||
|
public RecordMessageSender(final String categoryName, final int round, final boolean cumulative, final int newTime, final int oldTime) {
|
||||||
|
this.recordMessage = new StringBuilder(
|
||||||
|
"§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n§e Category: §d" + categoryName
|
||||||
|
);
|
||||||
|
if (cumulative) {
|
||||||
|
this.gameTime = newTime;
|
||||||
|
this.oldPB = oldTime;
|
||||||
|
this.roundTime = 0;
|
||||||
|
this.oldBS = 0;
|
||||||
|
} else {
|
||||||
|
this.gameTime = 0;
|
||||||
|
this.oldPB = 0;
|
||||||
|
this.roundTime = newTime;
|
||||||
|
this.oldBS = oldTime;
|
||||||
|
}
|
||||||
|
this.deltaString = oldTime != 0 ? formattedDelta(newTime, oldTime) : "";
|
||||||
|
this.timeString = formattedTime(newTime);
|
||||||
|
this.cumulative = cumulative;
|
||||||
|
this.round = round;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendRecordMessage() {
|
||||||
|
final ChatComponentText message = new ChatComponentText(
|
||||||
|
this.recordMessage
|
||||||
|
.append("\n§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")
|
||||||
|
.toString()
|
||||||
|
);
|
||||||
|
message.setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, this.copyString)));
|
||||||
|
Minecraft.getMinecraft().thePlayer.addChatMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void gameSplit() {
|
||||||
|
final String announcement = gameTime < oldPB && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
|
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
||||||
|
this.recordMessage.append(announcement)
|
||||||
|
.append("\n§cRound ")
|
||||||
|
.append(round)
|
||||||
|
.append("§e finished at §a")
|
||||||
|
.append(timeString)
|
||||||
|
.append(deltaString)
|
||||||
|
.append("§e!");
|
||||||
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
String.format("Round %d finished at %s!", round, timeString) :
|
||||||
|
String.format("Round %d finished at %s (%s)!", round, timeString, deltaString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void roundSplit() {
|
||||||
|
final String announcement = roundTime < oldBS && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
|
"\n§e§l***§6§l NEW BEST SEGMENT! §e§l***" : "";
|
||||||
|
final String timeString = formattedTime(roundTime);
|
||||||
|
final String deltaString = oldBS != 0 ? formattedDelta(roundTime, oldBS) : "";
|
||||||
|
this.recordMessage.append(announcement)
|
||||||
|
.append("\n§cRound ")
|
||||||
|
.append(round)
|
||||||
|
.append("§e took §a")
|
||||||
|
.append(timeString)
|
||||||
|
.append(" §9")
|
||||||
|
.append(deltaString)
|
||||||
|
.append("§e!");
|
||||||
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
String.format("Round %d took %s!", round, timeString) :
|
||||||
|
String.format("Round %d took %s (%s)!", round, timeString, deltaString);
|
||||||
|
}
|
||||||
|
public void helicopterSplit() {
|
||||||
|
final String announcement = gameTime < oldPB && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
|
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
||||||
|
this.recordMessage.append(announcement)
|
||||||
|
.append("§8§lHelicopter §r§ecalled at §a")
|
||||||
|
.append(timeString)
|
||||||
|
.append(" §9")
|
||||||
|
.append(deltaString)
|
||||||
|
.append("§e!");
|
||||||
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
String.format("Helicopter called at %s!", timeString) :
|
||||||
|
String.format("Helicopter called at %s (%s)!", timeString, deltaString);
|
||||||
|
}
|
||||||
|
@Contract(pure = true)
|
||||||
|
private String formattedTime(int time) {
|
||||||
|
time *= 50;
|
||||||
|
return String.format("%d:%02d.%d%d",
|
||||||
|
time / 60000,
|
||||||
|
(time % 60000) / 1000,
|
||||||
|
(time % 1000) / 100,
|
||||||
|
(time % 100) / 10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@Contract(pure = true)
|
||||||
|
private String formattedDelta(int newTime, int oldTime) {
|
||||||
|
final double delta = (double) (newTime - oldTime) / 20;
|
||||||
|
return String.format("%+.2f", delta);
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ public class CategoryData implements ISplitsData {
|
||||||
personalBests = new int[30];
|
personalBests = new int[30];
|
||||||
break;
|
break;
|
||||||
case PRISON:
|
case PRISON:
|
||||||
bestSegments = new short[31];
|
bestSegments = new short[30];
|
||||||
personalBests = new int[31];
|
personalBests = new int[31];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
@SuppressWarnings("SpellCheckingInspection")
|
@SuppressWarnings("SpellCheckingInspection")
|
||||||
public class LanguageSupport {
|
public class LanguageSupport {
|
||||||
private static final String[] LANGUAGEs = {
|
private static final String[] LANGUAGES = {
|
||||||
"EN",
|
"EN",
|
||||||
"FR",
|
"FR",
|
||||||
"DE"
|
"DE"
|
||||||
|
@ -51,6 +51,12 @@ public class LanguageSupport {
|
||||||
};
|
};
|
||||||
return Arrays.stream(words).anyMatch(input::contains);
|
return Arrays.stream(words).anyMatch(input::contains);
|
||||||
}
|
}
|
||||||
|
public static boolean isHelicopterIncoming(@NotNull String input) {
|
||||||
|
final String[] words = {
|
||||||
|
"The Helicopter is on its way! Hold out for 120 more seconds!"
|
||||||
|
};
|
||||||
|
return Arrays.stream(words).anyMatch(input::contains);
|
||||||
|
}
|
||||||
|
|
||||||
public static @NotNull Pattern roundPattern(@NotNull String language) {
|
public static @NotNull Pattern roundPattern(@NotNull String language) {
|
||||||
switch (language) {
|
switch (language) {
|
||||||
|
@ -64,21 +70,7 @@ public class LanguageSupport {
|
||||||
throw new IllegalStateException("Unexpected value: " + language);
|
throw new IllegalStateException("Unexpected value: " + language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull Pattern mapPattern(@NotNull String language) {
|
|
||||||
switch (language) {
|
|
||||||
case "EN":
|
|
||||||
return Pattern.compile("Map:.*(Dead End|Bad Blood|Alien Arcadium|Prison)");
|
|
||||||
case "FR":
|
|
||||||
return Pattern.compile("Carte:.*(Dead End|Bad Blood|Alien Arcadium|Prison)");
|
|
||||||
case "DE":
|
|
||||||
return Pattern.compile("Karte:.*(Dead End|Bad Blood|Alien Arcadium|Prison)");
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException("Unexpected value: " + language);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[] getLanguages() {
|
public static String[] getLanguages() {
|
||||||
return LANGUAGEs;
|
return LANGUAGES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue