Don't touch vertical knockback

This commit is contained in:
Minecon724 2025-01-02 20:23:18 +01:00
parent afed2a8f78
commit 6e45491508
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2024 Minecon724 * Copyright (C) 2025 Minecon724
* Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file * Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file
* in the project root for the full license text. * in the project root for the full license text.
*/ */
@ -13,12 +13,13 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityKnockbackByEntityEvent; import org.bukkit.event.entity.EntityKnockbackByEntityEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class KnockbackListener implements Listener { public class KnockbackListener implements Listener {
private final Map<EntityType, Double> modifiers = new HashMap<>(); private final Map<EntityType, Vector> modifiers = new HashMap<>();
public KnockbackListener(Plugin plugin) { public KnockbackListener(Plugin plugin) {
TweaksConfig.getConfig().knockbackModifiers().forEach((k, v) -> { TweaksConfig.getConfig().knockbackModifiers().forEach((k, v) -> {
@ -45,7 +46,7 @@ public class KnockbackListener implements Listener {
} }
if (mod == 1) return; if (mod == 1) return;
modifiers.put(type, mod); modifiers.put(type, new Vector(mod, mod >= 1 ? mod : 1, mod)); // don't touch vertical
}); });
if (!modifiers.isEmpty()) if (!modifiers.isEmpty())