Skip to content

Commit a9930a1

Browse files
Merge pull request #570 from aunncodes/featgoldminedeepcaverns
Feat: Add Gold Mine and Deep Caverns and Dwarven Mines
2 parents 92c3ec8 + 9ef2821 commit a9930a1

145 files changed

Lines changed: 12685 additions & 7311 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ build/
4545
### Islands ###
4646
/configuration/skyblock/islands/hypixel_skyblock_island_template/
4747
/configuration/skyblock/islands/hypixel_skyblock_hub/
48+
/configuration/skyblock/islands/hypixel_skyblock_gold_mine/
49+
/configuration/skyblock/islands/*
4850
/configuration/hypixel_prototype_lobby/
4951
.gradle/
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
package net.swofty.commons;
2+
3+
import lombok.Getter;
4+
5+
import java.util.List;
6+
7+
public class ChatUtility {
8+
9+
public enum FontInfo {
10+
A('A', 5),
11+
a('a', 5),
12+
B('B', 5),
13+
b('b', 5),
14+
C('C', 5),
15+
c('c', 5),
16+
D('D', 5),
17+
d('d', 5),
18+
E('E', 5),
19+
e('e', 5),
20+
F('F', 5),
21+
f('f', 4),
22+
G('G', 5),
23+
g('g', 5),
24+
H('H', 5),
25+
h('h', 5),
26+
I('I', 3),
27+
i('i', 1),
28+
J('J', 5),
29+
j('j', 5),
30+
K('K', 5),
31+
k('k', 4),
32+
L('L', 5),
33+
l('l', 1),
34+
M('M', 5),
35+
m('m', 5),
36+
N('N', 5),
37+
n('n', 5),
38+
O('O', 5),
39+
o('o', 5),
40+
P('P', 5),
41+
p('p', 5),
42+
Q('Q', 5),
43+
q('q', 5),
44+
R('R', 5),
45+
r('r', 5),
46+
S('S', 5),
47+
s('s', 5),
48+
T('T', 5),
49+
t('t', 4),
50+
U('U', 5),
51+
u('u', 5),
52+
V('V', 5),
53+
v('v', 5),
54+
W('W', 5),
55+
w('w', 5),
56+
X('X', 5),
57+
x('x', 5),
58+
Y('Y', 5),
59+
y('y', 5),
60+
Z('Z', 5),
61+
z('z', 5),
62+
NUM_1('1', 5),
63+
NUM_2('2', 5),
64+
NUM_3('3', 5),
65+
NUM_4('4', 5),
66+
NUM_5('5', 5),
67+
NUM_6('6', 5),
68+
NUM_7('7', 5),
69+
NUM_8('8', 5),
70+
NUM_9('9', 5),
71+
NUM_0('0', 5),
72+
EXCLAMATION_POINT('!', 1),
73+
AT_SYMBOL('@', 6),
74+
NUM_SIGN('#', 5),
75+
DOLLAR_SIGN('$', 5),
76+
PERCENT('%', 5),
77+
UP_ARROW('^', 5),
78+
AMPERSAND('&', 5),
79+
ASTERISK('*', 5),
80+
LEFT_PARENTHESIS('(', 4),
81+
RIGHT_PERENTHESIS(')', 4),
82+
MINUS('-', 5),
83+
UNDERSCORE('_', 5),
84+
PLUS_SIGN('+', 5),
85+
EQUALS_SIGN('=', 5),
86+
LEFT_CURL_BRACE('{', 4),
87+
RIGHT_CURL_BRACE('}', 4),
88+
LEFT_BRACKET('[', 3),
89+
RIGHT_BRACKET(']', 3),
90+
COLON(':', 1),
91+
SEMI_COLON(';', 1),
92+
DOUBLE_QUOTE('"', 3),
93+
SINGLE_QUOTE('\'', 1),
94+
LEFT_ARROW('<', 4),
95+
RIGHT_ARROW('>', 4),
96+
DOUBLE_LEFT_ARROW('«', 5),
97+
DOUBLE_RIGHT_ARROW('»', 5),
98+
QUESTION_MARK('?', 5),
99+
SLASH('/', 5),
100+
BACK_SLASH('\\', 5),
101+
LINE('|', 1),
102+
TILDE('~', 5),
103+
TICK('`', 2),
104+
PERIOD('.', 1),
105+
COMMA(',', 1),
106+
SPACE(' ', 3),
107+
DEFAULT('a', 4);
108+
109+
private final static int CENTER_PX = 320 / 2 - 6;
110+
@Getter
111+
private final char character;
112+
@Getter
113+
private final int length;
114+
115+
FontInfo(char character, int length) {
116+
this.character = character;
117+
this.length = length;
118+
}
119+
120+
public static FontInfo getDefaultFontInfo(char c) {
121+
for (FontInfo fontInfo : values()) {
122+
if (fontInfo.getCharacter() == c) {
123+
return fontInfo;
124+
}
125+
}
126+
return DEFAULT;
127+
}
128+
129+
public static String center(String message) {
130+
return getCenterSpaces(message) + message;
131+
}
132+
133+
public static List<String> centerLines(List<String> lines) {
134+
return lines.stream().map(FontInfo::center).toList();
135+
}
136+
137+
public static String getCenterSpaces(String message) {
138+
if (message == null || message.isEmpty()) {
139+
return "";
140+
}
141+
int messagePxSize = getLength(message);
142+
int halvedMessageSize = messagePxSize / 2;
143+
int toCompensate = CENTER_PX - halvedMessageSize;
144+
int spaceLength = SPACE.getLength() + 1;
145+
int compensated = 0;
146+
StringBuilder sb = new StringBuilder();
147+
148+
while (compensated < toCompensate) {
149+
sb.append(" ");
150+
compensated += spaceLength;
151+
}
152+
return sb.toString();
153+
}
154+
155+
public static String stripTokens(String input) {
156+
return input.replaceAll("§.", "");
157+
}
158+
159+
public static int getLength(String message) {
160+
message = stripTokens(message);
161+
162+
double messagePxSize = 0;
163+
boolean previousCode = false;
164+
boolean bold = false;
165+
166+
for (char c : message.toCharArray()) {
167+
if (c == '§') {
168+
previousCode = true;
169+
170+
} else if (previousCode) {
171+
previousCode = false;
172+
bold = bold ? c != 'r' : c == 'l';
173+
174+
} else {
175+
FontInfo fontInfo = getDefaultFontInfo(c);
176+
messagePxSize += bold ? fontInfo.getBoldLength() + 1.5 : fontInfo.getLength() + 1;
177+
}
178+
}
179+
return (int) messagePxSize;
180+
}
181+
182+
public int getBoldLength() {
183+
if (this == SPACE) {
184+
return getLength();
185+
}
186+
return length + 1;
187+
}
188+
}
189+
190+
}
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
package net.swofty.commons;
22

33
public enum CustomWorlds {
4-
SKYBLOCK_ISLAND_TEMPLATE("hypixel_skyblock_island_template"),
5-
SKYBLOCK_HUB("hypixel_skyblock_hub"),
6-
SKYBLOCK_DUNGEON_HUB("hypixel_skyblock_dungeon_hub"),
7-
PROTOTYPE_LOBBY("hypixel_prototype_lobby"),
8-
BEDWARS_LOBBY("hypixel_bedwars_lobby"),
9-
;
4+
SKYBLOCK_ISLAND_TEMPLATE("hypixel_skyblock_island_template"),
5+
SKYBLOCK_HUB("hypixel_skyblock_hub"),
6+
SKYBLOCK_GOLD_MINE("hypixel_skyblock_gold_mine"),
7+
SKYBLOCK_DEEP_CAVERNS("hypixel_skyblock_deep_caverns"),
8+
SKYBLOCK_DWARVEN_MINES("hypixel_skyblock_dwarven_mines"),
9+
SKYBLOCK_DUNGEON_HUB("hypixel_skyblock_dungeon_hub"),
10+
PROTOTYPE_LOBBY("hypixel_prototype_lobby"),
11+
BEDWARS_LOBBY("hypixel_bedwars_lobby"),
12+
;
1013

11-
private final String folderName;
14+
private final String folderName;
1215

13-
CustomWorlds(String folderName) {
14-
this.folderName = folderName;
15-
}
16+
CustomWorlds(String folderName) {
17+
this.folderName = folderName;
18+
}
1619

17-
public String getFolderName() {
18-
if (name().startsWith("SKYBLOCK_")) {
19-
return "./configuration/skyblock/islands/" + folderName;
20-
} else {
21-
return "./configuration/" + folderName;
22-
}
23-
}
20+
public String getFolderName() {
21+
if (name().startsWith("SKYBLOCK_")) {
22+
return "./configuration/skyblock/islands/" + folderName;
23+
} else {
24+
return "./configuration/" + folderName;
25+
}
26+
}
2427
}

commons/src/main/java/net/swofty/commons/ServerType.java

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,44 @@
44

55
@Getter
66
public enum ServerType {
7-
SKYBLOCK_ISLAND(true),
8-
SKYBLOCK_HUB(true),
9-
SKYBLOCK_DUNGEON_HUB(true),
10-
SKYBLOCK_THE_FARMING_ISLANDS(true),
11-
PROTOTYPE_LOBBY(false),
12-
BEDWARS_LOBBY(false),
13-
BEDWARS_GAME(false),
14-
;
15-
16-
private final boolean isSkyBlock;
17-
18-
ServerType(boolean isSkyBlock) {
19-
this.isSkyBlock = isSkyBlock;
20-
}
21-
22-
public static boolean isServerType(String type) {
23-
for (ServerType a : values())
24-
if (type.equalsIgnoreCase(a.name())) return true;
25-
26-
return false;
27-
}
28-
29-
public String formatName() {
30-
return StringUtility.toNormalCase(name());
31-
}
32-
33-
public static ServerType getSkyblockServer(String name) {
34-
if (!name.startsWith("SKYBLOCK_")) {
35-
return valueOf("SKYBLOCK_" + name.toUpperCase());
36-
} else {
37-
return valueOf(name);
38-
}
39-
}
40-
41-
public String skyblockName() {
42-
return name().replace("SKYBLOCK_", "");
43-
}
7+
SKYBLOCK_ISLAND(true),
8+
SKYBLOCK_HUB(true),
9+
SKYBLOCK_DUNGEON_HUB(true),
10+
SKYBLOCK_THE_FARMING_ISLANDS(true),
11+
SKYBLOCK_GOLD_MINE(true),
12+
SKYBLOCK_DEEP_CAVERNS(true),
13+
SKYBLOCK_DWARVEN_MINES(true),
14+
PROTOTYPE_LOBBY(false),
15+
BEDWARS_LOBBY(false),
16+
BEDWARS_GAME(false),
17+
;
18+
19+
private final boolean isSkyBlock;
20+
21+
ServerType(boolean isSkyBlock) {
22+
this.isSkyBlock = isSkyBlock;
23+
}
24+
25+
public static boolean isServerType(String type) {
26+
for (ServerType a : values())
27+
if (type.equalsIgnoreCase(a.name())) return true;
28+
29+
return false;
30+
}
31+
32+
public static ServerType getSkyblockServer(String name) {
33+
if (!name.startsWith("SKYBLOCK_")) {
34+
return valueOf("SKYBLOCK_" + name.toUpperCase());
35+
} else {
36+
return valueOf(name);
37+
}
38+
}
39+
40+
public String formatName() {
41+
return StringUtility.toNormalCase(name());
42+
}
43+
44+
public String skyblockName() {
45+
return name().replace("SKYBLOCK_", "");
46+
}
4447
}

0 commit comments

Comments
 (0)