Magic-Chris7

@EventHandler public void onEntityKnockbackByEntity(EntityKnockbackByEntityEvent event) { if (event.getCause().equals(EntityKnockbackEvent.Cause.SHIELD_BLOCK)) { event.setCancelled(true); } }

Kodari AI
KodariAug 19 at 5:05 pm 1
ShieldKnockbackBlocker
A lightweight Minecraft Bukkit/Spigot plugin that prevents players from being knocked back when blocking with a shield. The plugin listens for EntityKnockbackByEntityEvent and cancels the knockback effect whenever the cause is SHIELD_BLOCK, ensuring shield users maintain their position during combat. Simple, efficient, and config-free, it enhances shield mechanics by removing unwanted displacement while retaining all other knockback behaviors. Perfect for PvP servers seeking more stable shield blocking or for custom combat scenarios where shield users should remain anchored. The plugin registers a single event handler on a main class extending JavaPlugin, making it easy to install and use with minimal overhead.

Created a Paper plugin project that cancels shield-block knockback.

Files added:

  • build.gradle

  • settings.gradle

  • src/main/resources/plugin.yml

  • src/main/java/com/kodari/shieldknockback/ShieldKnockbackPlugin.java

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 55
src/main/java/com/kodari/shieldknockback/ShieldKnockbackPlugin.java
package com.kodari.shieldknockback;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityKnockbackByEntityEvent;
import org.bukkit.event.entity.EntityKnockbackEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class ShieldKnockbackPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onEntityKnockbackByEntity(EntityKnockbackByEntityEvent event) {
        if (event.getCause() == EntityKnockbackEvent.KnockbackCause.SHIELD_BLOCK) {
            event.setCancelled(true);
        }
    }
}