Files
DeltaZern/paper-server/src/test/java/io/papermc/paper/block/InstrumentSoundTest.java
T
Jake Potrebic 2b90721a45 fix Instruments
properly handle Player#playNote
2022-12-09 01:47:23 -08:00

29 lines
1.0 KiB
Java

package io.papermc.paper.block;
import java.util.Arrays;
import java.util.stream.Stream;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import org.bukkit.Instrument;
import org.bukkit.craftbukkit.CraftSound;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.support.environment.AllFeatures;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
@AllFeatures
class InstrumentSoundTest {
static Stream<Instrument> bukkitInstruments() {
return Arrays.stream(Instrument.values()).filter(i -> i.getSound() != null);
}
@ParameterizedTest
@MethodSource("bukkitInstruments")
void checkInstrumentSound(final Instrument bukkit) {
final NoteBlockInstrument nms = CraftBlockData.toNMS(bukkit, NoteBlockInstrument.class);
assertEquals(nms.getSoundEvent(), CraftSound.bukkitToMinecraftHolder(bukkit.getSound()));
}
}