diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 1e1b343..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -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" diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 94bffa1..ea963e7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,4 +28,6 @@ jobs: uses: actions/upload-artifact@v3 with: name: AuthMeVelocity - path: build/libs/AuthMeVelocity.jar \ No newline at end of file + path: |- + velocity/build/libs/AuthMeVelocity-Velocity-*.jar + paper/build/libs/AuthMeVelocity-Paper-*.jar \ No newline at end of file diff --git a/api/paper/build.gradle.kts b/api/paper/build.gradle.kts index 92df27a..761a4b6 100644 --- a/api/paper/build.gradle.kts +++ b/api/paper/build.gradle.kts @@ -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/" ) } diff --git a/api/velocity/build.gradle.kts b/api/velocity/build.gradle.kts index bdcc68e..4fbd237 100644 --- a/api/velocity/build.gradle.kts +++ b/api/velocity/build.gradle.kts @@ -1,6 +1,4 @@ plugins { - `java-library` - alias(libs.plugins.indra) id("authmevelocity.publishing") id("authmevelocity.spotless") } @@ -9,20 +7,15 @@ 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/" ) } - } + } } diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 70accc8..0b58780 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -12,7 +12,8 @@ repositories { gradlePluginPortal() } -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} \ No newline at end of file +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} diff --git a/build-logic/src/main/kotlin/authmevelocity.publishing.gradle.kts b/build-logic/src/main/kotlin/authmevelocity.publishing.gradle.kts index 17e955d..e9d891c 100644 --- a/build-logic/src/main/kotlin/authmevelocity.publishing.gradle.kts +++ b/build-logic/src/main/kotlin/authmevelocity.publishing.gradle.kts @@ -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("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"]) +} +*/ diff --git a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java index 862a866..1be0c0b 100644 --- a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java +++ b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java @@ -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(); } diff --git a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/configuration/ProxyConfiguration.java b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/configuration/ProxyConfiguration.java index 550fd3f..fed867f 100644 --- a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/configuration/ProxyConfiguration.java +++ b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/configuration/ProxyConfiguration.java @@ -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; - } } - - - } diff --git a/gradle.properties b/gradle.properties index 9cee269..36a82f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/jitpack.yml b/jitpack.yml deleted file mode 100644 index e008e7f..0000000 --- a/jitpack.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/AuthMeVelocityPlugin.java b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/AuthMeVelocityPlugin.java index 38ce207..d0971bb 100644 --- a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/AuthMeVelocityPlugin.java +++ b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/AuthMeVelocityPlugin.java @@ -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), diff --git a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ConnectListener.java b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ConnectListener.java index dee9c9a..3835d7b 100644 --- a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ConnectListener.java +++ b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ConnectListener.java @@ -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"); + } + }); } } } diff --git a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/PluginMessageListener.java b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/PluginMessageListener.java index 608b95a..2ca3ead 100644 --- a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/PluginMessageListener.java +++ b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/PluginMessageListener.java @@ -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"); diff --git a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ProxyListener.java b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ProxyListener.java index 293d604..37ef598 100644 --- a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ProxyListener.java +++ b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/ProxyListener.java @@ -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(); - } - }