if ( m.getType() instanceof MiscType && ((MiscType)m.getType()).isVibroblade() && clientgui.getClient().game.getPhase() != IGame.PHASE_PHYSICAL ){ clientgui.systemMessage(Messages.getString("MechDisplay.VibrobladeModePhase",null)); return; }
    public void itemStateChanged(ItemEvent ev) {        if(ev.getItemSelectable() == locList) {            m_chMode.removeAll();            m_chMode.setEnabled(false);            displaySlots();        }        else if (ev.getItemSelectable() == slotList) {            m_bDumpAmmo.setEnabled(false);            m_chMode.setEnabled(false);            modeLabel.setEnabled(false);            Mounted m = getSelectedEquipment();            boolean bOwner = (clientgui.getClient().getLocalPlayer() == en.getOwner());            if ( m != null && bOwner && m.getType() instanceof AmmoType                 && !(m.getType().hasInstantModeSwitch())                 && IGame.PHASE_DEPLOYMENT != clientgui.getClient().game.getPhase()                 && m.getShotsLeft() > 0 && !m.isDumping() && en.isActive() ) {                m_bDumpAmmo.setEnabled(true);            }            else if (m != null && bOwner && m.getType().hasModes()) {                if (!m.isDestroyed() && en.isActive()) {                    m_chMode.setEnabled(true);                }                if (!m.isDestroyed() && m.getType().hasFlag(MiscType.F_STEALTH)) {                    m_chMode.setEnabled(true);                }//if the maxtech eccm option is not set then the ECM should not show anything.                if (m.getType().hasFlag(MiscType.F_ECM)                    && !clientgui.getClient().game.getOptions().booleanOption("maxtech_eccm") ) {                    m_chMode.removeAll();                    return;                }                modeLabel.setEnabled(true);                m_chMode.removeAll();                for (Enumeration e = m.getType().getModes(); e.hasMoreElements();) {                    EquipmentMode em = (EquipmentMode) e.nextElement();                    m_chMode.add(em.getDisplayableName());                }                m_chMode.select(m.curMode().getDisplayableName());            }            else {                CriticalSlot cs = getSelectedCritical();                if(cs != null && cs.getType() == CriticalSlot.TYPE_SYSTEM) {                    if(cs.getIndex() == Mech.SYSTEM_COCKPIT                       && en.hasEiCockpit()                       && en instanceof Mech) {                        m_chMode.removeAll();                        m_chMode.setEnabled(true);                        m_chMode.add("EI Off");                        m_chMode.add("EI On");                        m_chMode.add("Aimed shot");                        m_chMode.select(((Mech)en).getCockpitStatusNextRound());                    }                }            }        }        else if (ev.getItemSelectable() == m_chMode) {            Mounted m = getSelectedEquipment();            CriticalSlot cs = getSelectedCritical();            if (m != null && m.getType().hasModes()) {                int nMode = m_chMode.getSelectedIndex();                if (nMode >= 0) {                                        if ( m.getType() instanceof MiscType                             && ((MiscType)m.getType()).isShield()                               && clientgui.getClient().game.getPhase() != IGame.PHASE_FIRING ){                        clientgui.systemMessage(Messages.getString("MechDisplay.ShieldModePhase",null));//$NON-NLS-1$                        return;                    }                                            m.setMode(nMode);                                        // send the event to the server                    clientgui.getClient().sendModeChange(en.getId(), en.getEquipmentNum(m), nMode);                                        // notify the player                    if (m.getType().hasInstantModeSwitch()) {                                            clientgui.systemMessage(Messages.getString("MechDisplay.switched", new Object[]{m.getName(),m.curMode().getDisplayableName()}));//$NON-NLS-1$                    }                    else {                        if (IGame.PHASE_DEPLOYMENT == clientgui.getClient().game.getPhase() ) {                                                    clientgui.systemMessage(Messages.getString("MechDisplay.willSwitchAtStart", new Object[]{m.getName(),m.pendingMode().getDisplayableName()}));//$NON-NLS-1$                        } else{                             clientgui.systemMessage(Messages.getString("MechDisplay.willSwitchAtEnd", new Object[]{m.getName(),m.pendingMode().getDisplayableName()}));//$NON-NLS-1$                        }                    }                }            }            else if(cs != null && cs.getType() == CriticalSlot.TYPE_SYSTEM) {                int nMode = m_chMode.getSelectedIndex();                if (nMode >= 0) {                    if(cs.getIndex() == Mech.SYSTEM_COCKPIT                       && en.hasEiCockpit()                       && en instanceof Mech) {                        Mech mech = (Mech)en;                        mech.setCockpitStatus(nMode);                        clientgui.getClient().sendSystemModeChange(en.getId(), Mech.SYSTEM_COCKPIT, nMode);                        if(mech.getCockpitStatus() == mech.getCockpitStatusNextRound()) {                            clientgui.systemMessage(Messages.getString("MechDisplay.switched", new Object[]{"Cockpit",m_chMode.getSelectedItem()}));//$NON-NLS-1$                        } else {                            clientgui.systemMessage(Messages.getString("MechDisplay.willSwitchAtEnd", new Object[]{"Cockpit",m_chMode.getSelectedItem()}));//$NON-NLS-1$                        }                    }                }            }        }    }