Merge branch 'feature/244-proxy-teleport-delay' into dev/spigot-1.13-1.16

This commit is contained in:
Sekwah 2021-05-13 01:00:55 +01:00
commit d025947134
No known key found for this signature in database
GPG Key ID: C3BE2E6C861A461A
11 changed files with 172 additions and 55 deletions

View File

@ -3,8 +3,7 @@ name: Build Project
on:
push:
branches:
- '*/*'
- '!release/*'
- '**'
tags:
- '*'
pull_request:
@ -28,13 +27,13 @@ jobs:
restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle
run: ./gradlew build
- name: Upload to Discord (If dev branch)
if: startsWith(github.ref, 'refs/heads/dev/')
- name: Upload to Discord (If pre-release tag)
if: "startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-')"
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: ./gradlew discordupload
- name: Publish to Curseforge (If tagged)
if: startsWith(github.ref, 'refs/tags/')
- name: Publish to Curseforge (If release tag)
if: "startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')"
env:
CURSE_API: ${{ secrets.CURSE_API }}
run: ./gradlew curseforge

43
.versionrc.js Normal file
View File

@ -0,0 +1,43 @@
let versionRegex = /(\nversion:\s)([0-9.-]+)/;
let velocityVersionRegex = /(\sversion\s=\s")([0-9.-]+)("\))/;
const ymlUpdater = {
updater: {
'readVersion': (contents) => {
return versionRegex.exec(contents)[2];
},
'writeVersion': (contents, version) => {
return contents.replace(versionRegex, `$1${version}`);
}
}
}
const bungee = {
filename: 'src/main/resources/bungee.yml',
...ymlUpdater,
}
const plugin = {
filename: 'src/main/resources/plugin.yml',
...ymlUpdater,
}
const velocity_plugin = {
filename: 'src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java',
updater: {
'readVersion': (contents) => {
return velocityVersionRegex.exec(contents)[2];
},
'writeVersion': (contents, version) => {
return contents.replace(velocityVersionRegex, `$1${version}$3`);
}
}
}
const files = [plugin, velocity_plugin, bungee];
module.exports = {
bumpFiles: files,
packageFiles: files
}

View File

@ -1,46 +1,92 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### 0.5.13-1 (2021-05-12)
### Features
* Added configurable proxy teleport delay ([a1121ad](https://github.com/sekwah41/Advanced-Portals/commit/a1121adc10addfcce515d1358d1274232109fdfd))
### 0.5.13-0 (2021-05-12)
* Build Tool Change: Updated versioning and changelog tooling and standards.
### 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
* 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.
* Added support for Velocity.
* Also fixed some issues with entity teleporting.
### 0.5.11
* Missing changelogs
### 0.5.10
* Missing changelogs
* Missing changelogs
### 0.5.10
* Added fix for command portals spam triggering if they didn't teleport you out.
* Made portals not activate if you were teleported into them by another portal (to allow linking zones like a star trek warp pad)
### 0.5.9
* Missing changelogs
### 0.5.8
* Missing changelogs
### 0.5.7
* Extra checks added by @tmantti to fix slow connections to new servers from activating the destination location too quick.
### 0.5.6
* Fixed packet exploit affecting destinations (only effecting versions 0.5.0 to 0.5.5).
### 0.5.5
* Added support for 1.16
* Reworked chat menus to better use Spigot API
* Changed edit menu to have Activate instead of Teleport to destination
* Compat code changed. You must now use Spigot rather than CraftBukkit.
* Added support for 1.16
* Reworked chat menus to better use Spigot API
* Changed edit menu to have Activate instead of Teleport to destination
* Compat code changed. You must now use Spigot rather than CraftBukkit.
### 0.5.4
* Added bungee backup methods to ensure bungee and desti work correctly together
* Fixed protection region issue
* Reworked the warp command and fixed the surrounding permissions
* Disabling gateway beams is now enabled for placing the blocks as well as by a few other means
* Added bungee backup methods to ensure bungee and desti work correctly together
* Fixed protection region issue
* Reworked the warp command and fixed the surrounding permissions
* Disabling gateway beams is now enabled for placing the blocks as well as by a few other means
### 0.5.3
* Fixed destination bug.
### 0.5.2
* Fixed issue with bungee destinations.
### 0.5.1
* Fixed warp permission info
### 0.5.0
* Added command:
* Fix for bungee warps
### 0.4.0
* Individual portal cooldown added
* Bungee improvements
### Earlier
* See github releases and spigot pages for more info.

View File

@ -12,12 +12,9 @@ Advanced Portals ![GitHub Workflow Status](https://img.shields.io/github/workflo
==============
An advanced portals plugin for bukkit made by sekwah41 designed to have a wide range of features which are easy to use. It adds a bunch of commands to create and edit portals and destinations. This plugin not only enable normal teleportation but also cross server teleportation for networks using bungee.
# Branch Layout
* [master](https://github.com/sekwah41/Advanced-Portals/) (Release Build)
* [dev](https://github.com/sekwah41/Advanced-Portals/tree/dev) (Dev Build)
* [recode](https://github.com/sekwah41/Advanced-Portals/tree/recode) (Recode)
Once the recode is done the master branch will be releases and the dev branch will be where work is done.
# Recode
We are currently slowly working on a complete re-code of the plugin with a full API.
For now maintaining the current 1.13+ spigot versions is our main priority.
# Help
[Command Documentation & Guides](https://www.guilded.gg/Sekwah/groups/MDqAZyrD/channels/72ffdaa3-9273-4722-bf47-b75408b371af/docs/1807463914)
@ -31,17 +28,13 @@ Once the recode is done the master branch will be releases and the dev branch wi
# Usage Data
Usage stats can be found here https://bstats.org/plugin/bukkit/AdvancedPortals
# Velocity Support
We add basic Velocity support though it isn't really a priority.
By default, the bungee: tag works without there being a plugin on velocity however for desti: to work
for now ensure that on spigot you have the bungeecord setting enabled to register the necessary packet channels.
We will look into adding better support for proxies (Especially Velocity as it looks better)
# API
The api isn't implemented in this version, sorry for any inconvenience. Check the recode tree for possibly a working recode at some point.
# Contribution
If you are going to change any of the reflection make sure you test it against the suggested supported versions at the moment e.g. 1.13 as well as 1.14 otherwise most will be accepted from just reviewing the code unless it changes something drastic which would effect other functionality in a bad way.
## Contributing
Please ensure that your commits are in the following style for PR's
https://www.conventionalcommits.org/en/v1.0.0/
This will help with changelogs and tracking bugfixes.

View File

@ -28,7 +28,7 @@ apply plugin: 'eclipse'
def branch = System.getenv("GITHUB_REF");
def sha = System.getenv("GITHUB_SHA");
def isDevBranch = branch == null || (!(branch.startsWith("refs/heads/release/") || branch.startsWith("refs/tags/")))
def isDevBranch = branch == null || !(branch.startsWith("refs/tags/") && !branch.contains("-"))
group = 'com.sekwah.advancedportals'
version = getPluginData("version") + (isDevBranch ? '-SNAPSHOT' : '')
@ -183,3 +183,17 @@ task runJar() {
}
}
}
task updateChangelog(type: Exec) {
commandLine 'cmd', '/c', 'npx standard-version'
ext.output = {
return standardOutput.toString()
}
}
task updateChangelogPreRelease(type: Exec) {
commandLine 'cmd', '/c', 'npx standard-version --prerelease'
ext.output = {
return standardOutput.toString()
}
}

View File

@ -4,13 +4,15 @@ import org.bukkit.configuration.file.FileConfiguration;
public class ConfigHelper {
public static String CONFIG_VERSION = "ConfigVersion";
public static final String CONFIG_VERSION = "ConfigVersion";
public static String COMMAND_LOGS = "CommandLogs";
public static final String COMMAND_LOGS = "CommandLogs";
public static String FORCE_ENABLE_PROXY_SUPPORT = "ForceEnableProxySupport";
public static final String FORCE_ENABLE_PROXY_SUPPORT = "ForceEnableProxySupport";
public static String DISABLE_GATEWAY_BEAM = "DisableGatewayBeam";
public static final String PROXY_TELEPORT_DELAY = "ProxyTeleportDelay";
public static final String DISABLE_GATEWAY_BEAM = "DisableGatewayBeam";
private final FileConfiguration config;
@ -22,7 +24,7 @@ public class ConfigHelper {
* Recursively for each time there is a future update
*/
public void update() {
String configVersion = config.getString("ConfigVersion");
String configVersion = config.getString(CONFIG_VERSION);
// Added in 0.5.4
if(configVersion == null || configVersion.equals("true") || configVersion.equals("0.5.3")) {
config.set(ConfigHelper.CONFIG_VERSION, "0.5.4");
@ -35,6 +37,7 @@ public class ConfigHelper {
} else if(configVersion.equals("0.5.10") || configVersion.equals("0.5.11")) {
config.set(ConfigHelper.CONFIG_VERSION, "0.5.13");
config.set(ConfigHelper.FORCE_ENABLE_PROXY_SUPPORT, false);
config.set(ConfigHelper.PROXY_TELEPORT_DELAY, 0);
}
}
}

View File

@ -3,6 +3,8 @@ package com.sekwah.advancedportals.bukkit.listeners;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
import com.sekwah.advancedportals.bukkit.config.ConfigHelper;
import com.sekwah.advancedportals.bukkit.destinations.Destination;
import com.sekwah.advancedportals.bungee.BungeeMessages;
import org.bukkit.entity.Player;
@ -13,9 +15,12 @@ import java.util.UUID;
public class PluginMessageReceiver implements PluginMessageListener {
private final AdvancedPortalsPlugin plugin;
private final int teleportDelay;
public PluginMessageReceiver(AdvancedPortalsPlugin plugin) {
this.plugin = plugin;
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
teleportDelay = config.getConfig().getInt(ConfigHelper.PROXY_TELEPORT_DELAY, 0);
}
@Override
@ -34,22 +39,33 @@ public class PluginMessageReceiver implements PluginMessageListener {
Player targetPlayer = this.plugin.getServer().getPlayer(UUID.fromString(bungeeUUID));
if (targetPlayer != null) {
Destination.warp(targetPlayer, targetDestination, false, true);
}
else {
plugin.getPlayerDestiMap().put(bungeeUUID, targetDestination);
if(teleportDelay <= 0) {
teleportPlayerToDesti(targetPlayer, targetDestination, bungeeUUID);
} else {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
plugin.getPlayerDestiMap().remove(bungeeUUID),
20L * 10
teleportPlayerToDesti(targetPlayer, targetDestination, bungeeUUID),
20L * teleportDelay
);
}
}
}
public void teleportPlayerToDesti(Player player, String desti, String bungeeUUID) {
if (player != null) {
Destination.warp(player, desti, false, true);
}
else {
plugin.getPlayerDestiMap().put(bungeeUUID, desti);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
plugin.getPlayerDestiMap().remove(bungeeUUID),
20L * 10
);
}
}
/**
* Example forward packet.
*

View File

@ -12,7 +12,6 @@ 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;
@ -24,7 +23,7 @@ import java.util.concurrent.TimeUnit;
*/
@Plugin(id = "advancedportals", name = "Advanced Portals",
url = "https://www.spigotmc.org/resources/advanced-portals.14356/",
version = "0.5.13")
version = "0.5.13-1")
public class AdvancedPortalsPlugin {
public HashMap<String, String[]> PlayerDestiMap = new HashMap<>();

View File

@ -1,4 +1,4 @@
main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin
name: AdvancedPortals
version: 0.5.13
version: 0.5.13-1
author: sekwah41

View File

@ -91,3 +91,7 @@ CommandLogs: true
# If you want to use bungee or velocity and it is not automatically detected (make sure you have advanced portals on the proxy, especially with velocity)
ForceEnableProxySupport: false
# How many seconds after the proxy event fires should the player be teleported (should help with on spawn plugins and such)
# 0 is disabled and anything higher causes a delay.
ProxyTeleportDelay: 0

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin
name: AdvancedPortals
version: 0.5.13
version: 0.5.13-1
author: sekwah41
description: An advanced portals plugin for bukkit.
api-version: 1.13