public static Explosive register(Explosive zhaPin) { if (!isRegistered(zhaPin)) { int nextID = maxID++; idToExplosiveMap.put(nextID, zhaPin); idToNameMap.put(nextID, zhaPin.getUnlocalizedName()); return zhaPin; } return null; }
public static boolean isRegistered(Explosive explosive) { return idToNameMap.containsKey(explosive.getUnlocalizedName()); }