mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-16 03:14:04 +00:00
feat: Add worldedit.schematic.list.other permission and functionality (#1507)
* Add worldedit.schematic.list.other permission and functionality * Implement StringMan#containsUuid * Javadocs * chore: Add since annotation Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
@@ -9,11 +9,14 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class StringMan {
|
||||
|
||||
private static final Pattern UUID_PATTERN = Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}");
|
||||
|
||||
public static boolean containsAny(CharSequence sequence, String any) {
|
||||
return IntStream.range(0, sequence.length())
|
||||
.anyMatch(i -> any.indexOf(sequence.charAt(i)) != -1);
|
||||
@@ -542,4 +545,16 @@ public class StringMan {
|
||||
return IntStream.range(0, n).mapToObj(i -> s).collect(Collectors.joining());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if there is a valid uuid contained inside the
|
||||
* provided String.
|
||||
*
|
||||
* @param str provided string
|
||||
* @return true if an uuid was found, false if not
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public static boolean containsUuid(String str) {
|
||||
return UUID_PATTERN.matcher(str).find();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user