'use strict';

module.exports = (srcPath) => {
  const Broadcast = require(srcPath + 'Broadcast');
  const Parser = require(srcPath + 'CommandParser').CommandParser;

  return {
    aliases: [ 'unwield', 'unequip' ],
    usage: 'remove <item>',
    command : state => (arg, player) => {
      if (!arg.length) {
        return Broadcast.sayAt(player, 'Remove what?');
      }

      const [slot, item] = Parser.parseDot(arg, player.equipment, true);

      if (!item) {
        return Broadcast.sayAt(player, "You aren't wearing anything like that.");
      }

      player.unequip(slot);

      Broadcast.sayAt(player, `<green>You un-equip: </green>${item.display}<green>.</green>`);

      item.emit('unequip', player);
      player.emit('unequip', slot, item);
    }
  };
};

@@ -386,22 +386,17 @@
 nst 
-%5Bslot, item%5D =
+result = 
  Par
@@ -438,17 +438,16 @@
  true);%0A
-%0A
       if
@@ -449,20 +449,22 @@
    if (!
-item
+result
 ) %7B%0A    
@@ -546,24 +546,59 @@
 );%0A      %7D%0A%0A
+      const %5Bslot, item%5D = result;%0A
       player
@@ -709,17 +709,16 @@
 een%3E%60);%0A
-%0A
       it

Fix node error when trying to remove invalid equipment