use of me.botsko.prism.api.BlockStateChange in project Prism-Bukkit by prism.
the class PrismMiscEvents method onPrismBlocksExtinguishEvent.
/**
* PrismExtinguishEvent.
* @param event PrismExtinguishEvent.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPrismBlocksExtinguishEvent(final PrismExtinguishEvent event) {
// Get all block changes for this event
final ArrayList<BlockStateChange> blockStateChanges = event.getBlockStateChanges();
if (!blockStateChanges.isEmpty()) {
// Create an entry for the rollback as a whole
final Handler primaryAction = ActionFactory.createPrismProcess("prism-process", PrismProcessType.EXTINGUISH, event.onBehalfOf(), "" + event.getRadius());
final long id = RecordingTask.insertActionIntoDatabase(primaryAction);
if (id == 0) {
return;
}
for (final BlockStateChange stateChange : blockStateChanges) {
final BlockState orig = stateChange.getOriginalBlock();
final BlockState newBlock = stateChange.getNewBlock();
// Build the action
RecordingQueue.addToQueue(ActionFactory.createPrismRollback("prism-extinguish", orig, newBlock, event.onBehalfOf(), id));
}
// ActionQueue.save();
}
}
Aggregations