OldCombatMechanics

OldCombatMechanics

46.1k Downloads

The residence area will be attacked by fishing rods

3154311518 opened this issue ยท 6 comments

commented

The residence area will be attacked by fishing rods

2023-04-26.07-30-40.mp4
commented

server:
paper1.12.2
OldCombatMechanics 1.11.0

commented

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.

commented

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.

commented
commented

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?
commented

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..