{
HumanEntity he = event.getPlayer();
if (!(he instanceof Player)) return;
Player pl = (Player) he;
AutoRefMatch match = plugin.getMatch(pl.getWorld());
AutoRefPlayer apl = match == null ? null : match.getPlayer(pl);
if (match == null || apl == null)
{ return; }
if (apl.getTeam() == null)
{ return; }
GoalsInventorySnapshot before = apl.getBeforeOpeningInventorySnapshot();
GoalsInventorySnapshot snap = apl.getCarrying();
if (before == null)
{ return; }
MapDifference<BlockData, Integer> diff = before.getDiff(snap);
if (diff.areEqual())
{ return; }
GoalsInventorySnapshot droppedOff = GoalsInventorySnapshot.fromDiff(diff, true);
GoalsInventorySnapshot pickedUp = GoalsInventorySnapshot.fromDiff(diff, false);
if (!droppedOff.isEmpty() && !pickedUp.isEmpty())
{
match.addEvent(new TranscriptEvent(match,
TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
// {player} has dropped off {snap} and picked up {snap} from a {container} (@ {loc})
"%s has dropped off %s and picked up %s from a %s (@ %s)", apl.getDisplayName(),
droppedOff, pickedUp, apl.getInventoryDescription(),
LocationUtil.toBlockCoords(apl.getInventoryLocation())),
apl.getInventoryLocation(), unpack2(droppedOff, pickedUp, apl)
));
}
else if (!droppedOff.isEmpty())
{
match.addEvent(new TranscriptEvent(match,
TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
// {player} has dropped off {snap} in a {container} (@ {loc})
"%s has dropped off %s in a %s (@ %s)", apl.getDisplayName(),
droppedOff, apl.getInventoryDescription(),
LocationUtil.toBlockCoords(apl.getInventoryLocation())),
apl.getInventoryLocation(), unpack(droppedOff, apl)
));
}
else if (!pickedUp.isEmpty())
{
match.addEvent(new TranscriptEvent(match,
TranscriptEvent.EventType.OBJECTIVE_DETAIL, String.format(
// {player} has picked up {snap} from a {container} (@ {loc})
"%s has picked up %s from a %s (@ %s)", apl.getDisplayName(),
pickedUp, apl.getInventoryDescription(),
LocationUtil.toBlockCoords(apl.getInventoryLocation())),