Merge branch 'master' into renovate/pluginyml

This commit is contained in:
Adrian 2023-03-03 16:03:38 -05:00 committed by GitHub
commit 1199a4005a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 95 additions and 127 deletions

View File

@ -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"

View File

@ -28,4 +28,6 @@ jobs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: AuthMeVelocity name: AuthMeVelocity
path: build/libs/AuthMeVelocity.jar path: |-
velocity/build/libs/AuthMeVelocity-Velocity-*.jar
paper/build/libs/AuthMeVelocity-Paper-*.jar

View File

@ -1,15 +1,8 @@
plugins { plugins {
`java-library`
alias(libs.plugins.indra)
id("authmevelocity.publishing") id("authmevelocity.publishing")
id("authmevelocity.spotless") id("authmevelocity.spotless")
} }
java {
withSourcesJar()
withJavadocJar()
}
dependencies { dependencies {
compileOnly(libs.paper) compileOnly(libs.paper)
} }
@ -19,8 +12,8 @@ tasks {
(options as StandardJavadocDocletOptions).run { (options as StandardJavadocDocletOptions).run {
encoding = Charsets.UTF_8.name() encoding = Charsets.UTF_8.name()
links( links(
"https://jd.adventure.kyori.net/api/4.11.0/", "https://jd.advntr.dev/api/4.12.0/",
"https://jd.adventure.kyori.net/text-minimessage/4.11.0/", "https://jd.advntr.dev/text-minimessage/4.12.0/",
"https://jd.papermc.io/paper/1.19/" "https://jd.papermc.io/paper/1.19/"
) )
} }

View File

@ -1,6 +1,4 @@
plugins { plugins {
`java-library`
alias(libs.plugins.indra)
id("authmevelocity.publishing") id("authmevelocity.publishing")
id("authmevelocity.spotless") id("authmevelocity.spotless")
} }
@ -9,18 +7,13 @@ dependencies {
compileOnly(libs.velocity) compileOnly(libs.velocity)
} }
java {
withSourcesJar()
withJavadocJar()
}
tasks { tasks {
javadoc { javadoc {
(options as? StandardJavadocDocletOptions)?.run{ (options as StandardJavadocDocletOptions).run{
encoding = Charsets.UTF_8.name() encoding = Charsets.UTF_8.name()
links( links(
"https://jd.adventure.kyori.net/api/4.12.0/", "https://jd.advntr.dev/api/4.12.0/",
"https://jd.adventure.kyori.net/text-minimessage/4.12.0/", "https://jd.advntr.dev/text-minimessage/4.12.0/",
"https://jd.papermc.io/velocity/3.0.0/" "https://jd.papermc.io/velocity/3.0.0/"
) )
} }

View File

@ -12,7 +12,8 @@ repositories {
gradlePluginPortal() gradlePluginPortal()
} }
java { kotlin {
sourceCompatibility = JavaVersion.VERSION_11 jvmToolchain {
targetCompatibility = JavaVersion.VERSION_11 languageVersion.set(JavaLanguageVersion.of(17))
}
} }

View File

@ -1,31 +1,73 @@
plugins { plugins {
id("net.kyori.indra.publishing") `java-library`
`maven-publish`
signing
} }
indra { java {
javaVersions { withSourcesJar()
testWith().add(17) withJavadocJar()
} }
/*
publishing {
publications {
create<MavenPublication>("mavenJava") {
repositories {
maven {
credentials(PasswordCredentials::class.java)
github("4drian3d", "AuthMeVelocity") { val central = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
ci(true) val snapshots = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
if (project.version.toString().endsWith("SNAPSHOT")) {
name = "SonatypeSnapshots"
setUrl(snapshots)
} else {
name = "OSSRH"
setUrl(central)
}
}
} }
gpl3OrLaterLicense()
configurePublications {
groupId = project.group as String
artifactId = project.name.replaceFirst("authmevelocity-", "")
version = project.version as String
from(components["java"]) from(components["java"])
pom { 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 { developers {
developer { developer {
id.set("4drian3d") id.set("4drian3d")
name.set("Adrian") 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"])
} }
*/

View File

@ -24,7 +24,7 @@ import net.byteflux.libby.relocation.Relocation;
public final class LibsManager { public final class LibsManager {
private final LibraryManager manager; private final LibraryManager manager;
public LibsManager(LibraryManager manager) { public LibsManager(final LibraryManager manager) {
this.manager = manager; this.manager = manager;
manager.addMavenCentral(); manager.addMavenCentral();
} }

View File

@ -24,6 +24,7 @@ import io.github._4drian3d.authmevelocity.common.enums.SendMode;
import java.util.List; import java.util.List;
@SuppressWarnings("FieldMayBeFinal")
@ConfigSerializable @ConfigSerializable
public class ProxyConfiguration { public class ProxyConfiguration {
@Comment("List of login/registration servers") @Comment("List of login/registration servers")
@ -128,18 +129,5 @@ public class ProxyConfiguration {
public int randomAttempts() { public int randomAttempts() {
return this.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;
} }
} }
}

View File

@ -1,4 +1,4 @@
group = io.github._4drian3d group = io.github.4drian3d
version = 4.0.0-SNAPSHOT version = 4.0.0-SNAPSHOT
description = AuthMeReloaded Support for Velocity description = AuthMeReloaded Support for Velocity
url = https://modrinth.com/plugin/authmevelocity url = https://modrinth.com/plugin/authmevelocity

View File

@ -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

View File

@ -28,6 +28,7 @@ import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.ServerConnection;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; 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.messages.MinecraftChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI; import io.github._4drian3d.authmevelocity.api.velocity.AuthMeVelocityAPI;
@ -74,8 +75,10 @@ import java.util.function.Predicate;
} }
) )
public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI { public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
public static final ChannelIdentifier AUTHMEVELOCITY_CHANNEL public static final ChannelIdentifier MODERN_CHANNEL
= MinecraftChannelIdentifier.create("authmevelocity", "main"); = MinecraftChannelIdentifier.create("authmevelocity", "main");
public static final ChannelIdentifier LEGACY_CHANNEL
= new LegacyChannelIdentifier("authmevelocity:main");
@Inject @Inject
private ProxyServer proxy; private ProxyServer proxy;
@Inject @Inject
@ -109,7 +112,7 @@ public final class AuthMeVelocityPlugin implements AuthMeVelocityAPI {
final int pluginId = 16128; final int pluginId = 16128;
final Metrics metrics = metricsFactory.make(this, pluginId); final Metrics metrics = metricsFactory.make(this, pluginId);
proxy.getChannelRegistrar().register(AUTHMEVELOCITY_CHANNEL); proxy.getChannelRegistrar().register(MODERN_CHANNEL, LEGACY_CHANNEL);
List.of( List.of(
new ProxyListener(this), new ProxyListener(this),

View File

@ -106,8 +106,14 @@ public final class ConnectListener {
plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server"); plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server");
final ByteArrayDataOutput buf = ByteStreams.newDataOutput(); final ByteArrayDataOutput buf = ByteStreams.newDataOutput();
buf.writeUTF("LOGIN"); buf.writeUTF("LOGIN");
player.getCurrentServer().ifPresent(sv -> player.getCurrentServer().ifPresent(sv -> {
sv.sendPluginMessage(AuthMeVelocityPlugin.AUTHMEVELOCITY_CHANNEL, buf.toByteArray())); 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");
}
});
} }
} }
} }

View File

@ -50,7 +50,8 @@ public class PluginMessageListener {
public void onPluginMessage(final PluginMessageEvent event, Continuation continuation) { public void onPluginMessage(final PluginMessageEvent event, Continuation continuation) {
final boolean cancelled = !event.getResult().isAllowed() final boolean cancelled = !event.getResult().isAllowed()
|| !(event.getSource() instanceof ServerConnection) || !(event.getSource() instanceof ServerConnection)
|| !event.getIdentifier().equals(AuthMeVelocityPlugin.AUTHMEVELOCITY_CHANNEL); || !(event.getIdentifier().equals(AuthMeVelocityPlugin.MODERN_CHANNEL)
|| event.getIdentifier().equals(AuthMeVelocityPlugin.LEGACY_CHANNEL));
if (cancelled) { if (cancelled) {
continuation.resume(); continuation.resume();
plugin.logDebug("PluginMessageEvent | Not allowed"); plugin.logDebug("PluginMessageEvent | Not allowed");

View File

@ -25,7 +25,6 @@ import com.velocitypowered.api.event.command.CommandExecuteEvent;
import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.event.connection.DisconnectEvent;
import com.velocitypowered.api.event.player.PlayerChatEvent; import com.velocitypowered.api.event.player.PlayerChatEvent;
import com.velocitypowered.api.event.player.TabCompleteEvent; import com.velocitypowered.api.event.player.TabCompleteEvent;
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import io.github._4drian3d.authmevelocity.velocity.AuthMeVelocityPlugin; import io.github._4drian3d.authmevelocity.velocity.AuthMeVelocityPlugin;
import io.github._4drian3d.authmevelocity.velocity.utils.AuthMeUtils; import io.github._4drian3d.authmevelocity.velocity.utils.AuthMeUtils;
@ -61,12 +60,6 @@ public final class ProxyListener {
return; return;
} }
if (canBeIgnored(player)) {
plugin.logDebug("CommandExecuteEvent | Ignored signed player");
continuation.resume();
return;
}
if (plugin.isInAuthServer(player)) { if (plugin.isInAuthServer(player)) {
plugin.logDebug("CommandExecuteEvent | Player is in Auth Server"); plugin.logDebug("CommandExecuteEvent | Player is in Auth Server");
String command = AuthMeUtils.getFirstArgument(event.getCommand()); String command = AuthMeUtils.getFirstArgument(event.getCommand());
@ -93,12 +86,6 @@ public final class ProxyListener {
plugin.logDebug("PlayerChatEvent | Player is not logged"); 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()); event.setResult(PlayerChatEvent.ChatResult.denied());
continuation.resume(); 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();
}
} }