Deprecate duplicate SoundGroup API (#7509)

This commit is contained in:
Jake Potrebic
2022-04-30 13:44:22 -07:00
parent bce57808da
commit dfa6307b48
4 changed files with 31 additions and 4 deletions

View File

@@ -21,46 +21,58 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Represents the sounds that a {@link Block} makes in certain situations + * Represents the sounds that a {@link Block} makes in certain situations
+ * <p> + * <p>
+ * The sound group includes break, step, place, hit, and fall sounds. + * The sound group includes break, step, place, hit, and fall sounds.
+ * @deprecated use {@link org.bukkit.SoundGroup}
+ */ + */
+@Deprecated(forRemoval = true)
+public interface BlockSoundGroup { +public interface BlockSoundGroup {
+ /** + /**
+ * Gets the sound that plays when breaking this block + * Gets the sound that plays when breaking this block
+ * + *
+ * @return The break sound + * @return The break sound
+ * @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ Sound getBreakSound(); + Sound getBreakSound();
+ +
+ /** + /**
+ * Gets the sound that plays when stepping on this block + * Gets the sound that plays when stepping on this block
+ * + *
+ * @return The step sound + * @return The step sound
+ * @deprecated use {@link org.bukkit.SoundGroup#getStepSound()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ Sound getStepSound(); + Sound getStepSound();
+ +
+ /** + /**
+ * Gets the sound that plays when placing this block + * Gets the sound that plays when placing this block
+ * + *
+ * @return The place sound + * @return The place sound
+ * @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ Sound getPlaceSound(); + Sound getPlaceSound();
+ +
+ /** + /**
+ * Gets the sound that plays when hitting this block + * Gets the sound that plays when hitting this block
+ * + *
+ * @return The hit sound + * @return The hit sound
+ * @deprecated use {@link org.bukkit.SoundGroup#getHitSound()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ Sound getHitSound(); + Sound getHitSound();
+ +
+ /** + /**
+ * Gets the sound that plays when this block falls + * Gets the sound that plays when this block falls
+ * + *
+ * @return The fall sound + * @return The fall sound
+ * @deprecated use {@link org.bukkit.SoundGroup#getFallSound()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ Sound getFallSound(); + Sound getFallSound();
+} +}
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
@@ -79,8 +91,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * This object contains the block, step, place, hit, and fall sounds. + * This object contains the block, step, place, hit, and fall sounds.
+ * + *
+ * @return the sound group for this block + * @return the sound group for this block
+ * @deprecated use {@link #getBlockSoundGroup()}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated(forRemoval = true)
+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup(); + com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
+
+ /**
+ * Gets the {@link org.bukkit.SoundGroup} for this block.
+ *
+ * @return the sound group for this block
+ */
+ @NotNull org.bukkit.SoundGroup getBlockSoundGroup();
+ // Paper end + // Paper end
} }

View File

@@ -225,9 +225,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
* Gets the metadata for this block * Gets the metadata for this block
@@ -0,0 +0,0 @@ public interface Block extends Metadatable { @@ -0,0 +0,0 @@ public interface Block extends Metadatable {
* @return the sound group for this block
*/ */
@NotNull @NotNull org.bukkit.SoundGroup getBlockSoundGroup();
com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
+ +
+ /** + /**
+ * Return the translation key for the Block, so the client can translate it into the active + * Return the translation key for the Block, so the client can translate it into the active

View File

@@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -0,0 +0,0 @@ public class CraftBlock implements Block { @@ -0,0 +0,0 @@ public class CraftBlock implements Block {
public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() { public org.bukkit.SoundGroup getBlockSoundGroup() {
return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType()); return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType());
} }
+ +
+ @Override + @Override

View File

@@ -16,6 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.Sound; +import org.bukkit.Sound;
+import org.bukkit.craftbukkit.CraftSound; +import org.bukkit.craftbukkit.CraftSound;
+ +
+@Deprecated(forRemoval = true)
+public class CraftBlockSoundGroup implements BlockSoundGroup { +public class CraftBlockSoundGroup implements BlockSoundGroup {
+ private final SoundType soundEffectType; + private final SoundType soundEffectType;
+ +
@@ -62,5 +63,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() { + public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {
+ return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType()); + return new com.destroystokyo.paper.block.CraftBlockSoundGroup(getNMS().getBlock().defaultBlockState().getSoundType());
+ } + }
+
+ @Override
+ public org.bukkit.SoundGroup getBlockSoundGroup() {
+ return org.bukkit.craftbukkit.CraftSoundGroup.getSoundGroup(this.getNMS().getSoundType());
+ }
+ // Paper end + // Paper end
} }