Search in sources :

Example 1 with Recall

use of org.cubeengine.module.vigil.report.Recall in project modules-extra by CubeEngine.

the class BreakBlockReport method showReport.

@Override
public void showReport(List<Action> actions, Receiver receiver) {
    Action action = actions.get(0);
    Optional<BlockSnapshot> orig = action.getCached(BLOCKS_ORIG, Recall::origSnapshot);
    if (!orig.isPresent()) {
        throw new IllegalStateException();
    }
    showReport(actions, receiver, action, orig.get());
}
Also used : Action(org.cubeengine.module.vigil.report.Action) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) Recall(org.cubeengine.module.vigil.report.Recall)

Example 2 with Recall

use of org.cubeengine.module.vigil.report.Recall in project modules-extra by CubeEngine.

the class ModifyBlockReport method showReport.

@Override
public void showReport(List<Action> actions, Receiver receiver) {
    Action action = actions.get(0);
    Optional<BlockSnapshot> orig = action.getCached(BLOCKS_ORIG, Recall::origSnapshot);
    Optional<BlockSnapshot> repl = action.getCached(BLOCKS_REPL, Recall::replSnapshot);
    Text cause = Recall.cause(action);
    if (!repl.isPresent() || !orig.isPresent()) {
        throw new IllegalStateException();
    }
    Optional<MutableBoundedValue<Integer>> growth = repl.get().getValue(Keys.GROWTH_STAGE);
    if (growth.isPresent()) {
        if (growth.get().get().equals(growth.get().getMaxValue())) {
            receiver.sendReport(this, actions, actions.size(), "{txt} let {txt} grow to maturity", "{txt} let {txt} grow to maturity x{}", cause, name(orig.get(), receiver), actions.size());
            return;
        }
        receiver.sendReport(this, actions, actions.size(), "{txt} let {txt} grow", "{txt} let {txt} grow x{}", cause, name(orig.get(), receiver), actions.size());
        return;
    }
    // TODO other modifyables
    receiver.sendReport(this, actions, actions.size(), "{txt} modified {txt}", "{txt} modified {txt} x{}", cause, name(orig.get(), receiver), actions.size());
}
Also used : Action(org.cubeengine.module.vigil.report.Action) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) MutableBoundedValue(org.spongepowered.api.data.value.mutable.MutableBoundedValue) Recall(org.cubeengine.module.vigil.report.Recall) Text(org.spongepowered.api.text.Text)

Example 3 with Recall

use of org.cubeengine.module.vigil.report.Recall in project modules-extra by CubeEngine.

the class PlaceBlockReport method showReport.

@Override
public void showReport(List<Action> actions, Receiver receiver) {
    Action action = actions.get(0);
    Optional<BlockSnapshot> orig = action.getCached(BLOCKS_ORIG, Recall::origSnapshot);
    Optional<BlockSnapshot> repl = action.getCached(BLOCKS_REPL, Recall::replSnapshot);
    if (!repl.isPresent()) {
        throw new IllegalStateException();
    }
    showReport(actions, receiver, action, orig, repl.get());
}
Also used : Action(org.cubeengine.module.vigil.report.Action) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) Recall(org.cubeengine.module.vigil.report.Recall)

Aggregations

Action (org.cubeengine.module.vigil.report.Action)3 Recall (org.cubeengine.module.vigil.report.Recall)3 BlockSnapshot (org.spongepowered.api.block.BlockSnapshot)3 MutableBoundedValue (org.spongepowered.api.data.value.mutable.MutableBoundedValue)1 Text (org.spongepowered.api.text.Text)1