forked from SteamWar/SteamWar
Answer private messages to yourself with an easter egg
Messaging yourself gets a random answer from your other self after ten seconds, formatted like a normal private message, instead of "nobody receives your message".
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user