DualWield 2.1

Off-hand attacking and tool usage, use your weapons and tools in the off-hand! Free and Open Source!

  1. Ranull
    Native Minecraft Version:
    1.16
    Tested Minecraft Versions:
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    Source Code:
    https://gitlab.com/ranull/minecraft/dualwield
    [​IMG]

    A simple lightweight plugin to allow you to fully use tools and weapons in the off-hand, this includes mining and attacking!​

    Compatibility:
    This plugin should be compatible with all protection plugins, plugins that cancel entity damage events and block break events. It should also be compatible with a majority of third party enchantment plugins and even plugins like McMMO. Attacking with an off-hand weapon uses a modified version of Mojangs own attack code so it should react and behave exactly like a a weapon in the main hand! Tools that mine blocks are virtually the same speed as in the main hand, normal enchantments also work. 1.8 PvP plugins are also compatible. Attacking still has a cooldown but it is impossible to show the animation as it is client side.

    VIDEO OF THE PLUGIN
    If someone wants to make a YouTube video on the plugin demonstrating it better I would be more than happy to put it here on the Spigot page.

    [​IMG]Attacking with the off-hand

    [​IMG]
    Mining with the off-hand

    Attack Cooldown Time:
    When you attack with the off-hand the same code is used to calculate the damage as when attacking normally, this includes accounting for spam clicking and cooldown time on attacks. Other plugins that change the attack speed to remove the cooldown will also automatically take effect in the off-hand too!

    Attack Cooldown Animation:
    When attacking with the off-hand players may think that there is no cooldown and they can spam hit since the animation does not play, but in fact the cooldown is taken into account when calculating the damage. It is impossible to play the animation to the player as it's completely client side.

    Permissions:
    dualwield.attack (Default)
    dualwield.mine (Default)

    API:
    The API allows you to check if if the BlockBreakEvent and EntityDamageByEntityEvent event were created by using an off-hand action.
    Code (Java):
    public final class DualWieldAPITest extends JavaPlugin implements Listener {
        DualWieldAPI dualWieldAPI;

        @Override
        public void onEnable() {
            Plugin dualWieldPlugin = getServer().getPluginManager().getPlugin("DualWield");

            if (dualWieldPlugin != null && dualWieldPlugin.isEnabled()) {
                dualWieldAPI = ((DualWield) dualWieldPlugin).getDualWieldAPI();
                getServer().getPluginManager().registerEvents(this, this);
            } else {
                getLogger().severe("DualWield plugin not found!");
                getServer().getPluginManager().disablePlugin(this);
            }
        }

        @EventHandler
        public void onPlayerOffHandAttackEntity(EntityDamageByEntityEvent event) {
            if (!event.isCancelled() && event.getDamager() instanceof Player) {
                Player player = (Player) event.getDamager();

                if (dualWieldAPI.isEntityDamageByEntityEventOffHand(event)) {
                    ItemStack mainHandItem = dualWieldAPI.getItemInMainHand(player);
                    ItemStack offHandItem = dualWieldAPI.getItemInOffHand(player);

                    player.sendMessage("Off-hand attack using " + offHandItem.getType().toString() + ", Main-hand is " + mainHandItem.getType().toString());
                }
            }
        }

        @EventHandler
        public void onPlayerOffHandBreakBlock(BlockBreakEvent event) {
            Player player = event.getPlayer();

            if (!event.isCancelled() && dualWieldAPI.isBlockBreakEventOffHand(event)) {
                ItemStack mainHandItem = dualWieldAPI.getItemInMainHand(player);
                ItemStack offHandItem = dualWieldAPI.getItemInOffHand(player);

                player.sendMessage("Off-hand block break using " + offHandItem.getType().toString() + ", Main-hand is " + mainHandItem.getType().toString());
            }
        }
    }
    For plugin compatibility, for the duration of the events that fire from mining and attacking the items in the players main-hand and off-hand are switched. This will allow plugins that use getItemInMainHand to get the correct item, we also put some NBT data on the item when it is in the off-hand so we can check in EntityDamageByEntityEvent and BlockBreakEvent if it was created using an off-hand item. When using the API it's recommended to use dualWieldAPI.getItemInMainHand(player) rather player.getItemInMainHand(). This is because the main-hand item is really the off-hand and the off-hand is really the main-hand, the NBT data also is removed from the item when you get it using the API.

    Extra:
    If you find any bugs please report them in the discussion and not in the reviews, if you enjoy the plugin I would be grateful if you left a positive review! :)

    [​IMG]
    [​IMG]

Recent Updates

  1. Added 1.16.5 Support
  2. Added 1.16.4 Support
  3. Bug Fixes

Recent Reviews

  1. Saikie
    Saikie
    5/5,
    Version: 2.0
    The plugin and the discord link is not working for me. Could you send me a link to your discord? I need your help.
  2. DJHHM
    DJHHM
    5/5,
    Version: 1.9
    It's so nice, but there's a bug, can you give me a discord link? Links on this site cannot be accessed! Here is my google email! [email protected]
    Contact us here!
    1. Ranull
      Author's Response
      Thanks for the review! I fixed the Discord link so you can join and report the bug you are having.
  3. Partridge420x
    Partridge420x
    5/5,
    Version: 1.9
    Excellent release as always Thanks for updating to 1.16.4
    10/10 would download again
    1. Ranull
      Author's Response
      Thanks for the review! :)
  4. k1ngbra1n
    k1ngbra1n
    3/5,
    Version: 1.9
    I can't use the permissions? I keep on writing dualwield.attack but it doesn't word :(
    1. Ranull
      Author's Response
      Players should have this permission by default, I fixed a bug relating to servers running on Windows in the latest release. If you need help you can join the Discord or use the Discussion, reviews are not the best place for bug reports.
  5. MeninoGrevius
    MeninoGrevius
    5/5,
    Version: 1.9
    Amazing work and amazing developer! I was not able to run it on 1.16.4, but Ranull already is working on a new .jar file and it's available on his discord. Also he was totally available to help, I appreciate it! Thank you
    1. Ranull
      Author's Response
      Thanks for the review! :)
  6. Roxxon
    Roxxon
    5/5,
    Version: 1.9
    I am truly amazed how well this works. I purchased another dual wielding plugin some time ago, but was ultimately dissatisfied with it. This however...is perfect. And it's free! :D
    1. Ranull
      Author's Response
      Thanks for the review! :)
  7. BluBuuui
    BluBuuui
    5/5,
    Version: 1.9
    This is a great and simple plugin! Especially since it's completely free. Thank you so much!
    1. Ranull
      Author's Response
      Thanks for the review! :)
  8. crston
    crston
    5/5,
    Version: 1.9
    In fact, this plugin works better than RealDualwield! He's a good developer, Oh, my God!!
    1. Ranull
      Author's Response
      Thanks for the review! :)
  9. Oathkeeper
    Oathkeeper
    5/5,
    Version: 1.8
    Quality update which fixed a minor annoyance. Didn't even realize the unbreakable tag wasn't being detected.
    1. Ranull
      Author's Response
      Thanks for the review! :)
  10. Minestick
    Minestick
    5/5,
    Version: 1.7
    A lightweight and efficient dualwielding plugin! Perfect for SMP and RPG server!
    1. Ranull
      Author's Response
      Thanks for the review! :)