diff --git a/VelocityCore/Persistent/src/de/steamwar/persistent/Storage.java b/VelocityCore/Persistent/src/de/steamwar/persistent/Storage.java index a32a577d..9128d5a5 100644 --- a/VelocityCore/Persistent/src/de/steamwar/persistent/Storage.java +++ b/VelocityCore/Persistent/src/de/steamwar/persistent/Storage.java @@ -25,10 +25,7 @@ import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket; import lombok.experimental.UtilityClass; import java.sql.Timestamp; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; @UtilityClass public class Storage { @@ -49,4 +46,6 @@ public class Storage { public static final Map teamServers = new HashMap<>(); // TeamID -> ServerInfo map public static final Map> directTabItems = new HashMap<>(); + + public static final Set streamingPlayers = new HashSet<>(); // SteamwarUser ID } diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index e1da5e7a..21a4025a 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -589,6 +589,7 @@ CHECK_CHECKING=§cYou are checking a Schematic! JOIN_ARENA=§7Click §ehere§7 to join §e{0} JOIN_ARENA_HOVER=§eJoin Arena JOIN_FIRST=§7Please greet §e{0}§7 on the server§8! +JOIN_STREAMING=§5Streaming Mode§7 is still active§8.§7 Keep in mind that you will not receive TeamChat nor ServerTeamChat messages§8. #EventModeListener EVENTMODE_KICK=§cYou are not an event participant. diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index f5d84d2e..aa2475f5 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -563,6 +563,7 @@ CHECK_CHECKING=§cDu prüfst gerade eine Schematic! JOIN_ARENA=§7Klicke §ehier§7, um §e{0} §7beizutreten JOIN_ARENA_HOVER=§eArena beitreten JOIN_FIRST=§7Begrüßt alle mal §e{0} §7auf dem Server§8! +JOIN_STREAMING=§5Streaming-Modus§7 ist weiterhin aktiv§8.§7 Beachten Sie, dass Sie keine TeamChat- oder ServerTeamChat-Nachrichten erhalten§8. #EventModeListener EVENTMODE_KICK=§cDu bist kein Eventteilnehmer. diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/StreamingCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/StreamingCommand.java index 1e50ecd3..edab1c5b 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/StreamingCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/StreamingCommand.java @@ -21,22 +21,18 @@ package de.steamwar.velocitycore.commands; import de.steamwar.command.SWCommand; import de.steamwar.messages.Chatter; +import de.steamwar.persistent.Storage; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserPerm; -import java.util.HashSet; -import java.util.Set; - public class StreamingCommand extends SWCommand { - private static final Set streaming = new HashSet<>(); - public static boolean isNotStreaming(Chatter sender) { return isNotStreaming(sender.user()); } public static boolean isNotStreaming(SteamwarUser user) { - return !streaming.contains(user.getId()); + return !Storage.streamingPlayers.contains(user.getId()); } public StreamingCommand() { @@ -46,11 +42,11 @@ public class StreamingCommand extends SWCommand { @Register public void toggleStreamingMode(Chatter sender) { int userId = sender.user().getId(); - if (streaming.contains(userId)) { - streaming.remove(userId); + if (Storage.streamingPlayers.contains(userId)) { + Storage.streamingPlayers.remove(userId); sender.system("STREAMING_DISABLE"); } else { - streaming.add(userId); + Storage.streamingPlayers.add(userId); sender.system("STREAMING_ENABLE"); } } diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java index 1806a8cb..f0a7be00 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java @@ -316,9 +316,10 @@ public class TeamCommand extends SWCommand { StringBuilder st = new StringBuilder(); if (VelocityCore.getProxy().getPlayer(user.getUUID()).isPresent()) { if (!StreamingCommand.isNotStreaming(user)) { - st.append("§5● "); + st.append("§5"); + } else { + st.append("§a"); } - st.append("§a"); } else { st.append("§e"); } diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java index d534b29a..765d09c7 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java +++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/ConnectionListener.java @@ -34,7 +34,6 @@ import de.steamwar.sql.CheckedSchematic; import de.steamwar.sql.SchematicType; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserPerm; -import de.steamwar.velocitycore.EventStarter; import de.steamwar.velocitycore.commands.*; import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.discord.util.DiscordRanks; @@ -45,7 +44,6 @@ import net.kyori.adventure.text.event.ClickEvent; import java.util.HashSet; import java.util.Set; import java.util.UUID; -import java.util.function.BiConsumer; public class ConnectionListener extends BasicListener { @@ -105,6 +103,10 @@ public class ConnectionListener extends BasicListener { newPlayers.remove(player.getUniqueId()); } + if (!StreamingCommand.isNotStreaming(user)) { + chatter.system("JOIN_STREAMING"); + } + DiscordBot.withBot(bot -> DiscordRanks.update(user)); if (player.getProtocolVersion().noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {