How to deny interact with armorstands?

I trying this code:

    @Listener
    public void onPlayerInteract(InteractEntityEvent e, @First Player p) {
        Entity ent = e.getTargetEntity();
        RedProtect.logger.debug("player","RPPlayerListener - Is InteractEntityEvent event: " + ent.getType().getName());
        
        Location<World> l = ent.getLocation();
        Region r = RedProtect.rm.getTopRegion(l);
        if (r == null){
        	return;
        }
        
        if (ent instanceof Hanging || ent instanceof ArmorStand) {        	
            if (!r.canBuild(p)) {
                RPLang.sendMessage(p, "playerlistener.region.cantedit");
                e.setCancelled(true);
                return;
            }
        } 
...

Checking Hanging work for Paintning and ItemFrames, but ArmorStand dont work :confused:

Perhaps check if ent.getType().equals(EntityTypes.ARMOR_STAND)? Although I doubt that would change much…

Its suposed to work, but the event is not fired when interact whit ArmorStand.

The debuger RedProtect.logger.debug dont shows anything :confused:

Any event is fired when interact with ArmorStands! I tryed all possible events and didnt find any!

That might be totally outdated, but:
I had that problem a while ago at the starts of Sponge, and realized that not even Forge itself fires any event when e.g. changing armor on an armorstand … i haven’t looked in further since now, but that still might be the problem? Or are you using Sponge Vanilla?

I’m using SpongeForge, and seems still not firing anything. I still trying but no success :frowning:

I tried it in SpongeVanilla with logging all events. It’s not fired. You may have to ask Sponge devs about it.

This has been fixed in latest SpongeForge build. Should be fixed in SpongeVanilla soon when common is bumped.