Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions commons/src/main/java/net/swofty/commons/CustomWorlds.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum CustomWorlds {
BEDWARS_LOBBY("hypixel_bedwars_lobby"),
MURDER_MYSTERY_LOBBY("hypixel_murder_mystery_lobby"),
SKYWARS_LOBBY("hypixel_skywars_lobby"),
ARCADE_LOBBY("hypixel_arcade_lobby")
;

private final String folderName;
Expand Down
5 changes: 4 additions & 1 deletion commons/src/main/java/net/swofty/commons/ServerType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public enum ServerType {
MURDER_MYSTERY_CONFIGURATOR(false),
SKYWARS_LOBBY(false),
SKYWARS_GAME(false),
SKYWARS_CONFIGURATOR(false)
SKYWARS_CONFIGURATOR(false),
ARCADE_LOBBY(false),
ZOMBIES_GAME(false),
ZOMBIES_CONFIGURATOR(false)
;

private final boolean isSkyBlock;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package net.swofty.commons.zombies;

import lombok.Getter;
import org.jetbrains.annotations.Nullable;

@Getter
public enum ZombiesGameType {
NORMAL(0, "Normal", ZombiesDifficulty.NORMAL),
RIP(1, "RIP", ZombiesDifficulty.HARD);

private final int id;
private final String displayName;
private final ZombiesDifficulty difficulty;

ZombiesGameType(int id, String displayName, ZombiesDifficulty difficulty) {
this.id = id;
this.displayName = displayName;
this.difficulty = difficulty;
}

public int getMaxPlayers() {
return 4;
}

public int getMinPlayers() {
return 4;
}

@Nullable
public static ZombiesGameType from(String field) {
for (ZombiesGameType type : values()) {
if (type.name().equalsIgnoreCase(field)) {
return type;
}
}
return null;
}

@Nullable
public static ZombiesGameType fromDisplayName(String displayName) {
for (ZombiesGameType type : values()) {
if (type.displayName.equalsIgnoreCase(displayName)) {
return type;
}
}
return null;
}

@Nullable
public static ZombiesGameType fromId(int id) {
for (ZombiesGameType type : values()) {
if (type.id == id) {
return type;
}
}
return null;
}

public boolean isRIP() {
return this == RIP;
}

@Getter
public enum ZombiesDifficulty {
NORMAL("Normal", 1.0),
HARD("Hard", 1.5);

private final String displayName;
private final double difficultyMultiplier;

ZombiesDifficulty(String displayName, double difficultyMultiplier) {
this.displayName = displayName;
this.difficultyMultiplier = difficultyMultiplier;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package net.swofty.commons.zombies;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;

@Getter
public enum ZombiesLeaderboardMode {
ALL("all", "All Maps"),
DEAD_END("dead_end", "Dead End"),
BAD_BLOOD("bad_blood", "Bad Blood"),
ALIEN_ARCADIUM("alien_arcadium", "Alien Arcadium"),
PRISON("prison", "Prison");

private final String key;
private final String displayName;

ZombiesLeaderboardMode(String key, String displayName) {
this.key = key;
this.displayName = displayName;
}

private static final List<ZombiesMap> ACTIVE_MAPS = Arrays.asList(
ZombiesMap.DEAD_END,
ZombiesMap.BAD_BLOOD,
ZombiesMap.ALIEN_ARCADIUM,
ZombiesMap.PRISON
);

public boolean includes(ZombiesMap map) {
return switch (this) {
case ALL -> ACTIVE_MAPS.contains(map);
case DEAD_END -> map == ZombiesMap.DEAD_END;
case BAD_BLOOD -> map == ZombiesMap.BAD_BLOOD;
case ALIEN_ARCADIUM -> map == ZombiesMap.ALIEN_ARCADIUM;
case PRISON -> map == ZombiesMap.PRISON;
};
}

public ZombiesLeaderboardMode next() {
ZombiesLeaderboardMode[] values = values();
int nextOrdinal = (this.ordinal() + 1) % values.length;
return values[nextOrdinal];
}

public ZombiesLeaderboardMode previous() {
ZombiesLeaderboardMode[] values = values();
int prevOrdinal = (this.ordinal() - 1 + values.length) % values.length;
return values[prevOrdinal];
}

public static ZombiesLeaderboardMode fromKey(String key) {
for (ZombiesLeaderboardMode mode : values()) {
if (mode.key.equalsIgnoreCase(key)) {
return mode;
}
}
return ALL;
}

public static ZombiesLeaderboardMode fromMap(ZombiesMap map) {
return switch (map) {
case DEAD_END -> DEAD_END;
case BAD_BLOOD -> BAD_BLOOD;
case ALIEN_ARCADIUM -> ALIEN_ARCADIUM;
case PRISON -> PRISON;
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package net.swofty.commons.zombies;

import lombok.Getter;

@Getter
public enum ZombiesLeaderboardPeriod {
DAILY("daily", "Daily", 1),
WEEKLY("weekly", "Weekly", 7),
MONTHLY("monthly", "Monthly", 30),
LIFETIME("lifetime", "Lifetime", -1);

private final String key;
private final String displayName;
private final int days;

ZombiesLeaderboardPeriod(String key, String displayName, int days) {
this.key = key;
this.displayName = displayName;
this.days = days;
}

public ZombiesLeaderboardPeriod next() {
ZombiesLeaderboardPeriod[] values = values();
int nextOrdinal = (this.ordinal() + 1) % values.length;
return values[nextOrdinal];
}

public ZombiesLeaderboardPeriod previous() {
ZombiesLeaderboardPeriod[] values = values();
int prevOrdinal = (this.ordinal() - 1 + values.length) % values.length;
return values[prevOrdinal];
}

public static ZombiesLeaderboardPeriod fromKey(String key) {
for (ZombiesLeaderboardPeriod period : values()) {
if (period.key.equalsIgnoreCase(key)) {
return period;
}
}
return LIFETIME;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.swofty.commons.zombies;

public record ZombiesLeaderboardPreferences(
ZombiesLeaderboardPeriod period,
ZombiesLeaderboardMode mode,
ZombiesLeaderboardView view,
ZombiesTextAlignment textAlignment
) {
public static ZombiesLeaderboardPreferences defaults() {
return new ZombiesLeaderboardPreferences(
ZombiesLeaderboardPeriod.WEEKLY,
ZombiesLeaderboardMode.ALL,
ZombiesLeaderboardView.TOP_10,
ZombiesTextAlignment.CENTER
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package net.swofty.commons.zombies;

import lombok.Getter;

@Getter
public enum ZombiesLeaderboardView {
TOP_10("top_10", "Top 10"),
PLAYERS_AROUND_YOU("around_you", "Players Around You");

private final String key;
private final String displayName;

ZombiesLeaderboardView(String key, String displayName) {
this.key = key;
this.displayName = displayName;
}

public ZombiesLeaderboardView next() {
ZombiesLeaderboardView[] values = values();
int nextOrdinal = (this.ordinal() + 1) % values.length;
return values[nextOrdinal];
}

public ZombiesLeaderboardView previous() {
ZombiesLeaderboardView[] values = values();
int prevOrdinal = (this.ordinal() - 1 + values.length) % values.length;
return values[prevOrdinal];
}

public static ZombiesLeaderboardView fromKey(String key) {
for (ZombiesLeaderboardView view : values()) {
if (view.key.equalsIgnoreCase(key)) {
return view;
}
}
return TOP_10;
}
}
58 changes: 58 additions & 0 deletions commons/src/main/java/net/swofty/commons/zombies/ZombiesMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package net.swofty.commons.zombies;

import lombok.Getter;
import org.jetbrains.annotations.Nullable;

@Getter
public enum ZombiesMap {
DEAD_END(0, "Dead End", 30, "The original Zombies map. Stranded in the middle of a city, make your way through the high rises to battle the undead!"),
BAD_BLOOD(1, "Bad Blood", 30, "After crashing into the courtyard of a beautiful mansion, fend off zombies as you uncover the secrets hidden within!"),
ALIEN_ARCADIUM(2, "Alien Arcadium", 105, "Extraterrestrial Zombies have attacked! Battle alien creatures and save the theme park from destruction."),
PRISON(3, "Prison", 30, "The cells of the undead have been opened! Save yourselves and escape from the Prison!");

private final int id;
private final String displayName;
private final int maxRounds;
private final String description;

ZombiesMap(int id, String displayName, int maxRounds, String description) {
this.id = id;
this.displayName = displayName;
this.maxRounds = maxRounds;
this.description = description;
}

public boolean isExtendedMap() {
return this == ALIEN_ARCADIUM;
}

@Nullable
public static ZombiesMap from(String field) {
for (ZombiesMap map : values()) {
if (map.name().equalsIgnoreCase(field)) {
return map;
}
}
return null;
}

@Nullable
public static ZombiesMap fromDisplayName(String displayName) {
for (ZombiesMap map : values()) {
if (map.displayName.equalsIgnoreCase(displayName)) {
return map;
}
}
return null;
}

@Nullable
public static ZombiesMap fromId(int id) {
for (ZombiesMap map : values()) {
if (map.id == id) {
return map;
}
}
return null;
}
}
Loading