OldCombatMechanics

OldCombatMechanics

46.1k Downloads

Sweeping Edge does not appear to disable; still hits multiple mobs.

Formula350 opened this issue ยท 19 comments

commented

OCM v1.6.2 build 60 (tried build 8, v1.6.1, v1.4.2, v,1.1.2)
Spigot 1.11.2 as far as I know (git-Spigot-3fb9445-6e3cec8)
RPGItems for 1.11.2 v3.5.255

OCM's "Sweeping Edge" feature seems to be non-functional from what I can tell. I know it says that the visual effect will still be present, and that's fine (looks cool anyhow), but unfortunately that's not what is the issue. When attacking more than one mob that's basically within your hit range, they all take damage. Granted, this is also with an RPGItems created weapon, but I can't imagine that has anything to do with it and feel pretty confident in saying it no doubt happens with a completely vanilla sword as well.

The best way to see this is by spawning a full-size Slime, attacking it with a Bow until you've broken it up into its smallest cubes, and running up with a sword and attacking. On my server, you'll usually kill between 2 and 5 slime depending on how compact the group is, all despite being configured with:

disable-sword-sweep:
  # This is to disable the sword sweep attack
  # The particle effect will still be present but will not affect surrounding entities
  enabled: true
  worlds: []

As such I've set the Difficulty to 3 to kind of offset the fact that this allows you to run into a hoard of whatever and just start swinging carelessly, being able to easily take them on with out much concern of dying. I mean I'm pretty sure this is a bug, given I've tried it with "enabled: false" and that hasn't appeared to change anything.

commented

@gvlfm78 What stops you from using

e.getCause() == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK

for your sweep detection?

It should reduce your module to something like

public class ModuleSwordSweep extends Module {

    private EntityDamageEvent.DamageCause sweepCause;

    public ModuleSwordSweep(OCMMain plugin) {
        super(plugin, "disable-sword-sweep");
        try {
            // be kind to not updated servers
            sweepCause = EntityDamageEvent.DamageCause.valueOf("ENTITY_SWEEP_ATTACK");
        } catch (IllegalArgumentException e) {
            sweepCause = null;
        }
    }

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onEntityDamaged(EntityDamageByEntityEvent e) {
        World world = e.getDamager().getWorld();

        if (!isEnabled(world)) return;

        if (!(e.getDamager() instanceof Player)) return;

        if (e.getCause() == sweepCause) {
            e.setCancelled(true);
        }
    }
}

The enum constant was introduced in this commit back on the verge of 2017, so it should probably be available on all servers you are targeting.

EDIT: Looking at the timeline it seems that it was added when Minecraft 1.11 was common. It is not present in 1.9 and not in the NMS code of that version either. Sucks tbh, but besides some really fun runtime bytecode patching it doesn't look like you can do much good. Though I would personally use the SWEEP_ATTACK implementation when supported, as it is at least accurate.

commented

Fixed by #183. If you are still using OldCombatMechanics, please try the latest test build.

commented

Well it definitely needs to be on enabled: true in order to do anything at all.

What you can do is try turning on debug mode in the configuration and reading the messages you receive. These should say whether the plugin is detecting the sweep attack or not, and the damage done.

commented

Weapon used was an RPGItem created Diamond Sword which does 35 Damage (17.5 Hearts) and has a 2% Chance to apply Poison. (Neither instance did the Poison proc). Player was wearing no armor for these tests.
[NOTE: Only -one- swing with the sword was taken on each screenshot.]

Attack 1; player in the open nothing else around...
solo-player

Attack 2: player standing next to an Armor Stand protected with LWC Entity Locking plugin....
player armor_stand

Attack 3: player standing next to one LWC-protected Armor Stand, one unprotcted Armor Stand...
player armor_stand-x2
Despite being hit by an attack and having apparently taken damage, the unprotected Armor Stand was not destroyed.

Config:

############# OldCombatMechanics Plugin by gvlfm78 and Rayzr522 #############
#                                                                           #
# Bukkit Page: http://dev.bukkit.org/bukkit-plugins/oldcombatmechanics/     #
# Spigot Page: https://www.spigotmc.org/resources/oldcombatmechanics.19510/ #
# GitHub Page: https://github.com/gvlfm78/BukkitOldCombatMechanics/         #
#                                                                           #
#############################################################################

# This is to toggle the update checker
update-checker:
  enabled: true
  # Modes: auto, bukkit, spigot
  mode: auto
    
# Enable the oldcombatmechanics.toggle permission
# for players to individually /ocm toggle their cooldown
enableIndividualToggle: false

# List of interactive blocks that right clicking on will be ignored
# This is for modules such as sword blocking and elytra
# ###### I don't know if this is something we are interest in, so I've disabled it - FORM ###### #
#interactive: [enchantment_table,anvil,brewing_stand,trapped_chest,chest,bed,boat,fence_gate,dispenser,dropper,furnace,jukebox,ender_chest,stone_button,wood_button,beacon,tripwire_hook,hopper,daylight_detector,daylight_detector_inverted,item_frame,diode,diode_block_off,diode_block_on,redstone_comparator,redstone_comparator_off,redstone_comparator_on,acacia_door,birch_door,dark_oak_door,jungle_door,spruce_door,wood_door,workbench,bed_block,lever,trap_door,burning_furnace,spruce_fence_gate,birch_fence_gate,jungle_fence_gate,dark_oak_fence_gate,acacia_fence_gate,white_shulker_box,orange_shulker_box,magenta_shulker_box,light_blue_shulker_box,yellow_shulker_box,lime_shulker_box,pink_shulker_box,gray_shulker_box,silver_shulker_box,cyan_shulker_box,purple_shulker_box,blue_shulker_box,brown_shulker_box,green_shulker_box,red_shulker_box,black_shulker_box]
interactive: []
 

# To use the per-world feature you specify a list of the worlds in the []
# For example: (names are case sensitive)
# worlds: [world,survival,creative,SkyWars]
# Another example (for 1 world): 
# worlds: [bestWorld]

disable-attack-cooldown:
  # This is to disable the attack cooldown
  enabled: true
  worlds: []
  # What to set the attack speed to. Default for 1.9 is 4, at least 16 is needed for no cooldown.
  generic-attack-speed: 24
  
disable-player-collisions:
  # This is to disable player collision
  # This is now compatible with scoreboard and tablist-editing plugins
  enabled: true
  worlds: []
  
disable-sword-sweep:
  # This is to disable the sword sweep attack
  # The particle effect will still be present but will not affect surrounding entities
  enabled: true
  worlds: []
  
disable-crafting:
  # Disable the crafting of specified items
  enabled: false
  worlds: []
  # List of denied items
  denied: [shield]
  
disable-offhand:
  # Disable the usage of the offhand
  # Won't affect sword-blocking module
  enabled: false
  worlds: []
  # Whether the following list blocks items or allows them
  whitelist: false
  # List of items that should be allowed/not
  # Example: [diamond_sword,BOW]
  items: []
  
old-brewing-stand:
  # Automatically refuels brewing stands
  enabled: false
  worlds: []
  
no-lapis-enchantments:
  # Automatically adds lapis to enchantment tables upon opening
  enabled: false
  worlds: []
  # Whether to only allow this for players with oldcombatmechanics.nolapis permission
  usePermission: false
  
disable-elytra:
  # Do not allow players to wear elytra
  enabled: false
  worlds: []
  
disable-enderpearl-cooldown:
  # Disables enderpearl cooldown
  enabled: true
  worlds: []
  
old-tool-damage:
  # This is to set the tool damage as in pre-1.9
  # NOTE: this will modify the damage, however on the item tooltip it will still show the 1.9+ damage
  enabled: true
  worlds: []
  # This will allow you to set the damage divider
  # The default values below are obtained by doing (1.8 value)/(1.9 value)
  # Only axes and shovel values changed between the versions, so all others here have a divider of 1
  # We put them here anyway in case you wished to change them.
  # The plugin subtracts the enchantment-added damage,
  # divides the damage done while holding the weapon by the following values,
  # and adds back on the enchantment-added damage.
  damages:
    # Axe damages
    GOLD_AXE: 2.333333
    WOOD_AXE: 2.333333
    STONE_AXE: 2.25
    IRON_AXE: 1.8
    DIAMOND_AXE: 1.5
    # Shovel damages
    GOLD_SPADE: 2.5
    WOOD_SPADE: 2.5
    STONE_SPADE: 1.75
    IRON_SPADE: 1.5
    DIAMOND_SPADE: 1.375
    # Sword damages
    GOLD_SWORD: 1
    WOOD_SWORD: 1
    STONE_SWORD: 1
    IRON_SWORD: 1
    DIAMOND_SWORD: 1
    # Pickaxe damages
    GOLD_PICKAXE: 1
    WOOD_PICKAXE: 1
    STONE_PICKAXE: 1
    IRON_PICKAXE: 1
    DIAMOND_PICKAXE: 1
    # Hoe damages
    GOLD_HOE: 1
    WOOD_HOE: 1
    STONE_HOE: 1
    IRON_HOE: 1
    DIAMOND_HOE: 1

sword-blocking:
  # This is to allow players to block with swords again by getting a shield while they hold right click with a sword
  enabled: false
  worlds: []
  # How much damage should blocking reduce
  # This can either be a number in half-hearts (e.g 2) or a percentage (e.g. 20%)
  # 1.8 default: 50%             1.9 default: 33%
  blockingDamageReduction: 50%
  # Whether shields can block damage entirely
  # In 1.8 blocking could only reduce to 1/2 a heart
  shieldFullBlock: false
  # The minimum amount of damage, in half-hearts, if shieldFullBlock is enabled
  minimumDamage: 1.0
  # How often, it ticks, should OCM check if the player is still blocking with the shield and remove it if not
  # If this is too fast the player will have their shield disappear before they're able to block again causing a slight delay
  # If this is too slow players will have a shield in their hand well after they've stopped blocking
  # 20 ticks = 1 second
  restoreDelay: 40
  # List of items that holding in the offhand while right-clicking with a sword doesn't trigger blocking e.g. bow
  noBlockingItems: []
  # Whether the above list should act as a blacklist (i.e. only items in it stop the blocking mechanic)
  blacklist: true

old-golden-apples:
  # This is to change the behaviour / crafting of golden apples to how it was in pre-1.9
  # WARNING: If on 1.12 or above and you disable this module you must reload the server for the recipe to disappear
  enabled: true
  worlds: []
  # If you want to allow enchanted golden apple crafting
  enchanted-golden-apple-crafting: true
  # Enabling this makes the potion effects gained by eating golden apples
  # and enchanted golden apples the same as it was in pre-1.9
  old-potion-effects: true
  # Potion effects golden apples should apply
  # Duration is in ticks (20 ticks = 1 second)
  # Amplifier is potion level -1, so Regeneration IV would be amplifier 3
  gapple-effects:
    regeneration:
      duration: 100
      amplifier: 1
    absorption:
      duration: 2400
      amplifier: 0
  # Potion effects enchanted golden apples should apply
  napple-effects:
    regeneration:
      duration: 600
      amplifier: 4
    damage_resistance:
      duration: 6000
      amplifier: 0
    fire_resistance:
      duration: 6000
      amplifier: 0
    absorption:
      duration: 2400
      amplifier: 0
  # Enable this if you have another plugin which adds a crafting recipe for
  # enchanted golden apples (requires server restart)
  no-conflict-mode: false

old-fishing-knockback:
  # This is to make the knockback of players when they get hit by a fishing bobber the same as it was in pre-1.9
  # Credit to HyKurtis for the original code, optimised by Rayzr522
  enabled: false
  worlds: []
  # This makes OCM check if other plugins are stopping the rod damage and follow their choice
  # Set to false to always have rod damage
  checkCancelled: false
  # This is the damage done by the fishing rod attack
  damage: 0.2
  # Whether the EntityDamageEvent should be used instead of the EntityDamageByEntityEvent
  # Set to true when using plugins like NCP that check range
  useEntityDamageEvent: false
  
projectile-knockback:
  # This adds knockback and/or damage to players when they get hit by snowballs, eggs & enderpearls
  # This has been a Bukkit bug for so long people thought it was vanilla when it was recently patched
  enabled: true
  worlds: []
  # This is the damage done by each projectile
  damage:
    snowball: 0.1
    egg: 0.1
    ender_pearl: 0.1

old-player-regen:
  # This is to make players' regeneration act mostly like it did in pre-1.9
  # It's hard to make it behave exactly like before, but in general this makes it work like in pre-1.9
  enabled: true
  worlds: []
  # How often, in seconds, a player should regenerate health
  frequency: 3
  # How many half-hearts the player should heal by, every seconds specified above
  amount: 1
  # How much exhaustion healing should give to the player. In 1.8: 3 In 1.9: 4 in 1.11: 6
  # If, after adding this, Minecraft finds the value is above 4, it subtracts 4
  # and either reduces saturation or, if saturation is 0, reduces food level by 1 (1/2 a stick)
  exhaustion: 3

old-armour-strength:
  # This is to set armour strength values as in pre-1.9
  enabled: true
  worlds: []
  # The higher the armour toughness value the closer the damage done while wearing armour is to pre-1.9 values
  toughness: 9999
  # This is to change the armour strength values if you so wish
  strength:
    # Leather armour
    LEATHER_HELMET: 1
    LEATHER_CHESTPLATE: 3
    LEATHER_LEGGINGS: 2
    LEATHER_BOOTS: 1
    # Chainmail armour
    CHAINMAIL_HELMET: 2
    CHAINMAIL_CHESTPLATE: 5
    CHAINMAIL_LEGGINGS: 4
    CHAINMAIL_BOOTS: 1
    # Golden armour
    GOLD_HELMET: 2
    GOLD_CHESTPLATE: 5
    GOLD_LEGGINGS: 3
    GOLD_BOOTS: 1
    # Iron armour
    IRON_HELMET: 2
    IRON_CHESTPLATE: 6
    IRON_LEGGINGS: 5
    IRON_BOOTS: 2
    # Diamond armour
    DIAMOND_HELMET: 3
    DIAMOND_CHESTPLATE: 8
    DIAMOND_LEGGINGS: 6
    DIAMOND_BOOTS: 3
    
disable-projectile-randomness:
  # This is to remove projectile randomness while firing arrows with a bow
  # This is actually a very old feature and has been in the game for quite some time
  enabled: false
  worlds: []
    
disable-bow-boost:
  # This is to stop players from boosting themselves forward by hitting themselves
  # while running with a punch II arrow from their bow
  # This module just stops them from hitting themselves with arrows entirely
  enabled: false
  worlds: []

################################
#### SPECIAL SETTINGS BELOW ####
################################
  
# This enables debug messages, only enable when troubleshooting
debug:
  enabled: true

# DO NOT CHANGE THIS NUMBER AS IT WILL RESET YOUR CONFIG
config-version: 23

# Not added yet
old-potion-effects:
  # This is to restore the 1.8 potion effects before they were nerfed
  enabled: true
  # Poison potion II
  8228:
    poison:
      duration: 440
      amplifier: 1????
  # Extended Poison potion
  8260:
    poison:
      duration: 2400
      amplifier: 0????
  # Extended Regeneration potion
  8257:
    regeneration:
      duration: 2400
      amplifier: 0????
commented

You sure about that? In every image above, the debug text reads 100% identical. Maybe you're reading the Enchantment Damage: 0 which, being the sword doesn't have any Enchants (nothing Vanilla), it wouldn't be having any added, so 0 is normal. The player was indeed taking damage though.

Here's one with the player wearing some really powerful armor and taking a hit:
armored_player

I'll go whack a Slime, like how I had mentioned originally.

My question though, is why does it show 2 identical debug outputs per entity hit?

commented

Well... I'm tired... I didn't quite register what I was seeing..
The debug message should only show once per EntityDamageByEntityEvent, I don't know why it is showing twice. Although I do recall changing something to do with that debug message recently, what version of the plugin are you using?

commented

OCM 1.6.2 build 60
Spigot 1.11.2

commented

Please try the latest test version from the new Jenkins server

commented

That's technically the one I am using, I just had gotten it from LuckPerms build server:
https://ci.lucko.me/job/OldCombatMechanics/changes

However, it does appear to be 2kb smaller... ๐Ÿ˜Ÿ
Boy will I feel like a total dumbass if getting them on Luck's CI is why I've been having these issues! ๐Ÿ˜ญ I'll go re-test all my submitted issues now... *facepalm*

commented

Alright to update: Using the OCM from YOUR build server has not changed how anything appears to be functioning, so thus far all of my Issue posts are still valid. Which is unfortunate since it would've been nice to have been so simple. (Just to spare posting in each Issue... the Armor-related error still occurs on world-change, join, quit. The fishing rod still does not cause any Debug text for neither the direct hit nor bobber methods of combat)

Anyways, attacking with the sword still yields two Debug events per swing, per entity.
Here's an action-shot of it happening:

sweep-many-slimes

HOWEVER....
After testing once again with a vanilla Diamond Sword, no enchants, with 3 Slimes in striking distance...
Results are:
6 Debug Messages
First 2 Debug Messages were for 7 Damage, remaining 4 were for 1 Damage
In between the 2 "Sweep" attack sets of Debug Messages was a [ModuleSwordSweep] Cancelling sweep...

With that information I've determined that OCM does not seem to handle any plugins that intercept/modify player attacks.
For example:

  1. RPGItem weapons with their modified damage cause Sweeps to occur and Whip's (Fishing Rods) to not do damage every time. Therefore, it was plausible for RodFix to have actually been helping and not placebo as mentioned in #132
  2. mcMMO's "Serrated Strike" ability, not 100% certain on this one, but it says it'll do 25% Damage AoE. One would thus expect that when activated on a vanilla weapon still, that the "Cancelling sweep" message would still show up. This doesn't happen but from what I can see, the mcMMO damage is being correctly applied, as the slime hit with the AoE receive 2 damage instead of 8, which is 25%.

I'll try and come up with other plugins we're using that cause similar issues as I come across them.

commented

In your armour stand trial it says the attack did 0 damage... You should try hitting an animal or another player and reading the debug messages, and then the same with some other animals nearby

commented

There have been some incompatibility issues between OCM and mcMMO before, such as issue #94

commented

Beings that I"m not a coder, and thus have pretty much no clue what I'm talking about, is there no way for a plugin to flag itself as the last one called in a chain so that it executes whatever it's doing after all the others? For instance, having OCM be the final plugin to intercept an attack to apply the removal of Sweeping Attack, only after RPGItems has touched the damage level?

I only ask since what seems to be happening is OCM intercepts it first, removes the Sweep, then RPG adjusts the damage, which for some reason resets (in Minecraft's eyes) the attack, causing Sweep to be applied again.

All-in-all, there's no way for OCM to easily address these issues? :\
While I've had luck with doing this in the past (fixed ConquestiaMob's issue with MultiVerse words), I don't suppose that simply changing the load-order so that OCM is the final one that loads, would somehow help?

commented

Well yes, you can change the priority of the listener. The problem is that we must work out if it's a sweep attack from the fact that it only does 1 damage (or with sweeping edge, more, but a defined amount).

I don't know if changing to after the damage has been changed make it unable to detect the attacks

commented

When you say "sweep attack" and "sweeping edge", are those two completely different things present in Vanilla? The extent of my exposure to Vanilla anything has been pretty much zero since as far back as like v1.4, so I was only aware of the one Sweeping Attack that was added, and thought they were all the same.

With a totally Vanilla Diamond Sword taken from the Creative Menu, the OCM Debug message reports that it does 8dmg to the main target and 1dmg to the surrounding targets. Sweep gets canceled though!
With an RPGItem Diamond Sword with modified damage (lets say 20), the Debug message reports that it does 20dmg to the main target and 20dmg to the surrounding targets. Sweep is not canceled, and the aforementioned targets receive the 20dmg.

commented

I believe sweeping edge is the enchantment that increases the amount of damage done by the sweep attack

commented

Yea this shouldn't be the enchant then. I can check with NBTExplorer in case somehow RPGItem is adding it, but I doubt it heh

commented

I've just tested this feature in my test server and it works as intended. So again, this is a plugin conflict. What is the exact weapon that is causing the problem and its features? Does the error still occur with a normal weapon?

commented

Vanilla weapons with vanilla enchantments appears to work just fine. As I mentioned, those items, the debug text says that the Sweep is canceled, and as such OCM is working as intended.

The problem comes down to the RPGItems [link to the plugins Releases page] created sword weapons, which have more damage. You might be able to tell by looking at their code how they go about delivering that damage to the entity you're attacking. Perhaps it's utilizing the old/alternative method EntityDamageEvent (that you have in the Fishing Rod section), instead of the new damage method of EntityDamageByEntityEvent?

While I test the Fishing Rods while only having OCM and a couple non-weapon/item/damage plugins running, I'll then load RPGItems afterwards to see if OCM and RPGItem weapons still misbehave.