diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2f43ac9..74ae1e3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,7 +3,8 @@ name: Build Project on: push: branches: - - 'dev/*' + - '*/*' + - '!release/*' tags: - '*' pull_request: @@ -14,11 +15,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle - name: Build with Gradle run: ./gradlew build - name: Upload to Discord (If dev branch) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8959df5..764927c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.5.13 +* Added improved support for Velocity (You can now add it directly to Velocity as a plugin) +* Added a ForceEnableProxySupport config option in case any are not detected +* Modern forwarding will be automatically detected. You will no longer need to manually set ForceEnableProxySupport ### 0.5.12 * Added support for Velocity. * Also fixed some issues with entity teleporting. diff --git a/build.gradle b/build.gradle index 8d388f3..416bfbd 100644 --- a/build.gradle +++ b/build.gradle @@ -26,12 +26,12 @@ apply plugin: 'maven-publish' apply plugin: 'idea' apply plugin: 'eclipse' -group = 'com.sekwah.advancedportals' -version = getPluginData("version") + '-snapshot' - def branch = System.getenv("GITHUB_REF"); def sha = System.getenv("GITHUB_SHA"); -def isDevBranch = !(branch && (branch.startsWith("refs/heads/release/") || branch.startsWith("refs/tags/"))); +def isDevBranch = branch == null || (!(branch.startsWith("refs/heads/release/") || branch.startsWith("refs/tags/"))) + +group = 'com.sekwah.advancedportals' +version = getPluginData("version") + (isDevBranch ? '-SNAPSHOT' : '') description = "" @@ -65,6 +65,7 @@ repositories { maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://nexus.velocitypowered.com/repository/maven-public/" } + maven { url 'https://papermc.io/repo/repository/maven-public/' } } // includeLibs just says to include the library in the final jar @@ -77,6 +78,7 @@ dependencies { annotationProcessor "com.velocitypowered:velocity-api:1.1.0-SNAPSHOT" implementation "io.netty:netty-all:4.0.4.Final" + compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT' //compile fileTree(dir: 'libs', include: ['*.jar']) } @@ -129,7 +131,7 @@ curseforge { // TODO add code to reference this but also cut the latest change logs in for the files changelog = "${project.github}/blob/${sha}/CHANGELOG.md" changelogType = 'markdown' - releaseType = 'beta' + releaseType = 'release' addGameVersion '1.16' addGameVersion '1.15' addGameVersion '1.14' diff --git a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java index e5b0e62..d419106 100644 --- a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java @@ -135,15 +135,27 @@ public class AdvancedPortalsPlugin extends JavaPlugin { try { ConfigurationSection configSelection = getServer().spigot().getConfig().getConfigurationSection("settings"); - if (configSelection == null || !configSelection.getBoolean("bungeecord") ) { - getLogger().warning( "Advanced bungee features disabled for Advanced Portals as bungee isn't enabled on the server (spigot.yml)" ); - return false; + if (configSelection != null && configSelection.getBoolean("bungeecord") ) { + getLogger().info( "Bungee detected. Enabling proxy features." ); + return true; } } catch(NullPointerException e) { - return false; } - return true; + // Will be valid if paperspigot is being used. Otherwise catch. + try { + ConfigurationSection configSelection = getServer().spigot().getPaperConfig().getConfigurationSection("settings"); + ConfigurationSection velocity = configSelection != null ? configSelection.getConfigurationSection("velocity-support") : null; + if (velocity != null && velocity.getBoolean("enabled") ) { + getLogger().info( "Modern forwarding detected. Enabling proxy features." ); + return true; + } + } catch(NullPointerException e) { + } + + getLogger().warning( "Proxy features disabled for Advanced Portals as bungee isn't enabled on the server (spigot.yml) " + + "or if you are using Paper settings.velocity-support.enabled may not be enabled (paper.yml)" ); + return false; } diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 9d62195..56d453c 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -12,6 +12,7 @@ import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; import com.velocitypowered.api.plugin.Plugin; 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 org.slf4j.Logger; @@ -104,6 +105,8 @@ public class AdvancedPortalsPlugin { out.writeUTF(val[1]); out.writeUTF(val[2]); + serverConnection.sendPluginMessage(AP_CHANNEL, out.toByteArray()); + } }); }