From 131e6ca7bcd54364c1d197de6931fdfe41f8add7 Mon Sep 17 00:00:00 2001 From: FordFriedel Date: Fri, 22 Dec 2023 09:27:53 -0600 Subject: [PATCH] feat: add toggle speedwalk for villiagers --- .../java/org/oddlama/vane/trifles/FastWalkingListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java b/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java index 726eaaf5d..028d75859 100644 --- a/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java +++ b/vane-trifles/src/main/java/org/oddlama/vane/trifles/FastWalkingListener.java @@ -1,9 +1,11 @@ package org.oddlama.vane.trifles; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; +import org.oddlama.vane.annotation.config.ConfigBoolean; import org.oddlama.vane.core.Listener; import io.papermc.paper.event.entity.EntityMoveEvent; @@ -16,6 +18,9 @@ public FastWalkingListener(FastWalkingGroup context) { super(context); this.fast_walking = context; } + + @ConfigBoolean(def = true, desc = "wether or not to speed villagers on path blocks.") + public boolean villager_speedwalk; @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void on_player_move(final PlayerMoveEvent event) { @@ -45,6 +50,8 @@ public void on_player_move(final PlayerMoveEvent event) { public void on_entity_move(final EntityMoveEvent event) { final var entity = event.getEntity(); + if(entity.getType() == EntityType.VILLAGER && villager_speedwalk == false) return; + // Inspect block type just a little below var block = event.getTo().clone().subtract(0.0, 0.1, 0.0).getBlock(); if (!fast_walking.config_materials.contains(block.getType())) {