mirror of
https://github.com/songoda/EpicHoppers.git
synced 2025-01-10 09:57:45 +01:00
Teleporting can now take place from inside the hopper.
This commit is contained in:
parent
8489ec6a51
commit
a55faf1aee
@ -35,8 +35,13 @@ public class InteractListeners implements Listener {
|
||||
public void onPlayerToggleSneakEvent(PlayerToggleSneakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.isSneaking()) {
|
||||
Location location = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation();
|
||||
if (instance.getHopperManager().isHopper(location)) {
|
||||
Location location = player.getLocation().getBlock().getRelative(BlockFace.SELF).getLocation();
|
||||
Location down = location.getBlock().getRelative(BlockFace.DOWN).getLocation();
|
||||
if (instance.getHopperManager().isHopper(down)) {
|
||||
Hopper hopper = instance.getHopperManager().getHopper(down);
|
||||
if (hopper.getTeleportTrigger() == TeleportTrigger.SNEAK)
|
||||
instance.getTeleportHandler().tpPlayer(player, hopper);
|
||||
} else if (instance.getHopperManager().isHopper(location)) {
|
||||
Hopper hopper = instance.getHopperManager().getHopper(location);
|
||||
if (hopper.getTeleportTrigger() == TeleportTrigger.SNEAK)
|
||||
instance.getTeleportHandler().tpPlayer(player, hopper);
|
||||
|
Loading…
Reference in New Issue
Block a user