diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java index c7e601cc4..7e991faaf 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java @@ -785,8 +785,14 @@ public class ClansDataAccessLayer // Memory claim.Safe = !claim.Safe; - // Save - _repository.updateTerritoryClaim(claim.Chunk, claim.Safe); + runAsync(new Runnable() + { + @Override + public void run() + { + _repository.updateTerritoryClaim(claim.Chunk, claim.Safe); + } + }); // Log _manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "]."); @@ -807,7 +813,14 @@ public class ClansDataAccessLayer public void clanExists(String clanName, Callback callback) { - _repository.clanExists(clanName, callback); + runAsync(new Runnable() + { + @Override + public void run() + { + _repository.clanExists(clanName, callback); + } + }); } public ClanRepository getRepository() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java index 4305ae4ed..900add9ed 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/objective/Objective.java @@ -267,12 +267,12 @@ public abstract class Objective public void siegeWeaponExplode(SiegeWeaponExplodeEvent event) { Player shooter = event.getProjectile().getShooter(); - - System.out.println(shooter.getName()); - + if (!contains(shooter)) { if (getObjective().getPlugin().isInTutorial(shooter)) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java index eda507507..0187a6f98 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/BuildHouseGoal.java @@ -69,7 +69,9 @@ public class BuildHouseGoal extends ObjectiveGoal { return; } - + + + for (ItemStack stack : _items) { if (event.getBlock().getType().equals(stack.getType()) || event.getBlock().getType().equals(Material.IRON_DOOR_BLOCK)) @@ -84,14 +86,17 @@ public class BuildHouseGoal extends ObjectiveGoal } } - @EventHandler + @EventHandler (priority = EventPriority.HIGHEST) public void blockPlace(BlockPlaceEvent event) { if (!contains(event.getPlayer())) { return; } - + + event.setCancelled(false); + + if (isInBuildArea(event.getPlayer(), event.getBlock())) { // Run 1 tick later because inventory doesn't get updated instantly diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java index 49a4c17e5..010847631 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/clan/CreateClanGoal.java @@ -47,6 +47,7 @@ public class CreateClanGoal extends ObjectiveGoal if (contains(event.getFounder())) { finish(event.getFounder()); + ClansManager.getInstance().resetLeftTimer(event.getFounder().getUniqueId()); } } 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 c976aae6b..94a7a404d 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 @@ -1,5 +1,6 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; +import java.util.HashSet; import java.util.UUID; import org.bukkit.Bukkit; @@ -17,6 +18,8 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective; public class LeaveSpawnGoal extends ObjectiveGoal { + private HashSet _removeList = new HashSet(); + public LeaveSpawnGoal(ClanObjective objective) { super( @@ -62,8 +65,15 @@ public class LeaveSpawnGoal extends ObjectiveGoal Player player = Bukkit.getPlayer(uuid); if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) { - finish(player); + _removeList.add(uuid); } } + + for (UUID uuid : _removeList) + { + finish(Bukkit.getPlayer(uuid)); + } + + _removeList.clear(); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java index 5a6b789ca..d2a716d2a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/classes/UseBullsChargeGoal.java @@ -1,16 +1,23 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.game.clans.clans.ClansManager; +import mineplex.minecraft.game.classcombat.Class.ClassManager; +import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.Class.IPvpClass; +import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; +import org.bukkit.event.player.PlayerInteractEvent; -public class UseBullsChargeGoal extends ObjectiveGoal -{ - public UseBullsChargeGoal(ClassesObjective objective) - { +public class UseBullsChargeGoal extends ObjectiveGoal { + public UseBullsChargeGoal(ClassesObjective objective) { super( objective, "Use Bulls Charge", @@ -21,22 +28,23 @@ public class UseBullsChargeGoal extends ObjectiveGoal } @Override - protected void customStart(Player player) - { + protected void customStart(Player player) { + ClientClass client = ClansManager.getInstance().getClassManager().Get(player); + + client.ResetSkills(player); + client.SetActiveCustomBuild(client.GetGameClass(), client.GetGameClass().getDefaultBuild()); } @Override - protected void customFinish(Player player) - { + protected void customFinish(Player player) { } @EventHandler - public void checkSkill(SkillTriggerEvent event) - { - if (contains(event.GetPlayer())) - { + public void checkSkill(SkillTriggerEvent event) { + if (contains(event.GetPlayer())) { if (event.GetSkillName().toLowerCase().contains("bulls charge")) finish(event.GetPlayer()); } } + } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java index 34a47fdd7..47506ed95 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/MineDiamondsGoal.java @@ -59,15 +59,12 @@ public class MineDiamondsGoal extends ObjectiveGoal @EventHandler(priority = EventPriority.HIGHEST) public void onBlockBreak(BlockBreakEvent event) { - System.out.println("a"); if (!contains(event.getPlayer()) || event.getBlock().getType() != Material.DIAMOND_ORE) return; - System.out.println("b"); TutorialRegion region = getObjective().getPlugin().getRegion(event.getPlayer()); if (getObjective().getPlugin().isIn(event.getBlock().getLocation(), region, ClansMainTutorial.Bounds.FIELDS)) { - System.out.println("c"); event.setCancelled(true); event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 1.5, 0.5), new ItemStack(Material.DIAMOND)); event.getBlock().setType(Material.COBBLESTONE); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java index 1ff580789..1a14e6a3c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/fields/SellDiamondsGoal.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; @@ -34,6 +35,7 @@ public class SellDiamondsGoal extends ObjectiveGoal { // Close Middle Gate getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.RED); + // Close Fields Gate getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK); } @@ -45,6 +47,7 @@ public class SellDiamondsGoal extends ObjectiveGoal { if (event.getItem().getType() == Material.DIAMOND) { + UtilInv.removeAll(event.getPlayer(), Material.DIAMOND, (byte) 0); finish(event.getPlayer()); } else diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java index fb1aa9210..2feef0100 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/DisbandClanGoal.java @@ -37,6 +37,7 @@ public class DisbandClanGoal extends ObjectiveGoal @Override protected void customFinish(Player player) { + ClansManager.getInstance().resetLeftTimer(player.getUniqueId()); } @EventHandler(priority = EventPriority.HIGHEST) @@ -50,6 +51,7 @@ public class DisbandClanGoal extends ObjectiveGoal UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan.")); ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null); + ClansManager.getInstance().resetLeftTimer(event.getDisbander().getUniqueId()); finish(event.getDisbander()); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java index 030bb18c8..c7b189ec5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/finalobj/TpClanHomeGoal.java @@ -13,7 +13,6 @@ import mineplex.game.clans.tutorial.objective.Objective; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; public class TpClanHomeGoal extends ObjectiveGoal