Merge branch 'master' into renovate/pluginyml
This commit is contained in:
commit
1199a4005a
35
.github/dependabot.yml
vendored
35
.github/dependabot.yml
vendored
@ -1,35 +0,0 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/api/paper"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/api/velocity"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/velocity"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/paper"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "gradle"
|
||||
directory: "/common"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
4
.github/workflows/gradle.yml
vendored
4
.github/workflows/gradle.yml
vendored
@ -28,4 +28,6 @@ jobs:
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: AuthMeVelocity
|
||||
path: build/libs/AuthMeVelocity.jar
|
||||
path: |-
|
||||
velocity/build/libs/AuthMeVelocity-Velocity-*.jar
|
||||
paper/build/libs/AuthMeVelocity-Paper-*.jar
|
@ -1,15 +1,8 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
alias(libs.plugins.indra)
|
||||
id("authmevelocity.publishing")
|
||||
id("authmevelocity.spotless")
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.paper)
|
||||
}
|
||||
@ -19,8 +12,8 @@ tasks {
|
||||
(options as StandardJavadocDocletOptions).run {
|
||||
encoding = Charsets.UTF_8.name()
|
||||
links(
|
||||
"https://jd.adventure.kyori.net/api/4.11.0/",
|
||||
"https://jd.adventure.kyori.net/text-minimessage/4.11.0/",
|
||||
"https://jd.advntr.dev/api/4.12.0/",
|
||||
"https://jd.advntr.dev/text-minimessage/4.12.0/",
|
||||
"https://jd.papermc.io/paper/1.19/"
|
||||
)
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
alias(libs.plugins.indra)
|
||||
id("authmevelocity.publishing")
|
||||
id("authmevelocity.spotless")
|
||||
}
|
||||
@ -9,18 +7,13 @@ dependencies {
|
||||
compileOnly(libs.velocity)
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks {
|
||||
javadoc {
|
||||
(options as? StandardJavadocDocletOptions)?.run{
|
||||
(options as StandardJavadocDocletOptions).run{
|
||||
encoding = Charsets.UTF_8.name()
|
||||
links(
|
||||
"https://jd.adventure.kyori.net/api/4.12.0/",
|
||||
"https://jd.adventure.kyori.net/text-minimessage/4.12.0/",
|
||||
"https://jd.advntr.dev/api/4.12.0/",
|
||||
"https://jd.advntr.dev/text-minimessage/4.12.0/",
|
||||
"https://jd.papermc.io/velocity/3.0.0/"
|
||||
)
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
@ -1,31 +1,73 @@
|
||||
plugins {
|
||||
id("net.kyori.indra.publishing")
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
signing
|
||||
}
|
||||
|
||||
indra {
|
||||
javaVersions {
|
||||
testWith().add(17)
|
||||
}
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
/*
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
repositories {
|
||||
maven {
|
||||
credentials(PasswordCredentials::class.java)
|
||||
|
||||
github("4drian3d", "AuthMeVelocity") {
|
||||
ci(true)
|
||||
}
|
||||
val central = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
val snapshots = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
|
||||
gpl3OrLaterLicense()
|
||||
|
||||
configurePublications {
|
||||
groupId = project.group as String
|
||||
artifactId = project.name.replaceFirst("authmevelocity-", "")
|
||||
version = project.version as String
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
developers {
|
||||
developer {
|
||||
id.set("4drian3d")
|
||||
name.set("Adrian")
|
||||
if (project.version.toString().endsWith("SNAPSHOT")) {
|
||||
name = "SonatypeSnapshots"
|
||||
setUrl(snapshots)
|
||||
} else {
|
||||
name = "OSSRH"
|
||||
setUrl(central)
|
||||
}
|
||||
}
|
||||
}
|
||||
from(components["java"])
|
||||
pom {
|
||||
url.set("https://github.com/4drian3d/AuthMeVelocity")
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License version 3 or later")
|
||||
url.set("https://opensource.org/licenses/GPL-3.0")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection.set("scm:git:https://github.com/4drian3d/AuthMeVelocity.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/4drian3d/AuthMeVelocity.git")
|
||||
url.set("https://github.com/4drian3d/AuthMeVelocity")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("4drian3d")
|
||||
name.set("Adrian Gonzales")
|
||||
email.set("adriangonzalesval@gmail.com")
|
||||
}
|
||||
}
|
||||
issueManagement {
|
||||
name.set("GitHub")
|
||||
url.set("https://github.com/4drian3d/AuthMeVelocity/issues")
|
||||
}
|
||||
ciManagement {
|
||||
name.set("GitHub Actions")
|
||||
url.set("https://github.com/4drian3d/AuthMeVelocity/actions")
|
||||
}
|
||||
name.set(project.name)
|
||||
description.set(project.description)
|
||||
url.set("https://github.com/4drian3d/AuthMeVelocity")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign(configurations.archives.get())
|
||||
sign(publishing.publications["mavenJava"])
|
||||
}
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ import net.byteflux.libby.relocation.Relocation;
|
||||
public final class LibsManager {
|
||||
private final LibraryManager manager;
|
||||
|
||||
public LibsManager(LibraryManager manager) {
|
||||
public LibsManager(final LibraryManager manager) {
|
||||
this.manager = manager;
|
||||
manager.addMavenCentral();
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import io.github._4drian3d.authmevelocity.common.enums.SendMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
@ConfigSerializable
|
||||
public class ProxyConfiguration {
|
||||
@Comment("List of login/registration servers")
|
||||
@ -128,18 +129,5 @@ public class ProxyConfiguration {
|
||||
public int randomAttempts() {
|
||||
return this.randomAttempts;
|
||||
}
|
||||
|
||||
@Comment("""
|
||||
Ignore blocking of commands and chat messages to 1.19.1 clients with a valid signed key
|
||||
When trying to block these executions, the proxy will kick the player out.
|
||||
This option allows you to prevent the plugin from trying to block these executions,
|
||||
avoiding the player to be kicked out""")
|
||||
private boolean ignoreSignedPlayers = false;
|
||||
public boolean ignoreSignedPlayers() {
|
||||
return this.ignoreSignedPlayers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
group = io.github._4drian3d
|
||||
group = io.github.4drian3d
|
||||
version = 4.0.0-SNAPSHOT
|
||||
description = AuthMeReloaded Support for Velocity
|
||||
url = https://modrinth.com/plugin/authmevelocity
|
||||
|
@ -1,7 +0,0 @@
|
||||
jdk:
|
||||
- openjdk17
|
||||
before_install:
|
||||
- source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
- sdk update
|
||||
- sdk install java 17.0.6.tem
|
||||
- sdk use java 17.0.6.tem
|
@ -28,6 +28,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI;
|
||||
@ -74,8 +75,10 @@ import java.util.function.Predicate;
|
||||
}
|
||||
)
|
||||
public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
||||
public static final ChannelIdentifier AUTHMEVELOCITY_CHANNEL
|
||||
public static final ChannelIdentifier MODERN_CHANNEL
|
||||
= MinecraftChannelIdentifier.create("authmevelocity", "main");
|
||||
public static final ChannelIdentifier LEGACY_CHANNEL
|
||||
= new LegacyChannelIdentifier("authmevelocity:main");
|
||||
@Inject
|
||||
private ProxyServer proxy;
|
||||
@Inject
|
||||
@ -109,7 +112,7 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
|
||||
final int pluginId = 16128;
|
||||
final Metrics metrics = metricsFactory.make(this, pluginId);
|
||||
|
||||
proxy.getChannelRegistrar().register(AUTHMEVELOCITY_CHANNEL);
|
||||
proxy.getChannelRegistrar().register(MODERN_CHANNEL, LEGACY_CHANNEL);
|
||||
|
||||
List.of(
|
||||
new ProxyListener(this),
|
||||
|
@ -106,8 +106,14 @@ public final class ConnectListener {
|
||||
plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server");
|
||||
final ByteArrayDataOutput buf = ByteStreams.newDataOutput();
|
||||
buf.writeUTF("LOGIN");
|
||||
player.getCurrentServer().ifPresent(sv ->
|
||||
sv.sendPluginMessage(AuthMeVelocityPlugin.AUTHMEVELOCITY_CHANNEL, buf.toByteArray()));
|
||||
player.getCurrentServer().ifPresent(sv -> {
|
||||
var byteArray = buf.toByteArray();
|
||||
if (!sv.sendPluginMessage(AuthMeVelocityPlugin.MODERN_CHANNEL, byteArray)) {
|
||||
plugin.logDebug("ServerPostConnectEvent | Failed to send on Modern Channel");
|
||||
var legacyResult = sv.sendPluginMessage(AuthMeVelocityPlugin.LEGACY_CHANNEL, byteArray);
|
||||
if(!legacyResult) plugin.logDebug("ServerPostConnectEvent | Failed to send on Legacy Channel");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ public class PluginMessageListener {
|
||||
public void onPluginMessage(final PluginMessageEvent event, Continuation continuation) {
|
||||
final boolean cancelled = !event.getResult().isAllowed()
|
||||
|| !(event.getSource() instanceof ServerConnection)
|
||||
|| !event.getIdentifier().equals(AuthMeVelocityPlugin.AUTHMEVELOCITY_CHANNEL);
|
||||
|| !(event.getIdentifier().equals(AuthMeVelocityPlugin.MODERN_CHANNEL)
|
||||
|| event.getIdentifier().equals(AuthMeVelocityPlugin.LEGACY_CHANNEL));
|
||||
if (cancelled) {
|
||||
continuation.resume();
|
||||
plugin.logDebug("PluginMessageEvent | Not allowed");
|
||||
|
@ -25,7 +25,6 @@ import com.velocitypowered.api.event.command.CommandExecuteEvent;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.player.PlayerChatEvent;
|
||||
import com.velocitypowered.api.event.player.TabCompleteEvent;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import io.github._4drian3d.authmevelocity.velocity.AuthMeVelocityPlugin;
|
||||
import io.github._4drian3d.authmevelocity.velocity.utils.AuthMeUtils;
|
||||
@ -61,12 +60,6 @@ public final class ProxyListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (canBeIgnored(player)) {
|
||||
plugin.logDebug("CommandExecuteEvent | Ignored signed player");
|
||||
continuation.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.isInAuthServer(player)) {
|
||||
plugin.logDebug("CommandExecuteEvent | Player is in Auth Server");
|
||||
String command = AuthMeUtils.getFirstArgument(event.getCommand());
|
||||
@ -93,12 +86,6 @@ public final class ProxyListener {
|
||||
|
||||
plugin.logDebug("PlayerChatEvent | Player is not logged");
|
||||
|
||||
if (canBeIgnored(event.getPlayer())) {
|
||||
plugin.logDebug("PlayerChatEvent | Ignored signed player");
|
||||
continuation.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
event.setResult(PlayerChatEvent.ChatResult.denied());
|
||||
continuation.resume();
|
||||
}
|
||||
@ -128,10 +115,4 @@ public final class ProxyListener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean canBeIgnored(Player player) {
|
||||
return player.getIdentifiedKey() != null
|
||||
&& player.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_19_1) >= 0
|
||||
&& plugin.config().get().advanced().ignoreSignedPlayers();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user