Added player interaction logging for jukeboxes
This commit is contained in:
parent
9da1343f7f
commit
66e32c02bf
1 changed files with 10 additions and 4 deletions
|
|
@ -624,11 +624,11 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||||
|
|
||||||
isCake = type.name().endsWith(Material.CAKE.name());
|
isCake = type.name().endsWith(Material.CAKE.name());
|
||||||
}
|
}
|
||||||
else if (type == Material.JUKEBOX && Config.getConfig(block.getWorld()).ITEM_TRANSACTIONS) {
|
else if (type == Material.JUKEBOX) {
|
||||||
BlockState blockState = block.getState();
|
BlockState blockState = block.getState();
|
||||||
if (blockState instanceof Jukebox) {
|
if (blockState instanceof Jukebox) {
|
||||||
Jukebox jukebox = (Jukebox) blockState;
|
Jukebox jukebox = (Jukebox) blockState;
|
||||||
ItemStack jukeboxRecord = jukebox.getRecord();
|
ItemStack jukeboxRecord = jukebox.isPlaying() ? jukebox.getRecord() : new ItemStack(Material.AIR);
|
||||||
ItemStack oldItemState = jukeboxRecord.clone();
|
ItemStack oldItemState = jukeboxRecord.clone();
|
||||||
ItemStack newItemState = new ItemStack(Material.AIR);
|
ItemStack newItemState = new ItemStack(Material.AIR);
|
||||||
|
|
||||||
|
|
@ -652,8 +652,14 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oldItemState.equals(newItemState)) {
|
if (!oldItemState.equals(newItemState)) {
|
||||||
boolean logDrops = player.getGameMode() != GameMode.CREATIVE;
|
if (Config.getConfig(player.getWorld()).PLAYER_INTERACTIONS) {
|
||||||
PlayerInteractEntityListener.queueContainerSingleItem(player.getName(), Material.JUKEBOX, new ItemStack[] { oldItemState, newItemState }, jukebox.getLocation(), logDrops);
|
Queue.queuePlayerInteraction(player.getName(), blockState, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Config.getConfig(block.getWorld()).ITEM_TRANSACTIONS) {
|
||||||
|
boolean logDrops = player.getGameMode() != GameMode.CREATIVE;
|
||||||
|
PlayerInteractEntityListener.queueContainerSingleItem(player.getName(), Material.JUKEBOX, new ItemStack[] { oldItemState, newItemState }, jukebox.getLocation(), logDrops);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue