3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00

Deprecate duplicate SoundGroup API (#7509)

Dieser Commit ist enthalten in:
Jake Potrebic 2022-04-30 13:44:22 -07:00 committet von GitHub
Ursprung e564110f9e
Commit e5da93a608
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
7 geänderte Dateien mit 48 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -7,10 +7,10 @@ This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup
diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74f4706545 index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aae3ae3e2f
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java +++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
@@ -0,0 +1,52 @@ @@ -0,0 +1,64 @@
+package com.destroystokyo.paper.block; +package com.destroystokyo.paper.block;
+ +
+import org.bukkit.Sound; +import org.bukkit.Sound;
@ -21,53 +21,65 @@ index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74
+ * 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
index b101f5264bdde8bd14913d5161c1047020830f8d..7ea765d5d653b1b84e73fd8c4d9d923049bd06ff 100644 index b101f5264bdde8bd14913d5161c1047020830f8d..db441e463b02ee734f85c855f5538cd41041dbae 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -606,4 +606,16 @@ public interface Block extends Metadatable { @@ -606,4 +606,25 @@ public interface Block extends Metadatable {
* @return <code>true</code> if the block data can be placed here * @return <code>true</code> if the block data can be placed here
*/ */
boolean canPlace(@NotNull BlockData data); boolean canPlace(@NotNull BlockData data);
@ -79,8 +91,17 @@ index b101f5264bdde8bd14913d5161c1047020830f8d..7ea765d5d653b1b84e73fd8c4d9d9230
+ * 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
} }

Datei anzeigen

@ -212,7 +212,7 @@ index 13eac9ad2c1672051635d1c35cc49239252e7a61..107e36ef02a9481954bd770ce9a55a0b
+ // Paper end + // Paper end
} }
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
index c88c4223928c2e47f1a85b73165cf433806677df..7124f7134a0afb355c01cac9e0187164f9630bcd 100644 index 1e7ee68e56f8d4399c2cbf26aa45bf8b599b3b02..2c837ea822f3b0c4ec312f0c956fe1b778cbd5e9 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
@ -224,10 +224,10 @@ index c88c4223928c2e47f1a85b73165cf433806677df..7124f7134a0afb355c01cac9e0187164
/** /**
* Gets the metadata for this block * Gets the metadata for this block
@@ -637,5 +637,15 @@ public interface Block extends Metadatable { @@ -646,5 +646,15 @@ 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

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
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
index 7124f7134a0afb355c01cac9e0187164f9630bcd..839867cd0a92fc0ea2b9ea009b67a841f8c7edd6 100644 index 3f1c58e813afe90eaf467e0b76949ed8df752939..68a91de4ab068fd32dc883a9427475c07218941e 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -647,5 +647,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran @@ -656,5 +656,29 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
@NotNull @NotNull
@Deprecated @Deprecated
String getTranslationKey(); String getTranslationKey();

Datei anzeigen

@ -6,16 +6,17 @@ Subject: [PATCH] Implement CraftBlockSoundGroup
diff --git a/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java diff --git a/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..9a516520d975f52169e346adc4ec6d9db843db2f index 0000000000000000000000000000000000000000..c5b07ec346105d1b95c1c938ffca12a21642040c
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java +++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java
@@ -0,0 +1,38 @@ @@ -0,0 +1,39 @@
+package com.destroystokyo.paper.block; +package com.destroystokyo.paper.block;
+ +
+import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.SoundType;
+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;
+ +
@ -49,10 +50,10 @@ index 0000000000000000000000000000000000000000..9a516520d975f52169e346adc4ec6d9d
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index ba8f9ffed49bf377be8b37532d4f2bdcb8c44d82..250185af0abcfea380cc00e670c0076f7fe87446 100644 index ba8f9ffed49bf377be8b37532d4f2bdcb8c44d82..4ae3c0b2c240f01a1fcea0b02616e91e057a297a 100644
--- 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
@@ -644,4 +644,11 @@ public class CraftBlock implements Block { @@ -644,4 +644,16 @@ public class CraftBlock implements Block {
return iblockdata.canSurvive(world, this.position); return iblockdata.canSurvive(world, this.position);
} }
@ -62,5 +63,10 @@ index ba8f9ffed49bf377be8b37532d4f2bdcb8c44d82..250185af0abcfea380cc00e670c0076f
+ 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
} }

Datei anzeigen

@ -6,12 +6,12 @@ Subject: [PATCH] Add methods to get translation keys
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com> Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 945553bfe218a16ebe4abbb11e0723b6d8fc4910..e116ccfa4878636073cc4cdcf680683cda88d314 100644 index ea3358905dcd39a1a855d98570457c65dcd7513d..396fb96abed1e77893d8ee8a15cff18cad804475 100644
--- 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
@@ -663,5 +663,15 @@ public class CraftBlock implements Block { @@ -668,5 +668,15 @@ 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

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 4bbaf22f449af42eba1307604e3860ea8b60a38c..25794fca0c10b262a696ecec9c736a991e8f357d 100644 index 2c1efaecf220588d8b74946194bf340871e57004..653dcec33f83ab490af424faa6ede7df07d41742 100644
--- 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
@@ -673,5 +673,26 @@ public class CraftBlock implements Block { @@ -678,5 +678,26 @@ public class CraftBlock implements Block {
public String translationKey() { public String translationKey() {
return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
} }

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/ma
index 3430bf2c05f9dc47a7483327bee4c04e4d87349e..56fd99224edf9041104a540fd14ba3468af4805e 100644 index 3430bf2c05f9dc47a7483327bee4c04e4d87349e..56fd99224edf9041104a540fd14ba3468af4805e 100644
--- 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
@@ -713,5 +713,9 @@ public class CraftBlock implements Block { @@ -718,5 +718,9 @@ public class CraftBlock implements Block {
} }
return speed; return speed;
} }