use of com.skelril.skree.service.internal.zone.ZoneStatus in project Skree by Skelril.
the class ZoneMeCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
ZoneService service = Sponge.getServiceManager().provide(ZoneService.class).get();
service.requestZone(args.<String>getOne("zone").get(), (Player) src, () -> {
src.sendMessage(Text.of(TextColors.YELLOW, "Job completed."));
}, (clause) -> {
if (clause.isPresent()) {
ZoneStatus status = clause.get().getValue();
src.sendMessage(Text.of(status == ZoneStatus.ADDED ? TextColors.GREEN : TextColors.RED, "Added with status: ", status));
}
});
src.sendMessage(Text.of(TextColors.YELLOW, "Creating requested zone."));
return CommandResult.success();
}
use of com.skelril.skree.service.internal.zone.ZoneStatus in project Skree by Skelril.
the class ZoneTransitionalOrbListener method onBlockInteract.
@Listener
public void onBlockInteract(InteractBlockEvent.Secondary.MainHand event, @First Player player) {
Optional<org.spongepowered.api.item.inventory.ItemStack> optItemStack = player.getItemInHand(HandTypes.MAIN_HAND);
if (!optItemStack.isPresent()) {
return;
}
ItemStack itemStack = tf(optItemStack.get());
if (itemStack.getItem() != CustomItemTypes.ZONE_TRANSITIONAL_ORB) {
return;
}
Optional<T> optInst = getApplicable(player);
if (optInst.isPresent()) {
Clause<Player, ZoneStatus> status = optInst.get().remove(player);
if (status.getValue() == ZoneStatus.REMOVED) {
Task.builder().execute(() -> {
tf(player).inventory.decrStackSize(tf(player).inventory.currentItem, 1);
tf(player).inventoryContainer.detectAndSendChanges();
}).delayTicks(1).submit(SkreePlugin.inst());
}
event.setUseBlockResult(Tristate.FALSE);
}
}
Aggregations