From 03cdffc2740b80509543057caaca996c2a378162 Mon Sep 17 00:00:00 2001 From: samolego <34912839+samolego@users.noreply.github.com> Date: Fri, 22 Jul 2022 12:39:32 +0200 Subject: [PATCH] Fixes empty group disconnect --- .../main/java/org/samo_lego/taterzens/npc/TaterzenNPC.java | 2 +- .../org/samo_lego/taterzens/npc/commands/CommandGroups.java | 4 ++++ gradle.properties | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/samo_lego/taterzens/npc/TaterzenNPC.java b/common/src/main/java/org/samo_lego/taterzens/npc/TaterzenNPC.java index 86150fe6d..d9be9b650 100644 --- a/common/src/main/java/org/samo_lego/taterzens/npc/TaterzenNPC.java +++ b/common/src/main/java/org/samo_lego/taterzens/npc/TaterzenNPC.java @@ -1188,7 +1188,7 @@ public boolean shouldDropExperience() { * @param text message to add */ public void addMessage(Component text) { - this.npcData.messages.add(new Pair<>(text, config.messages.messageDelay)); + this.addMessage(text, config.messages.messageDelay); } /** diff --git a/common/src/main/java/org/samo_lego/taterzens/npc/commands/CommandGroups.java b/common/src/main/java/org/samo_lego/taterzens/npc/commands/CommandGroups.java index f90b0eafd..fbc25938f 100644 --- a/common/src/main/java/org/samo_lego/taterzens/npc/commands/CommandGroups.java +++ b/common/src/main/java/org/samo_lego/taterzens/npc/commands/CommandGroups.java @@ -31,6 +31,10 @@ public void clear() { } public void execute(ServerPlayer player) { + if (this.isEmpty()) { + return; + } + if (this.groupIndex >= this.size()) { this.groupIndex = 0; } diff --git a/gradle.properties b/gradle.properties index 650b3ec06..a9d978222 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ fabric_version=0.56.0+1.19 forge_version=41.0.1 enable_forge=true # Mod Properties -mod_version=1.10.4 +mod_version=1.10.5 maven_group=org.samo_lego archives_base_name=taterzens # Dependencies