Package de.craftsblock.craftsnet.utils
Class Utils
java.lang.Object
de.craftsblock.craftsnet.utils.Utils
This utility class provides helper methods for general operations.
- Since:
- 2.1.1-SNAPSHOT
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternAPatterninstance which searches for ip addresses.static final StringA pattern to search for ipv4 addresses.static final StringA pattern to search for ipv6 addresses.static final PatternA regular expression pattern used to extract group names from a regular expression pattern string. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBlurs IPv4 and IPv6 ip addresses in an string.getGroupNames(String regex) Extracts the group names of aPattern.getGroupNames(Pattern pattern) Extracts the group names of aPattern.static @Nullable ThreadgetThreadByName(String name) Retrieves a thread by its name from the currently running threads.
-
Field Details
-
IPv4_SEARCH
A pattern to search for ipv4 addresses.- See Also:
-
IPv6_SEARCH
A pattern to search for ipv6 addresses.- See Also:
-
IP_SEARCHER
APatterninstance which searches for ip addresses. -
patternGroupNameExtractPattern
A regular expression pattern used to extract group names from a regular expression pattern string. This pattern matches named capturing groups defined in regular expression patterns.
-
-
Method Details
-
getThreadByName
Retrieves a thread by its name from the currently running threads.This method searches through all currently running threads and returns the thread with the specified name. If no thread with the given name is found, it returns null.
- Parameters:
name- The name of the thread to retrieve.- Returns:
- The thread with the specified name, or null if not found.
- Throws:
SecurityException- If a security manager exists and itsSecurityManager.checkPermission(Permission)method denies access to the current thread.
-
getGroupNames
Extracts the group names of aPattern. -
getGroupNames
Extracts the group names of aPattern. -
blurIPs
Blurs IPv4 and IPv6 ip addresses in an string.- Parameters:
phrase- The string where the readable ips are present- Returns:
- The string containing the blurred ip addresses.
- Since:
- 3.4.0-SNAPSHOT
-