From c2df5bf31ebd3270c9f41ae4c0203280f5ae60e1 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 19 Jun 2022 16:32:05 +0200 Subject: [PATCH 1/4] Potential Fix --- src/de/steamwar/lobby/LobbyPacketHandler.java | 15 +++++--- src/de/steamwar/lobby/LobbySystem.java | 3 +- src/de/steamwar/lobby/WaitingHall.java | 38 ------------------- 3 files changed, 11 insertions(+), 45 deletions(-) delete mode 100644 src/de/steamwar/lobby/WaitingHall.java diff --git a/src/de/steamwar/lobby/LobbyPacketHandler.java b/src/de/steamwar/lobby/LobbyPacketHandler.java index ccd5ef8..8edd985 100644 --- a/src/de/steamwar/lobby/LobbyPacketHandler.java +++ b/src/de/steamwar/lobby/LobbyPacketHandler.java @@ -21,17 +21,22 @@ package de.steamwar.lobby; import de.steamwar.network.packets.PacketHandler; import de.steamwar.network.packets.common.FightInfoPacket; +import de.steamwar.network.packets.server.StartingServerPacket; +import de.steamwar.sql.SteamwarUser; +import org.bukkit.Bukkit; +import org.bukkit.event.player.PlayerTeleportEvent; + +import java.util.Objects; public class LobbyPacketHandler extends PacketHandler { - public LobbyPacketHandler() { - super(); - this.register(); - } - @Handler public void handleFightserver(FightInfoPacket packet) { Fightserver.newFightInfo(packet); } + @Handler + private void serverStarting(StartingServerPacket in) { + Objects.requireNonNull(Bukkit.getPlayer(SteamwarUser.get(in.getUser()).getUUID())).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); + } } diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index e22339c..f71bf2b 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -45,7 +45,6 @@ public class LobbySystem extends JavaPlugin { message = new Message("de.steamwar.lobby.LobbySystem", getClassLoader()); Fightserver.init(); - new WaitingHall(); new Portals(); new PortalCommand(); new HologramCommand(); @@ -68,7 +67,7 @@ public class LobbySystem extends JavaPlugin { new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X); new AlphaWall(l -> l.getZ() > 892, AlphaWall.REFLECT_Z); new AlphaWall(l -> l.getZ() < 1794, AlphaWall.REFLECT_Z); - new LobbyPacketHandler(); + new LobbyPacketHandler().register(); } @Override diff --git a/src/de/steamwar/lobby/WaitingHall.java b/src/de/steamwar/lobby/WaitingHall.java deleted file mode 100644 index ea97117..0000000 --- a/src/de/steamwar/lobby/WaitingHall.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2022 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.lobby; - -import de.steamwar.network.packets.PacketHandler; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.network.packets.server.StartingServerPacket; -import org.bukkit.Bukkit; -import org.bukkit.event.player.PlayerTeleportEvent; - -public class WaitingHall extends PacketHandler { - public WaitingHall() { - super(); - this.register(); - } - - @Handler - private void serverStarting(StartingServerPacket in) { - Bukkit.getPlayer(SteamwarUser.get(in.getUser()).getUUID()).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); - } -} From 4f721595df173a68b93890180274e181139572e6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 22 Jun 2022 22:33:17 +0200 Subject: [PATCH 2/4] AAAAAAAAAAAAAAAAAAAAAAAAA --- src/de/steamwar/lobby/LobbyPacketHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/lobby/LobbyPacketHandler.java b/src/de/steamwar/lobby/LobbyPacketHandler.java index 8edd985..0d7bbcc 100644 --- a/src/de/steamwar/lobby/LobbyPacketHandler.java +++ b/src/de/steamwar/lobby/LobbyPacketHandler.java @@ -36,7 +36,7 @@ public class LobbyPacketHandler extends PacketHandler { } @Handler - private void serverStarting(StartingServerPacket in) { - Objects.requireNonNull(Bukkit.getPlayer(SteamwarUser.get(in.getUser()).getUUID())).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); + public void serverStarting(StartingServerPacket packet) { + Objects.requireNonNull(Bukkit.getPlayer(SteamwarUser.get(packet.getUser()).getUUID())).teleport(LobbySystem.config().getWaitingHallSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); } } From dbeb55662930b21e62215088ad49a48f5a200095 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 23 Jun 2022 17:02:42 +0200 Subject: [PATCH 3/4] Fix packet direction --- src/de/steamwar/lobby/listener/PlayerSpawn.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/listener/PlayerSpawn.java b/src/de/steamwar/lobby/listener/PlayerSpawn.java index 2a5c058..29ff64e 100644 --- a/src/de/steamwar/lobby/listener/PlayerSpawn.java +++ b/src/de/steamwar/lobby/listener/PlayerSpawn.java @@ -58,7 +58,7 @@ public class PlayerSpawn extends BasicListener { player.setFoodLevel(20); giveItems(player); - Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> NetworkSender.send(new ImALobbyPacket()), 20); + Bukkit.getScheduler().runTaskLater(LobbySystem.getPlugin(), () -> NetworkSender.send(new ImALobbyPacket(), player), 20); } private void giveItems(Player player) { From d8dbc1900b66e3fa7d9522122e87936dbf302221 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 22 Aug 2022 19:28:31 +0200 Subject: [PATCH 4/4] Auto hologram coloring --- src/de/steamwar/lobby/command/HologramCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/command/HologramCommand.java b/src/de/steamwar/lobby/command/HologramCommand.java index 4d101dc..bfcc6b7 100644 --- a/src/de/steamwar/lobby/command/HologramCommand.java +++ b/src/de/steamwar/lobby/command/HologramCommand.java @@ -43,7 +43,7 @@ public class HologramCommand extends SWCommand { public void portalCreate(Player player, String id, String... text) { if (PortalCommand.noPermissions(player)) return; - new Hologram(id, player.getLocation(), String.join(" ", text), false); + new Hologram(id, player.getLocation(), String.join(" ", text).replace("&", "ยง"), false); LobbySystem.config().save(); }