From ea43dca9af308f7372f295e8c7e5026239591448 Mon Sep 17 00:00:00 2001 From: samczsun Date: Mon, 16 May 2016 15:26:00 -0400 Subject: [PATCH] Don't allow placing TNT in tutorial. Fixes PC-307 --- .../goals/attackenemy/LoadCannonGoal.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java index 81ca051c6..21b69d371 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/goals/attackenemy/LoadCannonGoal.java @@ -1,5 +1,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -8,6 +10,8 @@ import mineplex.core.common.util.UtilInv; import mineplex.game.clans.clans.siege.events.LoadSiegeWeaponEvent; import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPlaceEvent; public class LoadCannonGoal extends ObjectiveGoal { @@ -43,4 +47,15 @@ public class LoadCannonGoal extends ObjectiveGoal finish(event.getPlayer()); } + + @EventHandler (priority = EventPriority.MONITOR) + public void onBlockPlace(BlockPlaceEvent event) + { + if (!contains(event.getPlayer())) + { + return; + } + UtilPlayer.message(event.getPlayer(), F.main("Clans", "Are you sure? That's the only TNT you have!")); + event.setCancelled(true); + } }