All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.sound.SoundEventImpl Maven / Gradle / Ivy

package net.minestom.server.sound;

import net.minestom.server.registry.Registry;
import net.minestom.server.utils.NamespaceID;
import org.jetbrains.annotations.NotNull;

import java.util.Collection;

record SoundEventImpl(NamespaceID namespace, int id) implements SoundEvent {
    private static final Registry.Container CONTAINER = Registry.createContainer(Registry.Resource.SOUNDS,
            (namespace, properties) -> new SoundEventImpl(NamespaceID.from(namespace), properties.getInt("id")));

    static SoundEvent get(@NotNull String namespace) {
        return CONTAINER.get(namespace);
    }

    static SoundEvent getSafe(@NotNull String namespace) {
        return CONTAINER.getSafe(namespace);
    }

    static SoundEvent getId(int id) {
        return CONTAINER.getId(id);
    }

    static Collection values() {
        return CONTAINER.values();
    }

    @Override
    public String toString() {
        return name();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy