Skip to content

Commit 479b7bf

Browse files
committed
Added error message when a player tries to access pager page that doesn't exist
1 parent 331db6f commit 479b7bf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77

88
group = 'com.datdeveloper'
9-
version = "${minecraftVersion}-1.4.0"
9+
version = "${minecraftVersion}-1.4.1"
1010

1111
java {
1212
archivesBaseName = 'datmoddingapi'

src/main/java/com/datdeveloper/datmoddingapi/command/util/Pager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.minecraft.ChatFormatting;
55
import net.minecraft.commands.CommandSource;
66
import net.minecraft.network.chat.*;
7+
import org.checkerframework.checker.units.qual.C;
78
import org.jetbrains.annotations.NotNull;
89
import org.jetbrains.annotations.Nullable;
910

@@ -197,7 +198,10 @@ protected Component getFooter(final int page) {
197198
* @param source The command source to send the page to
198199
*/
199200
public void sendPage(final int page, final CommandSource source) {
200-
if (page > getTotalPageCount()) return;
201+
if (page > getTotalPageCount()) {
202+
source.sendSystemMessage(Component.literal(DatChatFormatting.TextColour.ERROR + "There aren't that many pages"));
203+
return;
204+
}
201205

202206
final MutableComponent component = MutableComponent.create(ComponentContents.EMPTY);
203207
if (headerText != null) {

0 commit comments

Comments
 (0)