2013-09-18 11:46:45 +02:00
|
|
|
package mineplex.hub.modules;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
2014-08-07 10:46:10 +02:00
|
|
|
import java.util.Iterator;
|
2013-09-18 11:46:45 +02:00
|
|
|
import java.util.WeakHashMap;
|
|
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.entity.LivingEntity;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
2014-08-09 04:35:36 +02:00
|
|
|
import org.bukkit.event.EventPriority;
|
2013-09-18 11:46:45 +02:00
|
|
|
import org.bukkit.event.block.BlockBreakEvent;
|
|
|
|
import org.bukkit.event.entity.EntityDamageEvent;
|
|
|
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
|
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
2014-08-09 04:35:36 +02:00
|
|
|
import org.bukkit.event.player.PlayerInteractEvent;
|
2014-08-09 04:16:37 +02:00
|
|
|
import org.bukkit.event.player.PlayerQuitEvent;
|
|
|
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
2013-09-18 11:46:45 +02:00
|
|
|
|
|
|
|
import mineplex.core.MiniPlugin;
|
|
|
|
import mineplex.core.common.util.C;
|
|
|
|
import mineplex.core.common.util.Callback;
|
|
|
|
import mineplex.core.common.util.F;
|
|
|
|
import mineplex.core.common.util.UtilBlock;
|
|
|
|
import mineplex.core.common.util.UtilEnt;
|
2014-08-09 04:35:36 +02:00
|
|
|
import mineplex.core.common.util.UtilEvent;
|
2013-09-18 11:46:45 +02:00
|
|
|
import mineplex.core.common.util.UtilMath;
|
|
|
|
import mineplex.core.common.util.UtilPlayer;
|
|
|
|
import mineplex.core.common.util.UtilServer;
|
|
|
|
import mineplex.core.common.util.UtilTime;
|
2014-08-09 04:35:36 +02:00
|
|
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
2013-09-18 11:46:45 +02:00
|
|
|
import mineplex.core.donation.DonationManager;
|
2014-08-09 04:16:37 +02:00
|
|
|
import mineplex.core.gadget.event.GadgetActivateEvent;
|
2014-08-07 10:46:10 +02:00
|
|
|
import mineplex.core.gadget.event.GadgetBlockEvent;
|
2014-08-09 10:57:56 +02:00
|
|
|
import mineplex.core.mount.event.MountActivateEvent;
|
2013-09-18 11:46:45 +02:00
|
|
|
import mineplex.core.recharge.Recharge;
|
|
|
|
import mineplex.core.task.TaskManager;
|
|
|
|
import mineplex.core.updater.UpdateType;
|
|
|
|
import mineplex.core.updater.event.UpdateEvent;
|
|
|
|
import mineplex.hub.HubManager;
|
2014-08-20 02:39:41 +02:00
|
|
|
import mineplex.hub.modules.parkour.ParkourData;
|
|
|
|
import mineplex.hub.modules.parkour.ParkourSnake;
|
2013-09-18 11:46:45 +02:00
|
|
|
|
|
|
|
public class ParkourManager extends MiniPlugin
|
|
|
|
{
|
|
|
|
public HubManager Manager;
|
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
private HashSet<Player> _active = new HashSet<Player>();
|
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
|
|
|
|
|
2014-08-20 02:39:41 +02:00
|
|
|
private Location _snakeParkourReturn;
|
2013-09-18 11:46:45 +02:00
|
|
|
private Location _lavaParkourReturn;
|
|
|
|
private WeakHashMap<Player, Location> _lavaLocation = new WeakHashMap<Player, Location>();
|
|
|
|
private WeakHashMap<Player, Long> _lavaTimer = new WeakHashMap<Player, Long>();
|
|
|
|
|
|
|
|
//Modules
|
|
|
|
protected DonationManager _donationManager;
|
|
|
|
protected TaskManager _taskManager;
|
|
|
|
|
|
|
|
public ParkourManager(HubManager manager, DonationManager donation, TaskManager task)
|
|
|
|
{
|
|
|
|
super("Parkour", manager.GetPlugin());
|
|
|
|
|
|
|
|
Manager = manager;
|
|
|
|
|
|
|
|
_taskManager = task;
|
|
|
|
_donationManager = donation;
|
|
|
|
|
|
|
|
_parkour.add(new ParkourData("Ruins Parkour", new String[]
|
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
"This is an extremely difficult parkour.",
|
|
|
|
"You will need to find the correct way through",
|
|
|
|
"the ruins, overcoming many challenging jumps.",
|
2013-09-18 11:46:45 +02:00
|
|
|
},
|
2014-08-09 04:16:37 +02:00
|
|
|
6000, new Location(Manager.GetSpawn().getWorld(), 110,66,-44),
|
|
|
|
new Location(Manager.GetSpawn().getWorld(), 103,100,-60), new Location(Manager.GetSpawn().getWorld(), 150,50,26)));
|
|
|
|
|
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
_parkour.add(new ParkourData("Lava Parkour", new String[]
|
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
"This parkour is HOT! It's so hot that you",
|
|
|
|
"must keep sprinting for the entire course,",
|
|
|
|
"or you will die in flames!"
|
|
|
|
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
|
|
|
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
2014-08-20 02:39:41 +02:00
|
|
|
|
|
|
|
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
|
|
|
{
|
|
|
|
"This parkour requires incredible timing",
|
|
|
|
"and great agility! Some say it was created",
|
|
|
|
"by the devil as a cruel joke!"
|
|
|
|
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
|
|
|
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
2014-08-23 05:53:15 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
|
|
|
_lavaParkourReturn.setYaw(90);
|
2014-08-20 02:39:41 +02:00
|
|
|
|
|
|
|
_snakeParkourReturn = new Location(Manager.GetSpawn().getWorld(), 16.5,72,-52.5);
|
|
|
|
_snakeParkourReturn.setYaw(180);
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
public boolean isParkourMode(Player player)
|
|
|
|
{
|
|
|
|
return _active.contains(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setParkourMode(Player player, boolean enabled)
|
|
|
|
{
|
|
|
|
if (enabled)
|
|
|
|
{
|
|
|
|
_active.add(player);
|
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You have entered " + F.elem("Parkour Mode") + "."));
|
|
|
|
|
2014-08-09 06:57:01 +02:00
|
|
|
Manager.GetGadget().DisableAll(player);
|
2014-08-09 04:16:37 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_active.remove(player);
|
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You have exited " + F.elem("Parkour Mode") + "."));
|
|
|
|
}
|
|
|
|
}
|
2014-08-07 10:46:10 +02:00
|
|
|
|
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void playerVelocity(PlayerVelocityEvent event)
|
2014-08-07 10:46:10 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
if (isParkourMode(event.getPlayer()))
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void disableGadgets(GadgetActivateEvent event)
|
|
|
|
{
|
|
|
|
if (isParkourMode(event.getPlayer()))
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
2014-08-09 10:57:56 +02:00
|
|
|
@EventHandler
|
|
|
|
public void disableMounts(MountActivateEvent event)
|
|
|
|
{
|
|
|
|
if (isParkourMode(event.getPlayer()))
|
|
|
|
event.setCancelled(true);
|
|
|
|
}
|
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
@EventHandler
|
|
|
|
public void playerEnterParkour(UpdateEvent event)
|
|
|
|
{
|
|
|
|
if (event.getType() != UpdateType.FAST)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (Player player : UtilServer.getPlayers())
|
2014-08-07 10:46:10 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
if (isParkourMode(player))
|
|
|
|
continue;
|
|
|
|
|
2014-08-07 10:46:10 +02:00
|
|
|
for (ParkourData data : _parkour)
|
2014-08-09 04:16:37 +02:00
|
|
|
if (UtilMath.offset(player.getLocation(), data.NPC) < 6)
|
2014-08-20 02:39:41 +02:00
|
|
|
if (Recharge.Instance.use(player, data.Name+" Info", 300000, false, false))
|
2014-08-09 04:16:37 +02:00
|
|
|
data.Inform(player);
|
2014-08-07 10:46:10 +02:00
|
|
|
}
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void parkourUpdate(UpdateEvent event)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
if (event.getType() != UpdateType.FAST)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Iterator<Player> playerIterator = _active.iterator();
|
|
|
|
|
|
|
|
while (playerIterator.hasNext())
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
Player player = playerIterator.next();
|
|
|
|
|
|
|
|
player.leaveVehicle();
|
|
|
|
player.eject();
|
|
|
|
|
|
|
|
if (!InsideParkour(player.getLocation()))
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
playerIterator.remove();
|
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You have exited " + F.elem("Parkour Mode") + "."));
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void playerQuit(PlayerQuitEvent event)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
_active.remove(event.getPlayer());
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
|
|
|
|
2013-09-27 21:40:09 +02:00
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void disallowBlockBreak(BlockBreakEvent event)
|
2013-09-27 21:40:09 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
if (isParkourMode(event.getPlayer()))
|
2013-09-27 21:40:09 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
event.getPlayer().teleport(Manager.GetSpawn());
|
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You cannot break blocks in Parkour Mode!"));
|
2013-09-27 21:40:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-09 04:35:36 +02:00
|
|
|
@EventHandler(priority = EventPriority.LOWEST)
|
|
|
|
public void disallowBlockPlace(PlayerInteractEvent event)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
2014-08-09 04:35:36 +02:00
|
|
|
if (event.getPlayer().getItemInHand() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!event.getPlayer().getItemInHand().getType().isBlock())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
|
|
|
return;
|
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
if (isParkourMode(event.getPlayer()))
|
|
|
|
{
|
|
|
|
event.getPlayer().teleport(Manager.GetSpawn());
|
|
|
|
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You cannot place blocks in Parkour Mode!"));
|
|
|
|
}
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-27 21:40:09 +02:00
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void lavaReturn(EntityDamageEvent event)
|
2013-09-27 21:40:09 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
if (event.getCause() != DamageCause.LAVA)
|
2013-09-27 21:40:09 +02:00
|
|
|
return;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
if (!(event.getEntity() instanceof Player))
|
2013-09-27 21:40:09 +02:00
|
|
|
{
|
2014-08-09 04:16:37 +02:00
|
|
|
event.getEntity().remove();
|
|
|
|
return;
|
2013-09-27 21:40:09 +02:00
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
Player player = (Player)event.getEntity();
|
|
|
|
|
|
|
|
if (!isParkourMode(player))
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.getEntity().eject();
|
|
|
|
event.getEntity().leaveVehicle();
|
|
|
|
event.getEntity().teleport(_lavaParkourReturn);
|
2013-09-27 21:40:09 +02:00
|
|
|
}
|
2014-08-20 02:39:41 +02:00
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.HIGHEST)
|
|
|
|
public void snakeReturn(EntityDamageEvent event)
|
|
|
|
{
|
|
|
|
if (event.getCause() != DamageCause.VOID)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!(event.getEntity() instanceof Player))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Player player = (Player)event.getEntity();
|
|
|
|
|
|
|
|
if (!isParkourMode(player))
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.getEntity().eject();
|
|
|
|
event.getEntity().leaveVehicle();
|
|
|
|
event.getEntity().teleport(_snakeParkourReturn);
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void lavaBlockReturn(UpdateEvent event)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
|
|
|
if (event.getType() != UpdateType.TICK)
|
|
|
|
return;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
for (Player player : UtilServer.getPlayers())
|
|
|
|
{
|
|
|
|
if (!UtilEnt.isGrounded(player))
|
|
|
|
continue;
|
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
if (!isParkourMode(player))
|
|
|
|
continue;
|
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
int id = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getTypeId();
|
2013-10-12 00:34:46 +02:00
|
|
|
int data = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getData();
|
|
|
|
if (id != 0 && id != 112 && id != 114 && !(id == 43 && data == 6) && !(id == 44 && data == 6))
|
2013-09-18 11:46:45 +02:00
|
|
|
continue;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
if (!_lavaLocation.containsKey(player) || UtilMath.offset(player.getLocation(), _lavaLocation.get(player)) > 1.5)
|
|
|
|
{
|
|
|
|
_lavaLocation.put(player, player.getLocation());
|
|
|
|
_lavaTimer.put(player, System.currentTimeMillis());
|
|
|
|
continue;
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
if (UtilTime.elapsed(_lavaTimer.get(player), 500))
|
|
|
|
{
|
|
|
|
boolean inCourse = false;
|
|
|
|
for (Block block : UtilBlock.getInRadius(player.getLocation(), 1.5).keySet())
|
|
|
|
{
|
2013-10-12 00:34:46 +02:00
|
|
|
if (block.getType() == Material.NETHER_BRICK || block.getType() == Material.NETHER_BRICK_STAIRS)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
|
|
|
inCourse = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
if (!inCourse)
|
|
|
|
continue;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
_lavaLocation.remove(player);
|
|
|
|
_lavaTimer.remove(player);
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
player.eject();
|
|
|
|
player.leaveVehicle();
|
|
|
|
player.teleport(_lavaParkourReturn);
|
|
|
|
player.setFireTicks(0);
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You cannot stop running during Lava Parkour!"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
2014-08-09 04:16:37 +02:00
|
|
|
public void finishParkour(PlayerInteractEntityEvent event)
|
2013-09-18 11:46:45 +02:00
|
|
|
{
|
|
|
|
if (event.getRightClicked() == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!(event.getRightClicked() instanceof LivingEntity))
|
|
|
|
return;
|
|
|
|
|
|
|
|
LivingEntity ent = (LivingEntity)event.getRightClicked();
|
|
|
|
|
|
|
|
if (ent.getCustomName() == null)
|
|
|
|
return;
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
//Start Message
|
|
|
|
if (ent.getCustomName().contains("Start"))
|
|
|
|
{
|
|
|
|
Player player = event.getPlayer();
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
for (ParkourData data : _parkour)
|
|
|
|
{
|
|
|
|
if (!ent.getCustomName().contains(data.Name))
|
|
|
|
continue;
|
|
|
|
|
2014-08-09 06:57:01 +02:00
|
|
|
if (isParkourMode(player))
|
|
|
|
setParkourMode(player, false);
|
|
|
|
else
|
|
|
|
setParkourMode(player, true);
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
//Finish Message
|
|
|
|
if (ent.getCustomName().contains("Finish"))
|
|
|
|
{
|
|
|
|
final Player player = event.getPlayer();
|
|
|
|
|
2014-08-09 04:16:37 +02:00
|
|
|
if (!isParkourMode(player))
|
|
|
|
{
|
|
|
|
//Inform
|
2014-08-11 06:25:11 +02:00
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You must be in " + F.elem("Parkour Mode") + " to finish."));
|
2014-08-09 04:16:37 +02:00
|
|
|
UtilPlayer.message(player, F.main("Parkour", "Talk to the " + F.elem("Start NPC") + " to enter Parkour Mode."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-03 06:48:58 +02:00
|
|
|
if (!Recharge.Instance.use(player, "Finish Parkour", 30000, false, false))
|
2013-09-18 11:46:45 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
for (ParkourData data : _parkour)
|
|
|
|
{
|
|
|
|
if (!ent.getCustomName().contains(data.Name))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
//Inform
|
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You completed " + F.elem(data.Name) + "."));
|
|
|
|
|
|
|
|
//Gems
|
|
|
|
if (!_taskManager.hasCompletedTask(player, data.Name))
|
|
|
|
{
|
|
|
|
final ParkourData fData = data;
|
|
|
|
|
|
|
|
_donationManager.RewardGems(new Callback<Boolean>()
|
2014-08-09 04:16:37 +02:00
|
|
|
{
|
2013-09-18 11:46:45 +02:00
|
|
|
public void run(Boolean completed)
|
|
|
|
{
|
|
|
|
UtilPlayer.message(player, F.main("Parkour", "You received " + F.elem(C.cGreen + fData.Gems + " Gems") + "."));
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
_taskManager.completedTask(player, fData.Name);
|
2014-08-09 04:16:37 +02:00
|
|
|
|
2013-09-18 11:46:45 +02:00
|
|
|
//Sound
|
|
|
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
}, "Parkour " + data.Name, player.getName(), data.Gems);
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-09 04:16:37 +02:00
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void gadgetBlockChange(GadgetBlockEvent event)
|
|
|
|
{
|
|
|
|
for (Iterator<Block> iterator = event.getBlocks().iterator(); iterator.hasNext();)
|
|
|
|
{
|
|
|
|
for (ParkourData data : _parkour)
|
|
|
|
{
|
|
|
|
if (data.InBoundary(iterator.next().getLocation()))
|
|
|
|
{
|
|
|
|
iterator.remove();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean InsideParkour(Location loc)
|
|
|
|
{
|
|
|
|
for (ParkourData data : _parkour)
|
|
|
|
if (data.InBoundary(loc))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2014-08-20 02:39:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void snakeUpdate(UpdateEvent event)
|
|
|
|
{
|
|
|
|
if (event.getType() != UpdateType.FASTER)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (ParkourData parkour : _parkour)
|
|
|
|
if (parkour instanceof ParkourSnake)
|
|
|
|
((ParkourSnake)parkour).Update();
|
|
|
|
}
|
2013-09-18 11:46:45 +02:00
|
|
|
}
|