Compare commits
193 Commits
0.5.0
...
spigot-1.1
Author | SHA1 | Date |
---|---|---|
renovate[bot] | 689d4a4fe9 | |
renovate[bot] | f0671fb8b8 | |
renovate[bot] | 9cf6d9e991 | |
Tad Hunt | b0a93c2c35 | |
renovate[bot] | 5229339a8c | |
renovate[bot] | 1a759dcc76 | |
renovate[bot] | 93a6aface2 | |
renovate[bot] | 0b64f47b8a | |
renovate[bot] | 617ccfd66a | |
Osiris-Team | e808668fce | |
renovate[bot] | 91d52b8c1b | |
renovate[bot] | eb71f1c1d1 | |
renovate[bot] | 15956b4844 | |
renovate[bot] | 4f60d8e319 | |
renovate[bot] | f5f06167db | |
renovate[bot] | 0f595fac7d | |
renovate[bot] | 051fc6c92e | |
renovate[bot] | 22483ac052 | |
renovate[bot] | 51aa6dac47 | |
renovate[bot] | 029f117fc1 | |
Renovate Bot | 87cd76cdeb | |
Renovate Bot | 34b0127f99 | |
Renovate Bot | 7d3597faad | |
Renovate Bot | 58e7e3ad78 | |
Renovate Bot | 6906772138 | |
Renovate Bot | 080aae4a9e | |
Renovate Bot | f6620ef2eb | |
Renovate Bot | 05359480a3 | |
Renovate Bot | a317acce3d | |
Renovate Bot | 9b7c09955e | |
Renovate Bot | 8eb3a2926b | |
Renovate Bot | 71e67f2010 | |
Sekwah | 5df74aae28 | |
Sekwah | 4904d806be | |
Sekwah | 9a64ae58c7 | |
Renovate Bot | c504909668 | |
Renovate Bot | 5b79228be7 | |
Renovate Bot | 6ab4c363ac | |
Renovate Bot | 5751879abd | |
Renovate Bot | 7d82fa3879 | |
Sekwah | 1bad72bbc2 | |
Sekwah | f8bec4c1ee | |
Sekwah | 75d2be30fe | |
Sekwah | 787c1d09b4 | |
Sekwah | 20c56219f9 | |
Sekwah | 778ad2ab31 | |
JOO200 | e3021367ab | |
JOO200 | fdb22ab8b5 | |
JOO200 | d16ccb7717 | |
Renovate Bot | 2207324598 | |
Renovate Bot | d916deb3a9 | |
Sekwah | 659fcca7ee | |
Mohammed Al-Dahleh | 3928922de3 | |
Sekwah | a9e660db65 | |
Renovate Bot | 486cff7e09 | |
Renovate Bot | d09ad72491 | |
Renovate Bot | 7d5e96f291 | |
Sekwah | 393ad01d45 | |
Renovate Bot | 71d08da9dc | |
Renovate Bot | f225363e67 | |
Renovate Bot | 162505553f | |
Renovate Bot | 812f4c78dc | |
Renovate Bot | 0ab32790eb | |
Renovate Bot | 0be605fe3a | |
Sekwah | 64f0f5113e | |
Sekwah | fb80fbb515 | |
Sekwah | 81d64ecc5a | |
Renovate Bot | aacf626635 | |
Renovate Bot | 12ab00f004 | |
Renovate Bot | 065fa22852 | |
Sekwah | 012ddf6e36 | |
Sekwah | 9b3adf7ba4 | |
Sekwah | ab9dbe027e | |
Sekwah | 62307c6bcf | |
Renovate Bot | e2b0723d24 | |
Renovate Bot | 1a57a509e6 | |
Sekwah | ee8f0ff3d0 | |
Sekwah | 05d2a51fbf | |
Sekwah | e73d84afa3 | |
Renovate Bot | d4b642ec23 | |
Sekwah | bc683183f6 | |
Sekwah | 3a5460cff3 | |
Sekwah | f364828176 | |
Renovate Bot | dfe5cfc26d | |
Sekwah | ebd94fd081 | |
Renovate Bot | ffee4fbbbe | |
Renovate Bot | dcf8456511 | |
Renovate Bot | 1ac1fe7e2e | |
Sekwah | c51a556ac7 | |
Sekwah | eafe7f1d9c | |
Sekwah | ff95908bf2 | |
Sekwah | d2e69771c5 | |
Sekwah | 17a81dede7 | |
Renovate Bot | efc9ad4715 | |
Sekwah | 7c78f414ac | |
Sekwah | bfea4b2836 | |
Sekwah | b1be39b908 | |
Sekwah | 68ba7dc76b | |
Sekwah | cd96c0d2c0 | |
Sekwah | 06722986be | |
Sekwah | 9536835785 | |
Sekwah | 7b0c1ca6ae | |
Sekwah | 100b825765 | |
Sekwah | 186ec82afc | |
Sekwah | 093da07b00 | |
Sekwah | 8acb0f535e | |
Sekwah | 8e0590b6d1 | |
Sekwah | 9d7184d86e | |
Sekwah | 6b097087a2 | |
Sekwah | 99c810e1be | |
Sekwah | f3c8f73975 | |
Sekwah | b243b4d889 | |
Sekwah | 0adb854548 | |
Sekwah | 327e7dd0cb | |
Sekwah | 2bf377e575 | |
Sekwah | 4ab2e2bd7a | |
Sekwah | a20028d9fc | |
Sekwah | d025947134 | |
Sekwah | df7bceea6e | |
Sekwah | e22b068a97 | |
Sekwah | d884db3d6c | |
Sekwah | a1121adc10 | |
Sekwah | e8cbb403c5 | |
Sekwah | ae518bea39 | |
Sekwah | 4278cd5d7a | |
Sekwah | fd6ef9ac08 | |
Sekwah | 3ac7a8c6ff | |
Sekwah | 0ad693db0c | |
Sekwah | 1aa8ce45ac | |
Sekwah | fc952e6c9e | |
Sekwah | 5c1f712765 | |
Sekwah | 7034eee7b2 | |
Sekwah | e8ecde5b4e | |
Sekwah | baca2d3316 | |
Sekwah | 2040ea08a8 | |
Sekwah | afe4e41b14 | |
Sekwah | 425093d887 | |
Sekwah | a30e44bb35 | |
Sekwah | 3ac200bbc0 | |
Sekwah | 5c2c1cf465 | |
Sekwah | 9aa53f4a28 | |
Sekwah | 4648ca31d6 | |
Sekwah | 5e1d9aeb9d | |
Sekwah | 31db696b1a | |
Sekwah | 56221ee058 | |
loonybtard | b7b148f057 | |
Sekwah | ecd11a7f34 | |
Sekwah | 5ee12d7696 | |
loonybtard | ff4fd1f3e7 | |
loonybtard | 5682b94aef | |
Sekwah | 886a8744e2 | |
Sekwah | 8c7798dec8 | |
Sekwah | 41643caff2 | |
Sekwah | f8e5cced9e | |
Sekwah | 2da18a3417 | |
Sekwah | d06f150358 | |
Sekwah | 1796945896 | |
Sekwah | 2063c8e30c | |
Sekwah | 9279be58aa | |
Sekwah | 9a2ff28ab9 | |
Sekwah | aacdd54ffe | |
Sekwah | 6dd23ddeee | |
Sekwah | d104da907f | |
Sekwah | d84ec0bd3e | |
Sekwah | f14fd9f692 | |
Sekwah | 69176c379b | |
Freddy | 7aa4114742 | |
Sekwah | 42b01ec059 | |
Sekwah | 806beea62a | |
Sekwah | 38b15acd15 | |
Daniil | d950d8eb22 | |
Sekwah | e02dd0e858 | |
Sekwah | 5718d789d9 | |
tmantti | f82de6be12 | |
tmantti | 77096a931c | |
tmantti | 1cba807351 | |
tmantti | 35845e1caa | |
tmantti | cf2ff77ccb | |
Sekwah | 17fb0c5332 | |
Sekwah | 468715a29f | |
Sekwah | f2090a917b | |
Sekwah | 1c413c82e5 | |
Sekwah | 4012e9bc01 | |
Sekwah | 6c9eeb06d0 | |
Sekwah | a4771aa86a | |
Sekwah | d2a362e5af | |
Sekwah | 859971b6ea | |
Sekwah | 79f43b9a62 | |
Sekwah | 4912984cf0 | |
Sekwah | 9528ad6049 | |
Sekwah | 1e322aa2ce | |
Sekwah | bfcb2d596e | |
silicondev | 2100e5cec9 |
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"baseBranch": "spigot-1.13-1.16",
|
||||
"plugins": [
|
||||
[
|
||||
"gradle",
|
||||
{
|
||||
"gradleCommand": "./gradlew",
|
||||
"gradleOptions": [""]
|
||||
}
|
||||
],
|
||||
[
|
||||
"exec",
|
||||
{
|
||||
"canary": "./gradlew build discord"
|
||||
}
|
||||
],
|
||||
["conventional-commits", { "preset": "angular" }],
|
||||
"released",
|
||||
["upload-assets", ["./build/libs/*.jar"]]
|
||||
],
|
||||
"owner": "sekwah41",
|
||||
"repo": "Advanced-Portals",
|
||||
"name": "Sekwah",
|
||||
"email": "contact@sekwah.com",
|
||||
"onlyPublishWithReleaseLabel": true,
|
||||
"shipit": {
|
||||
"onlyGraduateWithReleaseLabel": true
|
||||
},
|
||||
"canary": {
|
||||
"message": "📦 Published PR to [discord](https://discord.sekwah.com/) as canary version: %v"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# What Changed
|
||||
Whatever changed here
|
||||
|
||||
## Release Notes
|
||||
If anything should be commented in the changelog release notes.
|
||||
|
||||
**NOTE:** Please remove this unless something important needs to be shared.
|
||||
It's just to save time looking up what is needed in the event we need to.
|
|
@ -0,0 +1,47 @@
|
|||
name: Release
|
||||
|
||||
on: [push, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||
restore-keys: ${{ runner.os }}-gradle
|
||||
- name: Cache Node packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||
restore-keys: ${{ runner.os }}-node
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: 8
|
||||
- name: Use Node.js 12.x
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Prepare repository
|
||||
run: |
|
||||
git fetch --unshallow --tags
|
||||
yarn install --frozen-lockfile
|
||||
echo $(yarn bin) >> $GITHUB_PATH
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Create Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CURSE_API: ${{ secrets.CURSE_API }}
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
run: |
|
||||
auto shipit
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
*.class
|
||||
.*
|
||||
/build/
|
||||
/target/
|
||||
|
||||
.gradle/
|
||||
.idea/
|
||||
# Package Files #
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
node_modules/
|
||||
*.iml
|
||||
*.iws
|
||||
*.ipr
|
||||
|
||||
.env
|
||||
out/
|
||||
logs/
|
||||
classes/
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
language: java
|
||||
before_install:
|
||||
- chmod +x gradlew
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
|
@ -0,0 +1,240 @@
|
|||
# v0.9.2 (Thu Feb 24 2022)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- fix: Removes the false positive warning from McAntiMalware [#318](https://github.com/sekwah41/Advanced-Portals/pull/318) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): Update Deps ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.9 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update Deps [#316](https://github.com/sekwah41/Advanced-Portals/pull/316) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency gradle to v7.3.3 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.9.1 (Fri Dec 17 2021)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- fix: Error in position checks for portal creation [#310](https://github.com/sekwah41/Advanced-Portals/pull/310) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(ci): Update release support flags ([@sekwah41](https://github.com/sekwah41))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
|
||||
---
|
||||
|
||||
# v0.9.0 (Wed Dec 15 2021)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- feat: WorldEdit Integration, fix logic error [#307](https://github.com/sekwah41/Advanced-Portals/pull/307) ([@JOO200](https://github.com/JOO200))
|
||||
- feat: Added WorldEdit Integration [#307](https://github.com/sekwah41/Advanced-Portals/pull/307) ([@JOO200](https://github.com/JOO200))
|
||||
- feat: Adds ability to configure warp message [#302](https://github.com/sekwah41/Advanced-Portals/pull/302) ([@maldahleh](https://github.com/maldahleh))
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- chore(deps): Update Velocity to 3.1.0 [#307](https://github.com/sekwah41/Advanced-Portals/pull/307) ([@JOO200](https://github.com/JOO200))
|
||||
- chore(deps): Update Deps ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency gradle to v7.3.1 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- docs: Update changelog ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(ci): Allow manual triggering ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): Update Deps to v10.32.3 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency gradle to v7.3 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency io.netty:netty-all to v4.1.70.Final ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(ci): Update to list 1.17 as supported automatically ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): Update dependency io.netty:netty-all to v4.1.69.Final ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update Deps to v10.32.1 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update Deps to v10.32.0 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): Update dependency com.velocitypowered:velocity-api to v1.1.9 ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
#### Authors: 4
|
||||
|
||||
- [@JOO200](https://github.com/JOO200)
|
||||
- Mohammed Al-Dahleh ([@maldahleh](https://github.com/maldahleh))
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.8.0 (Wed Sep 01 2021)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- feat: Allow the ability to disable the proxy warning message [#292](https://github.com/sekwah41/Advanced-Portals/pull/292) ([@maldahleh](https://github.com/maldahleh))
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- chore(deps): Update Deps ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(ci): Update rennovate config ([@sekwah41](https://github.com/sekwah41))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Mohammed Al-Dahleh ([@maldahleh](https://github.com/maldahleh))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.7.2 (Wed Jul 14 2021)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- fix: Issue where portal events activate too early in survival [#280](https://github.com/sekwah41/Advanced-Portals/pull/280) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): update dependency com.velocitypowered:velocity-api to v1.1.9 [#278](https://github.com/sekwah41/Advanced-Portals/pull/278) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): update dependency gradle to v7.1.1 [#277](https://github.com/sekwah41/Advanced-Portals/pull/277) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.7.1 (Wed Jun 30 2021)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- fix: Access to portal warp command locked behind wrong perm [#275](https://github.com/sekwah41/Advanced-Portals/pull/275) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): update dependency gradle to v7 [#271](https://github.com/sekwah41/Advanced-Portals/pull/271) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.7.0 (Sun Jun 27 2021)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- feat: Added missing commands from tab complete [#270](https://github.com/sekwah41/Advanced-Portals/pull/270) ([@sekwah41](https://github.com/sekwah41))
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- chore(deps): update dependency net.md-5:bungeecord-api to v1.16-r0.4 [#269](https://github.com/sekwah41/Advanced-Portals/pull/269) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(ci): removed verbose mode for release ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): update dependency com.google.code.gson:gson to v2.8.7 [#262](https://github.com/sekwah41/Advanced-Portals/pull/262) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): update dependency gradle to v6.9 [#267](https://github.com/sekwah41/Advanced-Portals/pull/267) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- chore(deps): update dependency com.velocitypowered:velocity-api to v1.1.8 [#266](https://github.com/sekwah41/Advanced-Portals/pull/266) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# v0.6.1 (Sun Jun 27 2021)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- chore(ci): Remove isDevBranch remains [#265](https://github.com/sekwah41/Advanced-Portals/pull/265) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(ci): Fix forgotten sha in build gradle [#264](https://github.com/sekwah41/Advanced-Portals/pull/264) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(ci): Update version-bumping task order [#263](https://github.com/sekwah41/Advanced-Portals/pull/263) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(deps): pin dependencies [#261](https://github.com/sekwah41/Advanced-Portals/pull/261) ([@renovate-bot](https://github.com/renovate-bot))
|
||||
- fix: Spigot 1.17 error message [#260](https://github.com/sekwah41/Advanced-Portals/pull/260) ([@sekwah41](https://github.com/sekwah41))
|
||||
- chore(ci): Swapping build pipeline ([@sekwah41](https://github.com/sekwah41))
|
||||
- ci: Fixed java version ([@sekwah41](https://github.com/sekwah41))
|
||||
- ci: Fix changelog reference ([@sekwah41](https://github.com/sekwah41))
|
||||
- ci: Updated build pipelines to newer module ([@sekwah41](https://github.com/sekwah41))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Sekwah ([@sekwah41](https://github.com/sekwah41))
|
||||
- WhiteSource Renovate ([@renovate-bot](https://github.com/renovate-bot))
|
||||
|
||||
---
|
||||
|
||||
# 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.6.0 (2021-05-19)
|
||||
|
||||
|
||||
### 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.
|
||||
* 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.
|
|
@ -4,4 +4,4 @@ REM Use this file for testing cases for different versions, just drag the versio
|
|||
java -Xmx4096M -DIReallyKnowWhatIAmDoingISwear=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar %1
|
||||
REM Could add a 32 bit test part but noone uses 32 bit anymore
|
||||
GOTO A
|
||||
PAUSE.
|
||||
PAUSE
|
||||
|
|
47
README.md
47
README.md
|
@ -8,18 +8,17 @@
|
|||
[![](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 [![Build Status](https://travis-ci.org/sekwah41/Advanced-Portals.svg?branch=master)](https://travis-ci.org/sekwah41/Advanced-Portals/branches)
|
||||
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.
|
||||
|
||||
# Branch Layout
|
||||
* [master](https://github.com/sekwah41/Advanced-Portals/) (Release Build) [![Build Status](https://travis-ci.org/sekwah41/Advanced-Portals.svg?branch=master)](https://travis-ci.org/sekwah41/Advanced-Portals/branches)
|
||||
* [dev](https://github.com/sekwah41/Advanced-Portals/tree/dev) (Dev Build) [![Build Status](https://travis-ci.org/sekwah41/Advanced-Portals.svg?branch=dev)](https://travis-ci.org/sekwah41/Advanced-Portals/branches)
|
||||
* [recode](https://github.com/sekwah41/Advanced-Portals/tree/recode) (Recode) [![Build Status](https://travis-ci.org/sekwah41/Advanced-Portals.svg?branch=recode)](https://travis-ci.org/sekwah41/Advanced-Portals/branches)
|
||||
|
||||
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)
|
||||
|
||||
[List Of Commands](https://github.com/sekwah41/Advanced-Portals/wiki/Commands)
|
||||
|
||||
[Spigot Page](https://www.spigotmc.org/resources/advanced-portals.14356/)
|
||||
|
@ -29,11 +28,37 @@ 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
|
||||
|
||||
Were available here http://mcstats.org/plugin/AdvancedPortals but mcstats is no longer working.
|
||||
|
||||
# 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
|
||||
|
||||
Don't worry about updating the file numbers in `bungee.yml`, `plugin.yml` and `AdvancedPortalsPlugin.java`.
|
||||
They will be updated automatically before builds.
|
||||
|
||||
Please ensure that your commits are in the following style for PR's
|
||||
|
||||
https://www.conventionalcommits.org/en/v1.0.0/
|
||||
|
||||
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)
|
||||
<!---
|
||||
We don't currently do tests. But in case.
|
||||
* **test**: Adding missing tests or correcting existing tests
|
||||
-->
|
||||
|
||||
## 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)
|
||||
|
||||
|
|
341
build.gradle
341
build.gradle
|
@ -1,10 +1,50 @@
|
|||
import com.google.gson.Gson
|
||||
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.HttpGet
|
||||
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 java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.apache.httpcomponents:httpmime:4.5.14"
|
||||
classpath "com.google.code.gson:gson:2.10.1"
|
||||
classpath "org.apache.httpcomponents:httpclient:4.5.14"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'net.researchgate.release' version '2.8.1'
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
def branch = System.getenv("GITHUB_REF");
|
||||
if (branch != null) {
|
||||
branch = branch.replace('refs/heads/', '')
|
||||
}
|
||||
def isCanary = version.toString().contains('canary')
|
||||
|
||||
group = 'com.sekwah.advancedportals'
|
||||
version = getPluginData("version") + '-snapshot'
|
||||
|
||||
description = ""
|
||||
|
||||
|
@ -18,9 +58,9 @@ tasks.withType(JavaCompile) {
|
|||
String getPluginData(String tag) {
|
||||
File file = file("src/main/resources/plugin.yml")
|
||||
String version = "notfound"
|
||||
file.readLines("UTF-8").each {String line ->
|
||||
file.readLines("UTF-8").each { String line ->
|
||||
line = line.trim()
|
||||
if(line.startsWith(tag)) {
|
||||
if (line.startsWith(tag)) {
|
||||
version = line.substring(tag.length() + 2, line.length())
|
||||
}
|
||||
}
|
||||
|
@ -37,20 +77,224 @@ repositories {
|
|||
maven { url "https://repo.maven.apache.org/maven2" }
|
||||
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/' }
|
||||
maven { url 'https://maven.enginehub.org/repo/' } // WorldEdit
|
||||
}
|
||||
|
||||
// includeLibs just says to include the library in the final jar
|
||||
dependencies {
|
||||
implementation "org.bukkit:bukkit:1.15.1-R0.1-SNAPSHOT"
|
||||
implementation "net.md-5:bungeecord-api:1.15-SNAPSHOT"
|
||||
|
||||
implementation "io.netty:netty-all:4.0.4.Final"
|
||||
//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.16-R0.4"
|
||||
|
||||
implementation "com.velocitypowered:velocity-api:3.1.1"
|
||||
annotationProcessor "com.velocitypowered:velocity-api:3.1.1"
|
||||
|
||||
implementation "io.netty:netty-all:4.1.87.Final"
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT'
|
||||
|
||||
implementation "com.sk89q.worldedit:worldedit-bukkit:7.2.13"
|
||||
//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()
|
||||
|
||||
if (isCanary) {
|
||||
builder.addTextBody("content", "New canary Build")
|
||||
} else {
|
||||
builder.addTextBody("content", "New release build\n\n" +
|
||||
"Current Features: <${project.github}/blob/${branch}/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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
int id
|
||||
int gameVersionTypeID
|
||||
String name
|
||||
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 {
|
||||
dependsOn(jar)
|
||||
doLast {
|
||||
String apiKey = null
|
||||
|
||||
if (System.getenv("CURSE_API") != null) {
|
||||
apiKey = System.getenv("CURSE_API")
|
||||
}
|
||||
|
||||
if (apiKey != null) {
|
||||
|
||||
Gson gson = new Gson()
|
||||
|
||||
//String VERSION_TYPES_URL = "/api/game/version-types"
|
||||
int gameVersionTypeID = 1
|
||||
String VERSION_URL = "/api/game/versions"
|
||||
println("Uploading to CurseForge")
|
||||
|
||||
// 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.18",
|
||||
"1.17",
|
||||
"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/${branch}/CHANGELOG.md"
|
||||
uploadMetadata.changelogType = "markdown"
|
||||
uploadMetadata.releaseType = "release"
|
||||
uploadMetadata.gameVersions = supportedGameVersionIds
|
||||
|
||||
def uploadId = uploadFile(uploadMetadata, file(jar.archiveFile), apiKey, gson)
|
||||
|
||||
println("Uploaded with ID: ${uploadId.id}")
|
||||
|
||||
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
|
||||
// changelogType = 'markdown'
|
||||
// releaseType = 'release'
|
||||
}
|
||||
|
||||
task copyPlugin {
|
||||
doLast {
|
||||
copy {
|
||||
if(System.env.MC_SERVER_LOC == null) {
|
||||
if (System.env.MC_SERVER_LOC == null) {
|
||||
throw new Exception('You must set the server location and jar to use')
|
||||
}
|
||||
println "$buildDir/libs/Advanced-Portals-${version}.jar"
|
||||
|
@ -60,7 +304,7 @@ task copyPlugin {
|
|||
include "*.jar"
|
||||
}
|
||||
}
|
||||
catch(RuntimeException e) {
|
||||
catch (RuntimeException e) {
|
||||
println e.getLocalizedMessage()
|
||||
}
|
||||
from file("$buildDir/libs/Advanced-Portals-${version}.jar")
|
||||
|
@ -73,7 +317,7 @@ task copyPlugin {
|
|||
// DIReallyKnowWhatIAmDoingISwear is to remove the stupid pause spigot has at the start
|
||||
task runJar() {
|
||||
doLast {
|
||||
if(System.env.MC_SERVER_LOC == null || System.env.MC_SERVER_JAR == null) {
|
||||
if (System.env.MC_SERVER_LOC == null || System.env.MC_SERVER_JAR == null) {
|
||||
throw new Exception('You must set the server location and jar to use MC_SERVER_LOC and MC_SERVER_JAR')
|
||||
}
|
||||
javaexec {
|
||||
|
@ -84,3 +328,78 @@ task runJar() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
task publish {
|
||||
doLast {
|
||||
println "This is a dummy task to run others for version: ${version}"
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/researchgate/gradle-release
|
||||
// Only other plugin I can find using auto & gradle https://github.com/intuit/hooks
|
||||
release {
|
||||
failOnPublishNeeded = false
|
||||
failOnSnapshotDependencies = false
|
||||
git {
|
||||
requireBranch = ''
|
||||
}
|
||||
|
||||
|
||||
// Disable tasks because something we have is causing -x to be ignored
|
||||
createReleaseTag.enabled = false
|
||||
preTagCommit.enabled = false
|
||||
commitNewVersion.enabled = false
|
||||
}
|
||||
|
||||
task cleanbuildfolder {
|
||||
doFirst {
|
||||
println "Cleaning up previous builds (to stop publishing old ones by mistake)"
|
||||
project.delete(files("${buildDir}/libs"))
|
||||
}
|
||||
}
|
||||
|
||||
void updateFileVersion(String fileLoc, Pattern pattern, Closure<String> stringClosure) {
|
||||
File file = new File(projectDir, fileLoc)
|
||||
Matcher m = pattern.matcher(file.text)
|
||||
if (m.find()) {
|
||||
def newVersion = stringClosure.call(m)
|
||||
println "Replacing ${pattern.toString()} in ${fileLoc} with '${newVersion}'"
|
||||
file.text = file.text.replaceAll(pattern, newVersion)
|
||||
}
|
||||
}
|
||||
|
||||
// Just to keep all numbers the same (as they are dotted all over the place)
|
||||
task updateVersionNumbers {
|
||||
doFirst {
|
||||
def versionRegex = ~/(\nversion:\s)([0-9.-]+)/
|
||||
def velocityVersionRegex = ~/(\sversion\s=\s")([0-9.-]+)("\))/
|
||||
|
||||
updateFileVersion("src/main/resources/bungee.yml", versionRegex,
|
||||
{ Matcher m ->
|
||||
return "${m.group(1)}${getVersion()}"
|
||||
})
|
||||
|
||||
updateFileVersion("src/main/resources/plugin.yml", versionRegex,
|
||||
{ Matcher m ->
|
||||
return "${m.group(1)}${getVersion()}"
|
||||
})
|
||||
|
||||
updateFileVersion("src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java",
|
||||
velocityVersionRegex,
|
||||
{ Matcher m ->
|
||||
return "${m.group(1)}${getVersion()}${m.group(3)}"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
updateVersion.finalizedBy 'updateVersionNumbers'
|
||||
|
||||
compileJava.dependsOn 'cleanbuildfolder'
|
||||
|
||||
// Publish rules
|
||||
// Current behavior seems to be canary or release. Though pre-releases may break this pattern.
|
||||
publish.dependsOn 'build'
|
||||
publish.finalizedBy 'discordupload'
|
||||
if (!isCanary) {
|
||||
publish.finalizedBy 'curseforge'
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
# https://docs.gradle.org/current/userguide/build_environment.html
|
||||
# Disable with --no-build-cache
|
||||
org.gradle.caching=true
|
||||
org.gradle.caching=true
|
||||
|
||||
github=https://github.com/sekwah41/Advanced-Portals
|
||||
curse_project_id=86001
|
||||
version=0.9.2
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#Sun Jan 19 19:02:36 KST 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -17,78 +17,113 @@
|
|||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
|
@ -105,79 +140,105 @@ location of your Java installation."
|
|||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
|
|
@ -1,100 +1,92 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"conventional-changelog-angular": "5.0.13",
|
||||
"@auto-it/conventional-commits": "10.37.6",
|
||||
"@auto-it/exec": "10.37.6",
|
||||
"@auto-it/first-time-contributor": "10.37.6",
|
||||
"@auto-it/gradle": "10.37.6",
|
||||
"@auto-it/released": "10.37.6",
|
||||
"@auto-it/upload-assets": "10.37.6",
|
||||
"auto": "10.37.6"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"commitMessagePrefix": "chore(deps):",
|
||||
"matchUpdateTypes": ["minor", "patch"],
|
||||
"automerge": true,
|
||||
"automergeType": "branch",
|
||||
"groupName": "Deps",
|
||||
"schedule": ["every weekend"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -2,13 +2,16 @@ package com.sekwah.advancedportals.bukkit;
|
|||
|
||||
import com.sekwah.advancedportals.bukkit.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.listeners.Listeners;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import com.sekwah.advancedportals.bukkit.util.WorldEditIntegration;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.EndGateway;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -26,11 +29,11 @@ import java.util.stream.Collectors;
|
|||
public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final List<String> blockMaterialList;
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
private int portalArgsStringLength = 0;
|
||||
|
||||
private HashSet<String> ignoreExtras = new HashSet<>(Arrays.asList("command.1", "permission"));
|
||||
private final HashSet<String> ignoreExtras = new HashSet<>(Arrays.asList("command.1", "permission"));
|
||||
|
||||
// TODO recode the portal args to be put into a hashmap and use a string array
|
||||
// to store all possible portal arguments. Makes code shorter and possibly more
|
||||
|
@ -49,40 +52,89 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
|
||||
// System.out.printf("%s %s %s %s%n", sender, cmd, command, args );
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
ConfigAccessor portalConfig = new ConfigAccessor(plugin, "portals.yml");
|
||||
if (!(sender instanceof Player)) {
|
||||
if(args.length == 1) {
|
||||
if(args[0].equalsIgnoreCase("reload")) {
|
||||
Listeners.reloadValues(plugin);
|
||||
Portal.loadPortals();
|
||||
sender.sendMessage("portal reloaded.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
sender.sendMessage(PluginMessages.customPrefixFail + " You cannot use commands with the console.");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
if(args.length > 0) {
|
||||
if(args[0].equalsIgnoreCase("warp") && player.hasPermission("advancedportals.warp")) {
|
||||
if (args.length == 2 && (player.hasPermission("advancedportals.warp.*")
|
||||
|| player.hasPermission("advancedportals.warp." + args[1]))) {
|
||||
AdvancedPortal portal = Portal.getPortal(args[1]);
|
||||
|
||||
if(portal == null) {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " Could not find a portal with that name");
|
||||
}
|
||||
else {
|
||||
if (portal.inPortal.contains(player.getUniqueId()))
|
||||
return true;
|
||||
WarpEvent warpEvent = new WarpEvent(player, portal);
|
||||
plugin.getServer().getPluginManager().callEvent(warpEvent);
|
||||
|
||||
if (!warpEvent.isCancelled()) {
|
||||
Portal.activate(player, portal, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (args.length == 1 && player.hasPermission("advancedportals.warp")) {
|
||||
sendMenu(player, "Help Menu: Warp",
|
||||
"\u00A76/" + command + " warp <name> \u00A7a- teleport to warp name");
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You do not have permission to perform that command");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sender.hasPermission("advancedportals.portal")) {
|
||||
if (args.length > 0) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "warp":
|
||||
if (args.length == 2 && player.hasPermission("advancedportals.portal.warp")) {
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
if (args[1].equalsIgnoreCase(portal.getName())) {
|
||||
case "disablebeacon":
|
||||
if (player.hasPermission("advancedportals.build")) {
|
||||
if(args.length == 1) {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need to specify a portal to replace the blocks.");
|
||||
}
|
||||
else {
|
||||
AdvancedPortal portal = Portal.getPortal(args[1]);
|
||||
|
||||
if (portal.inPortal.contains(player.getUniqueId()))
|
||||
return true;
|
||||
WarpEvent warpEvent = new WarpEvent(player, portal);
|
||||
plugin.getServer().getPluginManager().callEvent(warpEvent);
|
||||
|
||||
if (!warpEvent.isCancelled())
|
||||
Portal.activate(player, portal);
|
||||
break;
|
||||
if(portal == null) {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " Could not find a portal with that name");
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(PluginMessages.customPrefix
|
||||
+ " Replacing any found beacon blocks.");
|
||||
disableBeacons(portal);
|
||||
}
|
||||
}
|
||||
}
|
||||
sendMenu(player, "Help Menu: Warp",
|
||||
"\u00A76/" + command + " warp <name> \u00A7a- teleport to warp name");
|
||||
break;
|
||||
case "wand":
|
||||
case "selector":
|
||||
if (plugin.isWorldEditActive()) {
|
||||
sender.sendMessage(PluginMessages.customPrefix
|
||||
+ " Use the WorldEdit wand to select stuff. Checkout //wand.");
|
||||
return true;
|
||||
}
|
||||
String ItemID = config.getConfig().getString("AxeItemId");
|
||||
|
||||
Material WandMaterial = Material.getMaterial(ItemID);
|
||||
|
@ -150,238 +202,15 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
PluginMessages.customPrefix + " You have been given a \u00A7ePortal Block\u00A7a!");
|
||||
break;
|
||||
case "create":
|
||||
if (player.hasMetadata("Pos1World") && player.hasMetadata("Pos2World")) {
|
||||
if (player.getMetadata("Pos1World").get(0).asString()
|
||||
.equals(player.getMetadata("Pos2World").get(0).asString())
|
||||
&& player.getMetadata("Pos1World").get(0).asString()
|
||||
.equals(player.getLocation().getWorld().getName())) {
|
||||
if (args.length >= 2) { // may make this next piece of code more efficient, maybe check
|
||||
// against a list of available variables or something
|
||||
// TODO change system to use arrays and hashmaps
|
||||
boolean hasName = false;
|
||||
boolean hasTriggerBlock = false;
|
||||
boolean hasDestination = false;
|
||||
boolean isBungeePortal = false;
|
||||
boolean needsPermission = false;
|
||||
boolean executesCommand = false;
|
||||
String destination = null;
|
||||
String portalName = null;
|
||||
String triggerBlock = null;
|
||||
String serverName = null;
|
||||
String permission = null;
|
||||
String portalCommand = null;
|
||||
|
||||
ArrayList<PortalArg> extraData = new ArrayList<>();
|
||||
|
||||
// Is completely changed in the recode but for now im leaving it as this
|
||||
// horrible mess...
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
if (startsWithPortalArg("name:", args[i])) {
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
if (portalName.equals("")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You must include a name for the portal that isnt nothing!");
|
||||
return true;
|
||||
}
|
||||
hasName = true;
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
} else if (startsWithPortalArg("destination:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("destination:", "");
|
||||
} else if (startsWithPortalArg("desti:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("desti:", "");
|
||||
} else if (startsWithPortalArg("triggerblock:", args[i])) {
|
||||
hasTriggerBlock = true;
|
||||
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
|
||||
} else if (startsWithPortalArg("triggerblock:", args[i])) {
|
||||
hasTriggerBlock = true;
|
||||
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
|
||||
} else if (this.startsWithPortalArg("bungee:", args[i])) {
|
||||
isBungeePortal = true;
|
||||
serverName = args[i].substring("bungee:".length());
|
||||
} else if (startsWithPortalArg("permission:", args[i])) {
|
||||
needsPermission = true;
|
||||
permission = args[i].toLowerCase().replaceFirst("permission:", "");
|
||||
extraData.add(new PortalArg("permission", permission));
|
||||
} else if (startsWithPortalArg("delayed:", args[i])) {
|
||||
boolean delayed = Boolean
|
||||
.parseBoolean(args[i].toLowerCase().replaceFirst("delayed:", ""));
|
||||
extraData.add(new PortalArg("delayed", Boolean.toString(delayed)));
|
||||
} else if (startsWithPortalArg("message:", args[i])) {
|
||||
String message = parseArgVariable(args, i, "message:");
|
||||
if (message == null) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + " Message quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
extraData.add(new PortalArg("message", message));
|
||||
} else if (startsWithPortalArg("command:", args[i])) {
|
||||
executesCommand = true;
|
||||
portalCommand = parseArgVariable(args, i, "command:");
|
||||
if (portalCommand == null) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + " Command quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
i += this.portalArgsStringLength - 1;
|
||||
if (portalCommand.startsWith("#")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("c")
|
||||
&& (sender.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.console")
|
||||
|| sender.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a console command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("!")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("o")
|
||||
&& (sender.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.op")
|
||||
|| sender.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a op command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("%")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("b")
|
||||
&& (sender.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.bungee")
|
||||
|| sender.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a bungee command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("^")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("p")
|
||||
&& (sender.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.perms")
|
||||
|| sender.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a all perms command portal!");
|
||||
return true;
|
||||
}
|
||||
extraData.add(new PortalArg("command.1", portalCommand));
|
||||
} else if (startsWithPortalArg("cooldowndelay:", args[i])) {
|
||||
String cooldownDelay = parseArgVariable(args, i, "cooldowndelay:");
|
||||
extraData.add(new PortalArg("cooldowndelay", cooldownDelay));
|
||||
} else if (startsWithPortalArg("leavedesti:", args[i])) {
|
||||
String leaveDesti = parseArgVariable(args, i, "leavedesti:");
|
||||
extraData.add(new PortalArg("leavedesti", leaveDesti));
|
||||
}
|
||||
}
|
||||
if (!hasName) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You must include a name for the portal that you are creating in the variables!");
|
||||
return true;
|
||||
}
|
||||
|
||||
World world = org.bukkit.Bukkit
|
||||
.getWorld(player.getMetadata("Pos1World").get(0).asString());
|
||||
Location pos1 = new Location(world, player.getMetadata("Pos1X").get(0).asInt(),
|
||||
player.getMetadata("Pos1Y").get(0).asInt(),
|
||||
player.getMetadata("Pos1Z").get(0).asInt());
|
||||
Location pos2 = new Location(world, player.getMetadata("Pos2X").get(0).asInt(),
|
||||
player.getMetadata("Pos2Y").get(0).asInt(),
|
||||
player.getMetadata("Pos2Z").get(0).asInt());
|
||||
|
||||
ConfigAccessor desticonfig = new ConfigAccessor(plugin, "destinations.yml");
|
||||
String destiPosX = desticonfig.getConfig().getString(destination + ".pos.X");
|
||||
|
||||
if (!Portal.portalExists(portalName)) {
|
||||
|
||||
player.sendMessage("");
|
||||
player.sendMessage(PluginMessages.customPrefix
|
||||
+ "\u00A7e You have created a new portal with the following details:");
|
||||
player.sendMessage("\u00A7aname: \u00A7e" + portalName);
|
||||
if (hasDestination) {
|
||||
if (!isBungeePortal && destiPosX == null) {
|
||||
player.sendMessage("\u00A7cdestination: \u00A7e" + destination
|
||||
+ " (destination does not exist)");
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage("\u00A7adestination: \u00A7e" + destination);
|
||||
}
|
||||
|
||||
} else {
|
||||
player.sendMessage(
|
||||
"\u00A7cdestination: \u00A7eN/A (will not teleport to a location)");
|
||||
}
|
||||
|
||||
if (isBungeePortal) {
|
||||
player.sendMessage("\u00A7abungee: \u00A7e" + serverName);
|
||||
}
|
||||
|
||||
if (needsPermission) {
|
||||
player.sendMessage("\u00A7apermission: \u00A7e" + permission);
|
||||
} else {
|
||||
player.sendMessage("\u00A7apermission: \u00A7e(none needed)");
|
||||
}
|
||||
|
||||
for (PortalArg portalArg : extraData) {
|
||||
if (!ignoreExtras.contains(portalArg.argName)) {
|
||||
player.sendMessage(
|
||||
"\u00A7a" + portalArg.argName + ": \u00A7e" + portalArg.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (executesCommand) {
|
||||
player.sendMessage("\u00A7acommand: \u00A7e" + portalCommand);
|
||||
}
|
||||
|
||||
if (hasTriggerBlock) {
|
||||
Set<Material> materialSet = Portal
|
||||
.getMaterialSet(triggerBlock.toUpperCase().split(","));
|
||||
if (materialSet.size() != 0) {
|
||||
player.sendMessage(
|
||||
"\u00A7atriggerBlock: \u00A7e" + triggerBlock.toUpperCase());
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
materialSet, serverName, portalArgs));
|
||||
} else {
|
||||
ConfigAccessor Config = new ConfigAccessor(plugin, "config.yml");
|
||||
player.sendMessage("\u00A7ctriggerBlock: \u00A7edefault("
|
||||
+ Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
|
||||
|
||||
player.sendMessage("\u00A7c" + triggerBlock.toUpperCase()
|
||||
+ " no valid blocks were listed so the default has been set.");
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
serverName, portalArgs));
|
||||
}
|
||||
} else {
|
||||
ConfigAccessor Config = new ConfigAccessor(plugin, "config.yml");
|
||||
player.sendMessage("\u00A7atriggerBlock: \u00A7edefault("
|
||||
+ Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
serverName, portalArgs));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(
|
||||
PluginMessages.customPrefixFail + " A portal by that name already exists!");
|
||||
}
|
||||
|
||||
// add code to save the portal to the portal config and reload the portals
|
||||
|
||||
player.sendMessage("");
|
||||
} else {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need to at least add the name of the portal as a variable, \u00A7cType \u00A7e/portal variables\u00A7c"
|
||||
+ " for a full list of currently available variables and an example command!");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " The points you have selected need to be in the same world!");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need to have two points selected to make a portal!");
|
||||
}
|
||||
break;
|
||||
return createPortalRequest(player, args);
|
||||
case "variables":
|
||||
sender.sendMessage(PluginMessages.customPrefix
|
||||
+ " \u00A77Variables \u00A7c: \u00A7aname, triggerBlock, desti, destination, bungee, permission, command, cooldowndelay, leavedesti");
|
||||
sender.sendMessage(
|
||||
PluginMessages.customPrefix +
|
||||
" \u00A77Variables \u00A7c: " +
|
||||
"\u00A7aname, triggerBlock, desti, destination, " +
|
||||
"bungee, permission, command, cooldowndelay, leavedesti" +
|
||||
"particlein, particleout"
|
||||
);
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage("\u00A7aExample command: \u00A7e/portal create name:test triggerId:portal");
|
||||
break;
|
||||
|
@ -417,21 +246,31 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
player.sendMessage(PluginMessages.customPrefixFail + " You had no portal selected!");
|
||||
}
|
||||
case "gui":
|
||||
// /portal gui remove testarg
|
||||
if (args.length > 1) {
|
||||
if (args[1].toLowerCase().equals("remove") && args.length > 2) {
|
||||
if (args[1].equalsIgnoreCase("remove") && args.length > 2) {
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " Are you sure you would like to remove the portal \u00A7e" + args[2]
|
||||
+ "\u00A7c?");
|
||||
|
||||
TextComponent removeMessage = new TextComponent();
|
||||
TextComponent yes = new TextComponent("[Yes]");
|
||||
yes.setColor(ChatColor.YELLOW);
|
||||
yes.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/portal remove " + args[2]));
|
||||
yes.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Confirm removing this portal").create()));
|
||||
TextComponent no = new TextComponent("[No]");
|
||||
no.setColor(ChatColor.YELLOW);
|
||||
no.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/portal edit " + args[2]));
|
||||
no.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Cancel removing this portal").create()));
|
||||
|
||||
removeMessage.addExtra(" ");
|
||||
removeMessage.addExtra(yes);
|
||||
removeMessage.addExtra(" ");
|
||||
removeMessage.addExtra(no);
|
||||
|
||||
sender.sendMessage("");
|
||||
plugin.compat.sendRawMessage(
|
||||
"{\"text\":\" \",\"extra\":[{\"text\":\"\u00A7e[Yes]\",\"hoverEvent\":{\"action\":\"show_text\","
|
||||
+ "\"value\":\"Confirm removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal remove "
|
||||
+ args[2] + "\"}}, "
|
||||
+ "{\"text\":\" \"},{\"text\":\"\u00A7e[No]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Cancel removing this portal\"}"
|
||||
+ ",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal edit "
|
||||
+ args[2] + "\"}}]}",
|
||||
player);
|
||||
sender.spigot().sendMessage(removeMessage);
|
||||
sender.sendMessage("");
|
||||
}
|
||||
}
|
||||
|
@ -504,13 +343,13 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
String portalName = player.getMetadata("selectedPortal").get(0).asString();
|
||||
if (args.length > 1) {
|
||||
// TODO add the command autocompletes, add, remove and show
|
||||
if (args[1].toLowerCase().equals("add")) {
|
||||
if (args[1].equalsIgnoreCase("add")) {
|
||||
if (args.length > 2) {
|
||||
String portalCommand = args[2];
|
||||
StringBuilder portalCommand = new StringBuilder(args[2]);
|
||||
for (int i = 3; i < args.length; i++) {
|
||||
portalCommand += args[i];
|
||||
portalCommand.append(" ").append(args[i]);
|
||||
}
|
||||
if (Portal.addCommand(portalName, portalCommand)) {
|
||||
if (Portal.addCommand(portalName, portalCommand.toString())) {
|
||||
sender.sendMessage(
|
||||
PluginMessages.customPrefixFail + " Command added to portal!");
|
||||
} else {
|
||||
|
@ -523,9 +362,9 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
+ " You must actually specify a command to execute!");
|
||||
}
|
||||
|
||||
} else if (args[1].toLowerCase().equals("remove")) {
|
||||
} else if (args[1].equalsIgnoreCase("remove")) {
|
||||
// Specify what line to remove
|
||||
} else if (args[1].toLowerCase().equals("show")) {
|
||||
} else if (args[1].equalsIgnoreCase("show")) {
|
||||
} else {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You must specify to \u00A7eadd\u00A7c or \u00A7eremove a command!");
|
||||
|
@ -570,6 +409,14 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
case "help":
|
||||
helpCommand(sender, command, args);
|
||||
break;
|
||||
case "bukkitpage":
|
||||
sender.sendMessage(
|
||||
PluginMessages.customPrefix + " Bukkit Page: http://dev.bukkit.org/bukkit-plugins/advanced-portals/");
|
||||
break;
|
||||
case "helppage":
|
||||
sender.sendMessage(
|
||||
PluginMessages.customPrefix + " Help Page: https://www.guilded.gg/Sekwah/groups/MDqAZyrD/channels/72ffdaa3-9273-4722-bf47-b75408b371af/docs/1090356006");
|
||||
break;
|
||||
case "show":
|
||||
if (args.length > 1) {
|
||||
String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
|
||||
|
@ -597,6 +444,24 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case "we-selection":
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " WorldEdit is not enabled.");
|
||||
return true;
|
||||
}
|
||||
if (args.length <= 1) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " Specify a portal name!");
|
||||
return true;
|
||||
}
|
||||
AdvancedPortal wePortal = Portal.getPortal(args[1]);
|
||||
if (wePortal == null) {
|
||||
sender.sendMessage(PluginMessages.customPrefixFail + " No portal by that name exists!");
|
||||
return true;
|
||||
}
|
||||
WorldEditIntegration.explainRegion(player, wePortal.getPos1(), wePortal.getPos2());
|
||||
player.sendMessage(PluginMessages.customPrefix
|
||||
+ " The portal has been selected with worldedit!");
|
||||
break;
|
||||
case "reload":
|
||||
sender.sendMessage(PluginMessages.customPrefix + " Reloaded values!");
|
||||
Listeners.reloadValues(plugin);
|
||||
|
@ -627,6 +492,295 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void disableBeacons(AdvancedPortal portal) {
|
||||
Location loc1 = portal.getPos1();
|
||||
Location loc2 = portal.getPos2();
|
||||
|
||||
Location scanner = loc1.clone();
|
||||
|
||||
for (int x = loc2.getBlockX(); x <= loc1.getBlockX(); x++) {
|
||||
scanner.setZ(x);
|
||||
for (int y = loc2.getBlockY(); y <= loc1.getBlockY(); y++) {
|
||||
scanner.setZ(y);
|
||||
for (int z = loc2.getBlockZ(); z <= loc1.getBlockZ(); z++) {
|
||||
scanner.setZ(z);
|
||||
Block block = scanner.getBlock();
|
||||
if(block.getType() == Material.END_GATEWAY) {
|
||||
EndGateway tileState = (EndGateway) block.getState();
|
||||
tileState.setAge(Long.MIN_VALUE);
|
||||
tileState.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkValidSelection(Player player) {
|
||||
if (plugin.isWorldEditActive()) {
|
||||
if (!WorldEditIntegration.validateSelection(player)) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " Your WorldEdit selection is invalid!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!player.hasMetadata("Pos1World") || !player.hasMetadata("Pos2World")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need to have two points selected to make a portal!");
|
||||
return false;
|
||||
}
|
||||
if (!player.getMetadata("Pos1World").get(0).asString()
|
||||
.equals(player.getMetadata("Pos2World").get(0).asString())
|
||||
|| !player.getMetadata("Pos1World").get(0).asString()
|
||||
.equals(player.getLocation().getWorld().getName())) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " The points you have selected need to be in the same world as each other and yourself!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean createPortalRequest(Player player, String[] args) {
|
||||
if (!checkValidSelection(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need to at least add the name of the portal as a variable, \u00A7cType \u00A7e/portal variables\u00A7c"
|
||||
+ " for a full list of currently available variables and an example command!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// may make this next piece of code more efficient, maybe check
|
||||
// against a list of available variables or something
|
||||
// TODO change system to use arrays and hashmaps
|
||||
boolean hasName = false;
|
||||
boolean hasTriggerBlock = false;
|
||||
boolean hasDestination = false;
|
||||
boolean isBungeePortal = false;
|
||||
boolean needsPermission = false;
|
||||
boolean executesCommand = false;
|
||||
String destination = null;
|
||||
String portalName = null;
|
||||
String triggerBlock = null;
|
||||
String serverName = null;
|
||||
String permission = null;
|
||||
String portalCommand = null;
|
||||
|
||||
ArrayList<PortalArg> extraData = new ArrayList<>();
|
||||
|
||||
// Is completely changed in the recode but for now im leaving it as this
|
||||
// horrible mess...
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
if (startsWithPortalArg("name:", args[i])) {
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
if (portalName.equals("")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You must include a name for the portal that isnt nothing!");
|
||||
return true;
|
||||
}
|
||||
hasName = true;
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
} else if (startsWithPortalArg("destination:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("destination:", "");
|
||||
} else if (startsWithPortalArg("desti:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("desti:", "");
|
||||
} else if (startsWithPortalArg("triggerblock:", args[i])) {
|
||||
hasTriggerBlock = true;
|
||||
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
|
||||
} else if (this.startsWithPortalArg("bungee:", args[i])) {
|
||||
isBungeePortal = true;
|
||||
serverName = args[i].substring("bungee:".length());
|
||||
} else if (startsWithPortalArg("permission:", args[i])) {
|
||||
needsPermission = true;
|
||||
permission = args[i].toLowerCase().replaceFirst("permission:", "");
|
||||
extraData.add(new PortalArg("permission", permission));
|
||||
} else if (startsWithPortalArg("delayed:", args[i])) {
|
||||
boolean delayed = Boolean
|
||||
.parseBoolean(args[i].toLowerCase().replaceFirst("delayed:", ""));
|
||||
extraData.add(new PortalArg("delayed", Boolean.toString(delayed)));
|
||||
} else if (startsWithPortalArg("message:", args[i])) {
|
||||
String message = parseArgVariable(args, i, "message:");
|
||||
if (message == null) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + " Message quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
extraData.add(new PortalArg("message", message));
|
||||
} else if (startsWithPortalArg("command:", args[i])) {
|
||||
executesCommand = true;
|
||||
portalCommand = parseArgVariable(args, i, "command:");
|
||||
if (portalCommand == null) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + " Command quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
i += this.portalArgsStringLength - 1;
|
||||
if (portalCommand.startsWith("#")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("c")
|
||||
&& (player.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.console")
|
||||
|| player.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a console command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("!")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("o")
|
||||
&& (player.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.op")
|
||||
|| player.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a op command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("%")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("b")
|
||||
&& (player.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.bungee")
|
||||
|| player.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a bungee command portal!");
|
||||
return true;
|
||||
} else if (portalCommand.startsWith("^")
|
||||
&& !(this.plugin.getSettings().enabledCommandLevel("p")
|
||||
&& (player.hasPermission(
|
||||
"advancedportals.createportal.commandlevel.perms")
|
||||
|| player.isOp()))) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You need permission to make a all perms command portal!");
|
||||
return true;
|
||||
}
|
||||
extraData.add(new PortalArg("command.1", portalCommand));
|
||||
} else if (startsWithPortalArg("cooldowndelay:", args[i])) {
|
||||
String cooldownDelay = parseArgVariable(args, i, "cooldowndelay:");
|
||||
extraData.add(new PortalArg("cooldowndelay", cooldownDelay));
|
||||
} else if (startsWithPortalArg("leavedesti:", args[i])) {
|
||||
String leaveDesti = parseArgVariable(args, i, "leavedesti:");
|
||||
extraData.add(new PortalArg("leavedesti", leaveDesti));
|
||||
} else if (startsWithPortalArg("particlein:", args[i])) {
|
||||
String value = parseArgVariable(args, i, "particlein:");
|
||||
extraData.add(new PortalArg("particlein", value));
|
||||
} else if (startsWithPortalArg("particleout:", args[i])) {
|
||||
String value = parseArgVariable(args, i, "particleout:");
|
||||
extraData.add(new PortalArg("particleout", value));
|
||||
}
|
||||
}
|
||||
if (!hasName) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ " You must include a name for the portal that you are creating in the variables!");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location pos1, pos2;
|
||||
if (plugin.isWorldEditActive()) {
|
||||
pos1 = WorldEditIntegration.getPos1(player);
|
||||
pos2 = WorldEditIntegration.getPos2(player);
|
||||
} else {
|
||||
World world = Bukkit
|
||||
.getWorld(player.getMetadata("Pos1World").get(0).asString());
|
||||
pos1 = new Location(world, player.getMetadata("Pos1X").get(0).asInt(),
|
||||
player.getMetadata("Pos1Y").get(0).asInt(),
|
||||
player.getMetadata("Pos1Z").get(0).asInt());
|
||||
pos2 = new Location(world, player.getMetadata("Pos2X").get(0).asInt(),
|
||||
player.getMetadata("Pos2Y").get(0).asInt(),
|
||||
player.getMetadata("Pos2Z").get(0).asInt());
|
||||
}
|
||||
|
||||
ConfigAccessor desticonfig = new ConfigAccessor(plugin, "destinations.yml");
|
||||
String destiPosX = desticonfig.getConfig().getString(destination + ".pos.X");
|
||||
|
||||
if (!Portal.portalExists(portalName)) {
|
||||
|
||||
player.sendMessage("");
|
||||
player.sendMessage(PluginMessages.customPrefix
|
||||
+ "\u00A7e You have created a new portal with the following details:");
|
||||
player.sendMessage("\u00A7aname: \u00A7e" + portalName);
|
||||
if (hasDestination) {
|
||||
if (!isBungeePortal && destiPosX == null) {
|
||||
player.sendMessage("\u00A7cdestination: \u00A7e" + destination
|
||||
+ " (destination does not exist)");
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage("\u00A7adestination: \u00A7e" + destination);
|
||||
}
|
||||
|
||||
} else {
|
||||
player.sendMessage(
|
||||
"\u00A7cdestination: \u00A7eN/A (will not teleport to a location)");
|
||||
}
|
||||
|
||||
if (isBungeePortal) {
|
||||
player.sendMessage("\u00A7abungee: \u00A7e" + serverName);
|
||||
}
|
||||
|
||||
if (needsPermission) {
|
||||
player.sendMessage("\u00A7apermission: \u00A7e" + permission);
|
||||
} else {
|
||||
player.sendMessage("\u00A7apermission: \u00A7e(none needed)");
|
||||
}
|
||||
|
||||
for (PortalArg portalArg : extraData) {
|
||||
if (!ignoreExtras.contains(portalArg.argName)) {
|
||||
player.sendMessage(
|
||||
"\u00A7a" + portalArg.argName + ": \u00A7e" + portalArg.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (executesCommand) {
|
||||
player.sendMessage("\u00A7acommand: \u00A7e" + portalCommand);
|
||||
}
|
||||
|
||||
if (hasTriggerBlock) {
|
||||
Set<Material> materialSet = Portal
|
||||
.getMaterialSet(triggerBlock.toUpperCase().split(","));
|
||||
if (materialSet.size() != 0) {
|
||||
player.sendMessage(
|
||||
"\u00A7atriggerBlock: \u00A7e" + triggerBlock.toUpperCase());
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
materialSet, serverName, portalArgs));
|
||||
if(materialSet.contains(Material.END_GATEWAY)) {
|
||||
AdvancedPortal portal = Portal.getPortal(portalName);
|
||||
if(portal != null) {
|
||||
disableBeacons(portal);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ConfigAccessor Config = new ConfigAccessor(plugin, "config.yml");
|
||||
player.sendMessage("\u00A7ctriggerBlock: \u00A7edefault("
|
||||
+ Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
|
||||
|
||||
player.sendMessage("\u00A7c" + triggerBlock.toUpperCase()
|
||||
+ " no valid blocks were listed so the default has been set.");
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
serverName, portalArgs));
|
||||
}
|
||||
} else {
|
||||
ConfigAccessor Config = new ConfigAccessor(plugin, "config.yml");
|
||||
player.sendMessage("\u00A7atriggerBlock: \u00A7edefault("
|
||||
+ Config.getConfig().getString("DefaultPortalTriggerBlock") + ")");
|
||||
PortalArg[] portalArgs = new PortalArg[extraData.size()];
|
||||
portalArgs = extraData.toArray(portalArgs);
|
||||
player.sendMessage(Portal.create(pos1, pos2, portalName, destination,
|
||||
serverName, portalArgs));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + " A portal by that name already exists!");
|
||||
}
|
||||
|
||||
// add code to save the portal to the portal config and reload the portals
|
||||
|
||||
player.sendMessage("");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private boolean startsWithPortalArg(String portalArg, String arg) {
|
||||
return arg.toLowerCase().startsWith(portalArg) && arg.length() > portalArg.length();
|
||||
}
|
||||
|
@ -634,7 +788,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
private void helpCommand(CommandSender sender, String command, String[] args) {
|
||||
// Add pages if there starts to become too many
|
||||
if (args.length == 1) {
|
||||
sendMenu(sender, "Help Menu", "\u00A76/" + command + " selector \u00A7a- gives you a region selector",
|
||||
sendMenu(sender, "Help Menu",
|
||||
"\u00A76/" + command + " selector \u00A7a- gives you a region selector",
|
||||
"\u00A76/" + command + " create \u00A7c[tags] \u00A7a- creates a portal with a selection ",
|
||||
"\u00A76/" + command + " portalblock \u00A7a- gives you a portal block",
|
||||
"\u00A76/" + command + " endportalblock \u00A7a- gives you an end portal block",
|
||||
|
@ -649,18 +804,18 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
"\u00A76/" + command + " warp <name> \u00A7a- teleport to warp name",
|
||||
"\u00A76/" + command + " variables \u00A7a- lists all available tags");
|
||||
} else if (args.length > 1) {
|
||||
if (args[1].toLowerCase().equals("help")) {
|
||||
if (args[1].equalsIgnoreCase("help")) {
|
||||
sendMenu(sender, "Help Command",
|
||||
"Shows the help section. You can also use a single argument after it to show the "
|
||||
+ "help section for the corresponding command.");
|
||||
} else if (args[1].toLowerCase().equals("portalblock")) {
|
||||
} else if (args[1].equalsIgnoreCase("portalblock")) {
|
||||
sendMenu(sender, "Help Command", "Gives you a special wool block to place portal blocks.", "",
|
||||
"\u00A7eLeft Click: \u00A76Rotates the hit portal block",
|
||||
"\u00A7eRight Click: \u00A76Placed a portal block");
|
||||
} else if (args[1].toLowerCase().equals("endportalblock")) {
|
||||
} else if (args[1].equalsIgnoreCase("endportalblock")) {
|
||||
sendMenu(sender, "Help Command", "Gives you a special wool block to place end portal blocks.", "",
|
||||
"\u00A7eRight Click: \u00A76Placed a end portal block");
|
||||
} else if (args[1].toLowerCase().equals("gatewayblock")) {
|
||||
} else if (args[1].equalsIgnoreCase("gatewayblock")) {
|
||||
sendMenu(sender, "Help Command", "Gives you a special wool block to place gateway blocks.", "",
|
||||
"\u00A7eRight Click: \u00A76Placed a gateway block");
|
||||
} else {
|
||||
|
@ -757,16 +912,40 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
}
|
||||
sender.sendMessage("");
|
||||
|
||||
Player player = (Player) sender;
|
||||
TextComponent removeButton = new TextComponent("Remove");
|
||||
removeButton.setColor(ChatColor.YELLOW);
|
||||
removeButton.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Remove the selected portal").create()));
|
||||
removeButton.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
"/portal gui remove " + portalName));
|
||||
|
||||
plugin.compat.sendRawMessage("{\"text\":\"\u00A7aFunctions\u00A7e: \","
|
||||
+ "\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal gui remove "
|
||||
+ portalName + "\"}}"
|
||||
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal show "
|
||||
+ portalName + "\"}}"
|
||||
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eRename\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Change the name of the portal\"},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/portal rename \"}}"
|
||||
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eTeleport\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Teleport to the set destination\n(If there is one)\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/desti warp "
|
||||
+ destination + "\"}}]}", player);
|
||||
TextComponent showButton = new TextComponent("Show");
|
||||
showButton.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Show the selected portal").create()));
|
||||
showButton.setColor(ChatColor.YELLOW);
|
||||
showButton.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/portal show " + portalName));
|
||||
|
||||
TextComponent renameButton = new TextComponent("Rename");
|
||||
renameButton.setColor(ChatColor.YELLOW);
|
||||
renameButton.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Change the name of the portal").create()));
|
||||
renameButton.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/portal rename "));
|
||||
|
||||
TextComponent activateButton = new TextComponent("Activate");
|
||||
activateButton.setColor(ChatColor.YELLOW);
|
||||
activateButton.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Trigger it as if you've just walked into it (Minus failing knockback)").create()));
|
||||
activateButton.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/portal warp " + portalName));
|
||||
|
||||
BaseComponent[] editMessage = new ComponentBuilder("Functions").color(ChatColor.GREEN)
|
||||
.append(": ").color(ChatColor.YELLOW)
|
||||
.append(removeButton).append(" ")
|
||||
.append(showButton).append(" ")
|
||||
.append(renameButton).append(" ")
|
||||
.append(activateButton).append(" ")
|
||||
.create();
|
||||
|
||||
sender.spigot().sendMessage(editMessage);
|
||||
|
||||
sender.sendMessage("");
|
||||
|
||||
|
@ -775,12 +954,21 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
|
||||
LinkedList<String> autoComplete = new LinkedList<String>();
|
||||
if(args.length == 1 && (sender.hasPermission("advancedportals.warp"))) {
|
||||
autoComplete.add("warp");
|
||||
}
|
||||
if (sender.hasPermission("advancedportals.createportal")) {
|
||||
if (args.length == 1 || (args.length == 2 && args[0].toLowerCase().equals("help"))) {
|
||||
if (args.length == 1 || (args.length == 2 && args[0].equalsIgnoreCase("help"))) {
|
||||
autoComplete.addAll(Arrays.asList("create", "list", "portalblock", "select", "unselect", "command",
|
||||
"selector", "show", "gatewayblock", "endportalblock", "variables", "wand", "remove", "rename",
|
||||
"help", "bukkitpage", "helppage", "warp"));
|
||||
} else if (args[0].toLowerCase().equals("create")) {
|
||||
"show", "gatewayblock", "endportalblock", "variables", "disablebeacon", "remove", "rename",
|
||||
"help", "bukkitpage", "helppage"));
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
autoComplete.add("we-selection");
|
||||
}
|
||||
if (!plugin.isWorldEditActive()) {
|
||||
autoComplete.addAll(Arrays.asList("selector", "wand"));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("create")) {
|
||||
|
||||
boolean hasName = false;
|
||||
boolean hasTriggerBlock = false;
|
||||
|
@ -791,6 +979,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
boolean hasCommand = false;
|
||||
boolean hasCooldownDelay = false;
|
||||
boolean hasLeaveDesti = false;
|
||||
boolean hasDispParticle = false;
|
||||
boolean hasDestParticle = false;
|
||||
|
||||
// TODO change auto complete when quotes are opened and closed. Such as
|
||||
// autocomplete @Player and stuff when specifying commands
|
||||
|
@ -826,6 +1016,12 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
case "cooldowndelay":
|
||||
hasCooldownDelay = true;
|
||||
break;
|
||||
case "particlein":
|
||||
hasDispParticle = true;
|
||||
break;
|
||||
case "particleout":
|
||||
hasDestParticle = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,16 +1055,32 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
if (!hasLeaveDesti) {
|
||||
autoComplete.add("leavedesti:");
|
||||
}
|
||||
if (!hasDispParticle) {
|
||||
autoComplete.add("particlein:");
|
||||
}
|
||||
if (!hasDestParticle) {
|
||||
autoComplete.add("particleout:");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("warp")) {
|
||||
if (args.length == 2 && (args[0].equalsIgnoreCase("warp"))) {
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
String perm = portal.getArg("permission");
|
||||
if (perm == null || sender.hasPermission(perm)) {
|
||||
if ((perm == null || sender.hasPermission(perm))
|
||||
&& (sender.hasPermission("advancedportals.warp.*")
|
||||
|| sender.hasPermission("advancedportals.warp." + portal.getName()))) {
|
||||
autoComplete.add(portal.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.length == 2 &&
|
||||
(args[0].equalsIgnoreCase("remove")
|
||||
|| args[0].equalsIgnoreCase("disablebeacon")
|
||||
|| args[0].equalsIgnoreCase("we-selection"))) {
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
autoComplete.add(portal.getName());
|
||||
}
|
||||
}
|
||||
String triggerBlock = "triggerblock:";
|
||||
if (args[args.length - 1].toLowerCase().startsWith(triggerBlock)) {
|
||||
String currentArg = args[args.length - 1];
|
||||
|
@ -888,11 +1100,19 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
|||
if (args[args.length - 1].startsWith("desti:") || args[args.length - 1].startsWith("destination:")) {
|
||||
String tagStart = args[args.length - 1].startsWith("desti:") ? "desti:" : "destination:";
|
||||
ConfigAccessor destiConfig = new ConfigAccessor(plugin, "destinations.yml");
|
||||
List<Object> destiObj = Arrays.asList(destiConfig.getConfig().getKeys(false).toArray());
|
||||
Object[] destiObj = destiConfig.getConfig().getKeys(false).toArray();
|
||||
for (Object object : destiObj) {
|
||||
autoComplete.add(tagStart + object.toString());
|
||||
}
|
||||
}
|
||||
if (args[args.length - 1].startsWith("particlein:") || args[args.length - 1].startsWith("particleout:")) {
|
||||
String tagStart = args[args.length - 1].startsWith("particlein:") ? "particlein:" : "particleout:";
|
||||
for (Particle particle : Particle.values()) {
|
||||
if(particle.getDataType() != Void.class)
|
||||
continue;
|
||||
autoComplete.add(tagStart + particle.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
Collections.sort(autoComplete);
|
||||
for (Object result : autoComplete.toArray()) {
|
||||
if (!result.toString().startsWith(args[args.length - 1])) {
|
||||
|
|
|
@ -1,90 +1,89 @@
|
|||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.compat.CraftBukkit;
|
||||
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.bukkit.destinations.DestinationCommand;
|
||||
import com.sekwah.advancedportals.bukkit.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bukkit.listeners.*;
|
||||
import com.sekwah.advancedportals.bukkit.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
|
||||
public CraftBukkit compat = null;
|
||||
private Settings settings;
|
||||
|
||||
public String channelName = "mc:advancedportals";
|
||||
protected boolean isProxyPluginEnabled = false;
|
||||
|
||||
// public HashMap<OfflinePlayer, String> PlayerDestiMap = new HashMap<>();
|
||||
protected boolean forceRegisterProxyChannels = false;
|
||||
protected boolean disableProxyWarning = false;
|
||||
|
||||
private boolean worldEditActive = false;
|
||||
|
||||
protected static final Map<String, String> PLAYER_DESTI_MAP = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
String packageName = getServer().getClass().getPackage().getName();
|
||||
String[] packageSplit = packageName.split("\\.");
|
||||
String version = packageSplit[packageSplit.length - 1];
|
||||
|
||||
saveDefaultConfig();
|
||||
|
||||
Metrics metrics = new Metrics(this);
|
||||
/*Metrics metrics = */
|
||||
new Metrics(this);
|
||||
|
||||
try {
|
||||
ConfigAccessor config = new ConfigAccessor(this, "config.yml");
|
||||
|
||||
this.compat = new CraftBukkit(this, version);
|
||||
ConfigHelper configHelper = new ConfigHelper(config.getConfig());
|
||||
|
||||
ConfigAccessor config = new ConfigAccessor(this, "config.yml");
|
||||
configHelper.update();
|
||||
|
||||
// TODO reenable and finish but probably focus on the recode first
|
||||
/*if(config.getConfig().getBoolean("DisableGatewayBeam", true)) {
|
||||
new PacketInjector(this, version);
|
||||
}*/
|
||||
config.saveConfig();
|
||||
|
||||
ConfigAccessor portalConfig = new ConfigAccessor(this, "portals.yml");
|
||||
portalConfig.saveDefaultConfig();
|
||||
FileConfiguration pluginConfig = config.getConfig();
|
||||
forceRegisterProxyChannels = pluginConfig.getBoolean(ConfigHelper.FORCE_ENABLE_PROXY_SUPPORT, false);
|
||||
disableProxyWarning = pluginConfig.getBoolean(ConfigHelper.DISABLE_PROXY_WARNING, false);
|
||||
|
||||
ConfigAccessor portalConfig = new ConfigAccessor(this, "portals.yml");
|
||||
portalConfig.saveDefaultConfig();
|
||||
|
||||
|
||||
ConfigAccessor destinationConfig = new ConfigAccessor(this, "destinations.yml");
|
||||
destinationConfig.saveDefaultConfig();
|
||||
ConfigAccessor destinationConfig = new ConfigAccessor(this, "destinations.yml");
|
||||
destinationConfig.saveDefaultConfig();
|
||||
|
||||
this.settings = new Settings(this);
|
||||
this.settings = new Settings(this);
|
||||
|
||||
// Loads the portal and destination editors
|
||||
new Portal(this);
|
||||
new Destination(this);
|
||||
// Loads the portal and destination editors
|
||||
Portal.init(this);
|
||||
Destination.init(this);
|
||||
|
||||
|
||||
this.registerCommands();
|
||||
this.registerCommands();
|
||||
|
||||
new WarpEffects(this);
|
||||
new WarpEffects(this);
|
||||
|
||||
this.addListeners();
|
||||
this.setupDataCollector();
|
||||
this.addListeners();
|
||||
this.setupDataCollector();
|
||||
|
||||
this.setupBungee();
|
||||
this.setupBungee();
|
||||
|
||||
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been successfully enabled!");
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
this.getLogger().warning("This version of craftbukkit is not yet supported, please notify sekwah and tell him about this version v:" + version);
|
||||
this.getLogger().warning("Along with the above stacktrace");
|
||||
this.setEnabled(false);
|
||||
} catch (IllegalArgumentException |
|
||||
NoSuchFieldException | SecurityException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
this.getLogger().warning("Something went wrong, please notify sekwah and tell him about this version v:" + version);
|
||||
this.getLogger().warning("Along with the above stacktrace");
|
||||
this.setEnabled(false);
|
||||
}
|
||||
this.getServer().getConsoleSender().sendMessage("\u00A7aAdvanced portals have been successfully enabled!");
|
||||
|
||||
for (Player player:
|
||||
this.getServer().getOnlinePlayers()) {
|
||||
player.removeMetadata("hasWarped", this);
|
||||
player.removeMetadata("lavaWarped", this);
|
||||
this.getServer().getOnlinePlayers()) {
|
||||
player.removeMetadata(Listeners.HAS_WARPED, this);
|
||||
player.removeMetadata(Listeners.LAVA_WARPED, this);
|
||||
}
|
||||
|
||||
if (settings.enabledWorldEditIntegration() && Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
worldEditActive = true;
|
||||
}
|
||||
|
||||
// thanks to the new config accessor code the config.saveDefaultConfig(); will now
|
||||
|
@ -110,14 +109,68 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||
}
|
||||
|
||||
private void setupBungee() {
|
||||
// Enables very basic bungee support if not setup right
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
||||
if(forceRegisterProxyChannels || this.checkIfBungee()) {
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeListener(this));
|
||||
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, channelName);
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, channelName, new PluginMessageReceiver(this));
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, BungeeMessages.CHANNEL_NAME);
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, BungeeMessages.CHANNEL_NAME, new PluginMessageReceiver(this));
|
||||
isProxyPluginEnabled = true;
|
||||
}
|
||||
else {
|
||||
isProxyPluginEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getPlayerDestiMap() {
|
||||
return PLAYER_DESTI_MAP;
|
||||
}
|
||||
|
||||
public boolean isProxyPluginEnabled() {
|
||||
return isProxyPluginEnabled;
|
||||
}
|
||||
|
||||
private boolean checkIfBungee()
|
||||
{
|
||||
// we check if the server is Spigot/Paper (because of the spigot.yml file)
|
||||
try {
|
||||
Class.forName("org.spigotmc.SpigotConfig");
|
||||
} catch (ClassNotFoundException e) {
|
||||
this.getServer().getConsoleSender().sendMessage( "\u00A7ePossibly unsupported version for bungee messages detected, channels won't be enabled." );
|
||||
getLogger().info("If you believe this shouldn't be the case please contact us on discord https://discord.sekwah.com/");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigurationSection configSelection = getServer().spigot().getConfig().getConfigurationSection("settings");
|
||||
if (configSelection != null && configSelection.getBoolean("bungeecord") ) {
|
||||
getLogger().info( "Bungee detected. Enabling proxy features." );
|
||||
return true;
|
||||
}
|
||||
} catch(NoSuchMethodError | NullPointerException e) {
|
||||
if(!disableProxyWarning) getLogger().info("BungeeCord config not detected, ignoring settings");
|
||||
}
|
||||
|
||||
// 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(NoSuchMethodError | NullPointerException e) {
|
||||
if(!disableProxyWarning) getLogger().info("Paper config not detected, ignoring paper settings");
|
||||
}
|
||||
|
||||
if(!disableProxyWarning) 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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.getServer().getConsoleSender().sendMessage("\u00A7cAdvanced portals are being disabled!");
|
||||
}
|
||||
|
@ -126,4 +179,8 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
|||
public Settings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public boolean isWorldEditActive() {
|
||||
return worldEditActive;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,34 @@
|
|||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class PluginMessages {
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private static String WARP_MESSAGE;
|
||||
public boolean useCustomPrefix = false;
|
||||
public static String customPrefix = "\u00A7a[\u00A7eAdvancedPortals\u00A7a]";
|
||||
public static String customPrefixFail = "\u00A7c[\u00A77AdvancedPortals\u00A7c]";
|
||||
|
||||
public PluginMessages (AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
ConfigAccessor config = new ConfigAccessor(this.plugin, "config.yml");
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
this.useCustomPrefix = config.getConfig().getBoolean("UseCustomPrefix");
|
||||
if (useCustomPrefix) {
|
||||
PluginMessages.customPrefix = config.getConfig().getString("CustomPrefix").replaceAll("&(?=[0-9a-fk-or])", "\u00A7");
|
||||
PluginMessages.customPrefixFail = config.getConfig().getString("CustomPrefixFail").replaceAll("&(?=[0-9a-fk-or])", "\u00A7");
|
||||
}
|
||||
|
||||
WARP_MESSAGE = ChatColor.translateAlternateColorCodes('&', config.getConfig().getString("WarpMessage", "&aYou have warped to &e<warp>&a"));
|
||||
}
|
||||
|
||||
// This class is so then the common messages in commands or just messages over the commands are the same and can be
|
||||
// easily changed.
|
||||
|
||||
public static String getWarpMessage(String warp) {
|
||||
String cleanedWarp = warp.replace("_", " ");
|
||||
return WARP_MESSAGE.replace("<warp>", cleanedWarp);
|
||||
}
|
||||
|
||||
public static void UnknownCommand(CommandSender sender, String command) {
|
||||
sender.sendMessage(customPrefixFail + " You need to type something after /" + command + "\n");
|
||||
sender.sendMessage("\u00A7cIf you do not know what you can put or would like some help with the commands please type \u00A7e" + '"' + "\u00A7e/" + command + " help" + '"' + "\u00A7c\n");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.sekwah.advancedportals.bukkit;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
|
||||
import static com.sekwah.advancedportals.bukkit.Settings.PortalConfigOption.*;
|
||||
|
||||
/**
|
||||
|
@ -13,10 +15,13 @@ public class Settings {
|
|||
|
||||
private String commandLevels = "n";
|
||||
|
||||
private boolean worldEditEnabled = false;
|
||||
|
||||
public enum PortalConfigOption {
|
||||
COMMAND_LEVELS("CommandLevels"),
|
||||
WARP_PARTICLES("WarpParticles"),
|
||||
WARP_SOUND("WarpSound");
|
||||
WARP_SOUND("WarpSound"),
|
||||
WORLDEDIT_INTEGRATION("WorldEditIntegration");
|
||||
|
||||
private final String target;
|
||||
|
||||
|
@ -36,6 +41,8 @@ public class Settings {
|
|||
|
||||
commandLevels = config.getConfig().getString(COMMAND_LEVELS.value(), "opcb");
|
||||
|
||||
worldEditEnabled = config.getConfig().getBoolean(WORLDEDIT_INTEGRATION.value(), false);
|
||||
|
||||
assert commandLevels != null;
|
||||
if(commandLevels.equals("opchek")) {
|
||||
commandLevels = "opcb";
|
||||
|
@ -61,4 +68,8 @@ public class Settings {
|
|||
public int getCurrentWarpParticles() {
|
||||
return currentWarpParticles;
|
||||
}
|
||||
|
||||
public boolean enabledWorldEditIntegration() {
|
||||
return worldEditEnabled;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ public final class WarpEvent extends Event implements Cancellable {
|
|||
|
||||
private boolean cancelled = false;
|
||||
|
||||
private Player player;
|
||||
private final Player player;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private AdvancedPortal portalData;
|
||||
private final AdvancedPortal portalData;
|
||||
|
||||
private boolean hasWarped = false;
|
||||
|
||||
|
@ -75,4 +75,4 @@ public final class WarpEvent extends Event implements Cancellable {
|
|||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,13 +11,13 @@ public class TagRegistry {
|
|||
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
private ArrayList<String> tags = new ArrayList<String>();
|
||||
private final ArrayList<String> tags = new ArrayList<String>();
|
||||
|
||||
private Map<String, TagHandler.Activation> tagActivation = new HashMap<String, TagHandler.Activation>();
|
||||
private final Map<String, TagHandler.Activation> tagActivation = new HashMap<String, TagHandler.Activation>();
|
||||
|
||||
private Map<String, TagHandler.Creation> tagCreation = new HashMap<String, TagHandler.Creation>();
|
||||
private final Map<String, TagHandler.Creation> tagCreation = new HashMap<String, TagHandler.Creation>();
|
||||
|
||||
private Map<String, TagHandler.TagStatus> tagStatus = new HashMap<String, TagHandler.TagStatus>();
|
||||
private final Map<String, TagHandler.TagStatus> tagStatus = new HashMap<String, TagHandler.TagStatus>();
|
||||
|
||||
// TODO the event can be used for general data detection and management, but use a TagHandler to make it so they can register
|
||||
// the individual class to handle.
|
||||
|
|
|
@ -8,7 +8,7 @@ public class ActivationData {
|
|||
|
||||
private WarpedStatus warpStatus = WarpedStatus.INACTIVE;
|
||||
|
||||
private Portal activePortal;
|
||||
private final Portal activePortal;
|
||||
|
||||
public ActivationData(Portal portal){
|
||||
this.activePortal = portal;
|
||||
|
@ -19,10 +19,7 @@ public class ActivationData {
|
|||
}
|
||||
|
||||
public void setWarpStatus(WarpedStatus warped){
|
||||
if(this.warpStatus == WarpedStatus.WARPED){
|
||||
return;
|
||||
}
|
||||
else if(this.warpStatus == WarpedStatus.INACTIVE){
|
||||
if(this.warpStatus == WarpedStatus.WARPED || this.warpStatus == WarpedStatus.INACTIVE){
|
||||
return;
|
||||
}
|
||||
this.warpStatus = warped;
|
||||
|
@ -56,7 +53,7 @@ public class ActivationData {
|
|||
/**
|
||||
* Nothing has activated on the portal.
|
||||
*/
|
||||
INACTIVE;
|
||||
INACTIVE
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
package com.sekwah.advancedportals.bukkit.compat;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.reflection.ReflectionHelper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class CraftBukkit {
|
||||
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
// Data for chat bar and json message
|
||||
private Method chatMessageTypeMethod;
|
||||
|
||||
private Method serializeMessage;
|
||||
private Constructor<?> chatPacketConstructor;
|
||||
|
||||
private Method playerGetHandle;
|
||||
private Field playerConnection;
|
||||
private Method sendPacket;
|
||||
|
||||
|
||||
public CraftBukkit(AdvancedPortalsPlugin plugin, String bukkitImpl) throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException {
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
try {
|
||||
String craftBukkitPackage = "org.bukkit.craftbukkit." + bukkitImpl + ".";
|
||||
String minecraftPackage = "net.minecraft.server." + bukkitImpl + ".";
|
||||
|
||||
this.plugin.getLogger().info("Bukkit version detected " + bukkitImpl);
|
||||
|
||||
Class<?> chatBaseComponent = Class.forName(minecraftPackage + "IChatBaseComponent"); // string to packet methods
|
||||
Class<?> chatSerialClass = ReflectionHelper.findClass(chatBaseComponent, "ChatSerializer");
|
||||
|
||||
Class<?> chatMessageTypeClass = Class.forName(minecraftPackage + "ChatMessageType");
|
||||
|
||||
this.chatMessageTypeMethod = chatMessageTypeClass.getMethod("a", byte.class);
|
||||
|
||||
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, chatMessageTypeClass);
|
||||
|
||||
|
||||
this.serializeMessage = chatSerialClass.getMethod("a", String.class);
|
||||
|
||||
this.playerGetHandle = Class.forName(craftBukkitPackage + "entity.CraftPlayer").getMethod("getHandle");
|
||||
this.playerConnection = Class.forName(minecraftPackage + "EntityPlayer").getField("playerConnection"); // get player connection
|
||||
Class<?> packet = Class.forName(minecraftPackage + "Packet");
|
||||
this.sendPacket = playerConnection.getType().getMethod("sendPacket", packet);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().warning("Attempting to use backup porekit locations");
|
||||
// Fall back on your Porekit
|
||||
Class<?> textBaseComponent = Class.forName("net.minecraft.util.text.ITextComponent"); // string to packet methods
|
||||
this.serializeMessage = ReflectionHelper.findClass(textBaseComponent, "Serializer").getMethod("func_150699_a", String.class); // md: jsonToComponent
|
||||
this.chatPacketConstructor = Class.forName("net.minecraft.network.play.server.SPacketChat").getConstructor(textBaseComponent, byte.class);
|
||||
|
||||
this.playerGetHandle = Class.forName("blue.lapis.pore.impl.entity.PorePlayer").getMethod("getHandle");
|
||||
this.playerConnection = Class.forName("net.minecraft.entity.player.EntityPlayerMP").getField("field_71135_a"); // get player connection fd: connection
|
||||
Class<?> packet = Class.forName("net.minecraft.network.Packet");
|
||||
this.sendPacket = playerConnection.getType().getMethod("func_147359_a", packet); //md: sendPacket
|
||||
}
|
||||
}
|
||||
|
||||
public void sendRawMessage(String rawMessage, Player player) {
|
||||
this.sendMessage(rawMessage,player, (byte) 1);
|
||||
}
|
||||
|
||||
public void sendActionBarMessage(String rawMessage, Player player) {
|
||||
this.sendMessage("{\"text\":\"" + rawMessage + "\"}",player, (byte) 2);
|
||||
}
|
||||
|
||||
public void sendMessage(String rawMessage, Player player, byte msgType) {
|
||||
try {
|
||||
Object comp = this.serializeMessage.invoke(null, rawMessage);
|
||||
Object packet = this.chatPacketConstructor.newInstance(comp, this.chatMessageTypeMethod.invoke(null,msgType)); // convert bytes into packet
|
||||
|
||||
Object handle = this.playerGetHandle.invoke(player);
|
||||
Object playerConnection = this.playerConnection.get(handle); // get players connection
|
||||
sendPacket.invoke(playerConnection, packet); // send packet
|
||||
} catch (IllegalAccessException | InvocationTargetException | InstantiationException e) {
|
||||
this.plugin.getLogger().warning("Error creating raw message, something must be wrong with reflection");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Blocks the beacon from showing
|
||||
* @param block
|
||||
*/
|
||||
/*public void setGatewayAgeHigh(Block block) {
|
||||
if(block.getWorld().getEnvironment() != World.Environment.THE_END &&
|
||||
this.endGatewayClass.isAssignableFrom(block.getState().getClass())) {
|
||||
try {
|
||||
Object tileEntity = this.getTileEntityMethod.invoke(this.getWorldHandleMethod.invoke(block.getWorld()),
|
||||
this.blockPositionConstructor.newInstance(block.getX(), block.getY(), block.getZ()));
|
||||
if(this.tileEntityEndGatewayClass.isAssignableFrom(tileEntity.getClass())) {
|
||||
getEntityTimeoutField.set(tileEntity, Integer.MAX_VALUE);
|
||||
}
|
||||
} catch (IllegalAccessException| InvocationTargetException | InstantiationException e) {
|
||||
this.plugin.getLogger().warning("Error setting gateway time");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.sekwah.advancedportals.bukkit;
|
||||
package com.sekwah.advancedportals.bukkit.config;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
@ -78,4 +78,4 @@ public class ConfigAccessor {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.sekwah.advancedportals.bukkit.config;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class ConfigHelper {
|
||||
|
||||
public static final String CONFIG_VERSION = "ConfigVersion";
|
||||
|
||||
public static final String COMMAND_LOGS = "CommandLogs";
|
||||
|
||||
public static final String FORCE_ENABLE_PROXY_SUPPORT = "ForceEnableProxySupport";
|
||||
public static final String DISABLE_PROXY_WARNING = "DisableProxyWarning";
|
||||
|
||||
public static final String PROXY_TELEPORT_DELAY = "ProxyTeleportDelay";
|
||||
|
||||
public static final String DISABLE_GATEWAY_BEAM = "DisableGatewayBeam";
|
||||
|
||||
private final FileConfiguration config;
|
||||
|
||||
public ConfigHelper(FileConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively for each time there is a future update
|
||||
*/
|
||||
public void update() {
|
||||
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");
|
||||
|
||||
config.set(ConfigHelper.DISABLE_GATEWAY_BEAM, true);
|
||||
update();
|
||||
} else if(configVersion.equals("0.5.4")) {
|
||||
config.set(ConfigHelper.CONFIG_VERSION, "0.5.11");
|
||||
config.set(ConfigHelper.COMMAND_LOGS, true);
|
||||
update();
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,13 @@
|
|||
package com.sekwah.advancedportals.bukkit.destinations;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
|
@ -11,6 +15,7 @@ import org.bukkit.entity.Entity;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Destination {
|
||||
|
@ -20,7 +25,7 @@ public class Destination {
|
|||
private static boolean TELEPORT_RIDING = false;
|
||||
public static int PORTAL_MESSAGE_DISPLAY = 0;
|
||||
|
||||
public Destination(AdvancedPortalsPlugin plugin) {
|
||||
public static void init(AdvancedPortalsPlugin plugin) {
|
||||
Destination.plugin = plugin;
|
||||
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
|
@ -105,25 +110,33 @@ public class Destination {
|
|||
}
|
||||
|
||||
public static boolean warp(Player player, String name, boolean hideActionBar) {
|
||||
return warp(player, name, false, false);
|
||||
return warp(player, name, null, hideActionBar, false);
|
||||
}
|
||||
|
||||
public static boolean warp(Player player, String name, boolean hideActionbar, boolean noEffects) {
|
||||
public static boolean warp(Player player, String name, boolean hideActionBar, boolean noEffects) {
|
||||
return warp(player, name, null, hideActionBar, noEffects);
|
||||
}
|
||||
|
||||
public static boolean warp(Player player, String dest, AdvancedPortal disp, boolean hideActionbar, boolean noEffects) {
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||
if (config.getConfig().getString(name + ".world") != null) {
|
||||
if (config.getConfig().getString(dest + ".world") != null) {
|
||||
Location loc = player.getLocation();
|
||||
if (Bukkit.getWorld(config.getConfig().getString(name + ".world")) != null) {
|
||||
loc.setWorld(Bukkit.getWorld(config.getConfig().getString(name + ".world")));
|
||||
if (Bukkit.getWorld(config.getConfig().getString(dest + ".world")) != null) {
|
||||
loc.setWorld(Bukkit.getWorld(config.getConfig().getString(dest + ".world")));
|
||||
|
||||
loc.setX(config.getConfig().getDouble(name + ".pos.X"));
|
||||
loc.setY(config.getConfig().getDouble(name + ".pos.Y"));
|
||||
loc.setZ(config.getConfig().getDouble(name + ".pos.Z"));
|
||||
loc.setX(config.getConfig().getDouble(dest + ".pos.X"));
|
||||
loc.setY(config.getConfig().getDouble(dest + ".pos.Y"));
|
||||
loc.setZ(config.getConfig().getDouble(dest + ".pos.Z"));
|
||||
|
||||
loc.setPitch((float) config.getConfig().getDouble(name + ".pos.pitch"));
|
||||
loc.setYaw((float) config.getConfig().getDouble(name + ".pos.yaw"));
|
||||
loc.setPitch((float) config.getConfig().getDouble(dest + ".pos.pitch"));
|
||||
loc.setYaw((float) config.getConfig().getDouble(dest + ".pos.yaw"));
|
||||
|
||||
if (disp != null && disp.getArg("particlein") != null) {
|
||||
WarpEffects.activateParticle(player, disp.getArg("particlein"));
|
||||
}
|
||||
|
||||
if(!noEffects) {
|
||||
WarpEffects.activateParticles(player);
|
||||
WarpEffects.activateEffect(player);
|
||||
WarpEffects.activateSound(player);
|
||||
}
|
||||
Chunk c = loc.getChunk();
|
||||
|
@ -140,28 +153,42 @@ public class Destination {
|
|||
} else {
|
||||
player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
if (disp != null && disp.getArg("particleout") != null) {
|
||||
WarpEffects.activateParticle(player, disp.getArg("particleout"));
|
||||
}
|
||||
if(!noEffects) {
|
||||
WarpEffects.activateParticles(player);
|
||||
WarpEffects.activateEffect(player);
|
||||
WarpEffects.activateSound(player);
|
||||
}
|
||||
|
||||
if (PORTAL_MESSAGE_DISPLAY == 1) {
|
||||
player.sendMessage("");
|
||||
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7a You have been warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.");
|
||||
player.sendMessage(PluginMessages.customPrefix + PluginMessages.getWarpMessage(dest));
|
||||
player.sendMessage("");
|
||||
} else if (PORTAL_MESSAGE_DISPLAY == 2 && !hideActionbar) {
|
||||
plugin.compat.sendActionBarMessage("\u00A7aYou have warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.", player);
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(PluginMessages.getWarpMessage(dest)));
|
||||
}
|
||||
|
||||
Location newLoc = player.getLocation();
|
||||
Location newEyeLoc = player.getEyeLocation();
|
||||
UUID uuid = player.getUniqueId();
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
if (!portal.inPortal.contains(uuid) && !portal.isDelayed()
|
||||
&& (Portal.locationInPortalTrigger(portal, newLoc) || Portal.locationInPortalTrigger(portal, newEyeLoc))) {
|
||||
portal.inPortal.add(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7c The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' is linked to the world "
|
||||
+ config.getConfig().getString(name + ".world") + " which doesnt seem to exist any more!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + dest + "' is linked to the world "
|
||||
+ config.getConfig().getString(dest + ".world") + " which doesnt seem to exist any more!");
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(PluginMessages.customPrefix + "\u00A7c The destination you are currently attempting to warp to doesnt exist!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' has just had a warp "
|
||||
plugin.getLogger().log(Level.SEVERE, "The destination '" + dest + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or that destination doesn't exist!");
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.sekwah.advancedportals.bukkit.destinations;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
|
||||
public class DestinationCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
public DestinationCommand(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
@ -71,7 +71,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||
break;
|
||||
case "list":
|
||||
String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a";
|
||||
List<Object> destiObj = Arrays.asList(config.getConfig().getKeys(false).toArray());
|
||||
Object[] destiObj = config.getConfig().getKeys(false).toArray();
|
||||
LinkedList<String> destis = new LinkedList<>();
|
||||
for (Object object : destiObj) {
|
||||
destis.add(object.toString());
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.sekwah.advancedportals.bukkit.effects;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
|
@ -45,7 +47,7 @@ public class WarpEffects {
|
|||
return soundFound;
|
||||
}
|
||||
|
||||
public static void activateParticles(Player player) {
|
||||
public static void activateEffect(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
World world = player.getWorld();
|
||||
switch (plugin.getSettings().getCurrentWarpParticles()){
|
||||
|
@ -62,6 +64,21 @@ public class WarpEffects {
|
|||
|
||||
}
|
||||
|
||||
public static void activateParticle(Player player, String particle_name) {
|
||||
Particle particle = Portal.getParticle(particle_name);
|
||||
if(particle == null) {
|
||||
plugin.getLogger().warning("wrong particle name: " + particle_name);
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc_from = player.getLocation();
|
||||
|
||||
World world = player.getWorld();
|
||||
|
||||
world.spawnParticle(particle, loc_from, 100, 1, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
public static void activateSound(Player player) {
|
||||
if(!soundError){
|
||||
Location loc = player.getLocation();
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
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 org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BungeeListener implements PluginMessageListener {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
public BungeeListener(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.destinations.Destination;
|
||||
import com.sekwah.advancedportals.bukkit.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
|
@ -18,11 +18,11 @@ import org.bukkit.event.block.Action;
|
|||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityPortalEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
@ -34,6 +34,9 @@ public class Listeners implements Listener {
|
|||
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
public static String HAS_WARPED = "hasWarped";
|
||||
public static String LAVA_WARPED = "lavaWarped";
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Listeners(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
@ -83,7 +86,7 @@ public class Listeners implements Listener {
|
|||
@EventHandler
|
||||
public void onLeaveEvent(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(player.hasMetadata("leaveDesti")) {
|
||||
if (player.hasMetadata("leaveDesti")) {
|
||||
Destination.warp(player, player.getMetadata("leaveDesti").get(0).asString(),
|
||||
false, true);
|
||||
}
|
||||
|
@ -91,7 +94,26 @@ public class Listeners implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerJoinEvent event) {
|
||||
Portal.joinCooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Portal.joinCooldown.put(player.getName(), System.currentTimeMillis());
|
||||
|
||||
Location loc = player.getLocation();
|
||||
Location eyeLoc = player.getEyeLocation();
|
||||
UUID uuid = player.getUniqueId();
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
if (!portal.inPortal.contains(uuid)
|
||||
&& (Portal.locationInPortalTrigger(portal, loc) || Portal.locationInPortalTrigger(portal, eyeLoc))) {
|
||||
portal.inPortal.add(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> playerMap = plugin.getPlayerDestiMap();
|
||||
|
||||
if (playerMap.containsKey(uuid.toString())) {
|
||||
Destination.warp(player, playerMap.get(uuid.toString()), false, true);
|
||||
playerMap.remove(uuid.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -103,28 +125,22 @@ public class Listeners implements Listener {
|
|||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Location loc = event.getTo();
|
||||
Location eyeLoc = new Location(loc.getWorld(), loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ());
|
||||
|
||||
checkTriggerLocations(player, false, loc, eyeLoc);
|
||||
checkTriggerLocations(player, false, event.getTo(), player.getEyeLocation());
|
||||
|
||||
}
|
||||
|
||||
public void checkTriggerLocations(Player player, boolean useDelayed, Location... locations) {
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
boolean delayed = portal.hasArg("delayed") && portal.getArg("delayed").equalsIgnoreCase("true");
|
||||
for (Location loc : locations) {
|
||||
if (delayed == useDelayed) {
|
||||
boolean delayed = portal.isDelayed();
|
||||
if (delayed == useDelayed) {
|
||||
for (Location loc : locations) {
|
||||
if (delayed ? Portal.locationInPortal(portal, loc, 1)
|
||||
: Portal.locationInPortalTrigger(portal, loc)) {
|
||||
if (portal.getTriggers().contains(Material.NETHER_PORTAL)) {
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||
player.setMetadata("hasWarped", new FixedMetadataValue(plugin, true));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveWarpData(player), 10);
|
||||
}
|
||||
}
|
||||
|
||||
player.setMetadata(HAS_WARPED, new FixedMetadataValue(plugin, true));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveWarpData(player), 10);
|
||||
if (portal.getTriggers().contains(Material.LAVA)) {
|
||||
player.setMetadata("lavaWarped", new FixedMetadataValue(plugin, true));
|
||||
player.setMetadata(LAVA_WARPED, new FixedMetadataValue(plugin, true));
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new RemoveLavaData(player), 10);
|
||||
}
|
||||
if (portal.inPortal.contains(player.getUniqueId()))
|
||||
|
@ -138,9 +154,9 @@ public class Listeners implements Listener {
|
|||
if (!delayed)
|
||||
portal.inPortal.add(player.getUniqueId());
|
||||
return;
|
||||
} else if (!delayed)
|
||||
portal.inPortal.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
portal.inPortal.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +223,7 @@ public class Listeners implements Listener {
|
|||
// These are here because java 7 can only take finals straight into a runnable
|
||||
class RemoveLavaData implements Runnable {
|
||||
|
||||
private Player player;
|
||||
private final Player player;
|
||||
|
||||
public RemoveLavaData(Player player) {
|
||||
this.player = player;
|
||||
|
@ -215,14 +231,14 @@ public class Listeners implements Listener {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
player.removeMetadata("lavaWarped", plugin);
|
||||
player.removeMetadata(LAVA_WARPED, plugin);
|
||||
player.setFireTicks(0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class RemoveWarpData implements Runnable {
|
||||
|
||||
private Player player;
|
||||
private final Player player;
|
||||
|
||||
public RemoveWarpData(Player player) {
|
||||
this.player = player;
|
||||
|
@ -231,7 +247,7 @@ public class Listeners implements Listener {
|
|||
@Override
|
||||
public void run() {
|
||||
if (player != null && player.isOnline()) {
|
||||
player.removeMetadata("hasWarped", plugin);
|
||||
player.removeMetadata(HAS_WARPED, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +263,7 @@ public class Listeners implements Listener {
|
|||
if (event.getEntity() instanceof Player && (event.getCause() == EntityDamageEvent.DamageCause.LAVA
|
||||
|| event.getCause() == EntityDamageEvent.DamageCause.FIRE
|
||||
|| event.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK)) {
|
||||
if (event.getEntity().hasMetadata("lavaWarped")
|
||||
if (event.getEntity().hasMetadata(LAVA_WARPED)
|
||||
| Portal.inPortalTriggerRegion(event.getEntity().getLocation()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -260,17 +276,27 @@ public class Listeners implements Listener {
|
|||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!player.hasMetadata("hasWarped")) {
|
||||
if (!player.hasMetadata(HAS_WARPED)) {
|
||||
Location loc = event.getFrom();
|
||||
Location eyeLoc = new Location(loc.getWorld(), loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ());
|
||||
|
||||
checkTriggerLocations(player, true, loc, eyeLoc);
|
||||
}
|
||||
|
||||
if (player.hasMetadata("hasWarped") | Portal.inPortalRegion(event.getFrom(), 1))
|
||||
if (player.hasMetadata(HAS_WARPED) | Portal.inPortalRegion(event.getFrom(), 1))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityPortalEvent(EntityPortalEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if(Portal.locationInPortal(event.getFrom(), 2)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onItemInteract(PlayerInteractEvent event) {
|
||||
|
||||
|
@ -286,11 +312,11 @@ public class Listeners implements Listener {
|
|||
player.sendMessage(
|
||||
PluginMessages.customPrefix + "\u00A7a You have selected: \u00A7e" + portal.getName());
|
||||
player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, portal.getName())); // adds the
|
||||
// name to
|
||||
// the
|
||||
// metadata
|
||||
// of the
|
||||
// character
|
||||
// name to
|
||||
// the
|
||||
// metadata
|
||||
// of the
|
||||
// character
|
||||
event.setCancelled(true);
|
||||
player.removeMetadata("selectingPortal", plugin);
|
||||
return;
|
||||
|
@ -303,10 +329,10 @@ public class Listeners implements Listener {
|
|||
}
|
||||
|
||||
if (player.hasPermission("advancedportals.createportal")) {
|
||||
|
||||
if (event.getItem() != null && event.getItem().getType() == WandMaterial // was type id
|
||||
if (!plugin.getSettings().enabledWorldEditIntegration()
|
||||
&& event.getItem() != null && event.getItem().getType() == WandMaterial // was type id
|
||||
&& (!UseOnlyServerAxe || (checkItemForName(event.getItem()) && event.getItem().getItemMeta()
|
||||
.getDisplayName().equals("\u00A7ePortal Region Selector")))) {
|
||||
.getDisplayName().equals("\u00A7ePortal Region Selector")))) {
|
||||
|
||||
// This checks if the action was a left or right click and if it was directly
|
||||
// effecting a block.
|
||||
|
@ -345,7 +371,6 @@ public class Listeners implements Listener {
|
|||
// Returns the event so no more code is executed(stops unnecessary code being
|
||||
// executed)
|
||||
}
|
||||
|
||||
} else if (checkItemForName(event.getItem())
|
||||
&& event.getItem().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer")
|
||||
&& event.getAction() == Action.LEFT_CLICK_BLOCK
|
||||
|
|
|
@ -3,8 +3,10 @@ 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 org.bukkit.OfflinePlayer;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
|
@ -12,31 +14,55 @@ import java.util.UUID;
|
|||
|
||||
public class PluginMessageReceiver implements PluginMessageListener {
|
||||
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
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
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
|
||||
if (!channel.equals(plugin.channelName)) {
|
||||
if (!channel.equals(BungeeMessages.CHANNEL_NAME)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(message);
|
||||
String subchannel = in.readUTF();
|
||||
|
||||
if (subchannel.equals("BungeePortal")) {
|
||||
if (subchannel.equals(BungeeMessages.SERVER_DESTI)) {
|
||||
String targetDestination = in.readUTF();
|
||||
String bungeeUUID = in.readUTF();
|
||||
|
||||
if (player != null) {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,
|
||||
() -> Destination.warp(player, targetDestination, false, true),
|
||||
20L
|
||||
Player targetPlayer = this.plugin.getServer().getPlayer(UUID.fromString(bungeeUUID));
|
||||
|
||||
if(teleportDelay <= 0) {
|
||||
teleportPlayerToDesti(targetPlayer, targetDestination, bungeeUUID);
|
||||
} else {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.EndGateway;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
|
||||
public class PortalPlacer implements Listener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
//private final boolean DISABLE_GATEWAY_BEAM;
|
||||
private final boolean DISABLE_GATEWAY_BEAM;
|
||||
|
||||
public PortalPlacer(AdvancedPortalsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
@ -23,7 +26,7 @@ public class PortalPlacer implements Listener {
|
|||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
boolean portalPlace = config.getConfig().getBoolean("CanBuildPortalBlock");
|
||||
|
||||
//this.DISABLE_GATEWAY_BEAM = config.getConfig().getBoolean("DisableGatewayBeam", true);
|
||||
this.DISABLE_GATEWAY_BEAM = config.getConfig().getBoolean("DisableGatewayBeam", true);
|
||||
|
||||
|
||||
if (portalPlace) {
|
||||
|
@ -40,27 +43,46 @@ public class PortalPlacer implements Listener {
|
|||
if(name == null) return;
|
||||
|
||||
if (name.equals("\u00A75Portal Block Placer")){
|
||||
event.getBlockPlaced().setType(Material.NETHER_PORTAL);
|
||||
}
|
||||
else if (name.equals("\u00A78End Portal Block Placer")){
|
||||
event.getBlock().setType(Material.NETHER_PORTAL);
|
||||
} else if (name.equals("\u00A78End Portal Block Placer")){
|
||||
event.getBlockPlaced().setType(Material.END_PORTAL);
|
||||
}
|
||||
else if (name.equals("\u00A78Gateway Block Placer")){
|
||||
event.getBlockPlaced().setType(Material.END_GATEWAY);
|
||||
/*if(this.DISABLE_GATEWAY_BEAM) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
this.plugin.compat.setGatewayAgeHigh(event.getBlock());
|
||||
}, 1);
|
||||
}*/
|
||||
Block block = event.getBlockPlaced();
|
||||
|
||||
block.setType(Material.END_GATEWAY);
|
||||
if(this.DISABLE_GATEWAY_BEAM) {
|
||||
EndGateway tileState = (EndGateway) block.getState();
|
||||
tileState.setAge(Long.MIN_VALUE);
|
||||
tileState.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
if(!this.DISABLE_GATEWAY_BEAM) {
|
||||
return;
|
||||
}
|
||||
BlockState[] tileEntities = event.getChunk().getTileEntities();
|
||||
for(BlockState block : tileEntities) {
|
||||
if(block.getType() == Material.END_GATEWAY) {
|
||||
if(Portal.inPortalRegion(block.getLocation(), 5)) {
|
||||
EndGateway tileState = (EndGateway) block;
|
||||
tileState.setAge(Long.MIN_VALUE);
|
||||
tileState.update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
Block block = event.getBlock();
|
||||
Block newBlock = block.getWorld().getBlockAt(block.getLocation());
|
||||
Material material = block.getType();
|
||||
if (material == Material.NETHER_PORTAL && Portal.inPortalRegion(block.getLocation(), Portal.getPortalProtectionRadius()))
|
||||
event.setCancelled(true);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.sekwah.advancedportals.bukkit.listeners;
|
||||
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.config.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.portals.Portal;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -42,6 +42,8 @@ public class PortalProtect implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(!this.PortalProtect) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (!player.hasPermission("advancedportals.build")
|
||||
&& Portal.inPortalRegion(event.getBlock().getLocation(), PortalProtectionArea)) {
|
||||
|
@ -52,8 +54,10 @@ public class PortalProtect implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!this.PortalProtect) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
if (!player.hasPermission("advancedportals.build")
|
||||
if (PortalProtect && !player.hasPermission("advancedportals.build")
|
||||
&& Portal.inPortalRegion(event.getBlock().getLocation(), PortalProtectionArea)) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " You don't have permission to build here!");
|
||||
|
@ -62,6 +66,7 @@ public class PortalProtect implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onExplosion(EntityExplodeEvent event) {
|
||||
if(!this.PortalProtect) return;
|
||||
|
||||
List<Block> blockList = event.blockList();
|
||||
for (int i = 0; i < blockList.size(); i++) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class Metrics {
|
|||
private static final String URL = "https://bStats.org/submitData/bukkit";
|
||||
|
||||
// Is bStats enabled on this server?
|
||||
private boolean enabled;
|
||||
private final boolean enabled;
|
||||
|
||||
// Should failed requests be logged?
|
||||
private static boolean logFailedRequests;
|
||||
|
@ -715,4 +715,4 @@ public class Metrics {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,4 +112,8 @@ public class AdvancedPortal {
|
|||
public void setBungee(String bungee) {
|
||||
this.bungee = bungee;
|
||||
}
|
||||
|
||||
public boolean isDelayed() {
|
||||
return this.hasArg("delayed") && this.getArg("delayed").equalsIgnoreCase("true");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,15 @@ package com.sekwah.advancedportals.bukkit.portals;
|
|||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bukkit.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.bukkit.PluginMessages;
|
||||
import com.sekwah.advancedportals.bukkit.api.portaldata.PortalArg;
|
||||
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.bukkit.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -34,20 +38,24 @@ public class Portal {
|
|||
private static int portalProtectionRadius;
|
||||
private static boolean blockSpectatorMode;
|
||||
private static int joinCooldownDelay;
|
||||
private static Random random = new Random();
|
||||
private static boolean commandLog;
|
||||
private static final Random random = new Random();
|
||||
|
||||
public Portal(AdvancedPortalsPlugin plugin) {
|
||||
public static void init(AdvancedPortalsPlugin plugin) {
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
this.showBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage", false);
|
||||
showBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage", false);
|
||||
|
||||
this.portalProtectionRadius = config.getConfig().getInt("PortalProtectionRadius");
|
||||
portalProtectionRadius = config.getConfig().getBoolean("PortalProtection") ?
|
||||
config.getConfig().getInt("PortalProtectionArea") : 0;
|
||||
|
||||
this.throwback = config.getConfig().getDouble("ThrowbackAmount", 0.7);
|
||||
throwback = config.getConfig().getDouble("ThrowbackAmount", 0.7);
|
||||
|
||||
this.portalSound = WarpEffects.findSound(plugin, "BLOCK_PORTAL_TRAVEL", "PORTAL_TRAVEL");
|
||||
this.blockSpectatorMode = config.getConfig().getBoolean("BlockSpectatorMode", false);
|
||||
portalSound = WarpEffects.findSound(plugin, "BLOCK_PORTAL_TRAVEL", "PORTAL_TRAVEL");
|
||||
blockSpectatorMode = config.getConfig().getBoolean("BlockSpectatorMode", false);
|
||||
|
||||
this.joinCooldownDelay = config.getConfig().getInt("PortalCooldown", 5);
|
||||
joinCooldownDelay = config.getConfig().getInt("PortalCooldown", 5);
|
||||
|
||||
commandLog = config.getConfig().getBoolean(ConfigHelper.COMMAND_LOGS, true);
|
||||
|
||||
Portal.plugin = plugin;
|
||||
Portal.loadPortals();
|
||||
|
@ -154,13 +162,21 @@ public class Portal {
|
|||
return blockTypes;
|
||||
}
|
||||
|
||||
public static Particle getParticle(String name) {
|
||||
try {
|
||||
return Particle.valueOf(name.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String create(Location pos1, Location pos2, String name, String destination,
|
||||
Set<Material> triggerBlocks, PortalArg... extraData) {
|
||||
Set<Material> triggerBlocks, PortalArg... extraData) {
|
||||
return create(pos1, pos2, name, destination, triggerBlocks, null, extraData);
|
||||
}
|
||||
|
||||
public static String create(Location pos1, Location pos2, String name, String destination,
|
||||
Set<Material> triggerBlocks, String serverName, PortalArg... portalArgs) {
|
||||
Set<Material> triggerBlocks, String serverName, PortalArg... portalArgs) {
|
||||
|
||||
if (!pos1.getWorld().equals(pos2.getWorld())) {
|
||||
plugin.getLogger().log(Level.WARNING, "pos1 and pos2 must be in the same world!");
|
||||
|
@ -239,11 +255,11 @@ public class Portal {
|
|||
if (portalsActive) {
|
||||
int portalId = 0;
|
||||
for (@SuppressWarnings("unused")
|
||||
Object portal : Portal.portals) {
|
||||
Object portal : Portal.portals) {
|
||||
if (portals[portalId].getWorldName().equals(pos2.getWorld().getName())) { // checks that the cubes arnt
|
||||
// overlapping by seeing if
|
||||
// all 4 corners are not in
|
||||
// side another
|
||||
// overlapping by seeing if
|
||||
// all 4 corners are not in
|
||||
// side another
|
||||
if (checkOverLapPortal(pos1, pos2, portals[portalId].getPos1().getBlockX(),
|
||||
portals[portalId].getPos1().getBlockY(), portals[portalId].getPos1().getBlockZ())) {
|
||||
return true;
|
||||
|
@ -292,15 +308,13 @@ public class Portal {
|
|||
|
||||
private static boolean checkOverLapPortal(Location pos1, Location pos2, int posX, int posY, int posZ) {
|
||||
if (pos1.getX() >= posX && pos1.getY() >= posX && pos1.getZ() >= posZ) {
|
||||
if ((pos2.getX()) <= posX && pos2.getY() <= posY && pos2.getZ() <= posZ) {
|
||||
return true;
|
||||
}
|
||||
return (pos2.getX()) <= posX && pos2.getY() <= posY && pos2.getZ() <= posZ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String create(Location pos1, Location pos2, String name, String destination, String serverName,
|
||||
PortalArg... extraData) { // add stuff for destination names or coordinates
|
||||
PortalArg... extraData) { // add stuff for destination names or coordinates
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
|
||||
Material triggerBlockType;
|
||||
|
@ -403,7 +417,7 @@ public class Portal {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean activate(Player player, AdvancedPortal portal) {
|
||||
public static boolean activate(Player player, AdvancedPortal portal, boolean doKnockback) {
|
||||
|
||||
if (blockSpectatorMode && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
player.sendMessage(
|
||||
|
@ -413,11 +427,27 @@ public class Portal {
|
|||
|
||||
String permission = portal.getArg("permission");
|
||||
|
||||
if (!(permission == null || player.hasPermission(permission) || player.isOp())) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + "\u00A7c You do not have permission to use this portal!");
|
||||
failSound(player, portal);
|
||||
throwPlayerBack(player);
|
||||
boolean invertPermission = false;
|
||||
if(permission != null) {
|
||||
invertPermission = permission.startsWith("!");
|
||||
if (invertPermission) {
|
||||
permission.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
boolean noMessage = permission != null && permission.startsWith("nomsg.");
|
||||
if(noMessage) {
|
||||
permission.substring(6);
|
||||
}
|
||||
|
||||
if (!(permission == null || ((!invertPermission && player.hasPermission(permission)) || (invertPermission && !player.hasPermission(permission))) || player.isOp())) {
|
||||
if(!noMessage) {
|
||||
player.sendMessage(
|
||||
PluginMessages.customPrefixFail + "\u00A7c You do not have permission to use this portal!");
|
||||
failSound(player, portal);
|
||||
if(doKnockback)
|
||||
throwPlayerBack(player);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -428,7 +458,8 @@ public class Portal {
|
|||
int time = (joinCooldownDelay - diff);
|
||||
player.sendMessage(ChatColor.RED + "There is " + ChatColor.YELLOW + time + ChatColor.RED + (time == 1 ? " second" : " seconds") + " join cooldown protection left.");
|
||||
failSound(player, portal);
|
||||
throwPlayerBack(player);
|
||||
if(doKnockback)
|
||||
throwPlayerBack(player);
|
||||
return false;
|
||||
}
|
||||
joinCooldown.remove(player.getName());
|
||||
|
@ -449,7 +480,8 @@ public class Portal {
|
|||
player.sendMessage(ChatColor.RED + "Please wait " + ChatColor.YELLOW + time + ChatColor.RED
|
||||
+ (time == 1 ? " second" : " seconds") + " until attempting to enter this portal again.");
|
||||
failSound(player, portal);
|
||||
throwPlayerBack(player);
|
||||
if(doKnockback)
|
||||
throwPlayerBack(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -482,12 +514,19 @@ public class Portal {
|
|||
}
|
||||
|
||||
if (portal.getDestiation() != null) {
|
||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||
outForList.writeUTF("PortalEnter");
|
||||
outForList.writeUTF(bungeeServer);
|
||||
outForList.writeUTF(portal.getDestiation());
|
||||
if(plugin.isProxyPluginEnabled()) {
|
||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||
outForList.writeUTF(BungeeMessages.ENTER_PORTAL);
|
||||
outForList.writeUTF(bungeeServer);
|
||||
outForList.writeUTF(portal.getDestiation());
|
||||
outForList.writeUTF(player.getUniqueId().toString());
|
||||
|
||||
player.sendPluginMessage(plugin, BungeeMessages.CHANNEL_NAME, outForList.toByteArray());
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().log(Level.WARNING, "You do not have bungee setup correctly. Cross server destinations won't work.");
|
||||
}
|
||||
|
||||
player.sendPluginMessage(plugin, plugin.channelName, outForList.toByteArray());
|
||||
}
|
||||
|
||||
ByteArrayDataOutput outForSend = ByteStreams.newDataOutput();
|
||||
|
@ -503,34 +542,33 @@ public class Portal {
|
|||
} else if (portal.getDestiation() != null) {
|
||||
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
|
||||
if (configDesti.getConfig().getString(portal.getDestiation() + ".world") != null) {
|
||||
warped = Destination.warp(player, portal.getDestiation(), hasMessage);
|
||||
warped = Destination.warp(player, portal.getDestiation(), portal, hasMessage, false);
|
||||
if (!warped) {
|
||||
throwPlayerBack(player);
|
||||
if(doKnockback)
|
||||
throwPlayerBack(player);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (showFailMessage) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ "\u00A7c The portal you are trying to use doesn't have a destination!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.getName() + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or portal doesn't exist!");
|
||||
} else if (showFailMessage) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail
|
||||
+ "\u00A7c The portal you are trying to use doesn't have a destination!");
|
||||
plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.getName() + "' has just had a warp "
|
||||
+ "attempt and either the data is corrupt or portal doesn't exist!");
|
||||
if(doKnockback)
|
||||
throwPlayerBack(player);
|
||||
failSound(player, portal);
|
||||
}
|
||||
failSound(player, portal);
|
||||
}
|
||||
|
||||
if (portal.hasArg("command.1")) {
|
||||
warped = true;
|
||||
int commandLine = 1;
|
||||
String command = portal.getArg("command." + commandLine);// portalData.getConfig().getString(portal.getName()+
|
||||
// ".portalArgs.command." + commandLine);
|
||||
// ".portalArgs.command." + commandLine);
|
||||
do {
|
||||
// (?i) makes the search case insensitive
|
||||
command = command.replaceAll("@player", player.getName());
|
||||
plugin.getLogger().log(Level.INFO, "Portal command: " + command);
|
||||
if(commandLog) plugin.getLogger().log(Level.INFO, "Portal command: " + command);
|
||||
if (command.startsWith("#") && plugin.getSettings().enabledCommandLevel("c")) {
|
||||
command = command.substring(1);
|
||||
plugin.getLogger().log(Level.INFO, "Portal command: " + command);
|
||||
try {
|
||||
plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
} catch (Exception e) {
|
||||
|
@ -539,12 +577,15 @@ public class Portal {
|
|||
} else if (command.startsWith("!") && plugin.getSettings().enabledCommandLevel("o")) {
|
||||
command = command.substring(1);
|
||||
boolean wasOp = player.isOp();
|
||||
try {
|
||||
player.setOp(true);
|
||||
if(!wasOp) {
|
||||
try {
|
||||
player.setOp(true);
|
||||
player.chat("/" + command);
|
||||
} finally {
|
||||
player.setOp(false);
|
||||
}
|
||||
} else {
|
||||
player.chat("/" + command);
|
||||
// player.performCommand(command);
|
||||
} finally {
|
||||
player.setOp(wasOp);
|
||||
}
|
||||
} else if (command.startsWith("^") && plugin.getSettings().enabledCommandLevel("p")) {
|
||||
command = command.substring(1);
|
||||
|
@ -557,15 +598,20 @@ public class Portal {
|
|||
player.removeAttachment(permissionAttachment);
|
||||
}
|
||||
} else if (command.startsWith("%") && plugin.getSettings().enabledCommandLevel("b")) {
|
||||
command = command.substring(1);
|
||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||
outForList.writeUTF("BungeeCommand");
|
||||
outForList.writeUTF(player.getUniqueId().toString());
|
||||
outForList.writeUTF(command);
|
||||
player.sendPluginMessage(plugin, plugin.channelName, outForList.toByteArray());
|
||||
if(plugin.isProxyPluginEnabled()) {
|
||||
command = command.substring(1);
|
||||
ByteArrayDataOutput outForList = ByteStreams.newDataOutput();
|
||||
outForList.writeUTF(BungeeMessages.BUNGEE_COMMAND);
|
||||
outForList.writeUTF(command);
|
||||
player.sendPluginMessage(plugin, BungeeMessages.CHANNEL_NAME, outForList.toByteArray());
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().log(Level.WARNING, "You do not have bungee setup correctly. For security advanced bungee features won't work.");
|
||||
}
|
||||
|
||||
} else {
|
||||
player.chat("/" + command);
|
||||
// player.performCommand(command);
|
||||
player.chat("/" + command);
|
||||
// player.performCommand(command);
|
||||
}
|
||||
command = portal.getArg("command." + ++commandLine);
|
||||
} while (command != null);
|
||||
|
@ -573,8 +619,8 @@ public class Portal {
|
|||
|
||||
if (warped) {
|
||||
if (hasMessage) {
|
||||
plugin.compat.sendActionBarMessage(portal.getArg("message").replaceAll("&(?=[0-9a-fk-or])", "\u00A7"),
|
||||
player);
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
|
||||
TextComponent.fromLegacyText(portal.getArg("message").replaceAll("&(?=[0-9a-fk-or])", "\u00A7")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -670,10 +716,9 @@ public class Portal {
|
|||
if ((portal.getPos1().getX() + 1 + additionalArea) >= loc.getX()
|
||||
&& (portal.getPos1().getY() + 1 + additionalArea) > loc.getY()
|
||||
&& (portal.getPos1().getZ() + 1 + additionalArea) >= loc.getZ())
|
||||
if (portal.getPos2().getX() - additionalArea <= loc.getX()
|
||||
return portal.getPos2().getX() - additionalArea <= loc.getX()
|
||||
&& portal.getPos2().getY() - additionalArea <= loc.getY()
|
||||
&& portal.getPos2().getZ() - additionalArea <= loc.getZ())
|
||||
return true;
|
||||
&& portal.getPos2().getZ() - additionalArea <= loc.getZ();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -689,4 +734,8 @@ public class Portal {
|
|||
public static int getPortalProtectionRadius() {
|
||||
return portalProtectionRadius;
|
||||
}
|
||||
|
||||
public static boolean activate(Player player, AdvancedPortal portal) {
|
||||
return activate(player, portal, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.sekwah.advancedportals.bukkit.util;
|
||||
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class WorldEditIntegration {
|
||||
private static Region getCurrentSelection(Player player) {
|
||||
LocalSession localSession = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player));
|
||||
try {
|
||||
return localSession.getSelection(BukkitAdapter.adapt(player.getWorld()));
|
||||
} catch (IncompleteRegionException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean validateSelection(Player player) {
|
||||
return getCurrentSelection(player) instanceof CuboidRegion;
|
||||
}
|
||||
|
||||
public static Location getPos1(Player player) {
|
||||
Region currentSelection = getCurrentSelection(player);
|
||||
if (!(currentSelection instanceof CuboidRegion)) return null;
|
||||
return BukkitAdapter.adapt(player.getWorld(), ((CuboidRegion) currentSelection).getPos1());
|
||||
}
|
||||
|
||||
public static Location getPos2(Player player) {
|
||||
Region currentSelection = getCurrentSelection(player);
|
||||
if (currentSelection == null) return null;;
|
||||
return BukkitAdapter.adapt(player.getWorld(), ((CuboidRegion) currentSelection).getPos2());
|
||||
}
|
||||
|
||||
public static void explainRegion(Player player, Location pos1, Location pos2) {
|
||||
LocalSession localSession = WorldEdit.getInstance().getSessionManager().get(BukkitAdapter.adapt(player));
|
||||
RegionSelector selector = new CuboidRegionSelector(BukkitAdapter.adapt(player.getWorld()), BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2));
|
||||
localSession.setRegionSelector(BukkitAdapter.adapt(player.getWorld()), selector);
|
||||
selector.explainRegionAdjust(BukkitAdapter.adapt(player), localSession);
|
||||
|
||||
}
|
||||
}
|
|
@ -5,19 +5,18 @@ import com.sekwah.advancedportals.bungee.listener.PluginMessageReceiver;
|
|||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AdvancedPortalsPlugin extends Plugin {
|
||||
|
||||
public String channelName = "mc:advancedportals";
|
||||
|
||||
public HashMap<UUID, String[]> PlayerDestiMap = new HashMap<>();
|
||||
public HashMap<String, String[]> PlayerDestiMap = new HashMap<>();
|
||||
// key: UUID (string)
|
||||
// value: [0] targetServer, [1] targetDestination
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getProxy().registerChannel(channelName);
|
||||
getProxy().registerChannel(BungeeMessages.CHANNEL_NAME);
|
||||
|
||||
if(BungeeMessages.CHANNEL_NAME != null)
|
||||
|
||||
getProxy().getPluginManager().registerListener(this, new PluginMessageReceiver(this));
|
||||
getProxy().getPluginManager().registerListener(this, new EventListener(this));
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.sekwah.advancedportals.bungee;
|
||||
|
||||
public class BungeeMessages {
|
||||
|
||||
/**
|
||||
* String in
|
||||
* string bungee server
|
||||
* string desti name
|
||||
* string uuid (of what the server thinks it is)
|
||||
*
|
||||
* String out (to recieving server)
|
||||
* string destination
|
||||
* string uuid
|
||||
* string offline uuid
|
||||
*
|
||||
* String out
|
||||
*/
|
||||
public static String ENTER_PORTAL = "PortalEnter";
|
||||
|
||||
public static String CHANNEL_NAME = "advancedportals:warp";
|
||||
|
||||
|
||||
public static String SERVER_DESTI = "BungeePortal";
|
||||
|
||||
/**
|
||||
* Same in and out. This is read by the bungee
|
||||
* String containing command
|
||||
*/
|
||||
public static String BUNGEE_COMMAND = "BungeeCommand";
|
||||
}
|
|
@ -3,35 +3,36 @@ package com.sekwah.advancedportals.bungee.listener;
|
|||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class EventListener implements Listener {
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
public EventListener(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwitchServer(ServerSwitchEvent event) {
|
||||
UUID uuid = event.getPlayer().getUniqueId();
|
||||
public void onServerConnected(ServerConnectedEvent event) {
|
||||
String uuid = event.getPlayer().getUniqueId().toString();
|
||||
|
||||
if (plugin.PlayerDestiMap.containsKey(uuid)) {
|
||||
String[] val = plugin.PlayerDestiMap.get(uuid);
|
||||
String[] val = plugin.PlayerDestiMap.get(uuid);
|
||||
|
||||
if (val != null) {
|
||||
|
||||
// key: UUID (string)
|
||||
// value: [0] targetServer, [1] targetDestination
|
||||
// value: [0] targetServer, [1] targetDestination, [2] onlineUUID
|
||||
|
||||
if (event.getPlayer().getServer().getInfo().getName().equalsIgnoreCase(val[0])) {
|
||||
if (event.getServer().getInfo().getName().equalsIgnoreCase(val[0])) {
|
||||
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
||||
out.writeUTF("BungeePortal");
|
||||
out.writeUTF(BungeeMessages.SERVER_DESTI);
|
||||
out.writeUTF(val[1]);
|
||||
out.writeUTF(val[2]);
|
||||
|
||||
event.getPlayer().getServer().getInfo().sendData(plugin.channelName, out.toByteArray());
|
||||
event.getServer().sendData(BungeeMessages.CHANNEL_NAME, out.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,56 +3,47 @@ package com.sekwah.advancedportals.bungee.listener;
|
|||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class PluginMessageReceiver implements Listener {
|
||||
private AdvancedPortalsPlugin plugin;
|
||||
private final AdvancedPortalsPlugin plugin;
|
||||
|
||||
public PluginMessageReceiver(AdvancedPortalsPlugin plugin) { this.plugin = plugin; }
|
||||
|
||||
@EventHandler
|
||||
public void onMessageReceived(PluginMessageEvent event) {
|
||||
if(!event.getTag().equalsIgnoreCase(plugin.channelName)) return;
|
||||
if(!event.getTag().equalsIgnoreCase(BungeeMessages.CHANNEL_NAME) || !(event.getSender() instanceof Server)) return;
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||
String subChannel = in.readUTF();
|
||||
|
||||
if (subChannel.equalsIgnoreCase("PortalEnter")) {
|
||||
if (subChannel.equalsIgnoreCase(BungeeMessages.ENTER_PORTAL)) {
|
||||
String targetServer = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
UUID uuid;
|
||||
String targetUUID = in.readUTF();
|
||||
|
||||
if ( event.getReceiver() instanceof ProxiedPlayer )
|
||||
{
|
||||
ProxiedPlayer receiver = (ProxiedPlayer) event.getReceiver();
|
||||
uuid = receiver.getUniqueId();
|
||||
}
|
||||
else {
|
||||
plugin.getLogger().warning("There has been an issue getting the player for the teleport request.");
|
||||
return;
|
||||
}
|
||||
plugin.PlayerDestiMap.put(uuid, new String[]{targetServer, targetDestination});
|
||||
plugin.PlayerDestiMap.put(targetUUID, new String[]{targetServer, targetDestination, targetUUID});
|
||||
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> {
|
||||
plugin.PlayerDestiMap.remove(uuid);
|
||||
}, 20, TimeUnit.SECONDS);
|
||||
plugin.getProxy().getScheduler().schedule(plugin, () -> plugin.PlayerDestiMap.remove(targetUUID),
|
||||
10, TimeUnit.SECONDS);
|
||||
}
|
||||
else if (subChannel.equalsIgnoreCase("BungeeCommand")) {
|
||||
String targetPlayerUUID = in.readUTF();
|
||||
else if (subChannel.equalsIgnoreCase(BungeeMessages.BUNGEE_COMMAND)) {
|
||||
String command = in.readUTF();
|
||||
ProxiedPlayer player = plugin.getProxy().getPlayer(UUID.fromString(targetPlayerUUID));
|
||||
ProxiedPlayer player = (ProxiedPlayer) event.getReceiver();
|
||||
if (player != null) {
|
||||
// To send command to server the player is currently on
|
||||
// To send command to server the player is currently on in a lazy way
|
||||
//player.chat("/" + command);
|
||||
plugin.getProxy().getPluginManager().dispatchCommand(player, command);
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
package com.sekwah.advancedportals.velocity;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.inject.Inject;
|
||||
import com.sekwah.advancedportals.bungee.BungeeMessages;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
|
||||
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.LegacyChannelIdentifier;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@Plugin(id = "advancedportals", name = "Advanced Portals",
|
||||
url = "https://www.spigotmc.org/resources/advanced-portals.14356/",
|
||||
authors = {"sekwah"},
|
||||
version = "0.9.2")
|
||||
public class AdvancedPortalsPlugin {
|
||||
|
||||
public HashMap<String, String[]> PlayerDestiMap = new HashMap<>();
|
||||
|
||||
private final Logger logger;
|
||||
private final ProxyServer proxy;
|
||||
private LegacyChannelIdentifier AP_CHANNEL;
|
||||
|
||||
@Inject
|
||||
public AdvancedPortalsPlugin(ProxyServer proxy, Logger logger) {
|
||||
|
||||
this.proxy = proxy;
|
||||
this.logger = logger;
|
||||
|
||||
logger.info("\u00A7aAdvanced portals have been successfully enabled!");
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialize(ProxyInitializeEvent event) {
|
||||
|
||||
String[] splitChannel = BungeeMessages.CHANNEL_NAME.split(":");
|
||||
AP_CHANNEL = new LegacyChannelIdentifier(BungeeMessages.CHANNEL_NAME);
|
||||
|
||||
proxy.getChannelRegistrar().register(AP_CHANNEL);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPluginMessage(PluginMessageEvent event) {
|
||||
if(event.getIdentifier().equals(AP_CHANNEL)) {
|
||||
if(event.getSource() instanceof ServerConnection) {
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||
|
||||
String subChannel = in.readUTF();
|
||||
|
||||
if (subChannel.equalsIgnoreCase(BungeeMessages.ENTER_PORTAL)) {
|
||||
String targetServer = in.readUTF();
|
||||
String targetDestination = in.readUTF();
|
||||
String targetUUID = in.readUTF();
|
||||
|
||||
PlayerDestiMap.put(targetUUID, new String[]{targetServer, targetDestination, targetUUID});
|
||||
|
||||
proxy.getScheduler().buildTask(this, () -> PlayerDestiMap.remove(targetUUID))
|
||||
.delay(10, TimeUnit.SECONDS).schedule();
|
||||
}
|
||||
else if (subChannel.equalsIgnoreCase(BungeeMessages.BUNGEE_COMMAND)) {
|
||||
String command = in.readUTF();
|
||||
ServerConnection connection = (ServerConnection) event.getSource();
|
||||
if(connection.getPlayer() != null) {
|
||||
proxy.getCommandManager().executeAsync(connection.getPlayer(), command);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// So that client packets don't make it through to the servers, always trigger on this channel.
|
||||
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postJoinEvent(ServerPostConnectEvent event) {
|
||||
String uuid = event.getPlayer().getUniqueId().toString();
|
||||
|
||||
String[] val = PlayerDestiMap.get(uuid);
|
||||
|
||||
if (val != null) {
|
||||
// key: UUID (string)
|
||||
// value: [0] targetServer, [1] targetDestination, [2] onlineUUID
|
||||
|
||||
event.getPlayer().getCurrentServer().ifPresent(serverConnection -> {
|
||||
|
||||
if (serverConnection.getServerInfo().getName().equalsIgnoreCase(val[0])) {
|
||||
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
|
||||
out.writeUTF(BungeeMessages.SERVER_DESTI);
|
||||
out.writeUTF(val[1]);
|
||||
out.writeUTF(val[2]);
|
||||
|
||||
serverConnection.sendPluginMessage(AP_CHANNEL, out.toByteArray());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
main: com.sekwah.advancedportals.bungee.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.5.0
|
||||
author: sekwah41
|
||||
version: 0.9.2
|
||||
author: sekwah
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
# To set this file back to its default state just delete it and reload the server or restart it!
|
||||
|
||||
|
||||
# Will update whenever there is a config update from an older version so may not be the latest plugin version
|
||||
ConfigVersion: 0.5.13
|
||||
|
||||
# Set to true if you want the normal axes to work normally but the ones gived with /portals selector or wand will still work though
|
||||
# It can be usefull if people with permission want to use an iron axe on a survival server
|
||||
|
@ -24,7 +25,7 @@ PortalProtectionArea: 5
|
|||
DefaultPortalTriggerBlock: PORTAL
|
||||
|
||||
# This stops all water flowing inside a portal area(can be disabled if something like world edit is handelling the water flow or you dont want it active)
|
||||
# you want to
|
||||
# you want to
|
||||
StopWaterFlow: true
|
||||
|
||||
# This must be a placeable block or it will not work and may even crash
|
||||
|
@ -64,14 +65,19 @@ CustomPrefix: '&a[&eAdvancedPortals&a]'
|
|||
|
||||
CustomPrefixFail: '&c[&7AdvancedPortals&c]'
|
||||
|
||||
# Message sent to player in chat/action bar on warp
|
||||
WarpMessage: '&aYou have warped to &e<warp>&a.'
|
||||
|
||||
BlockSpectatorMode: false
|
||||
|
||||
PortalCooldown: 5 # How long after trying to enter a portal until the player can try to enter another. 0 or lower to deactivate.
|
||||
ThrowbackAmount: 0.7 # How fast to throw them back, 0 or lower to disable throwback
|
||||
|
||||
# Experimental, works but not all the time (Entities don't seem to be provided in the event sometimes or something is wrong)
|
||||
# We have no plans to further this but if anyone has any tips feel free to contact us here https://discord.gg/25QZVVn
|
||||
DisableGatewayBeam: false
|
||||
# Only disables the gateway block places with "/portal gatewayblock" for now
|
||||
# If you want to replace already made portals just use "/portal disablebeacon" and it will run through all the blocks in the area
|
||||
# Reloading the world or chunks that portals are in will also trigger the beacons to be disabled (this is for efficiency reasons)
|
||||
# However these wont trigger in the spawn chunks as they are loaded before any pluigns are.
|
||||
DisableGatewayBeam: true
|
||||
|
||||
# Enable or disable special command portals
|
||||
#
|
||||
|
@ -82,3 +88,20 @@ DisableGatewayBeam: false
|
|||
# b enable bungee command portals
|
||||
#
|
||||
CommandLevels: opcb
|
||||
|
||||
# Should the commands being triggered log in the console? (If you have an active server it may cause a bit of spam)
|
||||
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
|
||||
|
||||
# Just in case you are not using the proxy and dont want the warning message
|
||||
DisableProxyWarning: false
|
||||
|
||||
# Whether the integration with worldedit should be enabled.
|
||||
# This will force AdvancedPortals to use WorldEdit selections.
|
||||
WorldEditIntegration: false
|
|
@ -1,59 +1,71 @@
|
|||
main: com.sekwah.advancedportals.bukkit.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.5.0
|
||||
author: sekwah41
|
||||
version: 0.9.2
|
||||
author: sekwah
|
||||
description: An advanced portals plugin for bukkit.
|
||||
api-version: 1.13
|
||||
|
||||
softdepend:
|
||||
- WorldEdit
|
||||
|
||||
commands:
|
||||
advancedportals:
|
||||
description: The main command for the advanced portals
|
||||
aliases: [portals, aportals, portal, ap]
|
||||
usage: /<command>
|
||||
destination:
|
||||
description: Can be used to access portal destinations.
|
||||
aliases: [desti]
|
||||
usage: /<command>
|
||||
advancedportals:
|
||||
description: The main command for the advanced portals
|
||||
aliases: [portals, aportals, portal, ap]
|
||||
usage: /<command>
|
||||
permission: advancedportals.portalcommand
|
||||
destination:
|
||||
description: Can be used to access portal destinations.
|
||||
aliases: [desti]
|
||||
usage: /<command>
|
||||
permission: advancedportals.desti
|
||||
permissions:
|
||||
advancedportals.*:
|
||||
description: Gives access to all commands
|
||||
default: op
|
||||
children:
|
||||
advancedportals.createportal: true
|
||||
advancedportals.portal: true
|
||||
advancedportals.build: true
|
||||
advancedportals.desti: true
|
||||
advancedportals.createportal:
|
||||
description: Allows you to create portals
|
||||
default: op
|
||||
advancedportals.createportal.commandlevel.*:
|
||||
description: Gives access to all level raisers
|
||||
default: false
|
||||
children:
|
||||
advancedportals.createportal.commandlevel.op: true
|
||||
advancedportals.createportal.commandlevel.bungee: true
|
||||
advancedportals.createportal.commandlevel.perms: true
|
||||
advancedportals.createportal.commandlevel.console: true
|
||||
advancedportals.createportal.commandlevel.op:
|
||||
description: Allows you to run portal commands as op
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.perms:
|
||||
description: Allows you to run portal commands with * permission
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.bungee:
|
||||
description: Allows you to run portal commands through bungee
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.console:
|
||||
description: Executes command in the console
|
||||
default: false
|
||||
advancedportals.portal:
|
||||
description: Allows use of portal commands
|
||||
default: op
|
||||
advancedportals.build:
|
||||
description: Allows you to build in the portal regions
|
||||
default: op
|
||||
advancedportals.desti:
|
||||
description: Gives access to all desti commands
|
||||
default: op
|
||||
advancedportals.warp.*:
|
||||
description: Access to all warps (not really used tbh)
|
||||
default: op
|
||||
advancedportals.*:
|
||||
description: Gives access to all commands
|
||||
default: op
|
||||
children:
|
||||
advancedportals.createportal: true
|
||||
advancedportals.portal: true
|
||||
advancedportals.build: true
|
||||
advancedportals.desti: true
|
||||
advancedportals.createportal:
|
||||
description: Allows you to create portals
|
||||
default: op
|
||||
advancedportals.createportal.commandlevel.*:
|
||||
description: Gives access to all level raisers
|
||||
default: false
|
||||
children:
|
||||
advancedportals.createportal.commandlevel.op: true
|
||||
advancedportals.createportal.commandlevel.bungee: true
|
||||
advancedportals.createportal.commandlevel.perms: true
|
||||
advancedportals.createportal.commandlevel.console: true
|
||||
advancedportals.createportal.commandlevel.op:
|
||||
description: Allows you to run portal commands as op
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.perms:
|
||||
description: Allows you to run portal commands with * permission
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.bungee:
|
||||
description: Allows you to run portal commands through bungee
|
||||
default: false
|
||||
advancedportals.createportal.commandlevel.console:
|
||||
description: Executes command in the console
|
||||
default: false
|
||||
advancedportals.portal:
|
||||
description: Allows use of portal commands
|
||||
default: op
|
||||
advancedportals.portalcommand:
|
||||
description: Access to the portal command. This is seperate to allow access to portal warps without the rest.
|
||||
default: true
|
||||
advancedportals.build:
|
||||
description: Allows you to build in the portal regions
|
||||
default: op
|
||||
advancedportals.desti:
|
||||
description: Gives access to all desti commands
|
||||
default: op
|
||||
advancedportals.warp:
|
||||
description: Access to the warp command
|
||||
default: op
|
||||
advancedportals.warp.*:
|
||||
description: Access to all warps
|
||||
default: op
|
||||
|
|
Loading…
Reference in New Issue