Skip to content

Commit 7ee644d

Browse files
committed
Merge remote-tracking branch 'upstream/2.0' into dev/nukkitx-standard-generator
2 parents d932c2b + da10d75 commit 7ee644d

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@
150150
<artifactId>slf4j-api</artifactId>
151151
<version>2.0.0-alpha1</version>
152152
</dependency>
153+
<dependency>
154+
<groupId>com.lmax</groupId>
155+
<artifactId>disruptor</artifactId>
156+
<version>3.4.2</version>
157+
</dependency>
153158

154159
<!-- Jackson -->
155160
<dependency>

src/main/java/cn/nukkit/utils/TextFormat.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public enum TextFormat {
3535
*/
3636
DARK_PURPLE('5', 0x5),
3737
/**
38-
* Represents gold.
38+
* Represents orange.
3939
*/
40-
GOLD('6', 0x6),
40+
ORANGE('6', 0x6),
4141
/**
4242
* Represents gray.
4343
*/
@@ -74,6 +74,10 @@ public enum TextFormat {
7474
* Represents white.
7575
*/
7676
WHITE('f', 0xF),
77+
/**
78+
* Represents gold.
79+
*/
80+
GOLD('g', 0x16),
7781
/**
7882
* Makes the text obfuscated.
7983
*/
@@ -105,7 +109,7 @@ public enum TextFormat {
105109
*/
106110
public static final char ESCAPE = '\u00A7';
107111

108-
private static final Pattern CLEAN_PATTERN = Pattern.compile("(?i)" + ESCAPE + "[0-9A-FK-OR]");
112+
private static final Pattern CLEAN_PATTERN = Pattern.compile("(?i)" + ESCAPE + "[0-9A-GK-OR]");
109113
private final static Map<Integer, TextFormat> BY_ID = Maps.newTreeMap();
110114
private final static Map<Character, TextFormat> BY_CHAR = new HashMap<>();
111115

@@ -185,7 +189,7 @@ public static String clean(final String input, final boolean recursive) {
185189
* Translates a string using an alternate format code character into a
186190
* string that uses the internal TextFormat.ESCAPE format code
187191
* character. The alternate format code character will only be replaced if
188-
* it is immediately followed by 0-9, A-F, a-f, K-O, k-o, R or r.
192+
* it is immediately followed by 0-9, A-G, a-g, K-O, k-o, R or r.
189193
*
190194
* @param altFormatChar The alternate format code character to replace. Ex: &amp;
191195
* @param textToTranslate Text containing the alternate format code character.
@@ -194,7 +198,7 @@ public static String clean(final String input, final boolean recursive) {
194198
public static String colorize(char altFormatChar, String textToTranslate) {
195199
char[] b = textToTranslate.toCharArray();
196200
for (int i = 0; i < b.length - 1; i++) {
197-
if (b[i] == altFormatChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
201+
if (b[i] == altFormatChar && "0123456789AaBbCcDdEeFfGgKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
198202
b[i] = TextFormat.ESCAPE;
199203
b[i + 1] = Character.toLowerCase(b[i + 1]);
200204
}
@@ -206,7 +210,7 @@ public static String colorize(char altFormatChar, String textToTranslate) {
206210
* Translates a string, using an ampersand (&amp;) as an alternate format code
207211
* character, into a string that uses the internal TextFormat.ESCAPE format
208212
* code character. The alternate format code character will only be replaced if
209-
* it is immediately followed by 0-9, A-F, a-f, K-O, k-o, R or r.
213+
* it is immediately followed by 0-9, A-G, a-g, K-O, k-o, R or r.
210214
*
211215
* @param textToTranslate Text containing the alternate format code character.
212216
* @return Text containing the TextFormat.ESCAPE format code character.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## log4j2.messageFactory=cn.nukkit.locale.NukkitMessageFactory
2+
log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
23
log4j2.enableThreadlocals=true
34
log4j2.enableDirectEncoders=true
45
log4j2.garbagefreeThreadContextMap=true

0 commit comments

Comments
 (0)