All pastes #382691 Raw Edit

Someone

public text v1 · immutable
·published 2007-03-05 21:02 UTC
rendered paste body
    public boolean find(ClassGen cg) {
        if (!cg.isAbstract()) {
            return false;
        }
        for (Field f : cg.getFields()) {
            if (f.isStatic()) {
                continue;
            }
            if (f.getType().equals(types.get("StringWrapper"))) {
                setClassGen(cg);
                fields.put("getChat", f);
            }
        }
        if (!isFound()) {
            return false;
        }
        ConstantPoolGen cpg = cg.getConstantPool();
        Method m = cg.containsMethod("<init>", "()V");
        if (m == null) {
            return false;
        }
        ByteSequence bytes = new ByteSequence(m.getCode().getCode());
        try {
            Instruction i = Instruction.readInstruction(bytes);
            while (i != null) {
                if (i.equals(sipush)) {
                    Field f = cg.containsField(((FieldInstruction)Instruction.readInstruction(bytes)).getFieldName(cpg));
                    fields.put("getHPBarLastCycle", f);
                    break;
                }
                i = Instruction.readInstruction(bytes);
            }
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }