Question [1.21.6] Prevent Nether Portal destroying

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

Erfinderlabyrinth

New member
Mar 9, 2024
3
1
0
1
How can I prevent Nether portals from being destroyed, even if the frame is broken?
I tried the following, but it didn't work:


Java:
    @EventHandler
    public void onPortalPhysics(BlockPhysicsEvent event) {
        if (event.getBlock().getType() == Material.NETHER_PORTAL || event.getChangedType() == Material.NETHER_PORTAL) {
            System.out.println("Cancel");
            event.setCancelled(true);
        }
    }