Compare commits

...

70 Commits

Author SHA1 Message Date
70aa8186e2
getPoints returns no longer a Set but a List to maintains object order but removing dupicates (distinct) 2024-04-19 15:30:09 +02:00
900e0a5017
to gradle 2024-04-19 15:09:27 +02:00
Gabriele C
a9aa07bd59
Merge pull request #104 from HSGamer/master
wrapped Object class for raw values
2023-06-24 20:49:42 +02:00
Gabriele C
38104d506d Update dependencies, bump version, enhance code style 2023-06-24 20:48:09 +02:00
HSGamer
6d3fe42fcb wrapped Object class for raw values 2023-03-03 00:21:21 +07:00
Gabriele C
b553ccba91
Merge pull request #92 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.4.1
Bump maven-javadoc-plugin from 3.4.0 to 3.4.1
2022-08-18 03:53:53 +02:00
dependabot[bot]
2546fd3aba
Bump maven-javadoc-plugin from 3.4.0 to 3.4.1
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.4.0...maven-javadoc-plugin-3.4.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-15 17:01:52 +00:00
Gabriele C
4beb203fee
Merge pull request #91 from CodeMC/dependabot/maven/org.javassist-javassist-3.29.1-GA
Bump javassist from 3.29.0-GA to 3.29.1-GA
2022-08-11 19:04:39 +02:00
dependabot[bot]
1f0ffec679
Bump javassist from 3.29.0-GA to 3.29.1-GA
Bumps [javassist](https://github.com/jboss-javassist/javassist) from 3.29.0-GA to 3.29.1-GA.
- [Release notes](https://github.com/jboss-javassist/javassist/releases)
- [Changelog](https://github.com/jboss-javassist/javassist/blob/master/Changes.md)
- [Commits](https://github.com/jboss-javassist/javassist/commits)

---
updated-dependencies:
- dependency-name: org.javassist:javassist
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-11 17:03:17 +00:00
Gabriele C
1cf691c3e5 Bump spigot version, make sure the artifact is compatible with jdk 8 2022-07-30 21:28:09 +02:00
Gabriele C
2c89ae3baa Replace broken sk89q-repo with enginehub 2022-07-30 21:24:05 +02:00
Gabriele C
679609a816
Merge pull request #86 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-resources-plugin-3.3.0
Bump maven-resources-plugin from 3.2.0 to 3.3.0
2022-07-30 21:19:18 +02:00
Gabriele C
cef0ad5325
Merge pull request #85 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-install-plugin-3.0.1
Bump maven-install-plugin from 2.5.2 to 3.0.1
2022-07-30 21:19:09 +02:00
Gabriele C
131f13695c
Merge pull request #83 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-deploy-plugin-3.0.0
Bump maven-deploy-plugin from 2.8.2 to 3.0.0
2022-07-30 21:18:52 +02:00
Gabriele C
eb17d9f46c
Merge pull request #82 from CodeMC/dependabot/maven/org.javassist-javassist-3.29.0-GA
Bump javassist from 3.28.0-GA to 3.29.0-GA
2022-07-30 21:18:47 +02:00
Gabriele C
524ff2d71b
Merge pull request #81 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.4.0
Bump maven-javadoc-plugin from 3.3.2 to 3.4.0
2022-07-30 21:18:41 +02:00
Gabriele C
288a8906bd
Merge pull request #80 from CodeMC/dependabot/maven/org.projectlombok-lombok-1.18.24
Bump lombok from 1.18.22 to 1.18.24
2022-07-30 21:18:23 +02:00
dependabot[bot]
5fca76e47f
Bump maven-resources-plugin from 3.2.0 to 3.3.0
Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/apache/maven-resources-plugin/releases)
- [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.2.0...maven-resources-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-resources-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-26 17:02:51 +00:00
dependabot[bot]
3307201d63
Bump maven-install-plugin from 2.5.2 to 3.0.1
Bumps [maven-install-plugin](https://github.com/apache/maven-install-plugin) from 2.5.2 to 3.0.1.
- [Release notes](https://github.com/apache/maven-install-plugin/releases)
- [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-2.5.2...maven-install-plugin-3.0.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-install-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 17:02:31 +00:00
dependabot[bot]
3e52a13b5d
Bump maven-deploy-plugin from 2.8.2 to 3.0.0
Bumps [maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 2.8.2 to 3.0.0.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-2.8.2...maven-deploy-plugin-3.0.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-deploy-plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 17:01:25 +00:00
dependabot[bot]
f0f9c8dd5c
Bump javassist from 3.28.0-GA to 3.29.0-GA
Bumps [javassist](https://github.com/jboss-javassist/javassist) from 3.28.0-GA to 3.29.0-GA.
- [Release notes](https://github.com/jboss-javassist/javassist/releases)
- [Commits](https://github.com/jboss-javassist/javassist/commits)

---
updated-dependencies:
- dependency-name: org.javassist:javassist
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-13 17:01:25 +00:00
dependabot[bot]
758b46f234
Bump maven-javadoc-plugin from 3.3.2 to 3.4.0
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.2...maven-javadoc-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-21 17:02:55 +00:00
Gabriele C
0970767015
Build only on jdk 17 2022-04-18 21:00:20 +02:00
dependabot[bot]
f53bf1f2f9
Bump lombok from 1.18.22 to 1.18.24
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.22 to 1.18.24.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.22...v1.18.24)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-18 17:02:28 +00:00
Gabriele C
73d0cbfc29 Fix maven build 2022-04-10 21:34:19 +02:00
Gabriele C
c78dae81be
Use https for repository 2022-04-10 21:15:18 +02:00
Gabriele C
95971bcc76
Use https for repository 2022-04-10 21:14:59 +02:00
Gabriele C
db5ec9664d
Merge pull request #74 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.3.2
Bump maven-javadoc-plugin from 3.3.1 to 3.3.2
2022-04-10 21:11:32 +02:00
Gabriele C
01fa4a428b
Merge pull request #76 from CodeMC/dependabot/maven/com.sk89q.worldguard-worldguard-bukkit-7.0.7
Bump worldguard-bukkit from 7.0.6 to 7.0.7
2022-04-10 21:11:25 +02:00
Gabriele C
1eeaf3deaf
Merge pull request #77 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.10.1
Bump maven-compiler-plugin from 3.9.0 to 3.10.1
2022-04-10 21:11:02 +02:00
Gabriele C
6facd6ec08
Merge pull request #78 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-shade-plugin-3.3.0
Bump maven-shade-plugin from 3.2.4 to 3.3.0
2022-04-10 21:10:54 +02:00
Gabriele C
5c7edab9d5
Merge pull request #79 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-clean-plugin-3.2.0
Bump maven-clean-plugin from 3.1.0 to 3.2.0
2022-04-10 21:10:49 +02:00
Gabriele C
5ca6d718b8
Add Github pipeline 2022-04-10 21:10:28 +02:00
Gabriele C
6e0210902c
Delete .travis.yml 2022-04-10 21:09:38 +02:00
dependabot[bot]
648a2a8da4
Bump maven-clean-plugin from 3.1.0 to 3.2.0
Bumps [maven-clean-plugin](https://github.com/apache/maven-clean-plugin) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/apache/maven-clean-plugin/releases)
- [Commits](https://github.com/apache/maven-clean-plugin/compare/maven-clean-plugin-3.1.0...maven-clean-plugin-3.2.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-clean-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-05 17:02:42 +00:00
dependabot[bot]
882691b49d
Bump maven-shade-plugin from 3.2.4 to 3.3.0
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.4 to 3.3.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.4...maven-shade-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 17:01:43 +00:00
dependabot[bot]
7b475053a2
Bump maven-compiler-plugin from 3.9.0 to 3.10.1
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.9.0 to 3.10.1.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.9.0...maven-compiler-plugin-3.10.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-11 17:02:04 +00:00
dependabot[bot]
31d1f79a1a
Bump worldguard-bukkit from 7.0.6 to 7.0.7
Bumps worldguard-bukkit from 7.0.6 to 7.0.7.

---
updated-dependencies:
- dependency-name: com.sk89q.worldguard:worldguard-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-04 17:02:18 +00:00
dependabot[bot]
6822a361a3
Bump maven-javadoc-plugin from 3.3.1 to 3.3.2
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.1...maven-javadoc-plugin-3.3.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-11 17:01:45 +00:00
Gabriele C
e1a10af401
Merge pull request #73 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-jar-plugin-3.2.2
Bump maven-jar-plugin from 3.2.1 to 3.2.2
2022-01-12 18:08:24 +01:00
Gabriele C
62591b7e65
Merge pull request #72 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.9.0
Bump maven-compiler-plugin from 3.8.1 to 3.9.0
2022-01-12 18:08:15 +01:00
dependabot[bot]
cb8a7991d3
Bump maven-jar-plugin from 3.2.1 to 3.2.2
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.1...maven-jar-plugin-3.2.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-12 17:01:48 +00:00
dependabot[bot]
3526220a41
Bump maven-compiler-plugin from 3.8.1 to 3.9.0
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.8.1 to 3.9.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.8.1...maven-compiler-plugin-3.9.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-12 17:01:43 +00:00
Gabriele C
e4966608d9
Merge pull request #71 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-jar-plugin-3.2.1
Bump maven-jar-plugin from 3.2.0 to 3.2.1
2022-01-12 00:14:06 +01:00
dependabot[bot]
1ddd0750f3
Bump maven-jar-plugin from 3.2.0 to 3.2.1
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.0...maven-jar-plugin-3.2.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 17:01:58 +00:00
Gabriele C
99ec90eae6
Merge pull request #66 from CodeMC/dependabot/maven/org.projectlombok-lombok-1.18.22
Bump lombok from 1.18.20 to 1.18.22
2021-10-10 19:21:54 +02:00
dependabot[bot]
251f45b7ae
Bump lombok from 1.18.20 to 1.18.22
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.20 to 1.18.22.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.20...v1.18.22)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-07 17:02:00 +00:00
Gabriele C
0e45670c12 Fix Java16 build 2021-09-27 20:59:25 +02:00
Gabriele C
8efc339b84
Update .travis.yml 2021-09-27 18:02:25 +02:00
Gabriele C
1c2f01ed28
Update .travis.yml 2021-09-27 17:59:19 +02:00
Gabriele C
768a4d321f
Merge pull request #65 from CodeMC/dependabot/maven/com.sk89q.worldguard-worldguard-bukkit-7.0.6
Bump worldguard-bukkit from 7.0.4 to 7.0.6
2021-09-27 17:57:17 +02:00
Gabriele C
e1c5499708
Merge pull request #59 from CodeMC/dependabot/maven/org.javassist-javassist-3.28.0-GA
Bump javassist from 3.27.0-GA to 3.28.0-GA
2021-09-27 17:56:16 +02:00
Gabriele C
afcb165ba5
Merge pull request #64 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.3.1
Bump maven-javadoc-plugin from 3.2.0 to 3.3.1
2021-09-27 17:55:49 +02:00
dependabot[bot]
3aa49681ba
Bump worldguard-bukkit from 7.0.4 to 7.0.6
Bumps worldguard-bukkit from 7.0.4 to 7.0.6.

---
updated-dependencies:
- dependency-name: com.sk89q.worldguard:worldguard-bukkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-17 17:01:13 +00:00
dependabot[bot]
5cc6ec9732
Bump maven-javadoc-plugin from 3.2.0 to 3.3.1
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.2.0 to 3.3.1.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.2.0...maven-javadoc-plugin-3.3.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-08 17:01:38 +00:00
dependabot[bot]
8f24b16af9
Bump javassist from 3.27.0-GA to 3.28.0-GA
Bumps [javassist](https://github.com/jboss-javassist/javassist) from 3.27.0-GA to 3.28.0-GA.
- [Release notes](https://github.com/jboss-javassist/javassist/releases)
- [Commits](https://github.com/jboss-javassist/javassist/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 05:46:35 +00:00
Gabriele C
c2ab649fc9
Merge pull request #56 from CodeMC/dependabot/maven/org.projectlombok-lombok-1.18.20
Bump lombok from 1.18.16 to 1.18.20
2021-04-09 00:36:54 +02:00
dependabot[bot]
4ed9fd0080
Bump lombok from 1.18.16 to 1.18.20
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.16 to 1.18.20.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.16...v1.18.20)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-02 05:22:55 +00:00
Gabriele C
70e10bc0fd
Merge pull request #49 from JOO200/master
Fix CommandException in onLoad
2021-01-18 23:57:41 +01:00
JOO200
e8466e28e3 API Cleanup 2021-01-18 23:41:18 +01:00
Gabriele C
5edc204685 Actually make it work... + Cleanup 2020-10-22 03:33:33 +02:00
Gabriele C
c57c0c9df5 Implement IWrappedRegion.setPriority() 2020-10-21 21:27:00 +02:00
Gabriele C
150feaabb5
Update README.md 2020-10-21 20:16:03 +02:00
Gabriele C
1962772a0d Bump WG 7 version 2020-10-21 20:15:33 +02:00
Gabriele C
c9c6d343bd Implement session handlers (v6+), region sets, bump version 2020-10-21 20:13:42 +02:00
Gabriele C
ef4204a426
Merge pull request #41 from CodeMC/dependabot/maven/org.apache.maven.plugins-maven-resources-plugin-3.2.0
Bump maven-resources-plugin from 3.1.0 to 3.2.0
2020-08-20 01:13:02 +02:00
dependabot[bot]
3e4cb31bcb
Bump maven-resources-plugin from 3.1.0 to 3.2.0
Bumps [maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/apache/maven-resources-plugin/releases)
- [Commits](https://github.com/apache/maven-resources-plugin/compare/maven-resources-plugin-3.1.0...maven-resources-plugin-3.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-12 05:24:50 +00:00
Gabriele C
32bba2e012
Merge pull request #35 from CodeMC/dependabot/maven/com.sk89q.worldguard-worldguard-bukkit-7.0.3
Bump worldguard-bukkit from 7.0.3-SNAPSHOT to 7.0.3
2020-06-30 11:04:48 +02:00
Gabriele C
b7850d0b57
Merge pull request #36 from CodeMC/dependabot/add-v2-config-file
Create Dependabot config file
2020-06-30 11:04:30 +02:00
dependabot-preview[bot]
249bf12414
Bump worldguard-bukkit from 7.0.3-SNAPSHOT to 7.0.3
Bumps worldguard-bukkit from 7.0.3-SNAPSHOT to 7.0.3.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-29 05:53:31 +00:00
55 changed files with 1319 additions and 679 deletions

View File

@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

3
.gitignore vendored
View File

@ -65,8 +65,5 @@ nbactions.xml
nb-configuration.xml nb-configuration.xml
.nb-gradle/ .nb-gradle/
# Git
!.gitignore
# VSCode # VSCode
.vscode/ .vscode/

View File

@ -1,8 +0,0 @@
sudo: false
dist: trusty
language: java
jdk:
- oraclejdk8
cache:
directories:
- '$HOME/.m2/repository'

View File

@ -10,6 +10,7 @@ A wrapper for the WorldGuard API that allows plugins to support both v6 and v7 A
How to include WorldEditWrapper into your maven project: How to include WorldEditWrapper into your maven project:
```xml ```xml
<project>
<repositories> <repositories>
<repository> <repository>
<id>codemc-repo</id> <id>codemc-repo</id>
@ -21,9 +22,10 @@ How to include WorldEditWrapper into your maven project:
<dependency> <dependency>
<groupId>org.codemc.worldguardwrapper</groupId> <groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper</artifactId> <artifactId>worldguardwrapper</artifactId>
<version>1.1.9-SNAPSHOT</version> <version>1.2.1-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project>
``` ```
Remember to include/relocate the library into your final jar, example: Remember to include/relocate the library into your final jar, example:

8
api/build.gradle Normal file
View File

@ -0,0 +1,8 @@
group 'org.codemc.worldguardwrapper'
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-api</artifactId>
<name>WorldGuardWrapper-API</name>
</project>

View File

@ -1,6 +1,7 @@
package org.codemc.worldguardwrapper.event; package org.codemc.worldguardwrapper.event;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -20,10 +21,12 @@ public class WrappedDamageEntityEvent extends AbstractWrappedEvent {
private final Entity entity; private final Entity entity;
@Override @Override
@NonNull
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
@SuppressWarnings("unused")
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }

View File

@ -1,6 +1,7 @@
package org.codemc.worldguardwrapper.event; package org.codemc.worldguardwrapper.event;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
@ -17,10 +18,12 @@ public class WrappedDisallowedPVPEvent extends AbstractWrappedEvent {
private final Event cause; private final Event cause;
@Override @Override
@NonNull
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
@SuppressWarnings("unused")
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }

View File

@ -1,6 +1,7 @@
package org.codemc.worldguardwrapper.event; package org.codemc.worldguardwrapper.event;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -24,10 +25,12 @@ public class WrappedUseBlockEvent extends AbstractWrappedEvent {
private final Material effectiveMaterial; private final Material effectiveMaterial;
@Override @Override
@NonNull
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
@SuppressWarnings("unused")
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }

View File

@ -1,6 +1,7 @@
package org.codemc.worldguardwrapper.event; package org.codemc.worldguardwrapper.event;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -20,10 +21,12 @@ public class WrappedUseEntityEvent extends AbstractWrappedEvent {
private final Entity entity; private final Entity entity;
@Override @Override
@NonNull
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }
@SuppressWarnings("unused")
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }

View File

@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.flag;
import java.util.Optional; import java.util.Optional;
@SuppressWarnings("unused")
public interface IWrappedFlag<T> { public interface IWrappedFlag<T> {
String getName(); String getName();

View File

@ -1,4 +1,5 @@
package org.codemc.worldguardwrapper.flag; package org.codemc.worldguardwrapper.flag;
@SuppressWarnings("unused")
public interface IWrappedStatusFlag extends IWrappedFlag<WrappedState> { public interface IWrappedStatusFlag extends IWrappedFlag<WrappedState> {
} }

View File

@ -1,5 +1,6 @@
package org.codemc.worldguardwrapper.flag; package org.codemc.worldguardwrapper.flag;
@SuppressWarnings("unused")
public enum WrappedState { public enum WrappedState {
ALLOW, ALLOW,
DENY; DENY;

View File

@ -0,0 +1,46 @@
package org.codemc.worldguardwrapper.handler;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.codemc.worldguardwrapper.flag.WrappedState;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegionSet;
import java.util.Set;
@SuppressWarnings("unused")
public interface IHandler {
default void initialize(Player player, Location current, IWrappedRegionSet regionSet) {
}
default boolean testMoveTo(
Player player,
Location from,
Location to,
IWrappedRegionSet regionSet,
String moveType
) {
return true;
}
default boolean onCrossBoundary(
Player player,
Location from,
Location to,
IWrappedRegionSet toSet,
Set<IWrappedRegion> entered,
Set<IWrappedRegion> exited,
String moveType
) {
return true;
}
default void tick(Player player, IWrappedRegionSet regionSet) {
}
default WrappedState getInvincibility(Player player) {
return null;
}
}

View File

@ -6,13 +6,17 @@ import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.region.IWrappedRegion; import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegionSet;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection; import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.*; import java.util.*;
import java.util.function.Supplier;
@SuppressWarnings("unused")
public interface IWorldGuardImplementation { public interface IWorldGuardImplementation {
/** /**
@ -29,6 +33,8 @@ public interface IWorldGuardImplementation {
*/ */
int getApiVersion(); int getApiVersion();
void registerHandler(Supplier<IHandler> factory);
/** /**
* Query a flag's value for a given player at a given location. * Query a flag's value for a given player at a given location.
* *
@ -53,7 +59,7 @@ public interface IWorldGuardImplementation {
* *
* @param name The flag name * @param name The flag name
* @param type The flag type * @param type The flag type
* @return The flag, empty if it doesn't exists * @return The flag, empty if it doesn't exist
*/ */
<T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type); <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type);
@ -117,6 +123,14 @@ public interface IWorldGuardImplementation {
*/ */
Set<IWrappedRegion> getRegions(@NonNull Location minimum, @NonNull Location maximum); Set<IWrappedRegion> getRegions(@NonNull Location minimum, @NonNull Location maximum);
/**
* Get the applicable region set at the given location-
*
* @param location The location
* @return The region set
*/
Optional<IWrappedRegionSet> getRegionSet(@NonNull Location location);
/** /**
* Add a region. If only two points are given, a cuboid region will be created. * Add a region. If only two points are given, a cuboid region will be created.
* *
@ -136,13 +150,17 @@ public interface IWorldGuardImplementation {
* @param point2 The second point of the region * @param point2 The second point of the region
* @return The added region * @return The added region
*/ */
default Optional<IWrappedRegion> addCuboidRegion(@NonNull String id, @NonNull Location point1, @NonNull Location point2) { default Optional<IWrappedRegion> addCuboidRegion(
@NonNull String id,
@NonNull Location point1,
@NonNull Location point2
) {
return addRegion(id, Arrays.asList(point1, point2), 0, 0); return addRegion(id, Arrays.asList(point1, point2), 0, 0);
} }
/** /**
* Add a region for the given selection. * Add a region for the given selection.
* *
* @param id The region ID * @param id The region ID
* @param selection The selection for the region's volume * @param selection The selection for the region's volume
* @return The added region * @return The added region
@ -155,7 +173,8 @@ public interface IWorldGuardImplementation {
IPolygonalSelection sel = (IPolygonalSelection) selection; IPolygonalSelection sel = (IPolygonalSelection) selection;
return addRegion(id, new ArrayList<>(sel.getPoints()), sel.getMinimumY(), sel.getMaximumY()); return addRegion(id, new ArrayList<>(sel.getPoints()), sel.getMinimumY(), sel.getMaximumY());
} else { } else {
throw new UnsupportedOperationException("Unknown " + selection.getClass().getSimpleName() + " selection type!"); throw new UnsupportedOperationException("Unknown " + selection.getClass().getSimpleName()
+ " selection type!");
} }
} }

View File

@ -3,6 +3,7 @@ package org.codemc.worldguardwrapper.region;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@SuppressWarnings("unused")
public interface IWrappedDomain { public interface IWrappedDomain {
Set<UUID> getPlayers(); Set<UUID> getPlayers();

View File

@ -7,6 +7,7 @@ import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@SuppressWarnings("unused")
public interface IWrappedRegion { public interface IWrappedRegion {
ISelection getSelection(); ISelection getSelection();
@ -21,6 +22,8 @@ public interface IWrappedRegion {
int getPriority(); int getPriority();
void setPriority(int priority);
IWrappedDomain getOwners(); IWrappedDomain getOwners();
IWrappedDomain getMembers(); IWrappedDomain getMembers();

View File

@ -0,0 +1,27 @@
package org.codemc.worldguardwrapper.region;
import org.bukkit.OfflinePlayer;
import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
@SuppressWarnings("unused")
public interface IWrappedRegionSet extends Iterable<IWrappedRegion> {
boolean isVirtual();
<V> Optional<V> queryValue(OfflinePlayer subject, IWrappedFlag<V> flag);
<V> Collection<V> queryAllValues(OfflinePlayer subject, IWrappedFlag<V> flag);
boolean isOwnerOfAll(OfflinePlayer player);
boolean isMemberOfAll(OfflinePlayer player);
int size();
Set<IWrappedRegion> getRegions();
}

View File

@ -2,6 +2,7 @@ package org.codemc.worldguardwrapper.selection;
import org.bukkit.Location; import org.bukkit.Location;
@SuppressWarnings("unused")
public interface ICuboidSelection extends ISelection { public interface ICuboidSelection extends ISelection {
Location getMinimumPoint(); Location getMinimumPoint();

View File

@ -2,11 +2,13 @@ package org.codemc.worldguardwrapper.selection;
import org.bukkit.Location; import org.bukkit.Location;
import java.util.List;
import java.util.Set; import java.util.Set;
@SuppressWarnings("unused")
public interface IPolygonalSelection extends ISelection { public interface IPolygonalSelection extends ISelection {
Set<Location> getPoints(); List<Location> getPoints();
int getMinimumY(); int getMinimumY();

View File

@ -1,4 +1,5 @@
package org.codemc.worldguardwrapper.selection; package org.codemc.worldguardwrapper.selection;
@SuppressWarnings("unused")
public interface ISelection { public interface ISelection {
} }

View File

@ -5,10 +5,10 @@ import org.bukkit.Location;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import java.util.Collection; import java.util.*;
import java.util.HashSet; import java.util.stream.Collectors;
import java.util.Set;
@SuppressWarnings("unused")
@UtilityClass @UtilityClass
public class SelectionUtilities { public class SelectionUtilities {
@ -53,8 +53,9 @@ public class SelectionUtilities {
public IPolygonalSelection createPolygonalSelection(Collection<Location> points, int minY, int maxY) { public IPolygonalSelection createPolygonalSelection(Collection<Location> points, int minY, int maxY) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return new HashSet<>(points); //recoreHosting -> set to list , maintains order but remove duplicates
return new ArrayList<>(points).stream().distinct().collect(Collectors.toList());
} }
@Override @Override

22
build.gradle Normal file
View File

@ -0,0 +1,22 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.0.0" apply false
}
group 'org.codemc.worldguardwrapper'
version '1.2.1-SNAPSHOT'
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = parent.group
version = parent.version
repositories {
mavenCentral()
maven { url "https://maven.enginehub.org/repo/" }
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
}

View File

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

249
gradlew vendored Normal file
View File

@ -0,0 +1,249 @@
#!/bin/sh
#
# 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.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# 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
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##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
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 ;; #(
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
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
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
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
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=SC2039,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=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# 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.
# 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
# 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"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
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" "$@"

92
gradlew.bat vendored Normal file
View File

@ -0,0 +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=.
@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

View File

@ -0,0 +1,5 @@
dependencies {
api project(':implementation:v7')
api project(':implementation:v6')
api project(':implementation:legacy')
}

View File

@ -0,0 +1,10 @@
group 'org.codemc.worldguardwrapper.implementation.legacy'
dependencies {
api project(':api')
compileOnly 'org.spigotmc:spigot-api:1.12.1-R0.1-SNAPSHOT'
compileOnly 'com.sk89q:worldguard:6.1.1-SNAPSHOT'
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-legacy</artifactId>
<name>WorldGuardWrapper-Implementation-Legacy</name>
<repositories>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>6.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package org.codemc.worldguardwrapper.implementation.legacy; package org.codemc.worldguardwrapper.implementation.legacy;
import com.google.common.collect.Iterators;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -16,21 +17,25 @@ import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation; import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation;
import org.codemc.worldguardwrapper.implementation.legacy.flag.AbstractWrappedFlag; import org.codemc.worldguardwrapper.implementation.legacy.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.legacy.region.WrappedRegion; import org.codemc.worldguardwrapper.implementation.legacy.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardVectorUtilities; import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardVectorUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion; import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegionSet;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection; import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.*; import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class WorldGuardImplementation implements IWorldGuardImplementation { public class WorldGuardImplementation implements IWorldGuardImplementation {
@ -47,8 +52,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
} }
private Optional<LocalPlayer> wrapPlayer(Player player) { private Optional<LocalPlayer> wrapPlayer(OfflinePlayer player) {
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player)); return Optional.ofNullable(player).map(bukkitPlayer -> bukkitPlayer.isOnline() ?
worldGuardPlugin.wrapPlayer((Player) bukkitPlayer) : worldGuardPlugin.wrapOfflinePlayer(bukkitPlayer));
} }
private Optional<RegionManager> getWorldManager(@NonNull World world) { private Optional<RegionManager> getWorldManager(@NonNull World world) {
@ -56,17 +62,83 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(location)); return getWorldManager(Objects.requireNonNull(location.getWorld()))
.map(manager -> manager.getApplicableRegions(location));
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) {
return getWorldManager(minimum.getWorld()).map(manager -> manager.getApplicableRegions( return getWorldManager(Objects.requireNonNull(minimum.getWorld()))
new ProtectedCuboidRegion("temp", WorldGuardVectorUtilities.toBlockVector(minimum), WorldGuardVectorUtilities.toBlockVector(maximum)))); .map(manager ->
manager.getApplicableRegions(
new ProtectedCuboidRegion(
"temp",
WorldGuardVectorUtilities.toBlockVector(minimum),
WorldGuardVectorUtilities.toBlockVector(maximum)
)
)
);
} }
private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) { private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) {
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player) return getApplicableRegions(location)
.orElse(null), flag)); .map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player).orElse(null), flag));
}
private IWrappedRegionSet wrapRegionSet(@NonNull World world, @NonNull ApplicableRegionSet regionSet) {
return new IWrappedRegionSet() {
@Override
public Iterator<IWrappedRegion> iterator() {
return Iterators.transform(regionSet.iterator(), region -> new WrappedRegion(world, region));
}
@Override
public boolean isVirtual() {
return regionSet.isVirtual();
}
@Override
public <V> Optional<V> queryValue(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return Optional.ofNullable(regionSet.queryValue(subjectHandle, wrappedFlag.getHandle()))
.flatMap(wrappedFlag::fromWGValue);
}
@Override
public <V> Collection<V> queryAllValues(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return regionSet.queryAllValues(subjectHandle, wrappedFlag.getHandle()).stream()
.map(wrappedFlag::fromWGValue)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
}
@Override
public boolean isOwnerOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isOwnerOfAll(playerHandle);
}
@Override
public boolean isMemberOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isMemberOfAll(playerHandle);
}
@Override
public int size() {
return regionSet.size();
}
@Override
public Set<IWrappedRegion> getRegions() {
return regionSet.getRegions().stream()
.map(region -> new WrappedRegion(world, region)).collect(Collectors.toSet());
}
};
} }
@Override @Override
@ -79,6 +151,11 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return -6; return -6;
} }
@Override
public void registerHandler(Supplier<IHandler> factory) {
throw new UnsupportedOperationException("Custom flag handlers aren't supported in this version of WorldGuard!");
}
@Override @Override
public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) { public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) {
for (Flag<?> currentFlag : DefaultFlag.getFlags()) { for (Flag<?> currentFlag : DefaultFlag.getFlags()) {
@ -90,9 +167,10 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public <T> Optional<T> queryFlag(Player player, Location location, IWrappedFlag<T> flag) { public <T> Optional<T> queryFlag(Player player, @NonNull Location location, @NonNull IWrappedFlag<T> flag) {
AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag; AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag;
return queryValue(player, location, wrappedFlag.getHandle()).flatMap(value -> wrappedFlag.fromWGValue(value));
return queryValue(player, location, wrappedFlag.getHandle()).flatMap(wrappedFlag::fromWGValue);
} }
@Override @Override
@ -118,7 +196,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value); Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value);
flags.put(wrapped.getKey(), wrapped.getValue()); flags.put(wrapped.getKey(), wrapped.getValue());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
continue; // Unsupported flag type // Unsupported flag type
} }
} }
} }
@ -128,19 +206,19 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public <T> Optional<IWrappedFlag<T>> registerFlag(String name, Class<T> type, T defaultValue) { public <T> Optional<IWrappedFlag<T>> registerFlag(@NonNull String name, @NonNull Class<T> type, T defaultValue) {
throw new UnsupportedOperationException("Custom flags aren't supported in this version of WorldGuard!"); throw new UnsupportedOperationException("Custom flags aren't supported in this version of WorldGuard!");
} }
@Override @Override
public Optional<IWrappedRegion> getRegion(World world, String id) { public Optional<IWrappedRegion> getRegion(@NonNull World world, @NonNull String id) {
return getWorldManager(world) return getWorldManager(world)
.map(regionManager -> regionManager.getRegion(id)) .map(regionManager -> regionManager.getRegion(id))
.map(region -> new WrappedRegion(world, region)); .map(region -> new WrappedRegion(world, region));
} }
@Override @Override
public Map<String, IWrappedRegion> getRegions(World world) { public Map<String, IWrappedRegion> getRegions(@NonNull World world) {
RegionManager regionManager = worldGuardPlugin.getRegionManager(world); RegionManager regionManager = worldGuardPlugin.getRegionManager(world);
Map<String, ProtectedRegion> regions = regionManager.getRegions(); Map<String, ProtectedRegion> regions = regionManager.getRegions();
@ -151,7 +229,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location location) { public Set<IWrappedRegion> getRegions(@NonNull Location location) {
ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null);
Set<IWrappedRegion> set = new HashSet<>(); Set<IWrappedRegion> set = new HashSet<>();
@ -164,7 +242,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location minimum, Location maximum) { public Set<IWrappedRegion> getRegions(@NonNull Location minimum, @NonNull Location maximum) {
ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null);
Set<IWrappedRegion> set = new HashSet<>(); Set<IWrappedRegion> set = new HashSet<>();
@ -177,13 +255,28 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<IWrappedRegion> addRegion(String id, List<Location> points, int minY, int maxY) { public Optional<IWrappedRegionSet> getRegionSet(@NonNull Location location) {
return getApplicableRegions(location)
.map(regionSet -> wrapRegionSet(Objects.requireNonNull(location.getWorld()), regionSet));
}
@Override
public Optional<IWrappedRegion> addRegion(@NonNull String id, @NonNull List<Location> points, int minY, int maxY) {
ProtectedRegion region; ProtectedRegion region;
World world = points.get(0).getWorld(); World world = Objects.requireNonNull(points.get(0).getWorld());
if (points.size() == 2) { if (points.size() == 2) {
region = new ProtectedCuboidRegion(id, WorldGuardVectorUtilities.toBlockVector(points.get(0)), WorldGuardVectorUtilities.toBlockVector(points.get(1))); region = new ProtectedCuboidRegion(
id,
WorldGuardVectorUtilities.toBlockVector(points.get(0)),
WorldGuardVectorUtilities.toBlockVector(points.get(1))
);
} else { } else {
region = new ProtectedPolygonalRegion(id, WorldGuardVectorUtilities.toBlockVector2DList(points), minY, maxY); region = new ProtectedPolygonalRegion(
id,
WorldGuardVectorUtilities.toBlockVector2DList(points),
minY,
maxY
);
} }
Optional<RegionManager> manager = getWorldManager(world); Optional<RegionManager> manager = getWorldManager(world);
@ -196,7 +289,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<Set<IWrappedRegion>> removeRegion(World world, String id) { public Optional<Set<IWrappedRegion>> removeRegion(@NonNull World world, @NonNull String id) {
Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id)); Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id));
return set.map(protectedRegions -> protectedRegions.stream().map(region -> new WrappedRegion(world, region)) return set.map(protectedRegions -> protectedRegions.stream().map(region -> new WrappedRegion(world, region))
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
@ -221,11 +314,17 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} else if (selection instanceof Polygonal2DSelection) { } else if (selection instanceof Polygonal2DSelection) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return ((Polygonal2DSelection) selection).getNativePoints().stream() return ((Polygonal2DSelection) selection).getNativePoints().stream()
.distinct()
.map(vector -> new BlockVector(vector.toVector())) .map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(selection.getWorld(), vector)) .map(vector ->
.collect(Collectors.toSet()); WorldGuardVectorUtilities.fromBlockVector(
selection.getWorld(),
vector
)
)
.collect(Collectors.toList());
} }
@Override @Override
@ -239,7 +338,8 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
}; };
} else { } else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!"); throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName()
+ " selection!");
} }
}); });
} }

View File

@ -1,7 +1,6 @@
package org.codemc.worldguardwrapper.implementation.legacy.flag; package org.codemc.worldguardwrapper.implementation.legacy.flag;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities;

View File

@ -10,20 +10,16 @@ import lombok.Getter;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import org.codemc.worldguardwrapper.implementation.legacy.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardVectorUtilities; import org.codemc.worldguardwrapper.implementation.legacy.utility.WorldGuardVectorUtilities;
import org.codemc.worldguardwrapper.implementation.legacy.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.region.IWrappedDomain; import org.codemc.worldguardwrapper.region.IWrappedDomain;
import org.codemc.worldguardwrapper.region.IWrappedRegion; import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection; import org.codemc.worldguardwrapper.selection.ISelection;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
@ -50,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion {
} else if (handle instanceof ProtectedPolygonalRegion) { } else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return handle.getPoints().stream() return handle.getPoints().stream()
.distinct()
.map(vector -> new BlockVector(vector.toVector())) .map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector)) .map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector))
.collect(Collectors.toSet()); .collect(Collectors.toList());
} }
@Override @Override
@ -111,6 +108,11 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getPriority(); return handle.getPriority();
} }
@Override
public void setPriority(int priority) {
handle.setPriority(priority);
}
@Override @Override
public IWrappedDomain getOwners() { public IWrappedDomain getOwners() {
return new IWrappedDomain() { return new IWrappedDomain() {

View File

@ -4,7 +4,7 @@ import com.google.common.collect.Maps;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.StateFlag;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -15,8 +15,6 @@ import org.codemc.worldguardwrapper.implementation.legacy.flag.AbstractWrappedFl
import org.codemc.worldguardwrapper.implementation.legacy.flag.WrappedPrimitiveFlag; import org.codemc.worldguardwrapper.implementation.legacy.flag.WrappedPrimitiveFlag;
import org.codemc.worldguardwrapper.implementation.legacy.flag.WrappedStatusFlag; import org.codemc.worldguardwrapper.implementation.legacy.flag.WrappedStatusFlag;
import lombok.experimental.UtilityClass;
import java.util.Map; import java.util.Map;
@UtilityClass @UtilityClass
@ -42,6 +40,8 @@ public class WorldGuardFlagUtilities {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Vector.class)) { } else if (type.equals(Vector.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Object.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag);
} else { } else {
throw new IllegalArgumentException("Unsupported flag type " + type.getName()); throw new IllegalArgumentException("Unsupported flag type " + type.getName());
} }
@ -66,7 +66,8 @@ public class WorldGuardFlagUtilities {
public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) { public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) {
IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass()); IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass());
Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value).get(); // value is non-null Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value)
.orElseThrow(NullPointerException::new); // value should never be null
return Maps.immutableEntry(wrappedFlag, wrappedValue); return Maps.immutableEntry(wrappedFlag, wrappedValue);
} }
@ -92,4 +93,4 @@ public class WorldGuardFlagUtilities {
new com.sk89q.worldedit.Vector(location.getX(), location.getY(), location.getZ())); new com.sk89q.worldedit.Vector(location.getX(), location.getY(), location.getZ()));
} }
} }

View File

@ -21,7 +21,9 @@ public class WorldGuardVectorUtilities {
} }
public List<BlockVector2D> toBlockVector2DList(List<Location> locations) { public List<BlockVector2D> toBlockVector2DList(List<Location> locations) {
return locations.stream().map(location -> new BlockVector2D(location.getX(), location.getZ())).collect(Collectors.toList()); return locations.stream()
.map(location -> new BlockVector2D(location.getX(), location.getZ()))
.collect(Collectors.toList());
} }
} }

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation</artifactId>
<packaging>pom</packaging>
<modules>
<module>legacy</module>
<module>v6</module>
<module>v7</module>
</modules>
<name>WorldGuardWrapper-Implementation</name>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
</project>

View File

@ -0,0 +1,14 @@
group 'org.codemc.worldguardwrapper.implementation.legacy'
dependencies {
api project(':api')
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compileOnly 'com.sk89q.worldguard:worldguard-legacy:6.2'
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:6.1.5'
compileOnly 'com.sk89q.worldedit:worldedit-core:6.1.3-SNAPSHOT'
compileOnly 'org.javassist:javassist:3.29.2-GA'
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-v6</artifactId>
<name>WorldGuardWrapper-Implementation-V6</name>
<repositories>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-legacy</artifactId>
<version>6.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>6.1.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>6.1.4-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>de.schlichtherle</groupId>
<artifactId>truezip</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
</exclusion>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
<exclusion>
<groupId>com.thoughtworks.paranamer</groupId>
<artifactId>paranamer</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q.lib</groupId>
<artifactId>jlibnoise</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q</groupId>
<artifactId>jchronic</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -1,5 +1,6 @@
package org.codemc.worldguardwrapper.implementation.v6; package org.codemc.worldguardwrapper.implementation.v6;
import com.google.common.collect.Iterators;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -15,25 +16,35 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.session.Session;
import com.sk89q.worldguard.session.handler.Handler;
import javassist.util.proxy.ProxyFactory;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import org.codemc.worldguardwrapper.flag.WrappedState; import org.codemc.worldguardwrapper.flag.WrappedState;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation; import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation;
import org.codemc.worldguardwrapper.implementation.v6.flag.AbstractWrappedFlag; import org.codemc.worldguardwrapper.implementation.v6.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.v6.handler.ProxyHandler;
import org.codemc.worldguardwrapper.implementation.v6.region.WrappedRegion; import org.codemc.worldguardwrapper.implementation.v6.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardVectorUtilities; import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardVectorUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion; import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegionSet;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection; import org.codemc.worldguardwrapper.selection.ISelection;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.*; import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class WorldGuardImplementation implements IWorldGuardImplementation { public class WorldGuardImplementation implements IWorldGuardImplementation {
@ -52,8 +63,13 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
flagRegistry = worldGuardPlugin.getFlagRegistry(); flagRegistry = worldGuardPlugin.getFlagRegistry();
} }
private Optional<LocalPlayer> wrapPlayer(Player player) { private Optional<LocalPlayer> wrapPlayer(OfflinePlayer player) {
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player)); return Optional.ofNullable(player).map(bukkitPlayer -> {
if (bukkitPlayer.isOnline()) {
return worldGuardPlugin.wrapPlayer((Player) bukkitPlayer);
}
return worldGuardPlugin.wrapOfflinePlayer(bukkitPlayer);
});
} }
private Optional<RegionManager> getWorldManager(@NonNull World world) { private Optional<RegionManager> getWorldManager(@NonNull World world) {
@ -61,17 +77,83 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(location)); return getWorldManager(Objects.requireNonNull(location.getWorld()))
.map(manager -> manager.getApplicableRegions(location));
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) {
return getWorldManager(minimum.getWorld()).map(manager -> manager.getApplicableRegions( return getWorldManager(Objects.requireNonNull(minimum.getWorld()))
new ProtectedCuboidRegion("temp", WorldGuardVectorUtilities.toBlockVector(minimum), WorldGuardVectorUtilities.toBlockVector(maximum)))); .map(manager -> manager.getApplicableRegions(
new ProtectedCuboidRegion(
"temp",
WorldGuardVectorUtilities.toBlockVector(minimum),
WorldGuardVectorUtilities.toBlockVector(maximum)
)
));
} }
private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) { private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) {
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player) return getApplicableRegions(location)
.orElse(null), flag)); .map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player).orElse(null), flag));
}
public IWrappedRegionSet wrapRegionSet(@NonNull World world, @NonNull ApplicableRegionSet regionSet) {
return new IWrappedRegionSet() {
@Override
public Iterator<IWrappedRegion> iterator() {
return Iterators.transform(regionSet.iterator(), region -> new WrappedRegion(world, region));
}
@Override
public boolean isVirtual() {
return regionSet.isVirtual();
}
@Override
public <V> Optional<V> queryValue(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return Optional.ofNullable(regionSet.queryValue(subjectHandle, wrappedFlag.getHandle()))
.flatMap(wrappedFlag::fromWGValue);
}
@Override
public <V> Collection<V> queryAllValues(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return regionSet.queryAllValues(subjectHandle, wrappedFlag.getHandle()).stream()
.map(wrappedFlag::fromWGValue)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
}
@Override
public boolean isOwnerOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isOwnerOfAll(playerHandle);
}
@Override
public boolean isMemberOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isMemberOfAll(playerHandle);
}
@Override
public int size() {
return regionSet.size();
}
@Override
public Set<IWrappedRegion> getRegions() {
return regionSet.getRegions()
.stream()
.map(region -> new WrappedRegion(world, region))
.collect(Collectors.toSet());
}
};
} }
@Override @Override
@ -84,6 +166,39 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return 6; return 6;
} }
@Override
public void registerHandler(Supplier<IHandler> factory) {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setUseCache(false);
proxyFactory.setSuperclass(ProxyHandler.class);
Class<? extends ProxyHandler> handlerClass;
Constructor<? extends ProxyHandler> handlerConstructor;
try {
//noinspection unchecked
handlerClass = (Class<? extends ProxyHandler>) proxyFactory.createClass();
handlerConstructor = handlerClass.getDeclaredConstructor(
WorldGuardImplementation.class,
IHandler.class,
Session.class
);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
worldGuardPlugin.getSessionManager().registerHandler(new Handler.Factory<Handler>() {
@Override
public Handler create(Session session) {
IHandler handler = factory.get();
try {
return handlerConstructor.newInstance(WorldGuardImplementation.this, handler, session);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}, null);
}
@Override @Override
public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) { public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) {
return Optional.ofNullable(flagRegistry.get(name)) return Optional.ofNullable(flagRegistry.get(name))
@ -91,9 +206,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public <T> Optional<T> queryFlag(Player player, Location location, IWrappedFlag<T> flag) { public <T> Optional<T> queryFlag(Player player, @NonNull Location location, @NonNull IWrappedFlag<T> flag) {
AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag; AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag;
return queryValue(player, location, wrappedFlag.getHandle()).flatMap(value -> wrappedFlag.fromWGValue(value)); return queryValue(player, location, wrappedFlag.getHandle()).flatMap(wrappedFlag::fromWGValue);
} }
@Override @Override
@ -119,7 +234,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value); Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value);
flags.put(wrapped.getKey(), wrapped.getValue()); flags.put(wrapped.getKey(), wrapped.getValue());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
continue; // Unsupported flag type // Unsupported flag type
} }
} }
} }
@ -128,9 +243,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return flags; return flags;
} }
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
public <T> Optional<IWrappedFlag<T>> registerFlag(String name, Class<T> type, T defaultValue) { public <T> Optional<IWrappedFlag<T>> registerFlag(@NonNull String name, @NonNull Class<T> type, T defaultValue) {
final Flag<?> flag; final Flag<?> flag;
if (type.equals(WrappedState.class)) { if (type.equals(WrappedState.class)) {
flag = new StateFlag(name, defaultValue == WrappedState.ALLOW); flag = new StateFlag(name, defaultValue == WrappedState.ALLOW);
@ -160,14 +275,14 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<IWrappedRegion> getRegion(World world, String id) { public Optional<IWrappedRegion> getRegion(@NonNull World world, @NonNull String id) {
return getWorldManager(world) return getWorldManager(world)
.map(regionManager -> regionManager.getRegion(id)) .map(regionManager -> regionManager.getRegion(id))
.map(region -> new WrappedRegion(world, region)); .map(region -> new WrappedRegion(world, region));
} }
@Override @Override
public Map<String, IWrappedRegion> getRegions(World world) { public Map<String, IWrappedRegion> getRegions(@NonNull World world) {
RegionManager regionManager = worldGuardPlugin.getRegionManager(world); RegionManager regionManager = worldGuardPlugin.getRegionManager(world);
Map<String, ProtectedRegion> regions = regionManager.getRegions(); Map<String, ProtectedRegion> regions = regionManager.getRegions();
@ -178,7 +293,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location location) { public Set<IWrappedRegion> getRegions(@NonNull Location location) {
ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null);
Set<IWrappedRegion> set = new HashSet<>(); Set<IWrappedRegion> set = new HashSet<>();
@ -191,7 +306,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location minimum, Location maximum) { public Set<IWrappedRegion> getRegions(@NonNull Location minimum, @NonNull Location maximum) {
ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null);
Set<IWrappedRegion> set = new HashSet<>(); Set<IWrappedRegion> set = new HashSet<>();
@ -204,13 +319,28 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<IWrappedRegion> addRegion(String id, List<Location> points, int minY, int maxY) { public Optional<IWrappedRegionSet> getRegionSet(@NonNull Location location) {
return getApplicableRegions(location)
.map(regionSet -> wrapRegionSet(Objects.requireNonNull(location.getWorld()), regionSet));
}
@Override
public Optional<IWrappedRegion> addRegion(@NonNull String id, @NonNull List<Location> points, int minY, int maxY) {
ProtectedRegion region; ProtectedRegion region;
World world = points.get(0).getWorld(); World world = Objects.requireNonNull(points.get(0).getWorld());
if (points.size() == 2) { if (points.size() == 2) {
region = new ProtectedCuboidRegion(id, WorldGuardVectorUtilities.toBlockVector(points.get(0)), WorldGuardVectorUtilities.toBlockVector(points.get(1))); region = new ProtectedCuboidRegion(
id,
WorldGuardVectorUtilities.toBlockVector(points.get(0)),
WorldGuardVectorUtilities.toBlockVector(points.get(1))
);
} else { } else {
region = new ProtectedPolygonalRegion(id, WorldGuardVectorUtilities.toBlockVector2DList(points), minY, maxY); region = new ProtectedPolygonalRegion(
id,
WorldGuardVectorUtilities.toBlockVector2DList(points),
minY,
maxY
);
} }
Optional<RegionManager> manager = getWorldManager(world); Optional<RegionManager> manager = getWorldManager(world);
@ -223,10 +353,13 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<Set<IWrappedRegion>> removeRegion(World world, String id) { public Optional<Set<IWrappedRegion>> removeRegion(@NonNull World world, @NonNull String id) {
Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id)); Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id));
return set.map(protectedRegions -> protectedRegions.stream().map(region -> new WrappedRegion(world, region)) return set.map(protectedRegions ->
.collect(Collectors.toSet())); protectedRegions.stream()
.map(region -> new WrappedRegion(world, region))
.collect(Collectors.toSet())
);
} }
@Override @Override
@ -248,11 +381,17 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} else if (selection instanceof Polygonal2DSelection) { } else if (selection instanceof Polygonal2DSelection) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return ((Polygonal2DSelection) selection).getNativePoints().stream() return ((Polygonal2DSelection) selection).getNativePoints().stream()
.distinct()
.map(vector -> new BlockVector(vector.toVector())) .map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(selection.getWorld(), vector)) .map(vector ->
.collect(Collectors.toSet()); WorldGuardVectorUtilities.fromBlockVector(
selection.getWorld(),
vector
)
)
.collect(Collectors.toList());
} }
@Override @Override
@ -266,7 +405,8 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
}; };
} else { } else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!"); throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName()
+ " selection!");
} }
}); });
} }

View File

@ -1,7 +1,6 @@
package org.codemc.worldguardwrapper.implementation.v6.flag; package org.codemc.worldguardwrapper.implementation.v6.flag;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.v6.utility.WorldGuardFlagUtilities;

View File

@ -0,0 +1,94 @@
package org.codemc.worldguardwrapper.implementation.v6.handler;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.session.MoveType;
import com.sk89q.worldguard.session.Session;
import com.sk89q.worldguard.session.handler.Handler;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.codemc.worldguardwrapper.flag.WrappedState;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.implementation.v6.WorldGuardImplementation;
import org.codemc.worldguardwrapper.implementation.v6.region.WrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import javax.annotation.Nullable;
import java.util.Objects;
import java.util.Set;
public class ProxyHandler extends Handler {
private final WorldGuardImplementation implementation;
private final IHandler handler;
public ProxyHandler(WorldGuardImplementation implementation, IHandler handler, Session session) {
super(session);
this.implementation = implementation;
this.handler = handler;
}
@Override
public void initialize(Player player, Location current, ApplicableRegionSet set) {
handler.initialize(
player,
current,
implementation.wrapRegionSet(Objects.requireNonNull(current.getWorld()), set)
);
}
@Override
public boolean testMoveTo(Player player, Location from, Location to, ApplicableRegionSet toSet, MoveType moveType) {
return handler.testMoveTo(player,
from,
to,
implementation.wrapRegionSet(Objects.requireNonNull(to.getWorld()), toSet),
moveType.name()
);
}
@Override
public boolean onCrossBoundary(
Player player,
Location from,
Location to,
ApplicableRegionSet toSet,
Set<ProtectedRegion> entered,
Set<ProtectedRegion> exited,
MoveType moveType
) {
Set<IWrappedRegion> mappedEntered = ImmutableSet.copyOf(
Collections2.transform(entered, region -> new WrappedRegion(to.getWorld(), region))
);
Set<IWrappedRegion> mappedExited = ImmutableSet.copyOf(
Collections2.transform(exited, region -> new WrappedRegion(from.getWorld(), region))
);
return handler.onCrossBoundary(
player,
from,
to,
implementation.wrapRegionSet(Objects.requireNonNull(to.getWorld()), toSet),
mappedEntered,
mappedExited,
moveType.name()
);
}
@Override
public void tick(Player player, ApplicableRegionSet set) {
handler.tick(player, implementation.wrapRegionSet(player.getWorld(), set));
}
@Nullable
@Override
public StateFlag.State getInvincibility(Player player) {
WrappedState state = handler.getInvincibility(player);
if (state == null) {
return null;
}
return state == WrappedState.ALLOW ? StateFlag.State.ALLOW : StateFlag.State.DENY;
}
}

View File

@ -46,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion {
} else if (handle instanceof ProtectedPolygonalRegion) { } else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return handle.getPoints().stream() return handle.getPoints().stream()
.distinct()
.map(vector -> new BlockVector(vector.toVector())) .map(vector -> new BlockVector(vector.toVector()))
.map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector)) .map(vector -> WorldGuardVectorUtilities.fromBlockVector(world, vector))
.collect(Collectors.toSet()); .collect(Collectors.toList());
} }
@Override @Override
@ -107,6 +108,11 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getPriority(); return handle.getPriority();
} }
@Override
public void setPriority(int priority) {
handle.setPriority(priority);
}
@Override @Override
public IWrappedDomain getOwners() { public IWrappedDomain getOwners() {
return new IWrappedDomain() { return new IWrappedDomain() {

View File

@ -4,7 +4,7 @@ import com.google.common.collect.Maps;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.StateFlag;
import lombok.experimental.UtilityClass;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,8 +14,6 @@ import org.codemc.worldguardwrapper.implementation.v6.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.v6.flag.WrappedPrimitiveFlag; import org.codemc.worldguardwrapper.implementation.v6.flag.WrappedPrimitiveFlag;
import org.codemc.worldguardwrapper.implementation.v6.flag.WrappedStatusFlag; import org.codemc.worldguardwrapper.implementation.v6.flag.WrappedStatusFlag;
import lombok.experimental.UtilityClass;
import java.util.Map; import java.util.Map;
@UtilityClass @UtilityClass
@ -41,6 +39,8 @@ public class WorldGuardFlagUtilities {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Vector.class)) { } else if (type.equals(Vector.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Object.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag);
} else { } else {
throw new IllegalArgumentException("Unsupported flag type " + type.getName()); throw new IllegalArgumentException("Unsupported flag type " + type.getName());
} }
@ -65,6 +65,7 @@ public class WorldGuardFlagUtilities {
public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) { public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) {
IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass()); IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass());
//noinspection OptionalGetWithoutIsPresent
Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value).get(); // value is non-null Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value).get(); // value is non-null
return Maps.immutableEntry(wrappedFlag, wrappedValue); return Maps.immutableEntry(wrappedFlag, wrappedValue);
} }
@ -89,4 +90,4 @@ public class WorldGuardFlagUtilities {
location.getX(), location.getY(), location.getZ()); location.getX(), location.getY(), location.getZ());
} }
} }

View File

@ -21,7 +21,8 @@ public class WorldGuardVectorUtilities {
} }
public List<BlockVector2D> toBlockVector2DList(List<Location> locations) { public List<BlockVector2D> toBlockVector2DList(List<Location> locations) {
return locations.stream().map(location -> new BlockVector2D(location.getX(), location.getZ())).collect(Collectors.toList()); return locations.stream()
.map(location -> new BlockVector2D(location.getX(), location.getZ())).collect(Collectors.toList());
} }
} }

View File

@ -0,0 +1,12 @@
group ' org.codemc.worldguardwrapper.implementation.v7'
dependencies {
api project(':api')
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.1-SNAPSHOT'
compileOnly 'org.javassist:javassist:3.29.2-GA'
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}

View File

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-implementation</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper-implementation-v7</artifactId>
<name>WorldGuardWrapper-Implementation-V7</name>
<repositories>
<repository>
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.3-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q</groupId>
<artifactId>commandbook</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q</groupId>
<artifactId>dummypermscompat</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q.intake</groupId>
<artifactId>intake</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q</groupId>
<artifactId>squirrelid</artifactId>
</exclusion>
<exclusion>
<groupId>org.khelekore</groupId>
<artifactId>prtree</artifactId>
</exclusion>
<exclusion>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
</exclusion>
<exclusion>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</exclusion>
<exclusion>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
</exclusion>
<exclusion>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.bstats.bStats-Metrics</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
<exclusion>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
</exclusion>
<exclusion>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
</exclusion>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
<exclusion>
<groupId>de.schlichtherle</groupId>
<artifactId>truezip</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q</groupId>
<artifactId>jchronic</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<groupId>com.thoughtworks.paranamer</groupId>
<artifactId>paranamer</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
<exclusion>
<groupId>com.sk89q.lib</groupId>
<artifactId>jlibnoise</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

View File

@ -1,10 +1,10 @@
package org.codemc.worldguardwrapper.implementation.v7; package org.codemc.worldguardwrapper.implementation.v7;
import com.sk89q.minecraft.util.commands.CommandException; import com.google.common.collect.Iterators;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion; import com.sk89q.worldedit.regions.Polygonal2DRegion;
@ -20,46 +20,53 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.session.Session;
import com.sk89q.worldguard.session.handler.Handler;
import javassist.util.proxy.ProxyFactory;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
import org.codemc.worldguardwrapper.flag.WrappedState; import org.codemc.worldguardwrapper.flag.WrappedState;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation; import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation;
import org.codemc.worldguardwrapper.implementation.v7.flag.AbstractWrappedFlag; import org.codemc.worldguardwrapper.implementation.v7.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.v7.handler.ProxyHandler;
import org.codemc.worldguardwrapper.implementation.v7.region.WrappedRegion; import org.codemc.worldguardwrapper.implementation.v7.region.WrappedRegion;
import org.codemc.worldguardwrapper.implementation.v7.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.v7.utility.WorldGuardFlagUtilities;
import org.codemc.worldguardwrapper.region.IWrappedRegion; import org.codemc.worldguardwrapper.region.IWrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegionSet;
import org.codemc.worldguardwrapper.selection.ICuboidSelection; import org.codemc.worldguardwrapper.selection.ICuboidSelection;
import org.codemc.worldguardwrapper.selection.IPolygonalSelection; import org.codemc.worldguardwrapper.selection.IPolygonalSelection;
import org.codemc.worldguardwrapper.selection.ISelection; import org.codemc.worldguardwrapper.selection.ISelection;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.*; import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class WorldGuardImplementation implements IWorldGuardImplementation { public class WorldGuardImplementation implements IWorldGuardImplementation {
private final WorldGuard core; private final WorldGuard core;
private final FlagRegistry flagRegistry; private final FlagRegistry flagRegistry;
private final WorldGuardPlugin worldGuardPlugin;
private final WorldEditPlugin worldEditPlugin;
public WorldGuardImplementation() { public WorldGuardImplementation() {
core = WorldGuard.getInstance(); core = WorldGuard.getInstance();
flagRegistry = core.getFlagRegistry(); flagRegistry = core.getFlagRegistry();
worldGuardPlugin = WorldGuardPlugin.inst();
try {
worldEditPlugin = worldGuardPlugin.getWorldEdit();
} catch (CommandException e) {
throw new RuntimeException(e);
}
} }
private Optional<LocalPlayer> wrapPlayer(Player player) { private Optional<LocalPlayer> wrapPlayer(OfflinePlayer player) {
return Optional.ofNullable(player).map(bukkitPlayer -> worldGuardPlugin.wrapPlayer(player)); return Optional.ofNullable(player).map(bukkitPlayer -> {
if (bukkitPlayer.isOnline()) {
return WorldGuardPlugin.inst().wrapPlayer((Player) bukkitPlayer);
}
return WorldGuardPlugin.inst().wrapOfflinePlayer(bukkitPlayer);
});
} }
private Optional<RegionManager> getWorldManager(@NonNull World world) { private Optional<RegionManager> getWorldManager(@NonNull World world) {
@ -67,17 +74,81 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location location) {
return getWorldManager(location.getWorld()).map(manager -> manager.getApplicableRegions(BukkitAdapter.asBlockVector(location))); return getWorldManager(Objects.requireNonNull(location.getWorld()))
.map(manager -> manager.getApplicableRegions(BukkitAdapter.asBlockVector(location)));
} }
private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) { private Optional<ApplicableRegionSet> getApplicableRegions(@NonNull Location minimum, @NonNull Location maximum) {
return getWorldManager(minimum.getWorld()).map(manager -> manager.getApplicableRegions( return getWorldManager(Objects.requireNonNull(minimum.getWorld()))
new ProtectedCuboidRegion("temp", BukkitAdapter.asBlockVector(minimum), BukkitAdapter.asBlockVector(maximum)))); .map(manager -> manager.getApplicableRegions(
new ProtectedCuboidRegion(
"temp",
BukkitAdapter.asBlockVector(minimum),
BukkitAdapter.asBlockVector(maximum)
)
));
} }
private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) { private <V> Optional<V> queryValue(Player player, @NonNull Location location, @NonNull Flag<V> flag) {
return getApplicableRegions(location).map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player) return getApplicableRegions(location)
.orElse(null), flag)); .map(applicableRegions -> applicableRegions.queryValue(wrapPlayer(player).orElse(null), flag));
}
public IWrappedRegionSet wrapRegionSet(@NonNull World world, @NonNull ApplicableRegionSet regionSet) {
return new IWrappedRegionSet() {
@Override
public Iterator<IWrappedRegion> iterator() {
return Iterators.transform(regionSet.iterator(), region -> new WrappedRegion(world, region));
}
@Override
public boolean isVirtual() {
return regionSet.isVirtual();
}
@Override
public <V> Optional<V> queryValue(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return Optional.ofNullable(regionSet.queryValue(subjectHandle, wrappedFlag.getHandle()))
.flatMap(wrappedFlag::fromWGValue);
}
@Override
public <V> Collection<V> queryAllValues(OfflinePlayer subject, IWrappedFlag<V> flag) {
LocalPlayer subjectHandle = wrapPlayer(subject).orElse(null);
AbstractWrappedFlag<V> wrappedFlag = (AbstractWrappedFlag<V>) flag;
return regionSet.queryAllValues(subjectHandle, wrappedFlag.getHandle()).stream()
.map(wrappedFlag::fromWGValue)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
}
@Override
public boolean isOwnerOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isOwnerOfAll(playerHandle);
}
@Override
public boolean isMemberOfAll(OfflinePlayer player) {
LocalPlayer playerHandle = wrapPlayer(player).orElse(null);
return regionSet.isMemberOfAll(playerHandle);
}
@Override
public int size() {
return regionSet.size();
}
@Override
public Set<IWrappedRegion> getRegions() {
return regionSet.getRegions().stream()
.map(region -> new WrappedRegion(world, region)).collect(Collectors.toSet());
}
};
} }
@Override @Override
@ -90,6 +161,39 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return 7; return 7;
} }
@Override
public void registerHandler(Supplier<IHandler> factory) {
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.setUseCache(false);
proxyFactory.setSuperclass(ProxyHandler.class);
Class<? extends ProxyHandler> handlerClass;
Constructor<? extends ProxyHandler> handlerConstructor;
try {
//noinspection unchecked
handlerClass = (Class<? extends ProxyHandler>) proxyFactory.createClass();
handlerConstructor = handlerClass.getDeclaredConstructor(
WorldGuardImplementation.class,
IHandler.class,
Session.class
);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
core.getPlatform().getSessionManager().registerHandler(new Handler.Factory<Handler>() {
@Override
public Handler create(Session session) {
IHandler handler = factory.get();
try {
return handlerConstructor.newInstance(WorldGuardImplementation.this, handler, session);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}, null);
}
@Override @Override
public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) { public <T> Optional<IWrappedFlag<T>> getFlag(String name, Class<T> type) {
return Optional.ofNullable(flagRegistry.get(name)) return Optional.ofNullable(flagRegistry.get(name))
@ -97,9 +201,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public <T> Optional<T> queryFlag(Player player, Location location, IWrappedFlag<T> flag) { public <T> Optional<T> queryFlag(Player player, @NonNull Location location, @NonNull IWrappedFlag<T> flag) {
AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag; AbstractWrappedFlag<T> wrappedFlag = (AbstractWrappedFlag<T>) flag;
return queryValue(player, location, wrappedFlag.getHandle()).flatMap(value -> wrappedFlag.fromWGValue(value)); return queryValue(player, location, wrappedFlag.getHandle()).flatMap(wrappedFlag::fromWGValue);
} }
@Override @Override
@ -125,7 +229,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value); Map.Entry<IWrappedFlag<?>, Object> wrapped = WorldGuardFlagUtilities.wrap(flag, value);
flags.put(wrapped.getKey(), wrapped.getValue()); flags.put(wrapped.getKey(), wrapped.getValue());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
continue; // Unsupported flag type // Unsupported flag type
} }
} }
} }
@ -134,9 +238,9 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
return flags; return flags;
} }
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
@Override @Override
public <T> Optional<IWrappedFlag<T>> registerFlag(String name, Class<T> type, T defaultValue) { public <T> Optional<IWrappedFlag<T>> registerFlag(@NonNull String name, @NonNull Class<T> type, T defaultValue) {
final Flag<?> flag; final Flag<?> flag;
if (type.equals(WrappedState.class)) { if (type.equals(WrappedState.class)) {
flag = new StateFlag(name, defaultValue == WrappedState.ALLOW); flag = new StateFlag(name, defaultValue == WrappedState.ALLOW);
@ -166,14 +270,14 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<IWrappedRegion> getRegion(World world, String id) { public Optional<IWrappedRegion> getRegion(@NonNull World world, @NonNull String id) {
return getWorldManager(world) return getWorldManager(world)
.map(regionManager -> regionManager.getRegion(id)) .map(regionManager -> regionManager.getRegion(id))
.map(region -> new WrappedRegion(world, region)); .map(region -> new WrappedRegion(world, region));
} }
@Override @Override
public Map<String, IWrappedRegion> getRegions(World world) { public Map<String, IWrappedRegion> getRegions(@NonNull World world) {
RegionManager regionManager = core.getPlatform().getRegionContainer().get(new BukkitWorld(world)); RegionManager regionManager = core.getPlatform().getRegionContainer().get(new BukkitWorld(world));
if (regionManager == null) { if (regionManager == null) {
return Collections.emptyMap(); return Collections.emptyMap();
@ -186,7 +290,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location location) { public Set<IWrappedRegion> getRegions(@NonNull Location location) {
ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(location).orElse(null);
if (regionSet == null) { if (regionSet == null) {
return Collections.emptySet(); return Collections.emptySet();
@ -198,7 +302,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Set<IWrappedRegion> getRegions(Location minimum, Location maximum) { public Set<IWrappedRegion> getRegions(@NonNull Location minimum, @NonNull Location maximum) {
ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null); ApplicableRegionSet regionSet = getApplicableRegions(minimum, maximum).orElse(null);
if (regionSet == null) { if (regionSet == null) {
return Collections.emptySet(); return Collections.emptySet();
@ -210,9 +314,14 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<IWrappedRegion> addRegion(String id, List<Location> points, int minY, int maxY) { public Optional<IWrappedRegionSet> getRegionSet(@NonNull Location location) {
return Optional.empty();
}
@Override
public Optional<IWrappedRegion> addRegion(@NonNull String id, @NonNull List<Location> points, int minY, int maxY) {
ProtectedRegion region; ProtectedRegion region;
World world = points.get(0).getWorld(); World world = Objects.requireNonNull(points.get(0).getWorld());
if (points.size() == 2) { if (points.size() == 2) {
region = new ProtectedCuboidRegion(id, BukkitAdapter.asBlockVector(points.get(0)), region = new ProtectedCuboidRegion(id, BukkitAdapter.asBlockVector(points.get(0)),
BukkitAdapter.asBlockVector(points.get(1))); BukkitAdapter.asBlockVector(points.get(1)));
@ -234,7 +343,7 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
@Override @Override
public Optional<Set<IWrappedRegion>> removeRegion(World world, String id) { public Optional<Set<IWrappedRegion>> removeRegion(@NonNull World world, @NonNull String id) {
Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id)); Optional<Set<ProtectedRegion>> set = getWorldManager(world).map(manager -> manager.removeRegion(id));
return set.map(protectedRegions -> protectedRegions.stream() return set.map(protectedRegions -> protectedRegions.stream()
.map(region -> new WrappedRegion(world, region)).collect(Collectors.toSet())); .map(region -> new WrappedRegion(world, region)).collect(Collectors.toSet()));
@ -244,13 +353,18 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
public Optional<ISelection> getPlayerSelection(@NonNull Player player) { public Optional<ISelection> getPlayerSelection(@NonNull Player player) {
Region region; Region region;
try { try {
region = worldEditPlugin.getSession(player).getSelection(BukkitAdapter.adapt(player.getWorld())); region = WorldEdit.getInstance()
.getSessionManager()
.get(BukkitAdapter.adapt(player))
.getSelection(BukkitAdapter.adapt(player.getWorld()));
} catch (IncompleteRegionException e) { } catch (IncompleteRegionException e) {
region = null; region = null;
} }
return Optional.ofNullable(region) return Optional.ofNullable(region)
.map(selection -> { .map(selection -> {
World world = Optional.ofNullable(selection.getWorld()).map(BukkitAdapter::adapt).orElse(null); World world = Optional.ofNullable(selection.getWorld())
.map(BukkitAdapter::adapt)
.orElse(null);
if (world == null) { if (world == null) {
return null; return null;
} }
@ -269,11 +383,12 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} else if (selection instanceof Polygonal2DRegion) { } else if (selection instanceof Polygonal2DRegion) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return ((Polygonal2DRegion) selection).getPoints().stream() return ((Polygonal2DRegion) selection).getPoints().stream()
.distinct()
.map(BlockVector2::toBlockVector3) .map(BlockVector2::toBlockVector3)
.map(vector -> BukkitAdapter.adapt(world, vector)) .map(vector -> BukkitAdapter.adapt(world, vector))
.collect(Collectors.toSet()); .collect(Collectors.toList());
} }
@Override @Override
@ -287,7 +402,8 @@ public class WorldGuardImplementation implements IWorldGuardImplementation {
} }
}; };
} else { } else {
throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName() + " selection!"); throw new UnsupportedOperationException("Unsupported " + selection.getClass().getSimpleName()
+ " selection!");
} }
}); });
} }

View File

@ -3,7 +3,6 @@ package org.codemc.worldguardwrapper.implementation.v7.flag;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.implementation.v7.utility.WorldGuardFlagUtilities; import org.codemc.worldguardwrapper.implementation.v7.utility.WorldGuardFlagUtilities;

View File

@ -0,0 +1,113 @@
package org.codemc.worldguardwrapper.implementation.v7.handler;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableSet;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.session.MoveType;
import com.sk89q.worldguard.session.Session;
import com.sk89q.worldguard.session.handler.Handler;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.codemc.worldguardwrapper.flag.WrappedState;
import org.codemc.worldguardwrapper.handler.IHandler;
import org.codemc.worldguardwrapper.implementation.v7.WorldGuardImplementation;
import org.codemc.worldguardwrapper.implementation.v7.region.WrappedRegion;
import org.codemc.worldguardwrapper.region.IWrappedRegion;
import javax.annotation.Nullable;
import java.util.Objects;
import java.util.Set;
public class ProxyHandler extends Handler {
private final WorldGuardImplementation implementation;
private final IHandler handler;
public ProxyHandler(WorldGuardImplementation implementation, IHandler handler, Session session) {
super(session);
this.implementation = implementation;
this.handler = handler;
}
@Override
public void initialize(LocalPlayer player, com.sk89q.worldedit.util.Location current, ApplicableRegionSet set) {
Player bukkitPlayer = BukkitAdapter.adapt(player);
Location bukkitLocation = BukkitAdapter.adapt(current);
handler.initialize(
bukkitPlayer,
bukkitLocation,
implementation.wrapRegionSet(Objects.requireNonNull(bukkitLocation.getWorld()),set)
);
}
@Override
public boolean testMoveTo(
LocalPlayer player,
com.sk89q.worldedit.util.Location from,
com.sk89q.worldedit.util.Location to,
ApplicableRegionSet toSet,
MoveType moveType
) {
Player bukkitPlayer = BukkitAdapter.adapt(player);
Location bukkitFrom = BukkitAdapter.adapt(from);
Location bukkitTo = BukkitAdapter.adapt(to);
return handler.testMoveTo(
bukkitPlayer,
bukkitFrom,
bukkitTo,
implementation.wrapRegionSet(Objects.requireNonNull(bukkitTo.getWorld()), toSet),
moveType.name()
);
}
@Override
public boolean onCrossBoundary(
LocalPlayer player,
com.sk89q.worldedit.util.Location from,
com.sk89q.worldedit.util.Location to,
ApplicableRegionSet toSet,
Set<ProtectedRegion> entered,
Set<ProtectedRegion> exited,
MoveType moveType
) {
Player bukkitPlayer = BukkitAdapter.adapt(player);
Location bukkitFrom = BukkitAdapter.adapt(from);
Location bukkitTo = BukkitAdapter.adapt(to);
Set<IWrappedRegion> mappedEntered = ImmutableSet.copyOf(Collections2.transform(entered, region ->
new WrappedRegion(bukkitTo.getWorld(), region)
));
Set<IWrappedRegion> mappedExited = ImmutableSet.copyOf(Collections2.transform(exited, region ->
new WrappedRegion(bukkitFrom.getWorld(), region)
));
return handler.onCrossBoundary(
bukkitPlayer,
bukkitFrom,
bukkitTo,
implementation.wrapRegionSet(Objects.requireNonNull(bukkitTo.getWorld()), toSet),
mappedEntered,
mappedExited,
moveType.name()
);
}
@Override
public void tick(LocalPlayer player, ApplicableRegionSet set) {
Player bukkitPlayer = BukkitAdapter.adapt(player);
handler.tick(bukkitPlayer, implementation.wrapRegionSet(bukkitPlayer.getWorld(), set));
}
@Nullable
@Override
public StateFlag.State getInvincibility(LocalPlayer player) {
Player bukkitPlayer = BukkitAdapter.adapt(player);
WrappedState state = handler.getInvincibility(bukkitPlayer);
if (state == null) {
return null;
}
return state == WrappedState.ALLOW ? StateFlag.State.ALLOW : StateFlag.State.DENY;
}
}

View File

@ -46,11 +46,12 @@ public class WrappedRegion implements IWrappedRegion {
} else if (handle instanceof ProtectedPolygonalRegion) { } else if (handle instanceof ProtectedPolygonalRegion) {
return new IPolygonalSelection() { return new IPolygonalSelection() {
@Override @Override
public Set<Location> getPoints() { public List<Location> getPoints() {
return handle.getPoints().stream() return handle.getPoints().stream()
.distinct()
.map(BlockVector2::toBlockVector3) .map(BlockVector2::toBlockVector3)
.map(vector -> BukkitAdapter.adapt(world, vector)) .map(vector -> BukkitAdapter.adapt(world, vector))
.collect(Collectors.toSet()); .collect(Collectors.toList());
} }
@Override @Override
@ -107,6 +108,11 @@ public class WrappedRegion implements IWrappedRegion {
return handle.getPriority(); return handle.getPriority();
} }
@Override
public void setPriority(int priority) {
handle.setPriority(priority);
}
@Override @Override
public IWrappedDomain getOwners() { public IWrappedDomain getOwners() {
return new IWrappedDomain() { return new IWrappedDomain() {

View File

@ -4,7 +4,7 @@ import com.google.common.collect.Maps;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.StateFlag;
import lombok.experimental.UtilityClass;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.codemc.worldguardwrapper.flag.IWrappedFlag; import org.codemc.worldguardwrapper.flag.IWrappedFlag;
@ -13,10 +13,7 @@ import org.codemc.worldguardwrapper.implementation.v7.flag.AbstractWrappedFlag;
import org.codemc.worldguardwrapper.implementation.v7.flag.WrappedPrimitiveFlag; import org.codemc.worldguardwrapper.implementation.v7.flag.WrappedPrimitiveFlag;
import org.codemc.worldguardwrapper.implementation.v7.flag.WrappedStatusFlag; import org.codemc.worldguardwrapper.implementation.v7.flag.WrappedStatusFlag;
import lombok.experimental.UtilityClass;
import java.util.Map; import java.util.Map;
import java.util.Optional;
@UtilityClass @UtilityClass
public class WorldGuardFlagUtilities { public class WorldGuardFlagUtilities {
@ -41,6 +38,8 @@ public class WorldGuardFlagUtilities {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Vector.class)) { } else if (type.equals(Vector.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag); wrappedFlag = new WrappedPrimitiveFlag(flag);
} else if (type.equals(Object.class)) {
wrappedFlag = new WrappedPrimitiveFlag(flag);
} else { } else {
throw new IllegalArgumentException("Unsupported flag type " + type.getName()); throw new IllegalArgumentException("Unsupported flag type " + type.getName());
} }
@ -65,6 +64,7 @@ public class WorldGuardFlagUtilities {
public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) { public Map.Entry<IWrappedFlag<?>, Object> wrap(Flag<?> flag, Object value) {
IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass()); IWrappedFlag<?> wrappedFlag = wrapFixType(flag, value.getClass());
//noinspection OptionalGetWithoutIsPresent
Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value).get(); // value is non-null Object wrappedValue = ((AbstractWrappedFlag<?>) wrappedFlag).fromWGValue(value).get(); // value is non-null
return Maps.immutableEntry(wrappedFlag, wrappedValue); return Maps.immutableEntry(wrappedFlag, wrappedValue);
} }

65
library/build.gradle Normal file
View File

@ -0,0 +1,65 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow'
id 'maven-publish'
id 'signing'
}
group 'org.codemc.worldguardwrapper'
version parent.version
assemble.dependsOn shadowJar
repositories {
mavenCentral()
maven { url "https://maven.enginehub.org/repo/" }
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
dependencies {
api project(':api')
api project(':implementation')
compileOnly 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
implementation 'org.javassist:javassist:3.29.2-GA'
compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}
shadowJar {
dependencies {
exclude(dependency('org.projectlombok:lombok'))
exclude(dependency('org.jetbrains:annotations'))
}
relocate 'javassist', 'org.codemc.worldguardwrapper.libs.javassist'
archiveFileName = "WorldGuardWrapper-${project.version}.jar"
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'org.codemc.worldguardwrapper'
artifactId = 'worldguardwrapper'
artifact("build/libs/WorldGuardWrapper-${project.version}.jar") {
extension 'jar'
}
}
}
repositories {
maven {
name 'secure'
url = "https://repo.recorehosting.com/repository/maven-snapshots"
credentials(org.gradle.api.credentials.PasswordCredentials)
}
}
}

View File

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.9-SNAPSHOT</version>
</parent>
<artifactId>worldguardwrapper</artifactId>
<name>WorldGuardWrapper-Library</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-api</artifactId>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-legacy</artifactId>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-v6</artifactId>
<version>1.1.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>worldguardwrapper-implementation-v7</artifactId>
<version>1.1.9-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -6,6 +6,8 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation; import org.codemc.worldguardwrapper.implementation.IWorldGuardImplementation;
@SuppressWarnings("unused")
public class WorldGuardWrapper implements IWorldGuardImplementation { public class WorldGuardWrapper implements IWorldGuardImplementation {
private static WorldGuardWrapper instance; private static WorldGuardWrapper instance;
@ -23,8 +25,8 @@ public class WorldGuardWrapper implements IWorldGuardImplementation {
} }
@Delegate @Delegate
private IWorldGuardImplementation implementation; private final IWorldGuardImplementation implementation;
private Listener listener; private final Listener listener;
private WorldGuardWrapper() { private WorldGuardWrapper() {
int targetVersion; int targetVersion;
@ -46,15 +48,6 @@ public class WorldGuardWrapper implements IWorldGuardImplementation {
implementation = new org.codemc.worldguardwrapper.implementation.legacy.WorldGuardImplementation(); implementation = new org.codemc.worldguardwrapper.implementation.legacy.WorldGuardImplementation();
listener = new org.codemc.worldguardwrapper.implementation.legacy.event.EventListener(); listener = new org.codemc.worldguardwrapper.implementation.legacy.event.EventListener();
} else { } else {
/*
if (Bukkit.getPluginManager().isPluginEnabled("FastAsyncWorldEdit")) {
implementation = new org.codemc.worldguardwrapper.implementation.v7fawe.WorldGuardImplementation();
listener = new org.codemc.worldguardwrapper.implementation.v7fawe.event.EventListener();
} else {
implementation = new org.codemc.worldguardwrapper.implementation.v7.WorldGuardImplementation();
listener = new org.codemc.worldguardwrapper.implementation.v7.event.EventListener();
}
*/
implementation = new org.codemc.worldguardwrapper.implementation.v7.WorldGuardImplementation(); implementation = new org.codemc.worldguardwrapper.implementation.v7.WorldGuardImplementation();
listener = new org.codemc.worldguardwrapper.implementation.v7.event.EventListener(); listener = new org.codemc.worldguardwrapper.implementation.v7.event.EventListener();
} }

166
pom.xml
View File

@ -1,166 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper-parent</artifactId>
<version>1.1.9-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>api</module>
<module>library</module>
<module>implementation</module>
</modules>
<name>WorldGuardWrapper-Parent</name>
<description>A wrapper for the WorldGuard API that allows plugins to support both v6 and v7 APIs.</description>
<url>https://github.com/CodeMC/WorldGuardWrapper</url>
<inceptionYear>2018</inceptionYear>
<scm>
<connection>scm:git:https://github.com/CodeMC/WorldGuardWrapper.git</connection>
<developerConnection>scm:git:git@github.com:CodeMC/WorldGuardWrapper.git</developerConnection>
<url>https://github.com/CodeMC/WorldGuardWrapper</url>
</scm>
<ciManagement>
<system>jenkins</system>
<url>http://ci.codemc.org/job/CodeMC/job/HolographicDisplays/</url>
</ciManagement>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/CodeMC/WorldGuardWrapper/issues</url>
</issueManagement>
<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.org/repository/maven-releases/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spigot-api.version>1.15.2-R0.1-SNAPSHOT</spigot-api.version>
</properties>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot-api.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
<exclusion>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package</defaultGoal>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>public</show>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
</project>

8
settings.gradle Normal file
View File

@ -0,0 +1,8 @@
rootProject.name = 'WorldGuardWrapper'
include 'library'
include 'api'
include 'implementation'
include 'implementation:v6'
include 'implementation:v7'
include 'implementation:legacy'