13
0
geforkt von Mirrors/Paper

SPIGOT-2924: Improve handling of Jukeboxes playing nothing.

Dieser Commit ist enthalten in:
md_5 2016-12-17 09:45:14 +11:00
Ursprung 0a6a5cb4ad
Commit 217358e845

Datei anzeigen

@ -29,7 +29,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
@Override @Override
public Material getPlaying() { public Material getPlaying() {
ItemStack record = jukebox.getRecord(); ItemStack record = jukebox.getRecord();
if (record == null) { if (record.isEmpty()) {
return Material.AIR; return Material.AIR;
} }
return CraftMagicNumbers.getMaterial(record.getItem()); return CraftMagicNumbers.getMaterial(record.getItem());
@ -39,10 +39,9 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
public void setPlaying(Material record) { public void setPlaying(Material record) {
if (record == null || CraftMagicNumbers.getItem(record) == null) { if (record == null || CraftMagicNumbers.getItem(record) == null) {
record = Material.AIR; 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()) { if (!isPlaced()) {
return; return;
} }