diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 325fa09..8a01b72 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,6 +1,12 @@ -name: Java CI +name: Build Project -on: [push, pull_request] +on: + push: + branches: + - 'dev/*' + tags: + - '*' + pull_request: jobs: build: @@ -8,10 +14,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Gradle - run: ./gradlew build + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build with Gradle + run: ./gradlew build + - name: Upload to Discord (If dev branch) + if: startsWith(github.ref, 'refs/heads/dev/') + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + run: ./gradlew discordupload + - name: Publish to Curseforge (If release branch) + if: startsWith(github.ref, 'refs/heads/release/') + env: + CURSE_API: ${{ secrets.CURSE_API }} + run: ./gradlew curseforge diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8959df5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,42 @@ +### 0.5.12 +* Added support for Velocity. +* Also fixed some issues with entity teleporting. +### 0.5.11 + * Missing changelogs +### 0.5.10 +* 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. +### 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 +### 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/README.md b/README.md index f420fff..c4e8250 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![](https://img.shields.io/github/stars/sekwah41/Advanced-Portals.svg?style=for-the-badge&logo=github)](https://github.com/sekwah41/Advanced-Portals/stargazers) [![](https://img.shields.io/github/license/sekwah41/Advanced-Portals.svg?logo=github&style=for-the-badge)](https://github.com/sekwah41/Advanced-Portals/blob/master/LICENSE.md) -Advanced Portals ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/sekwah41/Advanced-Portals/Java%20CI/master) +Advanced Portals ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/sekwah41/Advanced-Portals/Build%20Project/master) ============== 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. diff --git a/build.gradle b/build.gradle index f2780ed..f91a373 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,26 @@ +import org.apache.http.HttpEntity +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.HttpClients + +buildscript { + repositories { + maven {url "https://plugins.gradle.org/m2/"} + mavenCentral() + mavenLocal() + } + dependencies { + classpath "org.apache.httpcomponents:httpmime:4.5.13" + } +} + +plugins { + id "com.matthewprenger.cursegradle" version "1.4.0" +} + apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'idea' @@ -6,6 +29,10 @@ 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/")); + description = "" sourceCompatibility = 1.8 @@ -54,6 +81,69 @@ dependencies { //compile fileTree(dir: 'libs', include: ['*.jar']) } +/** For pre-releases and testers to be able to try the latest commits if they want. + * If the builds start exceeding 8MB then we may want to upload to s3 instead and periodically clear. + * TODO possibly add a task that announces when builds are made? + * Though add a note that it may take a while for Curse to approve the files. + */ +task discordupload { + dependsOn(jar) + doLast { + String discordWebhook = System.getenv("DISCORD_WEBHOOK") + + if(discordWebhook != null) { + println("Logging Into Discord") + + CloseableHttpClient httpClient = HttpClients.createDefault() + HttpPost uploadFile = new HttpPost(discordWebhook) + + MultipartEntityBuilder builder = MultipartEntityBuilder.create() + builder.addTextBody("content", "New automated dev build\n\n" + + "Current Features: <${project.github}/blob/${sha}/CHANGELOG.md>") + + builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName) + + HttpEntity multipart = builder.build() + + uploadFile.setEntity(multipart) + CloseableHttpResponse response = httpClient.execute(uploadFile) + response.getEntity() + + println("Posted build") + + } else { + println("Discord webhook unspecified") + } + } +} + +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 = 'beta' + addGameVersion '1.16' + addGameVersion '1.15' + addGameVersion '1.14' + addGameVersion '1.13' + + mainArtifact(jar){ + + } + //addArtifact sourcesJar + //addArtifact deobfJar + //addArtifact javadocJar + } +} + task copyPlugin { doLast { copy { diff --git a/gradle.properties b/gradle.properties index 6d84430..24f8e62 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,6 @@ # https://docs.gradle.org/current/userguide/build_environment.html # Disable with --no-build-cache -org.gradle.caching=true \ No newline at end of file +org.gradle.caching=true + +github=https://github.com/sekwah41/Advanced-Portals +curse_project_id=86001