We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2795849 commit 0aa1a8aCopy full SHA for 0aa1a8a
src/main/kotlin/dev/arbjerg/lavalink/client/loadbalancing/regionFiltering.kt
@@ -45,6 +45,18 @@ object RegionGroup {
45
return if (region in regions) RegionFilterVerdict.PASS else RegionFilterVerdict.SOFT_BLOCK
46
}
47
48
+
49
+ /**
50
+ * Gets a [RegionGroup] from a string. This method is case-insensitive.
51
+ *
52
+ * @param region The region to get the [RegionGroup] for. Valid values are [ASIA], [EUROPE], and [US].
53
+ */
54
+ fun valueOf(region: String) = when (region.uppercase()) {
55
+ "ASIA" -> ASIA
56
+ "EUROPE" -> EUROPE
57
+ "US" -> US
58
+ else -> throw IllegalArgumentException("No region constant: $region")
59
+ }
60
61
62
// TODO In case no exact server match, should it look for the closest node in that same region?
0 commit comments