mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
SPIGOT-2924: Improve handling of Jukeboxes playing nothing.
By: md_5 <git@md-5.net>
This commit is contained in:
parent
d69f49d486
commit
fe586949bf
1 changed files with 3 additions and 4 deletions
|
@ -29,7 +29,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
|
|||
@Override
|
||||
public Material getPlaying() {
|
||||
ItemStack record = jukebox.getRecord();
|
||||
if (record == null) {
|
||||
if (record.isEmpty()) {
|
||||
return Material.AIR;
|
||||
}
|
||||
return CraftMagicNumbers.getMaterial(record.getItem());
|
||||
|
@ -39,10 +39,9 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
|
|||
public void setPlaying(Material record) {
|
||||
if (record == null || CraftMagicNumbers.getItem(record) == null) {
|
||||
record = Material.AIR;
|
||||
jukebox.setRecord(null);
|
||||
} else {
|
||||
jukebox.setRecord(new ItemStack(CraftMagicNumbers.getItem(record), 1));
|
||||
}
|
||||
|
||||
jukebox.setRecord(new ItemStack(CraftMagicNumbers.getItem(record), 1));
|
||||
if (!isPlaced()) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue