From 73897e407bed20073767c8993e89522d9f20bb28 Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 2 Jun 2017 03:41:06 +0200 Subject: [PATCH] Add fix for new game lobbies --- .../src/mineplex/core/bonuses/BonusManager.java | 5 +++++ .../src/mineplex/core/quests/QuestManager.java | 7 ++++++- .../Mineplex.Hub/src/mineplex/hub/HubManager.java | 2 +- .../src/nautilus/game/arcade/ArcadeManager.java | 2 +- .../game/arcade/managers/lobby/LobbyManager.java | 13 ++++++++++++- .../lobby/current/NewGameLobbyManager.java | 15 +++++++++++++-- .../lobby/legacy/LegacyGameLobbyManager.java | 2 +- 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 06f1d69b4..f135c63e7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -1261,4 +1261,9 @@ public class BonusManager extends MiniClientPlugin implements I { _carlLocation = carlLocation; } + + public Npc getCarl() + { + return _carlNpc; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/quests/QuestManager.java b/Plugins/Mineplex.Core/src/mineplex/core/quests/QuestManager.java index 63261a122..26741b195 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/quests/QuestManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/quests/QuestManager.java @@ -11,6 +11,7 @@ import java.util.function.Consumer; import net.md_5.bungee.api.ChatColor; import org.apache.commons.lang3.tuple.Triple; +import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Slime; @@ -78,7 +79,7 @@ public class QuestManager extends MiniClientPlugin private HologramManager _hologramManager; private boolean _visualTick; - public QuestManager(HologramManager hologramManager, InventoryManager inventoryManager, DonationManager donationManager) + public QuestManager(HologramManager hologramManager, Location npc, InventoryManager inventoryManager, DonationManager donationManager) { super("Quest Manager"); @@ -101,6 +102,10 @@ public class QuestManager extends MiniClientPlugin { Slime slime = (Slime) _questNPC.getEntity(); slime.setSize(3); + if (npc != null) + { + _questNPC.setLocation(npc); + } _enableNPC = true; } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 5109551d0..070cd582a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -294,7 +294,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess new EasterEggHunt(plugin, _clientManager); - _questManager = new QuestManager(hologramManager, _inventoryManager, _donationManager); + _questManager = new QuestManager(hologramManager, null, _inventoryManager, _donationManager); new TemporaryGemHuntersServerSender(_portal); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index a79a7a7bb..7a0616ff1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -391,7 +391,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _kitProgressionManager = new KitProgressionManager(getPlugin(), donationManager, clientManager); _progressionKitManager = new ProgressingKitManager(this); _serverUptimeManager = new ServerUptimeManager(this); - _questManager = new QuestManager(hologramManager, _inventoryManager, _donationManager); + _questManager = new QuestManager(hologramManager, _gameLobbyManager.getMissions(), _inventoryManager, _donationManager); if (GetHost() != null && !GetHost().isEmpty() && !GetHost().startsWith("COM-")) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java index 72f1dc35f..3b9d09168 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/LobbyManager.java @@ -83,12 +83,13 @@ public abstract class LobbyManager implements Listener private Location _kitText; private Location _teamText; private Location _carl; + private Location _missions; private Location _spawn; private Location _ampStand; private boolean _colorTick = false; private boolean _generatePodiums = false; - public LobbyManager(ArcadeManager manager, Location carl, Location spawn, Location ampStand) + public LobbyManager(ArcadeManager manager, Location missions, Location carl, Location spawn, Location ampStand) { _manager = manager; @@ -892,4 +893,14 @@ public abstract class LobbyManager implements Listener { return _generatePodiums; } + + public Location getMissions() + { + return _missions; + } + + public void setMissions(Location loc) + { + _missions = loc; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java index 11b970117..e813e21bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/current/NewGameLobbyManager.java @@ -58,6 +58,7 @@ public class NewGameLobbyManager extends LobbyManager public enum DataLoc { CARL, + MISSIONS, AMP, SPAWN,; } @@ -70,7 +71,7 @@ public class NewGameLobbyManager extends LobbyManager public NewGameLobbyManager(ArcadeManager manager) { - super(manager, null, null, null); + super(manager, null, null, null, null); _run = CONFIG.exists(); if (_run) @@ -519,7 +520,7 @@ public class NewGameLobbyManager extends LobbyManager continue; } - if (!lastName.equalsIgnoreCase("SPAWN") || lastName.equalsIgnoreCase("CARL")) + if (!lastName.equalsIgnoreCase("SPAWN") || lastName.equalsIgnoreCase("CARL") || lastName.equalsIgnoreCase("MISSIONS")) { loc.subtract(0, 0.5, 0); } @@ -557,6 +558,16 @@ public class NewGameLobbyManager extends LobbyManager setCarl(carl); } + + Location missions = _singleLocs.get(DataLoc.MISSIONS.name()); + if (missions != null) + { + missions.add(0, 0.5, 0); + float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(missions, getSpawn())); + missions.setYaw(yaw); + + setMissions(missions); + } Location amp = _singleLocs.get(DataLoc.AMP.name()); if (amp != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java index 2d988d0d5..9b275c0bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/lobby/legacy/LegacyGameLobbyManager.java @@ -39,7 +39,7 @@ public class LegacyGameLobbyManager extends LobbyManager public LegacyGameLobbyManager(ArcadeManager manager) { - super(manager, null, null, new Location(UtilWorld.getWorld("world"), 0, 102.5, -15)); + super(manager, null, null, null, new Location(UtilWorld.getWorld("world"), 0, 102.5, -15)); setSpawn(new Location(WORLD, 0, 104, 0, 0, 0));