Merge pull request #243 from sekwah41/dev/spigot-1.13-1.16

Add force enable features and proper velocity support
This commit is contained in:
Sekwah 2021-05-10 10:21:53 +01:00 committed by GitHub
commit 0ad693db0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 12 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,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.

View File

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

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

View File

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