Merge pull request #242 from sekwah41/feature/modern-forward-detect

Added modern forwarding
This commit is contained in:
Sekwah 2021-05-09 03:47:36 +01:00 committed by GitHub
commit fc952e6c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 10 deletions

View File

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

View File

@ -1,3 +1,6 @@
### 0.5.13
* Added improved support for Velocity, including 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.

View File

@ -28,10 +28,10 @@ apply plugin: 'eclipse'
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") + '-snapshot' + (isDevBranch ? '-dev' : '')
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'

View File

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