Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-296 Add a contextual bind for console command source on Velocity platform #296

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish LiteCommands
on:
push:
branches: [ master ]
branches: [ master, v2.x.x ]
jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -27,4 +27,4 @@ jobs:
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}
MINE_CODES_MAVEN_USERNAME: ${{ secrets.MINE_CODES_MAVEN_USERNAME }}
MINE_CODES_MAVEN_PASSWORD: ${{ secrets.MINE_CODES_MAVEN_PASSWORD }}
MINE_CODES_MAVEN_PASSWORD: ${{ secrets.MINE_CODES_MAVEN_PASSWORD }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package dev.rollczi.litecommands.velocity.tools;

import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ConsoleCommandSource;
import dev.rollczi.litecommands.command.Invocation;
import dev.rollczi.litecommands.contextual.Contextual;
import panda.std.Option;
import panda.std.Result;

public class VelocityOnlyConsoleContextual<MESSAGE> implements Contextual<CommandSource, ConsoleCommandSource> {

private final MESSAGE onlyConsoleMessage;

public VelocityOnlyConsoleContextual(MESSAGE onlyConsoleMessage) {
this.onlyConsoleMessage = onlyConsoleMessage;
}

@Override
public Result<ConsoleCommandSource, Object> extract(CommandSource source, Invocation<CommandSource> invocation) {
return Option.of(source).is(ConsoleCommandSource.class).toResult(onlyConsoleMessage);
}

}