kernitus / BukkitOldCombatMechanics

Spigot plugin to configure combat mechanics from 1.9 onwards
https://www.spigotmc.org/resources/19510/
Mozilla Public License 2.0
167 stars 72 forks source link

The residence area will be attacked by fishing rods #658

Closed 3154311518 closed 1 year ago

3154311518 commented 1 year ago

The residence area will be attacked by fishing rods

https://user-images.githubusercontent.com/46740577/234429590-4b81b4fb-b949-46c8-8d34-c0d97f9375df.mp4

3154311518 commented 1 year ago

server: paper1.12.2 OldCombatMechanics 1.11.0

kernitus commented 1 year ago

Please follow the issue template. I need a copy of your config.yml to know what is going on. Enabling useEntityDamageEvent: true under old-fishing-knockback should help with this.

3154311518 commented 1 year ago

Please follow the issue template. I need a copy of your config.yml to know what is going on. Enabling useEntityDamageEvent: true under old-fishing-knockback should help with this. I set useEntityDamageEvent to true, but I still take damage as before.

3154311518 commented 1 year ago

config.zip

kernitus commented 1 year ago

Alright. Can you outline what is happening in the video? I presume you are using the Residence plugin.

  1. Which of the players belong to the residence and which doesn't?
  2. What do you expect to happen instead of what happens in the video?
SrBedrock commented 1 year ago

I experienced the same problem using the GriefPrevention plugin, if the player is in a protected area the event of grabbing the player with a fishing rod is cancelled but BukkitOldCombatMechanics does not respect the event cancellation.

This makes it possible to pull players offline from their protected areas and then kill and steal their items.

GriefPrevention: https://github.com/TechFortress/GriefPrevention/blob/e5f579dd10efa669150ce3a012afa7c4071fce4a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java#LL1404C1-L1427C6

    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
    public void onPlayerFish(PlayerFishEvent event)
    {
        Entity entity = event.getCaught();
        if (entity == null) return;  //if nothing pulled, uninteresting event

        //if should be protected from pulling in land claims without permission
        if (entity.getType() == EntityType.ARMOR_STAND || entity instanceof Animals)
        {
            Player player = event.getPlayer();
            PlayerData playerData = instance.dataStore.getPlayerData(player.getUniqueId());
            Claim claim = instance.dataStore.getClaimAt(entity.getLocation(), false, playerData.lastClaim);
            if (claim != null)
            {
                //if no permission, cancel
                Supplier<String> errorMessage = claim.checkPermission(player, ClaimPermission.Inventory, event);
                if (errorMessage != null)
                {
                    event.setCancelled(true);
                    GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoDamageClaimedEntity, claim.getOwnerName());
                    return;
                }
            }
        }
    }

Residence and others protection plugins probably have some similar listener..