From 4c8c0ed4e3fdb69a531fe2d58059929bb482f42e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 21 Oct 2019 21:17:11 +0200 Subject: [PATCH] Easter Egg: LIXFEL in chat --- .../bungeecore/listeners/ChatListener.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 6caf92e..65fc95c 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -4,21 +4,27 @@ import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.commands.BauCommand; -import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.bungeecore.sql.Team; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.Title; +import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.TabCompleteEvent; import net.md_5.bungee.api.event.TabCompleteResponseEvent; +import net.md_5.bungee.api.scheduler.TaskScheduler; import net.md_5.bungee.event.EventHandler; import java.util.List; +import java.util.concurrent.TimeUnit; public class ChatListener extends BasicListener { + private static Title LIXFEL = ProxyServer.getInstance().createTitle().fadeIn(5).fadeOut(20).stay(30).title(TextComponent.fromLegacyText("§4§lLIXFEL")); + @EventHandler public void onChatEvent(ChatEvent e){ if(e.getMessage().startsWith("/")) @@ -42,9 +48,25 @@ public class ChatListener extends BasicListener { } } + private void lixfelAlert(ProxiedPlayer sender){ + ProxyServer.getInstance().getPlayers().forEach(p -> LIXFEL.send(p)); + final String l = "§8Lixfel»" + sender.getName() + " §c"; + BungeeCore.send(sender, ChatMessageType.ACTION_BAR, "§4§lTechnische Probleme?"); + TaskScheduler scheduler = ProxyServer.getInstance().getScheduler(); + scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Du hast mich gerufen!"), 3, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Leider bin ich nur ein Mensch und höre nicht alles."), 6, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Daher bitte ich dich, das Problem bzw. den Fehler im Forum in der Kategorie §eFehler melden §cmit einer ausreichenden Beschreibung zu hinterlegen."), 11, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Vielen Dank."), 12, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis."), 15, TimeUnit.SECONDS); + } + private void onChat(ChatEvent e){ if(e.getSender() instanceof ProxiedPlayer){ ProxiedPlayer sender = (ProxiedPlayer) e.getSender(); + + if(e.getMessage().contains("LIXFEL")) + lixfelAlert(sender); + if(sender.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){ BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen!"); e.setCancelled(true);