public void customizeMech(Entity entity) { boolean editable = clientgui.getBots().get(entity.getOwner().getName()) != null; Client c; if (editable) { c = (Client) clientgui.getBots().get(entity.getOwner().getName()); } else { editable |= entity.getOwnerId() == client.getLocalPlayer().getId(); c = client;
private void customizeMech() { if (lisEntities.getSelectedIndex() == -1) { return;
    public void customizeMech(Entity entity) {        boolean editable = clientgui.getBots().get(entity.getOwner().getName()) != null;        Client c;        if (editable) {            c = (Client) clientgui.getBots().get(entity.getOwner().getName());        } else {            editable |= entity.getOwnerId() == client.getLocalPlayer().getId();            c = client;        }        // When we customize a single entity's C3 network setting,        // **ALL** members of the network may get changed.        Entity c3master = entity.getC3Master();        ArrayList<Entity> c3members = new ArrayList<Entity>();        Enumeration playerUnits = c.game.getPlayerEntities(c.getLocalPlayer()).elements();        while (playerUnits.hasMoreElements()) {            Entity unit = (Entity) playerUnits.nextElement();            if (!entity.equals(unit) && entity.onSameC3NetworkAs(unit)) {                c3members.add(unit);            }        }        // display dialog        CustomMechDialog cmd = new CustomMechDialog(clientgui, c, entity, editable);        cmd.refreshOptions();        cmd.setTitle(entity.getShortName());        cmd.setVisible(true);        if (editable && cmd.isOkay()) {            // send changes            c.sendUpdateEntity(entity);            // Do we need to update the members of our C3 network?            if ((c3master != null && !c3master.equals(entity.getC3Master()))                    || (c3master == null && entity.getC3Master() != null)) {                for (Entity unit : c3members) {                    c.sendUpdateEntity(unit);                }            }        }    }