Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change some voice Regions and remove VOICE_CHANNEL_REGIONS set #1962

Merged
merged 3 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 12 additions & 25 deletions src/main/java/net/dv8tion/jda/api/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;

/**
* Represents the Regions used for Audio connections.
Expand All @@ -28,36 +25,32 @@
*/
public enum Region
{
AMSTERDAM("amsterdam", "Amsterdam", "\uD83C\uDDF3\uD83C\uDDF1", false),
BRAZIL("brazil", "Brazil", "\uD83C\uDDE7\uD83C\uDDF7", false),
EUROPE("europe", "Europe", "\uD83C\uDDEA\uD83C\uDDFA", false),
EU_CENTRAL("eu-central", "EU Central", "\uD83C\uDDEA\uD83C\uDDFA", false),
EU_WEST("eu-west", "EU West", "\uD83C\uDDEA\uD83C\uDDFA", false),
FRANKFURT("frankfurt", "Frankfurt", "\uD83C\uDDE9\uD83C\uDDEA", false),
HONG_KONG("hongkong", "Hong Kong", "\uD83C\uDDED\uD83C\uDDF0", false),
INDIA("india", "India", "\uD83C\uDDEE\uD83C\uDDF3", false),
JAPAN("japan", "Japan", "\uD83C\uDDEF\uD83C\uDDF5", false),
SOUTH_KOREA("south-korea", "South Korea", "\uD83C\uDDF0\uD83C\uDDF7", false),
LONDON("london", "London", "\uD83C\uDDEC\uD83C\uDDE7", false),
MILAN("milan", "Milan", "\uD83C\uDDEE\uD83C\uDDF9", false),
ROTTERDAM("rotterdam", "Rotterdam", "\uD83C\uDDF3\uD83C\uDDF1", false),
RUSSIA("russia", "Russia", "\uD83C\uDDF7\uD83C\uDDFA", false),
INDIA("india", "India", "\uD83C\uDDEE\uD83C\uDDF3", false),
SINGAPORE("singapore", "Singapore", "\uD83C\uDDF8\uD83C\uDDEC", false),
SOUTH_AFRICA("southafrica", "South Africa", "\uD83C\uDDFF\uD83C\uDDE6", false),
SOUTH_KOREA("south-korea", "South Korea", "\uD83C\uDDF0\uD83C\uDDF7", false),
SYDNEY("sydney", "Sydney", "\uD83C\uDDE6\uD83C\uDDFA", false),
US_CENTRAL("us-central", "US Central", "\uD83C\uDDFA\uD83C\uDDF8", false),
US_EAST("us-east", "US East", "\uD83C\uDDFA\uD83C\uDDF8", false),
US_SOUTH("us-south", "US South", "\uD83C\uDDFA\uD83C\uDDF8", false),
US_WEST("us-west", "US West", "\uD83C\uDDFA\uD83C\uDDF8", false),

VIP_AMSTERDAM("vip-amsterdam", "Amsterdam (VIP)", "\uD83C\uDDF3\uD83C\uDDF1", true),
VIP_BRAZIL("vip-brazil", "Brazil (VIP)", "\uD83C\uDDE7\uD83C\uDDF7", true),
VIP_EU_CENTRAL("vip-eu-central", "EU Central (VIP)", "\uD83C\uDDEA\uD83C\uDDFA", true),
VIP_EU_WEST("vip-eu-west", "EU West (VIP)", "\uD83C\uDDEA\uD83C\uDDFA", true),
VIP_FRANKFURT("vip-frankfurt", "Frankfurt (VIP)", "\uD83C\uDDE9\uD83C\uDDEA", true),
VIP_HONG_KONG("vip-hongkong", "Hong Kong (VIP)", "\uD83C\uDDED\uD83C\uDDF0", true),
VIP_INDIA("vip-india", "India (VIP)", "\uD83C\uDDEE\uD83C\uDDF3", true),
VIP_JAPAN("vip-japan", "Japan (VIP)", "\uD83C\uDDEF\uD83C\uDDF5", true),
VIP_SOUTH_KOREA("vip-south-korea", "South Korea (VIP)", "\uD83C\uDDF0\uD83C\uDDF7", true),
VIP_LONDON("vip-london", "London (VIP)", "\uD83C\uDDEC\uD83C\uDDE7", true),
VIP_MILAN("vip-milan", "Milan (VIP)", "\uD83C\uDDEE\uD83C\uDDF9", true),
VIP_ROTTERDAM("vip-rotterdam", "Rotterdam (VIP)", "\uD83C\uDDF3\uD83C\uDDF1", true),
VIP_RUSSIA("vip-russia", "Russia (VIP)", "\uD83C\uDDF7\uD83C\uDDFA", true),
VIP_SINGAPORE("vip-singapore", "Singapore (VIP)", "\uD83C\uDDF8\uD83C\uDDEC", true),
VIP_SOUTH_AFRICA("vip-southafrica", "South Africa (VIP)", "\uD83C\uDDFF\uD83C\uDDE6", true),
VIP_SOUTH_KOREA("vip-south-korea", "South Korea (VIP)", "\uD83C\uDDF0\uD83C\uDDF7", true),
VIP_SYDNEY("vip-sydney", "Sydney (VIP)", "\uD83C\uDDE6\uD83C\uDDFA", true),
VIP_US_CENTRAL("vip-us-central", "US Central (VIP)", "\uD83C\uDDFA\uD83C\uDDF8", true),
VIP_US_EAST("vip-us-east", "US East (VIP)", "\uD83C\uDDFA\uD83C\uDDF8", true),
Expand All @@ -68,12 +61,6 @@ public enum Region

AUTOMATIC("automatic", "Automatic", null, false);

/**
* This {@link java.util.Set Set} represents all regions that can be used for VoiceChannel region overrides.
*/
public static final Set<Region> VOICE_CHANNEL_REGIONS =
DV8FromTheWorld marked this conversation as resolved.
Show resolved Hide resolved
Collections.unmodifiableSet(EnumSet.of(AUTOMATIC, US_WEST, US_EAST, US_CENTRAL, US_SOUTH, SINGAPORE, SOUTH_AFRICA, SYDNEY, EUROPE, INDIA, SOUTH_KOREA, BRAZIL, JAPAN, RUSSIA));

private final String key;
private final String name;
private final String emoji;
Expand Down Expand Up @@ -108,10 +95,10 @@ public String getKey()
{
return key;
}

/**
* The unicode flag representative of this Region.
*
*
* @return Possibly-null unicode for the region's flag
*/
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ public M setRegion(@Nonnull Region region)
{
Checks.notNull(region, "Region");
if (!type.isAudio())
throw new IllegalStateException("Can only change region on voice channels!");
Checks.check(Region.VOICE_CHANNEL_REGIONS.contains(region), "Region is not usable for VoiceChannel region overrides!");
throw new IllegalStateException("Can only change region on audio channels!");
this.region = region == Region.AUTOMATIC ? null : region.getKey();
set |= REGION;
return (M) this;
Expand Down