Skip to content
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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 22
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '22'
java-version: '21'
distribution: 'temurin'
cache: gradle

Expand Down
27 changes: 14 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'java'
id 'eclipse'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8'
id("xyz.jpenilla.run-velocity") version "2.3.1"
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.4.1'
id("xyz.jpenilla.run-velocity") version "3.0.2"

id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.gradleup.shadow' version '9.6.1'
}

group = 'org.lby123165'
Expand All @@ -17,25 +17,26 @@ repositories {
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/easybot-team/easybot-bridge")
credentials {
username = System.getenv("GITHUB_ACTOR") ?: project.findProperty("gpr.user")
password = System.getenv("GITHUB_TOKEN") ?: project.findProperty("gpr.key")
}
name = "Jitpack"
url = "https://www.jitpack.io"
}
maven {
name = "GeyserMC"
url = "https://repo.opencollab.dev/main/"
}
}

dependencies {
compileOnly("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT")

implementation('com.springwater.easybot:easybot-bridge:1.7.1') {
implementation('com.github.easybot-team:easybot-bridge:1.7.1') {
exclude group: 'com.google.code.gson', module: 'gson'
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'org.projectlombok', module: 'lombok'
}


compileOnly("io.github.4drian3d:authmevelocity-api-velocity:4.3.0")
compileOnly(fileTree('libs'))

implementation 'org.java-websocket:Java-WebSocket:1.5.3'
Expand All @@ -61,9 +62,9 @@ tasks {
}
}

def targetJavaVersion = 17
def targetJavaVersion = 21
java {
toolchain.languageVersion = JavaLanguageVersion.of(22)
toolchain.languageVersion = JavaLanguageVersion.of(21)
}

tasks.withType(JavaCompile).configureEach {
Expand Down
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Sun Aug 02 23:14:39 CST 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://mirrors.aliyun.com/gradle/distributions/v9.3.0/gradle-9.3.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
authors = {"lby123165", "MiuxuE"},
dependencies = {
@Dependency(id = "librelogin", optional = true),
@Dependency(id = "limboauth", optional = true)
@Dependency(id = "limboauth", optional = true),
@Dependency(id = "authmevelocity", optional = true)
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

import com.springwater.easybot.bridge.BridgeBehavior;
import com.springwater.easybot.bridge.message.Segment;
import com.springwater.easybot.bridge.message.TextSegment;
import com.springwater.easybot.bridge.model.PlayerInfo;
import com.springwater.easybot.bridge.model.ServerInfo;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentBuilder;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.lby123165.easyBotVelocity.sender.EasyBotCommandSender;
import org.lby123165.easyBotVelocity.utils.*;
import org.slf4j.Logger;

import java.util.*;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -109,6 +105,9 @@ public boolean isAuthenticated(String playerName) {
if (LibreLoginUtils.hasLiberLogin()) {
return LibreLoginUtils.isAuthenticated(player.get());
}
if (AuthMeVcUtils.hasAuthMeVelocity()) {
return AuthMeVcUtils.isAuthenticated(player.get());
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.lby123165.easyBotVelocity.utils;

import com.velocitypowered.api.proxy.Player;
import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI;
import org.jetbrains.annotations.Nullable;
import org.lby123165.easyBotVelocity.EasyBotVelocity;

public class AuthMeVcUtils {
private static @Nullable AuthMeVelocityAPI authMeVelocityAPI = null;

public static boolean hasAuthMeVelocity() {
return EasyBotVelocity.getInstance().getServer().getPluginManager().isLoaded("authmevelocity");
}

public static AuthMeVelocityAPI getAuthMeVelocityAPI() {
if (authMeVelocityAPI == null) {
authMeVelocityAPI = (AuthMeVelocityAPI) EasyBotVelocity.getInstance().getServer().getPluginManager().getPlugin("authmevelocity").orElseThrow().getInstance().orElseThrow();
}
return authMeVelocityAPI;
}

@SuppressWarnings("unchecked")
public static boolean isAuthenticated(Player proxyPlayer) {
if (!hasAuthMeVelocity()) {
return true;
}
return getAuthMeVelocityAPI().isLogged(proxyPlayer);
}
}
Loading