diff --git a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java
index d6cec3afef..735bdd0bdd 100644
--- a/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java
+++ b/src/main/java/net/dv8tion/jda/api/entities/MessageChannel.java
@@ -86,18 +86,14 @@ public interface MessageChannel extends Channel, Formattable
/**
* The id for the most recent message sent
* in this current MessageChannel.
- *
This should only be used if {@link #hasLatestMessage()} returns {@code true}!
*
*
This value is updated on each {@link net.dv8tion.jda.api.events.message.MessageReceivedEvent MessageReceivedEvent}
- * and will be reset to {@code null} if the message associated with this ID gets deleted
- *
- * @throws java.lang.IllegalStateException
- * If no message id is available
+ * and the value might point to an already deleted message since the ID is not cleared when the message is deleted,
+ * so calling {@link #retrieveMessageById(long)} with this id can result in an {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} error
*
* @return The most recent message's id
*/
@Nonnull
- //TODO-v5: Revisit this. Surely this should be Nullable instead of throw an exception...
default String getLatestMessageId()
{
return Long.toUnsignedString(getLatestMessageIdLong());
@@ -106,36 +102,15 @@ default String getLatestMessageId()
/**
* The id for the most recent message sent
* in this current MessageChannel.
- *
This should only be used if {@link #hasLatestMessage()} returns {@code true}!
*
*
This value is updated on each {@link net.dv8tion.jda.api.events.message.MessageReceivedEvent MessageReceivedEvent} - * and will be reset to {@code null} if the message associated with this ID gets deleted - * - * @throws java.lang.IllegalStateException - * If no message id is available + * and the value might point to an already deleted message since the value is not cleared when the message is deleted, + * so calling {@link #retrieveMessageById(long)} with this id can result in an {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} error * * @return The most recent message's id */ long getLatestMessageIdLong(); - /** - * Whether this MessageChannel contains a tracked most recent - * message or not. - * - *
This does not directly mean that {@link #getHistory()} will be unable to retrieve past messages,
- * it merely means that the latest message is untracked by our internal cache meaning that
- * if this returns {@code false} the {@link #getLatestMessageId()}
- * method will throw an {@link java.util.NoSuchElementException NoSuchElementException}
- *
- * @return True, if a latest message id is available for retrieval by {@link #getLatestMessageId()}
- *
- * @see #getLatestMessageId()
- */
- default boolean hasLatestMessage()
- {
- return getLatestMessageIdLong() != 0;
- }
-
/**
* Whether the currently logged in user can send messages in this channel or not.
*
For {@link GuildMessageChannel} this method checks for
diff --git a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java
index 5e611c3e76..4b8748a397 100644
--- a/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java
+++ b/src/main/java/net/dv8tion/jda/internal/handle/MessageDeleteHandler.java
@@ -58,12 +58,6 @@ protected Long handleInternally(DataObject content)
return null;
}
- // Reset the latest message id as it was deleted.
- if (channel.hasLatestMessage() & messageId == channel.getLatestMessageIdLong())
- {
- ((MessageChannelMixin>) channel).setLatestMessageIdLong(0);
- }
-
if (channel.getType().isThread())
{
ThreadChannelImpl gThread = (ThreadChannelImpl) channel;