Allow relative coordinates in /bot region
Also remove codeql
This commit is contained in:
69
.github/workflows/dev-analysis.yml
vendored
69
.github/workflows/dev-analysis.yml
vendored
@@ -3,59 +3,30 @@ name: "CodeQL"
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
gradle:
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'java' ]
|
os: [ ubuntu-latest ]
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
runs-on: ${{ matrix.os }}
|
||||||
# Learn more:
|
|
||||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v2
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
|
||||||
- name: Cache local repo
|
- name: Make gradlew executable
|
||||||
uses: actions/cache@v3
|
run: chmod +x ./gradlew
|
||||||
with:
|
|
||||||
path: ~/.m2/repository
|
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-maven-
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Setup Gradle
|
||||||
uses: github/codeql-action/init@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v3
|
- name: Execute Gradle build
|
||||||
with:
|
run: ./gradlew build
|
||||||
distribution: temurin
|
|
||||||
java-version: 17
|
|
||||||
|
|
||||||
- name: Make gradlew executable
|
- name: Upload a Build Artifact
|
||||||
run: chmod +x ./gradlew
|
uses: actions/upload-artifact@v2.2.4
|
||||||
|
if: success()
|
||||||
- name: Setup Gradle
|
with:
|
||||||
uses: gradle/gradle-build-action@v2
|
name: TerminatorPlus
|
||||||
|
path: build/libs/
|
||||||
- name: Execute Gradle build
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
|
|
||||||
- name: Upload a Build Artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
name: TerminatorPlus
|
|
||||||
path: build/libs/
|
|
||||||
|
|||||||
@@ -434,12 +434,13 @@ public class BotCommand extends CommandInstance {
|
|||||||
}
|
}
|
||||||
double x1, y1, z1, x2, y2, z2, wX, wY, wZ;
|
double x1, y1, z1, x2, y2, z2, wX, wY, wZ;
|
||||||
try {
|
try {
|
||||||
x1 = Double.parseDouble(args.get(1));
|
Location loc = sender instanceof Player pl ? pl.getLocation() : null;
|
||||||
y1 = Double.parseDouble(args.get(2));
|
x1 = parseDoubleOrRelative(args.get(1), loc, 0);
|
||||||
z1 = Double.parseDouble(args.get(3));
|
y1 = parseDoubleOrRelative(args.get(2), loc, 1);
|
||||||
x2 = Double.parseDouble(args.get(4));
|
z1 = parseDoubleOrRelative(args.get(3), loc, 2);
|
||||||
y2 = Double.parseDouble(args.get(5));
|
x2 = parseDoubleOrRelative(args.get(4), loc, 0);
|
||||||
z2 = Double.parseDouble(args.get(6));
|
y2 = parseDoubleOrRelative(args.get(5), loc, 1);
|
||||||
|
z2 = parseDoubleOrRelative(args.get(6), loc, 2);
|
||||||
if (strict)
|
if (strict)
|
||||||
wX = wY = wZ = 0;
|
wX = wY = wZ = 0;
|
||||||
else {
|
else {
|
||||||
@@ -518,4 +519,20 @@ public class BotCommand extends CommandInstance {
|
|||||||
public void debug(CommandSender sender, @Arg("expression") String expression) {
|
public void debug(CommandSender sender, @Arg("expression") String expression) {
|
||||||
new Debugger(sender).execute(expression);
|
new Debugger(sender).execute(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double parseDoubleOrRelative(String pos, Location loc, int type) {
|
||||||
|
if (loc == null || pos.length() == 0 || pos.charAt(0) != '~')
|
||||||
|
return Double.parseDouble(pos);
|
||||||
|
double relative = Double.parseDouble(pos.substring(1));
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
return relative + loc.getX();
|
||||||
|
case 1:
|
||||||
|
return relative + loc.getY();
|
||||||
|
case 2:
|
||||||
|
return relative + loc.getZ();
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user