Skip to content

Commit

Permalink
Handle deprecations (#2097)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment committed Apr 18, 2022
1 parent 1247b25 commit 7452efb
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 30 deletions.
12 changes: 0 additions & 12 deletions src/main/java/net/dv8tion/jda/api/entities/StageInstance.java
Expand Up @@ -66,18 +66,6 @@ public interface StageInstance extends ISnowflake
@Nonnull
PrivacyLevel getPrivacyLevel();

/**
* Whether this stage instance can be found in stage discovery.
*
* @return True if this is a public stage that can be found in stage discovery
*
* @deprecated Stage discovery has been removed from the platform
*/
@Deprecated
@ForRemoval
@DeprecatedSince("5.0.0")
boolean isDiscoverable();

/**
* All current speakers of this stage instance.
*
Expand Down
Expand Up @@ -1252,7 +1252,6 @@ public StageInstance createStageInstance(GuildImpl guild, DataObject json)

long id = json.getUnsignedLong("id");
String topic = json.getString("topic");
boolean discoverable = !json.getBoolean("discoverable_disabled");
StageInstance.PrivacyLevel level = StageInstance.PrivacyLevel.fromKey(json.getInt("privacy_level", -1));


Expand All @@ -1265,7 +1264,6 @@ public StageInstance createStageInstance(GuildImpl guild, DataObject json)

return instance
.setPrivacyLevel(level)
.setDiscoverable(discoverable)
.setTopic(topic);
}

Expand Down
Expand Up @@ -39,8 +39,6 @@
import net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction;
import net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction;
import net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction;
import net.dv8tion.jda.api.requests.restaction.pagination.BanPaginationAction;
import net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction;
import net.dv8tion.jda.api.utils.cache.*;
import net.dv8tion.jda.api.utils.concurrent.Task;
import net.dv8tion.jda.api.utils.data.DataArray;
Expand All @@ -58,7 +56,6 @@
import net.dv8tion.jda.internal.requests.restaction.order.RoleOrderActionImpl;
import net.dv8tion.jda.internal.requests.restaction.pagination.AuditLogPaginationActionImpl;
import net.dv8tion.jda.internal.requests.restaction.pagination.BanPaginationActionImpl;
import net.dv8tion.jda.internal.requests.restaction.pagination.PaginationActionImpl;
import net.dv8tion.jda.internal.utils.*;
import net.dv8tion.jda.internal.utils.cache.AbstractCacheView;
import net.dv8tion.jda.internal.utils.cache.MemberCacheViewImpl;
Expand Down Expand Up @@ -303,6 +300,7 @@ public RestAction<List<CommandPrivilege>> updateCommandPrivilegesById(@Nonnull S

@Nonnull
@Override
@SuppressWarnings("deprecation")
public RestAction<Map<String, List<CommandPrivilege>>> updateCommandPrivileges(@Nonnull Map<String, ? extends Collection<CommandPrivilege>> privileges)
{
Checks.notNull(privileges, "Privileges");
Expand Down
Expand Up @@ -38,7 +38,6 @@ public class StageInstanceImpl implements StageInstance

private String topic;
private PrivacyLevel privacyLevel;
private boolean discoverable;

public StageInstanceImpl(long id, StageChannel channel)
{
Expand Down Expand Up @@ -83,12 +82,6 @@ public PrivacyLevel getPrivacyLevel()
return privacyLevel;
}

@Override
public boolean isDiscoverable()
{
return discoverable;
}

@Nonnull
@Override
public RestAction<Void> delete()
Expand Down Expand Up @@ -120,12 +113,6 @@ public StageInstanceImpl setPrivacyLevel(PrivacyLevel privacyLevel)
return this;
}

public StageInstanceImpl setDiscoverable(boolean discoverable)
{
this.discoverable = discoverable;
return this;
}

private void checkPermissions()
{
EnumSet<Permission> permissions = getGuild().getSelfMember().getPermissions(getChannel());
Expand Down
Expand Up @@ -50,6 +50,7 @@ public class Requester
public static final Logger LOG = JDALogger.getLog(Requester.class);
public static final String DISCORD_API_PREFIX = Helpers.format("https://discord.com/api/v%d/", JDAInfo.DISCORD_REST_VERSION);
public static final String USER_AGENT = "DiscordBot (" + JDAInfo.GITHUB + ", " + JDAInfo.VERSION + ")";
@SuppressWarnings("deprecation")
public static final RequestBody EMPTY_BODY = RequestBody.create(null, new byte[0]);
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
public static final MediaType MEDIA_TYPE_OCTET = MediaType.parse("application/octet-stream; charset=utf-8");
Expand Down
Expand Up @@ -131,6 +131,7 @@ public RestActionImpl(JDA api, Route.CompiledRoute route, BiFunction<Response, R
this(api, route, (RequestBody) null, handler);
}

@SuppressWarnings("deprecation")
public RestActionImpl(JDA api, Route.CompiledRoute route, DataObject data, BiFunction<Response, Request<T>, T> handler)
{
this(api, route, data == null ? null : RequestBody.create(Requester.MEDIA_TYPE_JSON, data.toJson()), handler);
Expand Down Expand Up @@ -241,13 +242,15 @@ public T complete(boolean shouldQueue) throws RateLimitedException
protected CaseInsensitiveMap<String, String> finalizeHeaders() { return null; }
protected BooleanSupplier finalizeChecks() { return null; }

@SuppressWarnings("deprecation")
protected RequestBody getRequestBody(DataObject object)
{
this.rawData = object;

return object == null ? null : RequestBody.create(Requester.MEDIA_TYPE_JSON, object.toJson());
}

@SuppressWarnings("deprecation")
protected RequestBody getRequestBody(DataArray array)
{
this.rawData = array;
Expand Down
Expand Up @@ -500,6 +500,7 @@ protected RequestBody asMultipart()
return builder.build();
}

@SuppressWarnings("deprecation")
protected RequestBody asJSON()
{
return RequestBody.create(Requester.MEDIA_TYPE_JSON, getJSON().toJson());
Expand Down

0 comments on commit 7452efb

Please sign in to comment.