Skip to content

Commit

Permalink
Merge pull request #720 from DV8FromTheWorld/release/3.7.1
Browse files Browse the repository at this point in the history
Hotfix version 3.7.1
  • Loading branch information
MinnDevelopment authored Jul 18, 2018
2 parents cb3ae62 + 6e5e44c commit 2adfdca
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '2.0.1'
}

def versionObj = new Version(major: 3, minor: 7, revision: 0)
def versionObj = new Version(major: 3, minor: 7, revision: 1)

group = "net.dv8tion"
archivesBaseName = "JDA"
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/net/dv8tion/jda/bot/sharding/ShardManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,22 @@ default Guild getGuildById(final String id)
return this.getGuildCache().getElementById(id);
}

/**
* An unmodifiable list of all {@link net.dv8tion.jda.core.entities.Guild Guilds} that have the same name as the one provided.
* <br>If there are no {@link net.dv8tion.jda.core.entities.Guild Guilds} with the provided name, then this returns an empty list.
*
* @param name
* The name of the requested {@link net.dv8tion.jda.core.entities.Guild Guilds}.
* @param ignoreCase
* Whether to ignore case or not when comparing the provided name to each {@link net.dv8tion.jda.core.entities.Guild#getName()}.
*
* @return Possibly-empty list of all the {@link net.dv8tion.jda.core.entities.Guild Guilds} that all have the same name as the provided name.
*/
default List<Guild> getGuildsByName(final String name, final boolean ignoreCase)
{
return this.getGuildCache().getElementsByName(name, ignoreCase);
}

/**
* {@link net.dv8tion.jda.core.utils.cache.SnowflakeCacheView SnowflakeCacheView} of
* all cached {@link net.dv8tion.jda.core.entities.Guild Guilds} visible to this ShardManager instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ private void setSpeaking(boolean isSpeaking)
this.speaking = isSpeaking;
JSONObject obj = new JSONObject()
.put("speaking", isSpeaking ? 1 : 0)
.put("ssrc", webSocket.getSSRC())
.put("delay", 0);
webSocket.send(VoiceCode.USER_SPEAKING_UPDATE, obj);
if (!isSpeaking)
Expand Down Expand Up @@ -656,7 +657,7 @@ public ByteBuffer getNextPacketRaw(boolean changeTalking)
}

nextPacket = getPacketData(rawAudio);
if (!speaking && changeTalking)
if (!speaking)
setSpeaking(true);

if (seq + 1 > Character.MAX_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,17 @@ public ChannelAction setNSFW(boolean nsfw)
}

/**
* Adds a new Role-{@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride}
* Adds a new Role or Member {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride}
* for the new Channel.
*
* <p>Example:
* <pre>{@code
* Role role = guild.getPublicRole();
* EnumSet<Permission> allow = EnumSet.of(Permission.MESSAGE_READ);
* EnumSet<Permission> deny = EnumSet.of(Permission.MESSAGE_WRITE);
* channelAction.addPermissionOverride(role, allow, deny);
* }</pre>
*
* @param target
* The not-null {@link net.dv8tion.jda.core.entities.Role Role} or {@link net.dv8tion.jda.core.entities.Member Member} for the override
* @param allow
Expand All @@ -182,10 +190,11 @@ public ChannelAction setNSFW(boolean nsfw)
* The denied {@link net.dv8tion.jda.core.Permission Permissions} for the override or null
*
* @throws java.lang.IllegalArgumentException
* If the specified {@link net.dv8tion.jda.core.entities.Role Role} is null
* or not within the same guild.
* If the specified target is null or not within the same guild.
*
* @return The current ChannelAction, for chaining convenience
*
* @see java.util.EnumSet
*/
@CheckReturnValue
public ChannelAction addPermissionOverride(IPermissionHolder target, Collection<Permission> allow, Collection<Permission> deny)
Expand All @@ -199,11 +208,19 @@ public ChannelAction addPermissionOverride(IPermissionHolder target, Collection<
}

/**
* Adds a new Role-{@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride}
* Adds a new Role or Member {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride}
* for the new Channel.
*
* <p>Example:
* <pre>{@code
* Role role = guild.getPublicRole();
* long allow = Permission.MESSAGE_READ.getRawValue();
* long deny = Permission.MESSAGE_WRITE.getRawValue() | Permission.MESSAGE_ADD_REACTION.getRawValue();
* channelAction.addPermissionOverride(role, allow, deny);
* }</pre>
*
* @param target
* The not-null {@link net.dv8tion.jda.core.entities.Role Role} for the override
* The not-null {@link net.dv8tion.jda.core.entities.Role Role} or {@link net.dv8tion.jda.core.entities.Member Member} for the override
* @param allow
* The granted {@link net.dv8tion.jda.core.Permission Permissions} for the override
* Use {@link net.dv8tion.jda.core.Permission#getRawValue()} to retrieve these Permissions.
Expand All @@ -213,7 +230,7 @@ public ChannelAction addPermissionOverride(IPermissionHolder target, Collection<
*
* @throws java.lang.IllegalArgumentException
* <ul>
* <li>If the specified {@link net.dv8tion.jda.core.entities.Role Role} is null
* <li>If the specified target is null
* or not within the same guild.</li>
* <li>If one of the provided Permission values is invalid</li>
* </ul>
Expand Down Expand Up @@ -362,14 +379,6 @@ protected void handleResponse(Response response, Request<Channel> request)
request.onSuccess(channel);
}

protected void checkPermissions(Permission... permissions)
{
if (permissions == null)
return;
for (Permission p : permissions)
Checks.notNull(p, "Permissions");
}

protected void checkPermissions(Collection<Permission> permissions)
{
if (permissions == null)
Expand Down

0 comments on commit 2adfdca

Please sign in to comment.