From 1799b1b91a05ec9b5e03d80379f212fa8c7a90dd Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 20 Dec 2020 13:58:56 +0100 Subject: [PATCH] Hotfix /challenge Bug --- src/de/steamwar/misslewars/MissileWars.java | 4 ++++ src/de/steamwar/misslewars/listener/JoinListener.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/de/steamwar/misslewars/MissileWars.java b/src/de/steamwar/misslewars/MissileWars.java index b5571b6..a4f67d2 100644 --- a/src/de/steamwar/misslewars/MissileWars.java +++ b/src/de/steamwar/misslewars/MissileWars.java @@ -162,6 +162,10 @@ public class MissileWars extends JavaPlugin { } } + public static void spectateJoin(Player p) { + p.teleport(MissileWars.getRedTeam().getSpawn().toVector().midpoint(MissileWars.getBlueTeam().getSpawn().toVector()).toLocation(p.getWorld())); + } + public static void leave(Player p) { MissileWars.getBlueTeam().leave(p); MissileWars.getRedTeam().leave(p); diff --git a/src/de/steamwar/misslewars/listener/JoinListener.java b/src/de/steamwar/misslewars/listener/JoinListener.java index 4e8bf44..96a5b53 100644 --- a/src/de/steamwar/misslewars/listener/JoinListener.java +++ b/src/de/steamwar/misslewars/listener/JoinListener.java @@ -42,6 +42,8 @@ public class JoinListener extends BasicListener { MissileWars.getRedTeam().join(e.getPlayer()); } else if (Config.BlueLeader.equals(e.getPlayer().getUniqueId())) { MissileWars.getBlueTeam().join(e.getPlayer()); + } else { + MissileWars.spectateJoin(e.getPlayer()); } return; }