diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index eef7b3de..e4ad39d4 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -583,6 +583,11 @@ CHAT_MSG_SENDER = §e{0} CHAT_MSG_SEPARATOR = §8» CHAT_MSG_RECEIVER = §e{0} CHAT_MSG = §7{0} +CHAT_MSG_SELF_1 = I know. +CHAT_MSG_SELF_2 = Who are you telling? +CHAT_MSG_SELF_3 = Interesting. Tell me more. +CHAT_MSG_SELF_4 = Shh, the others can hear us! +CHAT_MSG_SELF_5 = Finally someone who understands me. CHAT_SPECIAL_ALERT = §e{0}§8»§e{1} §7{2} CHAT_FIGHT_PARTICIPANT_SENDER = {0}{1} CHAT_FIGHT_PARTICIPANT = §8» §7{0} diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index d64f4919..ffb5ce7a 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -548,6 +548,11 @@ CHAT_MSG_SENDER = §e{0} CHAT_MSG_SEPARATOR = §8» CHAT_MSG_RECEIVER = §e{0} CHAT_MSG = §7{0} +CHAT_MSG_SELF_1 = Ich weiß. +CHAT_MSG_SELF_2 = Wem erzählst du das? +CHAT_MSG_SELF_3 = Interessant. Erzähl mir mehr. +CHAT_MSG_SELF_4 = Psst, die anderen hören uns! +CHAT_MSG_SELF_5 = Endlich jemand, der mich versteht. CHAT_SPECIAL_ALERT = §e{0}§8»§e{1} §7{2} CHAT_FIGHT_PARTICIPANT_SENDER = {0}{1} CHAT_FIGHT_PARTICIPANT = §8» §7{0} diff --git a/VelocityCore/src/de/steamwar/velocitycore/chat/DirectChannel.java b/VelocityCore/src/de/steamwar/velocitycore/chat/DirectChannel.java index 5f31e756..20d3584b 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/chat/DirectChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/chat/DirectChannel.java @@ -30,6 +30,8 @@ import de.steamwar.velocitycore.VelocityCore; import net.kyori.adventure.text.Component; import java.util.UUID; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import static de.steamwar.persistent.Storage.lastChats; @@ -39,6 +41,8 @@ import static de.steamwar.persistent.Storage.lastChats; */ public class DirectChannel extends ChatChannel { + private static final int SELF_ANSWERS = 5; + private final UUID first; private final UUID second; @@ -118,6 +122,17 @@ public class DirectChannel extends ChatChannel { lastChats.put(senderPlayer, partnerPlayer); lastChats.put(partnerPlayer, senderPlayer); } + + if (first.equals(second)) { + // Easter egg: messaging yourself gets an answer from your other self instead of "nobody receives your message" + Message answer = new Message("CHAT_MSG_SELF_" + (ThreadLocalRandom.current().nextInt(SELF_ANSWERS) + 1)); + VelocityCore.schedule(() -> sender.sendMessage(Component.text() + .append(iconComponent(sender, iconColor())) + .append(Component.text(" ")) + .append(format(sender, sender, sender.parseToLegacy(answer))) + .build())).delay(10, TimeUnit.SECONDS).schedule(); + return true; + } return false; }