mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 14:44:43 +02:00
Compare commits
1 Commits
fix/plotTi
...
fix/v6/Blo
Author | SHA1 | Date | |
---|---|---|---|
a58581751e |
@ -116,7 +116,7 @@ public class BlockArrayCacheScopedQueueCoordinator extends ScopedQueueCoordinato
|
|||||||
x += offsetX;
|
x += offsetX;
|
||||||
z += offsetZ;
|
z += offsetZ;
|
||||||
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
if (x >= scopeMinX && x < scopeMaxX && y >= minY && y <= maxY && z >= scopeMinZ && z < scopeMaxZ) {
|
||||||
blockStates[y - minY][x][z] = id.toImmutableState();
|
blockStates[y - minY][x - scopeMinX][z - scopeMinZ] = id.toImmutableState();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class StringMan {
|
public class StringMan {
|
||||||
|
|
||||||
// Stolen from https://stackoverflow.com/a/366532/12620913 | Debug: https://regex101.com/r/DudJLb/1
|
private static final Pattern STRING_SPLIT_PATTERN = Pattern.compile("(?<quoted>\"[\\w ]+\")|(?<single>\\w+)");
|
||||||
private static final Pattern STRING_SPLIT_PATTERN = Pattern.compile("[^\\s\"]+|\"([^\"]*)\"");
|
|
||||||
|
|
||||||
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
||||||
StringBuilder sb = new StringBuilder(string);
|
StringBuilder sb = new StringBuilder(string);
|
||||||
@ -356,7 +355,7 @@ public class StringMan {
|
|||||||
var matcher = StringMan.STRING_SPLIT_PATTERN.matcher(message);
|
var matcher = StringMan.STRING_SPLIT_PATTERN.matcher(message);
|
||||||
List<String> splitMessages = new ArrayList<>();
|
List<String> splitMessages = new ArrayList<>();
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
splitMessages.add(matcher.group(matcher.groupCount() - 1).replaceAll("\"", ""));
|
splitMessages.add(matcher.group(0).replaceAll("\"", ""));
|
||||||
}
|
}
|
||||||
return splitMessages;
|
return splitMessages;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class FlagTest {
|
|||||||
public void shouldSuccessfullyParseTitleFlagWithTitleEmptyAndSubTitleSingleWord() {
|
public void shouldSuccessfullyParseTitleFlagWithTitleEmptyAndSubTitleSingleWord() {
|
||||||
Assertions.assertDoesNotThrow(() -> {
|
Assertions.assertDoesNotThrow(() -> {
|
||||||
var title = PlotTitleFlag.TITLE_FLAG_DEFAULT.parse("\"\" \"single\"").getValue();
|
var title = PlotTitleFlag.TITLE_FLAG_DEFAULT.parse("\"\" \"single\"").getValue();
|
||||||
Assertions.assertEquals("", title.title());
|
Assertions.assertEquals(" ", title.title());
|
||||||
Assertions.assertEquals("single", title.subtitle());
|
Assertions.assertEquals("single", title.subtitle());
|
||||||
}, "Should not throw a FlagParseException");
|
}, "Should not throw a FlagParseException");
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@ public class StringManTest {
|
|||||||
new Message("title", List.of("title")),
|
new Message("title", List.of("title")),
|
||||||
new Message("title \"sub title\"", List.of("title", "sub title")),
|
new Message("title \"sub title\"", List.of("title", "sub title")),
|
||||||
new Message("\"a title\" subtitle", List.of("a title", "subtitle")),
|
new Message("\"a title\" subtitle", List.of("a title", "subtitle")),
|
||||||
new Message("\"title\" \"subtitle\"", List.of("title", "subtitle")),
|
new Message("\"title\" \"subtitle\"", List.of("title", "subtitle"))
|
||||||
new Message("\"How <bold>bold</bold> of you\" \"to assume I like <rainbow>rainbows</rainbow>\"",
|
|
||||||
List.of("How <bold>bold</bold> of you", "to assume I like <rainbow>rainbows</rainbow>"))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
|
Reference in New Issue
Block a user