public SettingMap<S, V> decode(byte[] buf) {
        if (buf.length == 0) {
            return newMap();
        }

        ByteArrayDataInput in = ByteStreams.newDataInput(buf);
        int n = Byte.toUnsignedInt(in.readByte());

        byte[] states = Arrays.copyOf(this.defaultStates, this.defaultStates.length);

        for (int i = 0; i < n; i++) {
            int settingOrdinal = Byte.toUnsignedInt(in.readByte());
            byte stateByte = in.readByte();

            states[settingOrdinal] = stateByte;
        }

        return new SettingMap<>(this, states);
    }
Decodes the given byte array to a {@link SettingMap}.

<p>Operates on the reverse of {@link SettingMap#encode()}.</p>

@param buf the byte array
@return the decoded map
helper/src/main/java/me/lucko/helper/setting/SettingMapFactory.java