use of com.karanumcoding.adamantineshield.db.queue.BlockQueueEntry in project AdamantineShield by Karanum.
the class MobBlockChangeListener method onBlockPlace.
@Listener(order = Order.POST)
public void onBlockPlace(ChangeBlockEvent.Place e, @Root Agent a) {
if (a instanceof Player)
return;
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
String type = a.getType().getName();
if (transaction.getOriginal().getState().getType() != BlockTypes.AIR) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.MOB_DESTROY, type, time));
}
db.addToQueue(new BlockQueueEntry(transaction.getFinal(), ActionType.MOB_PLACE, type, time));
}
}
use of com.karanumcoding.adamantineshield.db.queue.BlockQueueEntry in project AdamantineShield by Karanum.
the class PlayerBlockChangeListener method onBreakCascade.
@Listener(order = Order.POST)
public void onBreakCascade(ChangeBlockEvent.Break e, @Root LocatableBlock b) {
Optional<User> optionalUser = e.getCause().getContext().get(EventContextKeys.NOTIFIER);
if (!optionalUser.isPresent())
return;
User user = optionalUser.get();
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.DESTROY, user.getUniqueId().toString(), time));
}
}
Aggregations