Don't allow placing TNT in tutorial. Fixes PC-307

This commit is contained in:
samczsun 2016-05-16 15:26:00 -04:00 committed by Sam Sun
parent d29d5dd5e4
commit ea43dca9af

View File

@ -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<AttackEnemyObjective>
{
@ -43,4 +47,15 @@ public class LoadCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
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);
}
}