mirror of
https://github.com/songoda/EpicHoppers.git
synced 2025-01-25 09:01:35 +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) {
|
public void onPlayerToggleSneakEvent(PlayerToggleSneakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
Location location = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation();
|
Location location = player.getLocation().getBlock().getRelative(BlockFace.SELF).getLocation();
|
||||||
if (instance.getHopperManager().isHopper(location)) {
|
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);
|
Hopper hopper = instance.getHopperManager().getHopper(location);
|
||||||
if (hopper.getTeleportTrigger() == TeleportTrigger.SNEAK)
|
if (hopper.getTeleportTrigger() == TeleportTrigger.SNEAK)
|
||||||
instance.getTeleportHandler().tpPlayer(player, hopper);
|
instance.getTeleportHandler().tpPlayer(player, hopper);
|
||||||
|
Loading…
Reference in New Issue
Block a user