/** * Sets the voice {@link net.dv8tion.jda.core.Region Region} of * the resulting {@link net.dv8tion.jda.core.entities.Guild Guild}. * * @param region * The {@link net.dv8tion.jda.core.Region Region} to use * * @throws java.lang.IllegalArgumentException * If the provided region is a VIP region as per {@link net.dv8tion.jda.core.Region#isVip() Region.isVip()} * * @return The current GuildAction for chaining convenience */ @CheckReturnValue public GuildAction setRegion(Region region) { Checks.check(region == null || !region.isVip(), "Cannot create a Guild with a VIP voice region!"); this.region = region; return this; }
/** * Sets the {@link net.dv8tion.jda.core.Region Region} of this {@link net.dv8tion.jda.core.entities.Guild Guild}. * * @param region * The new region for this {@link net.dv8tion.jda.core.entities.Guild Guild} * * @throws IllegalArgumentException * If the provided region is a {@link net.dv8tion.jda.core.Region#isVip() VIP Region} but the guild does not support VIP regions. * Use {@link net.dv8tion.jda.core.entities.Guild#getFeatures() Guild#getFeatures()} to check if VIP regions are supported. * * @return GuildManager for chaining convenience * * @see net.dv8tion.jda.core.Region#isVip() * @see net.dv8tion.jda.core.entities.Guild#getFeatures() */ @CheckReturnValue public GuildManager setRegion(Region region) { Checks.notNull(region, "Region"); Checks.check(region != Region.UNKNOWN, "Region must not be UNKNOWN"); Checks.check(!region.isVip() || getGuild().getFeatures().contains("VIP_REGIONS"), "Cannot set a VIP voice region on this guild"); this.region = region.getKey(); set |= REGION; return this; }
private Region getRandomRegion(Region currentRegion) { List<Region> regions = new ArrayList<>(); for (Region region : Region.values()) { if (region.equals(Region.UNKNOWN) || region.equals(currentRegion) || region.isVip() != currentRegion.isVip()) { continue; } regions.add(region); } return (Region) RandomUtil.pickRandom(regions); }
public GuildTransformer(Guild guild) { super(null); locale = null; id = guild.getId(); name = guild.getName(); nameRaw = guild.getName(); partner = guild.getRegion().isVip(); guildType = partner ? partnerTypeTransformer : new GuildTypeTransformer(data); }
public GuildTransformer(Guild guild, DataRow data) { super(data); partner = guild.getRegion().isVip();
if (guild.getRegion().isVip()) { context.makeInfo("The **:server** server is a Discord partner, they will always be partnered with the bot because of that.") .set("server", guild.getName())