From 3ac7a8c6ff62a9b628b2f32e65669dee5bdf5e1b Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 12 May 2021 01:19:01 +0100 Subject: [PATCH 01/22] ci: Adding changelog generation as well as changes to pipelines --- .github/workflows/gradle.yml | 3 +-- .versionrc.js | 18 ++++++++++++++++++ build.gradle | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .versionrc.js diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 74ae1e3..93e9ce2 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,8 +3,7 @@ name: Build Project on: push: branches: - - '*/*' - - '!release/*' + - '**' tags: - '*' pull_request: diff --git a/.versionrc.js b/.versionrc.js new file mode 100644 index 0000000..f7369e5 --- /dev/null +++ b/.versionrc.js @@ -0,0 +1,18 @@ +let versionRegex = /(\nversion=)([0-9.-]+)/; + +const tracker = { + filename: 'gradle.properties', + updater: { + 'readVersion': (contents) => { + return versionRegex.exec(contents)[2]; + }, + 'writeVersion': (contents, version) => { + return contents.replace(versionRegex, `$1${version}`); + } + } +} + +module.exports = { + bumpFiles: [tracker], + packageFiles: [tracker] +} diff --git a/build.gradle b/build.gradle index 416bfbd..64809ca 100644 --- a/build.gradle +++ b/build.gradle @@ -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() + } +} From fd6ef9ac08702db98a5f9c5b2af16ba9a6fae6c2 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 12 May 2021 01:22:50 +0100 Subject: [PATCH 02/22] docs: Updating Readme --- README.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c4e8250..b08c364 100644 --- a/README.md +++ b/README.md @@ -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. From 4278cd5d7a26ff540ca107c5f3a2d7512a6143f5 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 12 May 2021 02:01:52 +0100 Subject: [PATCH 03/22] ci: Fixed version bumping --- .versionrc.js | 25 ++++++++++++++----- .../velocity/AdvancedPortalsPlugin.java | 1 - 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.versionrc.js b/.versionrc.js index f7369e5..84bf848 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -1,7 +1,8 @@ -let versionRegex = /(\nversion=)([0-9.-]+)/; +let versionRegex = /(\nversion:\s)([0-9.-]+)/; +let velocityVersionRegex = /(\sversion\s=\s")([0-9.-]+)("\))/; -const tracker = { - filename: 'gradle.properties', +const plugin = { + filename: 'src/main/resources/plugin.yml', updater: { 'readVersion': (contents) => { return versionRegex.exec(contents)[2]; @@ -12,7 +13,19 @@ const tracker = { } } -module.exports = { - bumpFiles: [tracker], - packageFiles: [tracker] +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`); + } + } +} + +module.exports = { + bumpFiles: [plugin, velocity_plugin], + packageFiles: [plugin, velocity_plugin] } diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 56d453c..6e40797 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -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; From ae518bea39d9a025e140fd81d6051a36cad98bb5 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 12 May 2021 02:07:31 +0100 Subject: [PATCH 04/22] chore(release): 0.5.14-0 --- .github/workflows/gradle.yml | 8 +-- CHANGELOG.md | 67 +++++++++++++++---- build.gradle | 2 +- .../velocity/AdvancedPortalsPlugin.java | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 60 insertions(+), 21 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 93e9ce2..ff7ac3e 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -27,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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 764927c..cf3615f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,46 +1,85 @@ +# 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.14-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. diff --git a/build.gradle b/build.gradle index 64809ca..9117f79 100644 --- a/build.gradle +++ b/build.gradle @@ -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' : '') diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 6e40797..553702c 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -23,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.14-0") public class AdvancedPortalsPlugin { public HashMap PlayerDestiMap = new HashMap<>(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e3f2215..c826fd3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13 +version: 0.5.14-0 author: sekwah41 description: An advanced portals plugin for bukkit. api-version: 1.13 From e8cbb403c5237fa4ffb61d5ccc6b50b0f461324e Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 12 May 2021 02:52:43 +0100 Subject: [PATCH 05/22] ci: Fix issue with wrong dev mode --- .versionrc.js | 27 +++++++++++++++++-- build.gradle | 2 +- .../velocity/AdvancedPortalsPlugin.java | 2 +- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/.versionrc.js b/.versionrc.js index 84bf848..ad1f0ae 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -1,6 +1,17 @@ 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 plugin = { filename: 'src/main/resources/plugin.yml', updater: { @@ -13,6 +24,16 @@ const plugin = { } } +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: { @@ -25,7 +46,9 @@ const velocity_plugin = { } } +const files = [plugin, velocity_plugin, bungee]; + module.exports = { - bumpFiles: [plugin, velocity_plugin], - packageFiles: [plugin, velocity_plugin] + bumpFiles: files, + packageFiles: files } diff --git a/build.gradle b/build.gradle index 9117f79..33bfaf3 100644 --- a/build.gradle +++ b/build.gradle @@ -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/tags/") && branch.contains("-")) +def isDevBranch = branch == null || !(branch.startsWith("refs/tags/") && !branch.contains("-")) group = 'com.sekwah.advancedportals' version = getPluginData("version") + (isDevBranch ? '-SNAPSHOT' : '') diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 553702c..706f20d 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -23,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.14-0") + version = "0.5.13-0") public class AdvancedPortalsPlugin { public HashMap PlayerDestiMap = new HashMap<>(); diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 7c4275c..3557274 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13 +version: 0.5.13-0 author: sekwah41 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c826fd3..07c6038 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.14-0 +version: 0.5.13-0 author: sekwah41 description: An advanced portals plugin for bukkit. api-version: 1.13 From a1121adc10addfcce515d1358d1274232109fdfd Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 13 May 2021 00:33:28 +0100 Subject: [PATCH 06/22] feat: Added configurable proxy teleport delay --- .../bukkit/config/ConfigHelper.java | 13 ++++--- .../listeners/PluginMessageReceiver.java | 34 ++++++++++++++----- src/main/resources/config.yml | 4 +++ 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/sekwah/advancedportals/bukkit/config/ConfigHelper.java b/src/main/java/com/sekwah/advancedportals/bukkit/config/ConfigHelper.java index d7a66b4..8c7162e 100644 --- a/src/main/java/com/sekwah/advancedportals/bukkit/config/ConfigHelper.java +++ b/src/main/java/com/sekwah/advancedportals/bukkit/config/ConfigHelper.java @@ -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); } } } diff --git a/src/main/java/com/sekwah/advancedportals/bukkit/listeners/PluginMessageReceiver.java b/src/main/java/com/sekwah/advancedportals/bukkit/listeners/PluginMessageReceiver.java index 640982d..693462d 100644 --- a/src/main/java/com/sekwah/advancedportals/bukkit/listeners/PluginMessageReceiver.java +++ b/src/main/java/com/sekwah/advancedportals/bukkit/listeners/PluginMessageReceiver.java @@ -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. * diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 9bf16db..849668b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -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 From d884db3d6c14cf26bfc1190baebe109a6875c2d2 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 13 May 2021 00:44:25 +0100 Subject: [PATCH 07/22] chore(release): 0.5.13-1 --- CHANGELOG.md | 15 +++++++++++---- .../velocity/AdvancedPortalsPlugin.java | 2 +- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3615f..e913f6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,14 @@ -# 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. - +# 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.14-0 (2021-05-12) * Build Tool Change: Updated versioning and changelog tooling and standards. diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 706f20d..49d9709 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -23,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-0") + version = "0.5.13-1") public class AdvancedPortalsPlugin { public HashMap PlayerDestiMap = new HashMap<>(); diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 3557274..72f2b58 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-0 +version: 0.5.13-1 author: sekwah41 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 07c6038..97f61ee 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-0 +version: 0.5.13-1 author: sekwah41 description: An advanced portals plugin for bukkit. api-version: 1.13 From e22b068a972aef38ca878c6c4a311459b736eee5 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 13 May 2021 00:45:13 +0100 Subject: [PATCH 08/22] ci: Fix changelog generator --- .versionrc.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.versionrc.js b/.versionrc.js index ad1f0ae..0966c47 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -12,17 +12,6 @@ const ymlUpdater = { } } } -const plugin = { - filename: 'src/main/resources/plugin.yml', - 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', From df7bceea6eb9bab3244dd93b57c580bbb10ca86b Mon Sep 17 00:00:00 2001 From: Sekwah Date: Thu, 13 May 2021 00:47:46 +0100 Subject: [PATCH 09/22] docs: Fix version issue in CHANGELOG.md --- CHANGELOG.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e913f6d..8777919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,15 @@ -# 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.14-0 (2021-05-12) +# 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. From a20028d9fc15032e04cb0449f9bcc37d10bc023f Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 00:50:33 +0100 Subject: [PATCH 10/22] ci: Upload to curseforge bukkit --- build.gradle | 105 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 33bfaf3..5d9ad72 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,17 @@ +import org.apache.commons.codec.Charsets import org.apache.http.HttpEntity +import org.apache.http.HttpResponse +import org.apache.http.client.HttpClient +import org.apache.http.client.config.CookieSpecs +import org.apache.http.client.config.RequestConfig import org.apache.http.client.methods.CloseableHttpResponse import org.apache.http.client.methods.HttpPost import org.apache.http.entity.ContentType import org.apache.http.entity.mime.MultipartEntityBuilder import org.apache.http.impl.client.CloseableHttpClient +import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.impl.client.HttpClients +import org.apache.http.client.methods.HttpGet buildscript { repositories { @@ -14,13 +21,10 @@ buildscript { } dependencies { classpath "org.apache.httpcomponents:httpmime:4.5.13" + classpath "com.google.code.gson:gson:2.6.2" } } -plugins { - id "com.matthewprenger.cursegradle" version "1.4.0" -} - apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'idea' @@ -70,6 +74,11 @@ repositories { // includeLibs just says to include the library in the final jar dependencies { + // to stop IntelliJ complaining about this build script + testCompile "org.apache.httpcomponents:httpmime:4.5.13" + testCompile "org.apache.httpcomponents:httpclient:4.5.13" + testCompile "com.google.code.gson:gson:2.6.2" + //implementation "org.bukkit:bukkit:1.16.1-R0.1-SNAPSHOT" implementation "org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" implementation "net.md-5:bungeecord-api:1.15-SNAPSHOT" @@ -119,31 +128,79 @@ task discordupload { } } -tasks.curseforge.enabled = System.getenv("CURSE_API") != null -curseforge { - logger.info("Curse api: " + System.getenv("CURSE_API")) - if (System.getenv("CURSE_API") != null) { - apiKey = System.getenv("CURSE_API") - } - project { - id = project.curse_project_id - // 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 = 'release' - addGameVersion '1.16' - addGameVersion '1.15' - addGameVersion '1.14' - addGameVersion '1.13' +String getValueFromCurseAPI(apiKey, endpoint) { + String API_BASE_URL = 'https://minecraft.curseforge.com' - mainArtifact(jar){ + HttpClient client = HttpClientBuilder.create() + .setDefaultRequestConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build()).build() + HttpGet get = new HttpGet(API_BASE_URL + endpoint) + get.setHeader('X-Api-Token', apiKey) + + HttpResponse response = client.execute(get) + + int statusCode = response.statusLine.statusCode + + if (statusCode == 200) { + byte[] data = response.entity.content.bytes + return new String(data, Charsets.UTF_8) + } else { + if (response.getFirstHeader('content-type').value.contains('json')) { + InputStreamReader reader = new InputStreamReader(response.entity.content) + reader.close() + throw new RuntimeException("[CurseForge] Error") + } else { + throw new RuntimeException("[CurseForge] HTTP Error Code $response.statusLine.statusCode: $response.statusLine.reasonPhrase") } - //addArtifact sourcesJar - //addArtifact deobfJar - //addArtifact javadocJar } + return "" +} + +class VersionInfo { + int id + String name + String slug +} + +class GameVersion { + int id + int gameVersionTypeID + String name + String slug +} + + +// Based on https://github.com/matthewprenger/CurseGradle as it didnt support Bukkit uploads at the time. +task curseforge { + dependsOn(jar) + doLast { + String apiKey = null + + if (System.getenv("CURSE_API") != null) { + apiKey = System.getenv("CURSE_API") + } + + if(apiKey != null) { + String VERSION_TYPES_URL = "/api/game/version-types" + String VERSION_URL = "/api/game/versions" + String UPLOAD_URL = "/api/projects/%s/upload-file" + println("Uploading to CurseForge") + + println(getValueFromCurseAPI(apiKey, VERSION_TYPES_URL)) + + println("Published build") + + } else { + println("Discord webhook unspecified") + } + } +// id = project.curse_project_id +// // 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 = 'release' } task copyPlugin { From 4ab2e2bd7a5f29730f64539db09c543c421e4ed8 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:06:23 +0100 Subject: [PATCH 11/22] ci: Update changelog scripts --- build.gradle | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 5d9ad72..8599f94 100644 --- a/build.gradle +++ b/build.gradle @@ -241,10 +241,36 @@ task runJar() { } } -task updateChangelog(type: Exec) { - commandLine 'cmd', '/c', 'npx standard-version' - ext.output = { - return standardOutput.toString() +/** + * These are needed as standard-version doesnt allow for the ability to skip tag versions for the changelog. + * Well it does but not on purpose and it breaks things. + */ +task updateChangelog { + doLast{ + exec { + commandLine 'cmd', '/c', 'npx standard-version -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag --skip.bump --skip.commit' + ext.output = { + return standardOutput.toString() + } + } + exec { + commandLine 'cmd', '/c', 'git add CHANGELOG.md' + ext.output = { + return standardOutput.toString() + } + } + exec { + commandLine 'cmd', '/c', 'git commit -m "chore(changelog): Update CHANGELOG.md with full release notes.' + ext.output = { + return standardOutput.toString() + } + } + exec { + commandLine 'cmd', '/c', 'npx standard-version --skip.changelog' + ext.output = { + return standardOutput.toString() + } + } } } From 2bf377e575df07ab018e9f23747f97699bc63954 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:10:38 +0100 Subject: [PATCH 12/22] docs(changelog): Updating locations and other details. --- .versionrc.js | 8 +++++++- build.gradle | 8 ++++---- CHANGELOG.md => docs/CHANGELOG.md | 4 +--- docs/SNAPSHOT_CHANGELOG.md | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 8 deletions(-) rename CHANGELOG.md => docs/CHANGELOG.md (95%) create mode 100644 docs/SNAPSHOT_CHANGELOG.md diff --git a/.versionrc.js b/.versionrc.js index 0966c47..a81b7db 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -39,5 +39,11 @@ const files = [plugin, velocity_plugin, bungee]; module.exports = { bumpFiles: files, - packageFiles: files + packageFiles: files, + header:"# Changelog\n" + + "\n" + + "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.\n" + + "\n" + + "For release changelogs see [CHANGELOG.md](CHANGELOG.md) \n" + + "For snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md)\n", } diff --git a/build.gradle b/build.gradle index 8599f94..d5e4b20 100644 --- a/build.gradle +++ b/build.gradle @@ -110,7 +110,7 @@ task discordupload { MultipartEntityBuilder builder = MultipartEntityBuilder.create() builder.addTextBody("content", "New automated dev build\n\n" + - "Current Features: <${project.github}/blob/${sha}/CHANGELOG.md>") + "Current Features: <${project.github}/blob/${sha}/docs/CHANGELOG.md>") builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName) @@ -248,13 +248,13 @@ task runJar() { task updateChangelog { doLast{ exec { - commandLine 'cmd', '/c', 'npx standard-version -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag --skip.bump --skip.commit' + commandLine 'cmd', '/c', 'npx standard-version -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag --skip.bump --skip.commit' ext.output = { return standardOutput.toString() } } exec { - commandLine 'cmd', '/c', 'git add CHANGELOG.md' + commandLine 'cmd', '/c', 'git add docs/CHANGELOG.md' ext.output = { return standardOutput.toString() } @@ -275,7 +275,7 @@ task updateChangelog { } task updateChangelogPreRelease(type: Exec) { - commandLine 'cmd', '/c', 'npx standard-version --prerelease' + commandLine 'cmd', '/c', 'npx standard-version --prerelease -i docs/SNAPSHOT_CHANGELOG.md' ext.output = { return standardOutput.toString() } diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 95% rename from CHANGELOG.md rename to docs/CHANGELOG.md index 8777919..2887088 100644 --- a/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,13 +12,11 @@ All notable changes to this project will be documented in this file. See [standa ### 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 + ### 0.5.12 * Added support for Velocity. diff --git a/docs/SNAPSHOT_CHANGELOG.md b/docs/SNAPSHOT_CHANGELOG.md new file mode 100644 index 0000000..e7641ba --- /dev/null +++ b/docs/SNAPSHOT_CHANGELOG.md @@ -0,0 +1,14 @@ +# 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. From 327e7dd0cb0666d69c6d52430091da88fcc1f037 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:32:48 +0100 Subject: [PATCH 13/22] chore(release): 0.5.13-2 --- .versionrc.js | 4 ++-- docs/CHANGELOG.md | 16 ++-------------- docs/SNAPSHOT_CHANGELOG.md | 12 ++++++++++++ .../velocity/AdvancedPortalsPlugin.java | 2 +- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.versionrc.js b/.versionrc.js index a81b7db..6679355 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -44,6 +44,6 @@ module.exports = { "\n" + "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.\n" + "\n" + - "For release changelogs see [CHANGELOG.md](CHANGELOG.md) \n" + - "For snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md)\n", + "For the release changelogs see [CHANGELOG.md](CHANGELOG.md) \n" + + "For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md)\n", } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2887088..4fa2ead 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,20 +2,8 @@ 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. - * 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 - +For the release changelogs see [CHANGELOG.md](CHANGELOG.md) +For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md) ### 0.5.12 diff --git a/docs/SNAPSHOT_CHANGELOG.md b/docs/SNAPSHOT_CHANGELOG.md index e7641ba..22e6041 100644 --- a/docs/SNAPSHOT_CHANGELOG.md +++ b/docs/SNAPSHOT_CHANGELOG.md @@ -2,6 +2,13 @@ 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. +For the release changelogs see [CHANGELOG.md](CHANGELOG.md) +For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md) + +### [0.5.13-2](https://github.com/sekwah41/Advanced-Portals/compare/v0.5.13-1...v0.5.13-2) (2021-05-14) + + * No code changes, just updated the changelog generation. + ### 0.5.13-1 (2021-05-12) @@ -12,3 +19,8 @@ All notable changes to this project will be documented in this file. See [standa ### 0.5.13-0 (2021-05-12) * Build Tool Change: Updated versioning and changelog tooling and standards. + * 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 + + diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 49d9709..7980787 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -23,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-1") + version = "0.5.13-2") public class AdvancedPortalsPlugin { public HashMap PlayerDestiMap = new HashMap<>(); diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 72f2b58..44ad4c8 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-1 +version: 0.5.13-2 author: sekwah41 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 97f61ee..25265af 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-1 +version: 0.5.13-2 author: sekwah41 description: An advanced portals plugin for bukkit. api-version: 1.13 From 0adb85454814a6bfcca414196eb8f50893477428 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:40:12 +0100 Subject: [PATCH 14/22] ci: Further upgrades to changelog scripts --- build.gradle | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index d5e4b20..c815fed 100644 --- a/build.gradle +++ b/build.gradle @@ -248,7 +248,13 @@ task runJar() { task updateChangelog { doLast{ exec { - commandLine 'cmd', '/c', 'npx standard-version -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag --skip.bump --skip.commit' + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.tag' + ext.output = { + return standardOutput.toString() + } + } + exec { + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.commit --skip.tag --skip.bump' ext.output = { return standardOutput.toString() } @@ -266,7 +272,7 @@ task updateChangelog { } } exec { - commandLine 'cmd', '/c', 'npx standard-version --skip.changelog' + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.bump' ext.output = { return standardOutput.toString() } @@ -275,7 +281,7 @@ task updateChangelog { } task updateChangelogPreRelease(type: Exec) { - commandLine 'cmd', '/c', 'npx standard-version --prerelease -i docs/SNAPSHOT_CHANGELOG.md' + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --prerelease -i docs/SNAPSHOT_CHANGELOG.md' ext.output = { return standardOutput.toString() } From b243b4d889b8039cb800d981d44d85da06ff62d5 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:55:22 +0100 Subject: [PATCH 15/22] feat(proxy): Added Velocity support --- .../advancedportals/velocity/AdvancedPortalsPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 7980787..5e867d0 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -18,6 +18,10 @@ import org.slf4j.Logger; import java.util.HashMap; import java.util.concurrent.TimeUnit; +/** + * Velocity support was added here (this is just a comment to properly fix changelogs) + */ + /** * While there may be a better way to do this for now we are keeping the behavior so it also works with Bungee's horrible API. */ From f3c8f73975857a4e5d31a6a21111eee8b7888bdd Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 02:59:24 +0100 Subject: [PATCH 16/22] feat(proxy): Modern forwarding will be automatically detected. You will no longer need to manually set ForceEnableProxySupport --- .../sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java | 4 ++++ .../advancedportals/velocity/AdvancedPortalsPlugin.java | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java index d419106..ebcc3f2 100644 --- a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java @@ -17,6 +17,10 @@ import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; import java.util.Map; +/** + * Support for auto detecting modern forwarding added. + */ + public class AdvancedPortalsPlugin extends JavaPlugin { private Settings settings; diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 5e867d0..7980787 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -18,10 +18,6 @@ import org.slf4j.Logger; import java.util.HashMap; import java.util.concurrent.TimeUnit; -/** - * Velocity support was added here (this is just a comment to properly fix changelogs) - */ - /** * While there may be a better way to do this for now we are keeping the behavior so it also works with Bungee's horrible API. */ From 99c810e1beeee743734ec451ffe5df312eec8726 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 03:16:12 +0100 Subject: [PATCH 17/22] feat(proxy): Added a ForceEnableProxySupport config option This is in case other plugins may be messing with the location after swapping servers so that it is enforced after the others. --- .../sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java index ebcc3f2..d419106 100644 --- a/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/bukkit/AdvancedPortalsPlugin.java @@ -17,10 +17,6 @@ import org.bukkit.plugin.java.JavaPlugin; import java.util.HashMap; import java.util.Map; -/** - * Support for auto detecting modern forwarding added. - */ - public class AdvancedPortalsPlugin extends JavaPlugin { private Settings settings; From 6b097087a2d016e9b6ece6d95196b7761a03c9df Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 11:14:53 +0100 Subject: [PATCH 18/22] build: Shorten updateChangelog steps --- build.gradle | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index c815fed..d2cce6c 100644 --- a/build.gradle +++ b/build.gradle @@ -248,25 +248,7 @@ task runJar() { task updateChangelog { doLast{ exec { - commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.tag' - ext.output = { - return standardOutput.toString() - } - } - exec { - commandLine 'cmd', '/c', 'npx standard-version@9.3.0 -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.commit --skip.tag --skip.bump' - ext.output = { - return standardOutput.toString() - } - } - exec { - commandLine 'cmd', '/c', 'git add docs/CHANGELOG.md' - ext.output = { - return standardOutput.toString() - } - } - exec { - commandLine 'cmd', '/c', 'git commit -m "chore(changelog): Update CHANGELOG.md with full release notes.' + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag' ext.output = { return standardOutput.toString() } From 9d7184d86ed80365bb7f90baef46598fd89b7794 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Fri, 14 May 2021 11:42:46 +0100 Subject: [PATCH 19/22] docs: Updated README.md --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b08c364..0994903 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,29 @@ Usage stats can be found here https://bstats.org/plugin/bukkit/AdvancedPortals The api isn't implemented in this version, sorry for any inconvenience. Check the recode tree for possibly a working recode at some point. -## Contributing +# 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. +Accepted tags mostly follow the Angular style and are meant to only loosely be followed. +When commits close an issue refer in the commit description in the following style (Refs #1, #2, #3) +## Types available + * **build**: Changes that affect the build system or external dependencies + * **ci**: Changes to our CI configuration files and scripts + * **docs**: Documentation only changes + * **feat**: A new feature + * **fix**: A bug fix + * **perf**: A code change that improves performance + * **refactor**: A code change that neither fixes a bug nor adds a feature + * **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) + + +## Scopes available +Scopes are only needed if relating to specific features just to make them easier to find. +_I'll expand the list as I work more on the project._ + * **proxy** (Proxy specific features and issues) + From 8e0590b6d1f7666e73987f9095067dd1729974c9 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Sat, 15 May 2021 02:59:07 +0100 Subject: [PATCH 20/22] ci: Add comment for specific version --- .versionrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.versionrc.js b/.versionrc.js index 6679355..b45b3bd 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -40,6 +40,7 @@ const files = [plugin, velocity_plugin, bungee]; module.exports = { bumpFiles: files, packageFiles: files, + //releaseAs: '0.16.0', header:"# Changelog\n" + "\n" + "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.\n" + From 8acb0f535ea2a4c4e96b0acd06bc0ae57636dd24 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Tue, 18 May 2021 03:39:06 +0100 Subject: [PATCH 21/22] ci: Updating uploads --- .versionrc.js | 1 + build.gradle | 108 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 17 deletions(-) diff --git a/.versionrc.js b/.versionrc.js index b45b3bd..ad5cf20 100644 --- a/.versionrc.js +++ b/.versionrc.js @@ -40,6 +40,7 @@ const files = [plugin, velocity_plugin, bungee]; module.exports = { bumpFiles: files, packageFiles: files, + // In case you need to force a version change (mostly due to change of scope of the update e.g. major now instead of patch) //releaseAs: '0.16.0', header:"# Changelog\n" + "\n" + diff --git a/build.gradle b/build.gradle index d2cce6c..edad35d 100644 --- a/build.gradle +++ b/build.gradle @@ -12,24 +12,27 @@ import org.apache.http.impl.client.CloseableHttpClient import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.impl.client.HttpClients import org.apache.http.client.methods.HttpGet +import com.google.gson.Gson + + +apply plugin: 'java' +apply plugin: 'maven-publish' +apply plugin: 'idea' buildscript { repositories { maven {url "https://plugins.gradle.org/m2/"} mavenCentral() mavenLocal() + jcenter() } dependencies { classpath "org.apache.httpcomponents:httpmime:4.5.13" - classpath "com.google.code.gson:gson:2.6.2" + classpath "com.google.code.gson:gson:2.8.6" + classpath "org.apache.httpcomponents:httpclient:4.5.13" } } -apply plugin: 'java' -apply plugin: 'maven-publish' -apply plugin: 'idea' -apply plugin: 'eclipse' - def branch = System.getenv("GITHUB_REF"); def sha = System.getenv("GITHUB_SHA"); def isDevBranch = branch == null || !(branch.startsWith("refs/tags/") && !branch.contains("-")) @@ -74,10 +77,6 @@ repositories { // includeLibs just says to include the library in the final jar dependencies { - // to stop IntelliJ complaining about this build script - testCompile "org.apache.httpcomponents:httpmime:4.5.13" - testCompile "org.apache.httpcomponents:httpclient:4.5.13" - testCompile "com.google.code.gson:gson:2.6.2" //implementation "org.bukkit:bukkit:1.16.1-R0.1-SNAPSHOT" implementation "org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT" @@ -132,6 +131,8 @@ task discordupload { String getValueFromCurseAPI(apiKey, endpoint) { String API_BASE_URL = 'https://minecraft.curseforge.com' + Gson gson = new Gson() + HttpClient client = HttpClientBuilder.create() .setDefaultRequestConfig(RequestConfig.custom() .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build()).build() @@ -158,10 +159,40 @@ String getValueFromCurseAPI(apiKey, endpoint) { return "" } -class VersionInfo { - int id - String name - String slug +/** + * Upload a single file (in case you also want to upload the other files like source n stuff) + * @param json + * @param file + * @return + * @throws IOException + * @throws URISyntaxException + */ +UploadResponse uploadFile(Metadata metadata, File file, String apiKey, Gson gson) throws IOException, URISyntaxException { + String API_BASE_URL = 'https://minecraft.curseforge.com' + String UPLOAD_URL = "/api/projects/%s/upload-file" + // Upload + // Important info + String uploadUrl = String.format(API_BASE_URL + UPLOAD_URL, project.curse_project_id) + + HttpClient client = HttpClientBuilder.create() + .setDefaultRequestConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build()).build() + + HttpPost post = new HttpPost(uploadUrl) + post.setHeader('X-Api-Token', apiKey) + + + // https://support.curseforge.com/en/support/solutions/articles/9000197321-curseforge-api + post.setEntity(MultipartEntityBuilder.create() + .addTextBody('metadata', gson.toJson(metadata), ContentType.APPLICATION_JSON) + .addBinaryBody('file', file) + .build()) + + HttpResponse response = client.execute(post) + InputStreamReader reader = new InputStreamReader(response.entity.content) + UploadResponse uploadResponse = gson.fromJson(reader, UploadResponse) + reader.close() + return uploadResponse } class GameVersion { @@ -171,6 +202,20 @@ class GameVersion { String slug } +/** + * As described here https://support.curseforge.com/en/support/solutions/articles/9000197321-curseforge-api + */ +class Metadata { + String changelog + String changelogType + int[] gameVersions + String releaseType +} + +class UploadResponse { + int id; +} + // Based on https://github.com/matthewprenger/CurseGradle as it didnt support Bukkit uploads at the time. task curseforge { @@ -183,12 +228,41 @@ task curseforge { } if(apiKey != null) { - String VERSION_TYPES_URL = "/api/game/version-types" + + Gson gson = new Gson() + + //String VERSION_TYPES_URL = "/api/game/version-types" + int gameVersionTypeID = 1 String VERSION_URL = "/api/game/versions" - String UPLOAD_URL = "/api/projects/%s/upload-file" println("Uploading to CurseForge") - println(getValueFromCurseAPI(apiKey, VERSION_TYPES_URL)) + // Get game versions + String gameVersionsString = getValueFromCurseAPI(apiKey, VERSION_URL) + GameVersion[] gameVersions = gson.fromJson(gameVersionsString, GameVersion[].class) + def versions = gameVersions.findAll {it.gameVersionTypeID == gameVersionTypeID} + + String[] supportedVersions = [ + "1.16", + "1.15", + "1.14", + "1.13" + ] + + def supportedGameVersions = versions.findAll {supportedVersions.contains(it.name)} + int[] supportedGameVersionIds = supportedGameVersions.collect {it.id}.toArray() + + println("Supported Version Id's ${supportedGameVersionIds}") + + Metadata uploadMetadata = new Metadata(); + + uploadMetadata.changelog = "${project.github}/blob/${sha}/CHANGELOG.md" + uploadMetadata.changelogType = "markdown" + uploadMetadata.releaseType = isDevBranch ? "beta" : "release" + uploadMetadata.gameVersions = supportedGameVersionIds + + def uploadId = uploadFile(uploadMetadata, file(jar.archiveFile), apiKey, gson) + + println("Uploaded with ID: ${uploadId.id}") println("Published build") From 093da07b007fa96e68b351f8039f978402dda5ca Mon Sep 17 00:00:00 2001 From: Sekwah Date: Wed, 19 May 2021 00:49:41 +0100 Subject: [PATCH 22/22] chore(release): 0.16.0 --- build.gradle | 4 +++- docs/CHANGELOG.md | 24 +++++++++++++------ .../velocity/AdvancedPortalsPlugin.java | 2 +- src/main/resources/bungee.yml | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index edad35d..8537bd5 100644 --- a/build.gradle +++ b/build.gradle @@ -318,6 +318,8 @@ task runJar() { /** * These are needed as standard-version doesnt allow for the ability to skip tag versions for the changelog. * Well it does but not on purpose and it breaks things. + * + * Tagging is skipped so that the release can be merged and confirmed (A little long winded but just to stop mistakes) */ task updateChangelog { doLast{ @@ -328,7 +330,7 @@ task updateChangelog { } } exec { - commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.bump' + commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.bump --skip.tag' ext.output = { return standardOutput.toString() } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4fa2ead..9a6b710 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,10 +1,20 @@ -# 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. - -For the release changelogs see [CHANGELOG.md](CHANGELOG.md) -For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md) - +# 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. + +For the release changelogs see [CHANGELOG.md](CHANGELOG.md) +For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md) + +## 0.16.0 (2021-05-18) + + +### Features + +* **proxy:** Added a ForceEnableProxySupport config option ([99c810e](https://github.com/sekwah41/Advanced-Portals/commit/99c810e1beeee743734ec451ffe5df312eec8726)) +* **proxy:** Added Velocity support ([b243b4d](https://github.com/sekwah41/Advanced-Portals/commit/b243b4d889b8039cb800d981d44d85da06ff62d5)) +* **proxy:** Modern forwarding will be automatically detected. ([f3c8f73](https://github.com/sekwah41/Advanced-Portals/commit/f3c8f73975857a4e5d31a6a21111eee8b7888bdd)) +* Added configurable proxy teleport delay ([a1121ad](https://github.com/sekwah41/Advanced-Portals/commit/a1121adc10addfcce515d1358d1274232109fdfd)) + ### 0.5.12 * Added support for Velocity. diff --git a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java index 7980787..9786ede 100644 --- a/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java +++ b/src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java @@ -23,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-2") + version = "0.16.0") public class AdvancedPortalsPlugin { public HashMap PlayerDestiMap = new HashMap<>(); diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml index 44ad4c8..09fc20d 100644 --- a/src/main/resources/bungee.yml +++ b/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-2 +version: 0.16.0 author: sekwah41 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 25265af..1259463 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin name: AdvancedPortals -version: 0.5.13-2 +version: 0.16.0 author: sekwah41 description: An advanced portals plugin for bukkit. api-version: 1.13