diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java index c886dd1e9..15bf9b6e0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/Tutorial.java @@ -251,7 +251,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener public TutorialRegion getRegion(Player player) { - if(player == null || _playerSessionMap == null || _playerSessionMap.get(player) == null) return null; + if(player == null || !player.isOnline() || _playerSessionMap == null || _playerSessionMap.get(player) == null) return null; return _playerSessionMap.get(player).getRegion(); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java index 40ed11d39..36f92a3ef 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/ObjectiveGoal.java @@ -76,7 +76,7 @@ public abstract class ObjectiveGoal > implements Liste public boolean contains(Player player) { - if (player == null) + if (player == null || !player.isOnline()) { return false; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java index 43d037bf3..d62b0b366 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/ClansMainTutorial.java @@ -3,6 +3,7 @@ package mineplex.game.clans.tutorial.tutorials.clans; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.UUID; import mineplex.core.common.util.*; @@ -181,11 +182,12 @@ public class ClansMainTutorial extends Tutorial public boolean isIn(Player player, Bounds bounds) { - if(player == null) return false; + if(player == null || !player.isOnline()) return false; TutorialRegion region = getRegion(player); if (region != null) { + if (player.getLocation() == null) return false; return isIn(player.getLocation(), region, bounds); } @@ -351,7 +353,6 @@ public class ClansMainTutorial extends Tutorial if (event.getArguments()[0].equalsIgnoreCase("join") || event.getArguments()[0].equalsIgnoreCase("leave") - || event.getArguments()[0].equalsIgnoreCase("map") || event.getArguments()[0].equalsIgnoreCase("stuck") || event.getArguments()[0].equalsIgnoreCase("promote") || event.getArguments()[0].equalsIgnoreCase("demote") @@ -382,6 +383,7 @@ public class ClansMainTutorial extends Tutorial for (Player player : getPlayers()) { + if (player == null || !player.isOnline()) continue; if (player.getLocation().getWorld() != getWorldManager().getTutorialWorld()) { TutorialRegion region = getRegion(player); @@ -397,7 +399,7 @@ public class ClansMainTutorial extends Tutorial for (Player player : _fireworks) { - if (player == null) continue; + if (player == null || !player.isOnline()) continue; UtilFirework.spawnRandomFirework(UtilAlg.getRandomLocation(player.getLocation(), 10)); } } @@ -406,6 +408,7 @@ public class ClansMainTutorial extends Tutorial public void onJoin(PlayerJoinEvent event) { start(event.getPlayer()); + /* ClansManager.getInstance().runAsync(() -> { if (_repository.GetTimesPlayed(event.getPlayer().getUniqueId()) == 0) @@ -418,7 +421,7 @@ public class ClansMainTutorial extends Tutorial public void performGateCheck(Player player, DyeColor key) { - if(player == null) return; + if(player == null || !player.isOnline()) return; Location exact = getRegion(player).getLocationMap().getIronLocations(key).get(0); if(exact == null) return; Location fence = UtilAlg.getAverageLocation(getRegion(player).getLocationMap().getIronLocations(key)); @@ -453,4 +456,11 @@ public class ClansMainTutorial extends Tutorial if(isInTutorial(event.getPlayer())) event.setCancelled(true); } + + @EventHandler (priority = EventPriority.LOWEST) + public void onSell(ClansPlayerSellItemEvent event) + { + if(isInTutorial(event.getPlayer())) + event.setCancelled(true); + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java index 4e504d045..24b4c1bb3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/PurchaseItemsObjective.java @@ -63,7 +63,7 @@ public class PurchaseItemsObjective extends UnorderedObjective locations = getPlugin().getRegion(player).getLocationMap().getSpongeLocations(DyeColor.BROWN); if (locations == null) continue; for(Location loc : locations) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java index 91fcdfe55..c066b8a59 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClaimLandGoal.java @@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; import java.util.List; +import mineplex.core.common.util.C; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -29,7 +30,7 @@ public class ClaimLandGoal extends ObjectiveGoal "Claim Land using the Clan Menu ( Type /c )", "The first thing your Clan needs to do before you can start to " + "build your fortress is claim the land in an area for your Clan. " + - "You must be inside the blue outline to claim land.", + "You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.", DyeColor.ORANGE ); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanInfoGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanInfoGoal.java index 9dfbca36e..424576bb4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanInfoGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/ClanInfoGoal.java @@ -1,6 +1,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.game.clans.clans.ClanInfo; @@ -54,7 +55,7 @@ public class ClanInfoGoal extends ObjectiveGoal if (!event.getArguments()[0].equalsIgnoreCase("EnemyClan")) { - // Display info + event.getPlayer().sendMessage(F.main("Clans", "That clan does not exist.")); return; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java index dec12af44..d7347e245 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/LeaveSpawnGoal.java @@ -69,7 +69,7 @@ public class LeaveSpawnGoal extends ObjectiveGoal for (UUID uuid : getActivePlayers()) { Player player = Bukkit.getPlayer(uuid); - if(player == null) continue; + if(player == null || !player.isOnline()) continue; if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) { finish(Bukkit.getPlayer(uuid)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java index 0ebdd7221..bc31e43e6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/SelectBullsChargeGoal.java @@ -41,7 +41,7 @@ public class SelectBullsChargeGoal extends ObjectiveGoal getActivePlayers().forEach(uuid -> { Player player = UtilPlayer.searchExact(uuid); - if (player == null) + if (player == null || !player.isOnline()) { return; } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java index 73f0ac438..079c91c8f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/BuyEnergyGoal.java @@ -3,7 +3,9 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.game.clans.clans.ClansManager; import org.bukkit.DyeColor; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -28,8 +30,12 @@ public class BuyEnergyGoal extends ObjectiveGoal @Override protected void customStart(Player player) { - UtilPlayer.message(player, F.main("Clans", "WARNING: Clan Energy is running very low!")); - UtilTextMiddle.display("Clan Energy", "is running very low", 10, 80, 10, player); + ClansManager.getInstance().runSyncLater(() -> { + UtilPlayer.message(player, F.main("Clans", "WARNING: Clan Energy is running very low!")); + UtilTextMiddle.display("Clan Energy", "is running very low", 10, 100, 10, player); + + player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); + }, 3L); } @Override diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java index b21a4a9d3..c90c31f8f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/energy/ExplainEnergyGoal.java @@ -31,8 +31,6 @@ public class ExplainEnergyGoal extends ObjectiveGoal @Override protected void customStart(Player player) { - player.playSound(player.getLocation(), Sound.NOTE_BASS, 1.0f, 1.0f); - ClansManager.getInstance().runSyncLater(() -> { // Explain Energy UtilPlayer.message(player, F.main("Clans", "Energy is required to maintain a Clan's territory, without it, any territory that your Clan owns will be claimed by the Wilderness, and anyone will be able to claim that territory. You can buy Energy at the Energy Shop in the Shops.")); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java index 6b3dab0f6..0e416501e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/GoToFieldsGoal.java @@ -50,6 +50,8 @@ public class GoToFieldsGoal extends ObjectiveGoal for (UUID uuid : getActivePlayers()) { + if(UtilPlayer.searchExact(uuid) == null) return; + getObjective().getPlugin().performGateCheck(UtilPlayer.searchExact(uuid), DyeColor.RED); } } @@ -63,6 +65,7 @@ public class GoToFieldsGoal extends ObjectiveGoal for (UUID uuid : getActivePlayers()) { Player player = UtilPlayer.searchExact(uuid); + if(player == null || !player.isOnline()) continue; if (getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.FIELDS)) { finish(player); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java index 303230475..356653bc1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/shops/GoToShopsGoal.java @@ -51,6 +51,7 @@ public class GoToShopsGoal extends ObjectiveGoal for (UUID uuid : getActivePlayers()) { + if(UtilPlayer.searchExact(uuid) == null) continue; getObjective().getPlugin().performGateCheck(UtilPlayer.searchExact(uuid), DyeColor.BROWN); } } @@ -64,6 +65,7 @@ public class GoToShopsGoal extends ObjectiveGoal for (UUID uuid : getActivePlayers()) { Player player = UtilPlayer.searchExact(uuid); + if(player == null || !player.isOnline()) continue; if (getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SHOPS)) { finish(player);