Commit 697e4bf2 by Jonathan Thomas

Updated discord.gg links in error messages with discord.creaturechat.com. Output…

Updated discord.gg links in error messages with discord.creaturechat.com. Output clickable error message to chat (for ease of use) to player that got error.
parent 86505e4f
Pipeline #12077 passed with stage
in 24 seconds
......@@ -319,6 +319,11 @@ public class ChatDataManager {
String randomErrorMessage = Randomizer.getRandomMessage(Randomizer.RandomType.ERROR);
this.addMessage(randomErrorMessage, ChatSender.ASSISTANT, player.getUuidAsString());
// Send clickable error message
ServerPackets.SendClickableError(player,
"Help is available at discord.creaturechat.com",
"http://discord.creaturechat.com");
// Clear history (if no character sheet was generated)
if (characterSheet.isEmpty()) {
previousMessages.clear();
......
......@@ -21,13 +21,15 @@ import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
......@@ -313,4 +315,14 @@ public class ServerPackets {
ServerPlayNetworking.send(serverPlayer, PACKET_S2C_PLAYER_STATUS, buffer);
}
}
// Send a chat message to a player which is clickable (for error messages with a link for help)
public static void SendClickableError(PlayerEntity player, String message, String url) {
MutableText text = Text.literal(message)
.formatted(Formatting.BLUE)
.styled(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))
.withUnderline(true));
player.sendMessage(text, false);
}
}
......@@ -41,26 +41,26 @@ public class Randomizer {
"<plays with a nonexistent pet>"
);
private static List<String> errorResponseMessages = Arrays.asList(
"Seems like my words got lost in the End. Check out https://discord.gg/m9dvPFmN3e for clues!",
"Oops! My speech bubble popped. Need help? Visit https://discord.gg/m9dvPFmN3e.",
"I might've eaten a bad Command Block. Help me out at https://discord.gg/m9dvPFmN3e!",
"My words are on strike. More info? https://discord.gg/m9dvPFmN3e.",
"I think a Creeper blew up my script. Instructions? https://discord.gg/m9dvPFmN3e.",
"BRB, asking a villager for directions to https://discord.gg/m9dvPFmN3e.",
"It’s not you, it’s my API key. Let's regroup at https://discord.gg/m9dvPFmN3e.",
"I tried to speak, but it was a critical miss. Help at https://discord.gg/m9dvPFmN3e.",
"Words are hard. Come chat at https://discord.gg/m9dvPFmN3e.",
"I must've left my responses in my other pants. See https://discord.gg/m9dvPFmN3e.",
"Shh... I’m hiding from an invalid API key. Join the hunt at https://discord.gg/m9dvPFmN3e.",
"I’d tell you, but then I’d have to respawn. Meet me at https://discord.gg/m9dvPFmN3e.",
"Error 404: Response not found. Maybe it’s at https://discord.gg/m9dvPFmN3e?",
"I'm speechless, literally. Let's troubleshoot at https://discord.gg/m9dvPFmN3e.",
"Looks like my connection got lost in the Nether. Can you help? https://discord.gg/m9dvPFmN3e.",
"I forgot what I was saying, but https://discord.gg/m9dvPFmN3e remembers.",
"Are my words mining without a pickaxe? Dig up some help at https://discord.gg/m9dvPFmN3e.",
"Sorry, my parrot ate the response. Teach it better at https://discord.gg/m9dvPFmN3e.",
"My magic mirror says: 'Better answers found at https://discord.gg/m9dvPFmN3e.'",
"This message is temporarily out of order. Order yours at https://discord.gg/m9dvPFmN3e."
"Seems like my words got lost in the End. Check out http://discord.creaturechat.com for clues!",
"Oops! My speech bubble popped. Need help? Visit http://discord.creaturechat.com",
"I might've eaten a bad Command Block. Help me out at http://discord.creaturechat.com!",
"My words are on strike. More info? http://discord.creaturechat.com",
"I think a Creeper blew up my script. Instructions? http://discord.creaturechat.com",
"BRB, asking a villager for directions to http://discord.creaturechat.com",
"It’s not you, it’s my API key. Let's regroup at http://discord.creaturechat.com",
"I tried to speak, but it was a critical miss. Help at http://discord.creaturechat.com",
"Words are hard. Come chat at http://discord.creaturechat.com",
"I must've left my responses in my other pants. See http://discord.creaturechat.com",
"Shh... I’m hiding from an invalid API key. Join the hunt at http://discord.creaturechat.com",
"I’d tell you, but then I’d have to respawn. Meet me at http://discord.creaturechat.com",
"Error 404: Response not found. Maybe it’s at http://discord.creaturechat.com?",
"I'm speechless, literally. Let's troubleshoot at http://discord.creaturechat.com",
"Looks like my connection got lost in the Nether. Can you help? http://discord.creaturechat.com",
"I forgot what I was saying, but http://discord.creaturechat.com remembers.",
"Are my words mining without a pickaxe? Dig up some help at http://discord.creaturechat.com",
"Sorry, my parrot ate the response. Teach it better at http://discord.creaturechat.com",
"My magic mirror says: 'Better answers found at http://discord.creaturechat.com'",
"This message is temporarily out of order. Order yours at http://discord.creaturechat.com"
);
private static List<String> characterAdjectives = Arrays.asList(
"mystical", "fiery", "ancient", "cursed", "ethereal",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment