Compare commits
57
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b46b0adae | ||
|
|
0f15609401 | ||
|
|
ffa738afcc | ||
|
|
2cecee8f21 | ||
|
|
5e7f246de9 | ||
|
|
e97718ec5a | ||
|
|
4867eda532 | ||
|
|
4fa1aeaccc | ||
|
|
1b44edeec5 | ||
|
|
d21dc02dff | ||
|
|
ad6bb7b13b | ||
|
|
8269d80831 | ||
|
|
57b9987e9b | ||
|
|
f8ce0f415f | ||
|
|
3ef3169942 | ||
|
|
5cf64a672d | ||
|
|
c49b2d9dc2 | ||
|
|
8801e8e855 | ||
|
|
bc4775c293 | ||
|
|
74e39c2666 | ||
|
|
f73e798e65 | ||
|
|
f101ea4768 | ||
|
|
f5d547ab27 | ||
|
|
7fcb964f41 | ||
|
|
d4f1a74dee | ||
|
|
3e192a70da | ||
|
|
103f1e56c7 | ||
|
|
103b4055f3 | ||
|
|
c91442cd1e | ||
|
|
e368ead04a | ||
|
|
d68ec28f8e | ||
|
|
2f4ad00f1c | ||
|
|
524e407620 | ||
|
|
992166de66 | ||
|
|
0b74355467 | ||
|
|
105a8cad51 | ||
|
|
0f693329ca | ||
|
|
263d129325 | ||
|
|
442096e9da | ||
|
|
36084dbfa3 | ||
|
|
8a05dbbf00 | ||
|
|
8a3529377f | ||
|
|
5f519c477a | ||
|
|
7eb748bb9a | ||
|
|
18507016a8 | ||
|
|
ed243f72ec | ||
|
|
5021b8ad7b | ||
|
|
f98868c776 | ||
|
|
2850e59d37 | ||
|
|
86d4fac938 | ||
|
|
0258a75c81 | ||
|
|
61dcb3d440 | ||
|
|
bf1033af76 | ||
|
|
807d39afeb | ||
|
|
bc046d4b2a | ||
|
|
545dd1652f | ||
|
|
e9ec283ace |
No files matched your search
@@ -15,23 +15,23 @@ jobs:
|
||||
fail-fast: true
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
java-version: [ 8, 11, 16, 17 ]
|
||||
java-version: [ 16, 17 ]
|
||||
runs-on: ubuntu-latest
|
||||
name: Java ${{ matrix.java-version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: "Set up JDK ${{ matrix.java-version }}"
|
||||
uses: actions/setup-java@v2
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: "${{ matrix.java-version }}"
|
||||
distribution: 'adopt'
|
||||
cache: 'maven'
|
||||
- name: Build with Maven
|
||||
run: mvn -B -U package --file pom.xml
|
||||
run: ./mvnw -B -U package --file pom.xml
|
||||
- name: Upload Build Artifact
|
||||
if: "${{ matrix.java-version == 8 }}"
|
||||
uses: actions/upload-artifact@v2
|
||||
if: "${{ matrix.java-version == 16 }}"
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: SimpleClans
|
||||
path: target/SimpleClans.jar
|
||||
@@ -7,15 +7,15 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: itsmeow/curseforge-upload@v3
|
||||
with:
|
||||
|
||||
@@ -7,15 +7,15 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: RubixDev/modrinth-upload@v1.0.0
|
||||
with:
|
||||
|
||||
@@ -10,20 +10,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: 16
|
||||
server-id: reposilite # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
server-username: MAVEN_USERNAME
|
||||
server-password: MAVEN_PASSWORD
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Publish to Reposilite
|
||||
run: mvn -B deploy
|
||||
run: ./mvnw -B deploy
|
||||
env:
|
||||
MAVEN_USERNAME: simpleclans
|
||||
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_TOKEN }}
|
||||
+2
-1
@@ -3,7 +3,8 @@
|
||||
/bin/
|
||||
/.classpath
|
||||
/.project
|
||||
/dependency-reduced-pom.xml
|
||||
*.jar
|
||||
.settings
|
||||
.factorypath
|
||||
SimpleClans.iml
|
||||
dependency-reduced-pom.xml
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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
|
||||
#
|
||||
# http://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.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
@@ -1,5 +1,61 @@
|
||||
# Changelog
|
||||
|
||||
## [2.19.0](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.1...v2.19.0) (2023-07-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add %simpleclans_has_rank% placeholder ([#379](https://github.com/RoinujNosde/SimpleClans/issues/379)) ([f8ce0f4](https://github.com/RoinujNosde/SimpleClans/commit/f8ce0f415f17748f8b4382e028dd1f5f93cae06a))
|
||||
* add a command to set player's locale ([#378](https://github.com/RoinujNosde/SimpleClans/issues/378)) ([5cf64a6](https://github.com/RoinujNosde/SimpleClans/commit/5cf64a672d0a25a62d3abd6720082bb3b4cf056f))
|
||||
* add confirmation before reset kdr ([#371](https://github.com/RoinujNosde/SimpleClans/issues/371)) ([d4f1a74](https://github.com/RoinujNosde/SimpleClans/commit/d4f1a74dee9cdeeb458ff6975715a817bfe30fa1))
|
||||
* add PlayerResetKdrEvent ([#370](https://github.com/RoinujNosde/SimpleClans/issues/370)) ([d68ec28](https://github.com/RoinujNosde/SimpleClans/commit/d68ec28f8e14926cbe9d13c09a61735e5304a97d))
|
||||
* add subcommand /clan mod bb display ([#367](https://github.com/RoinujNosde/SimpleClans/issues/367)) ([105a8ca](https://github.com/RoinujNosde/SimpleClans/commit/105a8cad51b12bf6f487cf6c2b81eb85d966a3cc))
|
||||
* adds the possibility to rename a clan ([#360](https://github.com/RoinujNosde/SimpleClans/issues/360)) ([0f69332](https://github.com/RoinujNosde/SimpleClans/commit/0f693329cae81036bfe1423344ed41cf3d535f64))
|
||||
* bb message language key ([#358](https://github.com/RoinujNosde/SimpleClans/issues/358)) ([263d129](https://github.com/RoinujNosde/SimpleClans/commit/263d129325888fb1303dda549986ab43ca93ed13))
|
||||
* **chat:** adds permissions to use colors and formats ([#341](https://github.com/RoinujNosde/SimpleClans/issues/341)) ([2a139ab](https://github.com/RoinujNosde/SimpleClans/commit/2a139aba03be174086dfb3603007312d0c7a6c33))
|
||||
* EconomyTransactionEvent creation ([#384](https://github.com/RoinujNosde/SimpleClans/issues/384)) ([d21dc02](https://github.com/RoinujNosde/SimpleClans/commit/d21dc02dff45f4f20a40303cd26215a71de7dddb))
|
||||
* hide reset kdr in main frame if perm denied ([#385](https://github.com/RoinujNosde/SimpleClans/issues/385)) ([ad6bb7b](https://github.com/RoinujNosde/SimpleClans/commit/ad6bb7b13b347be71789fbfb4b8a82f6c5481c96))
|
||||
* validating tag by regex ([#363](https://github.com/RoinujNosde/SimpleClans/issues/363)) ([3ef3169](https://github.com/RoinujNosde/SimpleClans/commit/3ef3169942f897280af15040f1243d955df001ab))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* added clan suggestion in staff bb commands ([#359](https://github.com/RoinujNosde/SimpleClans/issues/359)) ([442096e](https://github.com/RoinujNosde/SimpleClans/commit/442096e9da98410682c2cd09e0e930454fe0364f))
|
||||
* async permission reset & category deletion ([#347](https://github.com/RoinujNosde/SimpleClans/issues/347)) ([7eb748b](https://github.com/RoinujNosde/SimpleClans/commit/7eb748bb9a31a826f53fd7ac6b1eeac64e330467))
|
||||
* bump JDK to 16 ([e368ead](https://github.com/RoinujNosde/SimpleClans/commit/e368ead04aa2735f5525d88d5dcb63b78286f80e))
|
||||
* **bungee:** removes players from clan on delete ([0258a75](https://github.com/RoinujNosde/SimpleClans/commit/0258a75c819f12e5dbbaf383a572682717f34c59))
|
||||
* **bungee:** updates kills count immediately ([ed243f7](https://github.com/RoinujNosde/SimpleClans/commit/ed243f72ecc58a3af11d053d73b315bce9e20e94))
|
||||
* default username-regex ([bf1033a](https://github.com/RoinujNosde/SimpleClans/commit/bf1033af769bacbca9a790d2184ec77eeb519485))
|
||||
* **discord:** permission overrides reset only existing members ([#349](https://github.com/RoinujNosde/SimpleClans/issues/349)) ([8a35293](https://github.com/RoinujNosde/SimpleClans/commit/8a3529377f5b4a482b530e474e4921b311197a04))
|
||||
* display hex message on bulletin board ([#365](https://github.com/RoinujNosde/SimpleClans/issues/365)) ([0b74355](https://github.com/RoinujNosde/SimpleClans/commit/0b74355467625a4901944c72feb84d8de91a4283))
|
||||
* invalid colors being used in tags ([2850e59](https://github.com/RoinujNosde/SimpleClans/commit/2850e59d370da34c643de198de85d91744610467))
|
||||
* invalid colors being used in tags, pt. 2 ([f98868c](https://github.com/RoinujNosde/SimpleClans/commit/f98868c776a2e275dc7c1647748a0231e935f43e))
|
||||
* migrates land permissions on GP claim resize ([2f4ad00](https://github.com/RoinujNosde/SimpleClans/commit/2f4ad00f1c72ee7e3948267965c3a075ec4ef728))
|
||||
* NPE on EntityDamageByEntityEvent listener (LandProtection) ([524e407](https://github.com/RoinujNosde/SimpleClans/commit/524e40762011dd500a407286b72b51acf6c357f3))
|
||||
* players not able to break vehicles/exit horses ([86d4fac](https://github.com/RoinujNosde/SimpleClans/commit/86d4fac938e353f94c288c39b884027027972bba))
|
||||
* players not able to sleep on beds (WorldGuard) ([e9ec283](https://github.com/RoinujNosde/SimpleClans/commit/e9ec283ace55af10abdeb6f937d31d4c2dc198dc))
|
||||
* players not able to strip logs/fertilize blocks ([5021b8a](https://github.com/RoinujNosde/SimpleClans/commit/5021b8ad7b5633769bd87af96a0226a53a8b24b4))
|
||||
* players not able to use water buckets (WorldGuard) ([807d39a](https://github.com/RoinujNosde/SimpleClans/commit/807d39afeb51d99a96fb793099393b44e2c43b04))
|
||||
* players unable to interact with armor stands, paintings, etc ([61dcb3d](https://github.com/RoinujNosde/SimpleClans/commit/61dcb3d440e2eedfb717afcc69687194311a8973))
|
||||
* possibly fixes CME on SpyChatHandler ([8a05dbb](https://github.com/RoinujNosde/SimpleClans/commit/8a05dbbf00df97afa7df71a500e2626aaa46ed37))
|
||||
* prevent clan name renaming with colors ([#374](https://github.com/RoinujNosde/SimpleClans/issues/374)) ([7fcb964](https://github.com/RoinujNosde/SimpleClans/commit/7fcb964f41118e7d8746e87d5770cc329730834c))
|
||||
* remove abandoned channels before validating ([#348](https://github.com/RoinujNosde/SimpleClans/issues/348)) ([5f519c4](https://github.com/RoinujNosde/SimpleClans/commit/5f519c477af3e759596017010d51ddd06e26157e))
|
||||
* resets error message when validating a clan tag ([#383](https://github.com/RoinujNosde/SimpleClans/issues/383)) ([8269d80](https://github.com/RoinujNosde/SimpleClans/commit/8269d80831533e517ed2ebd94bec18021de7b0e3))
|
||||
* sets duplicate names to something unique ([046aa1d](https://github.com/RoinujNosde/SimpleClans/commit/046aa1d96d58e21496a3361c7d072f3943595304))
|
||||
* tnt explosion doesn't count a kill ([#381](https://github.com/RoinujNosde/SimpleClans/issues/381)) ([57b9987](https://github.com/RoinujNosde/SimpleClans/commit/57b9987e9b9dade59c52c88dbfd3b12fdf5eee94))
|
||||
* view permission applies only to cached channels ([#346](https://github.com/RoinujNosde/SimpleClans/issues/346)) ([1850701](https://github.com/RoinujNosde/SimpleClans/commit/18507016a843c28efc6d8109f2bb5a5106531f47))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **discord:** remove discord channels from creation ([#353](https://github.com/RoinujNosde/SimpleClans/issues/353)) ([36084db](https://github.com/RoinujNosde/SimpleClans/commit/36084dbfa3e73aedccb156e49af5062e40639927))
|
||||
|
||||
|
||||
### Documentation
|
||||
|
||||
* author tag isn't available at methods ([f5d547a](https://github.com/RoinujNosde/SimpleClans/commit/f5d547ab27fac7cfe1abd9c819e4f1bb3dd7c624))
|
||||
* updated version in README ([#343](https://github.com/RoinujNosde/SimpleClans/issues/343)) ([718868b](https://github.com/RoinujNosde/SimpleClans/commit/718868b2d9eea2aeb6fcfd734e85d16a2cefaa36))
|
||||
|
||||
## [2.18.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.0...v2.18.1) (2022-11-29)
|
||||
|
||||
|
||||
|
||||
-145
@@ -1,145 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:2.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.bstats:bstats-base:2.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.10.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:22.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.papermc:paperlib:1.0.8-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: co.aikar:acf-paper:0.5.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.cryptomorin:XSeries:8.3.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-bukkit:7.0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard.worldguard-libs:core:7.0.4" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.2.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-default_2.13:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.13.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-http:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-spec:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-annotations:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:annotations:3.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-cio:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-io:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-services:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-logging:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-odf:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zipdriver:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zip:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bouncycastle:bcprov-jdk15on:1.63" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-tardriver:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-bzip2:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-gzip:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-xz:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.tukaani:xz:1.8" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip-raes:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-base_2.13:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access-swing:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-file:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-jar:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-ibm437:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-impl_2.13:0.12.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-console:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-default:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-swing:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-macosx:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-spec:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-shed:2.5.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.1.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mozilla:rhino-runtime:1.7.12" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.7.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TechFortress:GriefPrevention:16.17.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.discordsrv:discordsrv:1.24.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:4.3.0_349" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.13.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.14" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: github.scarsz:configuralize:1.3.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.alexheretic:dynamics:4.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.alexheretic:fluent:2.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-jdk14:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.8.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.vdurmont:emoji-java:5.1.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20170516" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.zafarkhaja:java-semver:0.9.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.kevinsawicki:http-request:6.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-hla:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-dnssec:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-client:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-core:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-iterative-resolver:1.0.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-expression:5.2.7.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-core:5.2.7.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: dev.vankka:MCDiscordReserializer:4.2.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: dev.vankka:SimpleAST:2.2.7" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-api:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-key:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-legacy:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-plain:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-bukkit:4.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-api:4.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-bungeecord:4.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-nbt:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson-legacy-impl:4.9.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-facet:4.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-viaversion:4.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-minimessage:4.1.0-20210316.192746" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-latest:4.351" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-core:4.351" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-api:4.351" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: io.github.bananapuncher714:nbteditor:7.16.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.eldoria:eldo-util:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.9.1" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,412 +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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<name>SimpleClans</name>
|
||||
<version>2.18.1-SNAPSHOT</version>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
<include>config.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.name}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.metrics</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>co.aikar.commands</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.acf</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>co.aikar.locales</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.locales</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.cryptomorin.xseries</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.xseries</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.gson</pattern>
|
||||
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.gson</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.jetbrains:annotations</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-installed</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>${project.packaging}</type>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${env.TEST_SERVER}\plugins</outputDirectory>
|
||||
<silent>true</silent>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>javadoc</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi-repo</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aikar</id>
|
||||
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Scarsz-Nexus</id>
|
||||
<url>https://nexus.scarsz.me/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>eldonexus</id>
|
||||
<url>https://eldonexus.de/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>org.bukkit</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>22.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.7.2</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>apiguardian-api</artifactId>
|
||||
<groupId>org.apiguardian</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>opentest4j</artifactId>
|
||||
<groupId>org.opentest4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>junit-platform-commons</artifactId>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.4</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>worldguard-core</artifactId>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commandbook</artifactId>
|
||||
<groupId>com.sk89q</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.17.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.discordsrv</groupId>
|
||||
<artifactId>discordsrv</artifactId>
|
||||
<version>1.24.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>JDA</artifactId>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>nv-websocket-client</artifactId>
|
||||
<groupId>com.neovisionaries</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>configuralize</artifactId>
|
||||
<groupId>github.scarsz</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<groupId>commons-io</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<groupId>commons-collections</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>emoji-java</artifactId>
|
||||
<groupId>com.vdurmont</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>java-semver</artifactId>
|
||||
<groupId>com.github.zafarkhaja</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>http-request</artifactId>
|
||||
<groupId>com.github.kevinsawicki</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>minidns-hla</artifactId>
|
||||
<groupId>org.minidns</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>MCDiscordReserializer</artifactId>
|
||||
<groupId>dev.vankka</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-text-serializer-legacy</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-text-serializer-plain</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<groupId>net.kyori</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>biz.princeps</groupId>
|
||||
<artifactId>landlord-latest</artifactId>
|
||||
<version>4.351</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>landlord-core</artifactId>
|
||||
<groupId>biz.princeps</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>reposilite</id>
|
||||
<url>https://repo.roinujnosde.me/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>reposilite</id>
|
||||
<url>https://repo.roinujnosde.me/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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
|
||||
#
|
||||
# http://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.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
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
|
||||
else
|
||||
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
@@ -0,0 +1,205 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
@@ -1,8 +1,9 @@
|
||||
<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">
|
||||
<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>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<version>2.18.2-SNAPSHOT</version>
|
||||
<version>2.19.1-SNAPSHOT</version>
|
||||
<name>SimpleClans</name>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
|
||||
@@ -29,10 +30,9 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<release>16</release>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
@@ -45,21 +45,21 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Release plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- Shade plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
@@ -92,6 +92,13 @@
|
||||
<exclude>org.jetbrains:annotations</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
|
||||
<transformers>
|
||||
<!-- Avoid overlapping MANIFEST.MF file -->
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
|
||||
<resource>MANIFEST.MF</resource>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
@@ -107,7 +114,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-installed</id>
|
||||
@@ -134,7 +141,7 @@
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>4.9.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -151,7 +158,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -161,9 +168,15 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<release>16</release>
|
||||
<doclint>all,-missing</doclint>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- Dependencies -->
|
||||
@@ -179,6 +192,13 @@
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<!-- No idea why, but it fails JUnit 5 tests -->
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
@@ -213,12 +233,6 @@
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>8.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.7.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
@@ -228,7 +242,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.17.1</version>
|
||||
<version>16.18.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -248,6 +262,14 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test frameworks -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.9.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Repositories -->
|
||||
@@ -306,4 +328,4 @@
|
||||
<url>https://repo.roinujnosde.me/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
</project>
|
||||
@@ -1,3 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.sacredlabyrinth.phaed.simpleclans.SimpleClans
|
||||
|
||||
@@ -524,7 +524,7 @@ public class ChatBlock {
|
||||
* Outputs a single line out, crops overflow
|
||||
*
|
||||
* @param receiver the receiver
|
||||
* @param msg the message
|
||||
* @param msg the message
|
||||
*/
|
||||
public static void saySingle(CommandSender receiver, String msg) {
|
||||
if (receiver == null) {
|
||||
@@ -538,7 +538,7 @@ public class ChatBlock {
|
||||
* Outputs a message to a user
|
||||
*
|
||||
* @param receiver the receiver
|
||||
* @param msg the message
|
||||
* @param msg the message
|
||||
*/
|
||||
public static void sendMessage(@Nullable CommandSender receiver, @NotNull String msg) {
|
||||
if (receiver == null) {
|
||||
@@ -561,6 +561,10 @@ public class ChatBlock {
|
||||
sendMessage(receiver, lang(key, receiver, args));
|
||||
}
|
||||
|
||||
public static void sendMessageKey(@NotNull ClanPlayer clanPlayer, @NotNull String key, @NotNull Object... args) {
|
||||
sendMessageKey(clanPlayer.toPlayer(), key, args);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void startColor(String color) {
|
||||
this.color = color;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.*;
|
||||
@@ -112,9 +113,9 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
@Deprecated
|
||||
public void deposit(double amount, Player player) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().playerHasMoney(player, amount)) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().playerChargeMoney(player, amount)) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
|
||||
addBb(player.getName(), AQUA + lang("bb.clan.deposit", amount));
|
||||
addBb(player.getName(), lang("bb.clan.deposit", amount));
|
||||
setBalance(getBalance() + amount);
|
||||
SimpleClans.getInstance().getStorageManager().updateClan(this);
|
||||
} else {
|
||||
@@ -149,9 +150,9 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
@Deprecated
|
||||
public void withdraw(double amount, Player player) {
|
||||
if (getBalance() >= amount) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().playerGrantMoney(player, amount)) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
|
||||
addBb(player.getName(), AQUA + lang("bb.clan.withdraw", amount));
|
||||
addBb(player.getName(), lang("bb.clan.withdraw", amount));
|
||||
setBalance(getBalance() - amount);
|
||||
}
|
||||
} else {
|
||||
@@ -292,7 +293,6 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the first color in the clan's tag
|
||||
*
|
||||
@@ -492,6 +492,9 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
SimpleClans.getInstance().getStorageManager().updateClan(this);
|
||||
}
|
||||
|
||||
public void setBb(List<String> bb) {
|
||||
this.bb = new ArrayList<>(bb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a bulletin board message without saving it to the database
|
||||
@@ -1277,8 +1280,8 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
*/
|
||||
public void addBb(String announcerName, String msg) {
|
||||
if (isVerified()) {
|
||||
addBb(SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR) + msg);
|
||||
clanAnnounce(announcerName, SimpleClans.getInstance().getSettingsManager().getColored(BB_ACCENT_COLOR) + "* " + SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR) + ChatUtils.parseColors(msg));
|
||||
addBb(msg);
|
||||
clanAnnounce(announcerName, SimpleClans.getInstance().getSettingsManager().getColored(BB_PREFIX) + ChatUtils.parseColors(msg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,8 +1290,8 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
*/
|
||||
public void addBb(String announcerName, String msg, boolean updateLastUsed) {
|
||||
if (isVerified()) {
|
||||
addBb(SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR) + msg, updateLastUsed);
|
||||
clanAnnounce(announcerName, SimpleClans.getInstance().getSettingsManager().getColored(BB_ACCENT_COLOR) + "* " + SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR) + ChatUtils.parseColors(msg));
|
||||
addBb(msg, updateLastUsed);
|
||||
clanAnnounce(announcerName, SimpleClans.getInstance().getSettingsManager().getColored(BB_PREFIX) + ChatUtils.parseColors(msg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1305,31 +1308,35 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
* @param maxSize amount of lines to display
|
||||
*/
|
||||
public void displayBb(Player player, int maxSize) {
|
||||
if (isVerified()) {
|
||||
ChatBlock.sendBlank(player);
|
||||
String bbAccentColor = SimpleClans.getInstance().getSettingsManager().getColored(BB_ACCENT_COLOR);
|
||||
String pageHeadingsColor = SimpleClans.getInstance().getSettingsManager().getColored(PAGE_HEADINGS_COLOR);
|
||||
ChatBlock.saySingle(player, lang("bulletin.board.header", bbAccentColor, pageHeadingsColor, getName()));
|
||||
|
||||
List<String> localBb;
|
||||
if (maxSize == -1) {
|
||||
localBb = bb;
|
||||
maxSize = SimpleClans.getInstance().getSettingsManager().getInt(BB_SIZE);
|
||||
} else {
|
||||
localBb = new ArrayList<>(bb);
|
||||
}
|
||||
while (localBb.size() > maxSize) {
|
||||
localBb.remove(0);
|
||||
}
|
||||
|
||||
for (String msg : localBb) {
|
||||
if (!sendBbTime(player, msg)) {
|
||||
String bbColor = SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR);
|
||||
ChatBlock.sendMessage(player, bbAccentColor + "* " + bbColor + ChatUtils.parseColors(msg));
|
||||
}
|
||||
}
|
||||
ChatBlock.sendBlank(player);
|
||||
if (!isVerified()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsManager settings = SimpleClans.getInstance().getSettingsManager();
|
||||
|
||||
ChatBlock.sendBlank(player);
|
||||
ChatBlock.saySingle(player, lang("bulletin.board.header", getName()));
|
||||
|
||||
List<String> localBb;
|
||||
if (maxSize == -1) {
|
||||
localBb = bb;
|
||||
maxSize = settings.getInt(BB_SIZE);
|
||||
} else {
|
||||
localBb = new ArrayList<>(bb);
|
||||
}
|
||||
|
||||
while (localBb.size() > maxSize) {
|
||||
localBb.remove(0);
|
||||
}
|
||||
|
||||
for (String msg : localBb) {
|
||||
if (!sendBbTime(player, msg)) {
|
||||
String bbPrefix = settings.getColored(BB_PREFIX);
|
||||
ChatBlock.sendMessage(player, bbPrefix + ChatUtils.parseColors(msg));
|
||||
}
|
||||
}
|
||||
|
||||
ChatBlock.sendBlank(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1345,16 +1352,19 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
if (index < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String bbPrefix = SimpleClans.getInstance().getSettingsManager().getColored(BB_PREFIX);
|
||||
|
||||
long time = (System.currentTimeMillis() - Long.parseLong(msg.substring(0, index))) / 1000L;
|
||||
String bbAccentColor = SimpleClans.getInstance().getSettingsManager().getColored(BB_ACCENT_COLOR);
|
||||
String bbColor = SimpleClans.getInstance().getSettingsManager().getColored(BB_COLOR);
|
||||
msg = ChatUtils.parseColors(bbAccentColor + "* " + bbColor + msg.substring(++index));
|
||||
TextComponent textComponent = new TextComponent(msg);
|
||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(
|
||||
msg = ChatUtils.parseColors(bbPrefix + msg.substring(++index));
|
||||
|
||||
BaseComponent[] baseComponent = TextComponent.fromLegacyText(msg);
|
||||
TextComponent textMessage = new TextComponent(baseComponent);
|
||||
textMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(
|
||||
Dates.formatTime(time, 1) + lang("bb.ago"))));
|
||||
player.spigot().sendMessage(textComponent);
|
||||
player.spigot().sendMessage(textMessage);
|
||||
return true;
|
||||
} catch (Throwable rock) {
|
||||
} catch (Exception rock) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1371,7 +1381,7 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
List<Clan> clans = SimpleClans.getInstance().getClanManager().getClans();
|
||||
|
||||
if (isPermanent() && !force) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("cannot.disband.permanent"));
|
||||
ChatBlock.sendMessage(sender, RED + lang("cannot.disband.permanent", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1404,17 +1414,18 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
String disbanded = lang("clan.disbanded");
|
||||
|
||||
if (c.removeWarringClan(this)) {
|
||||
c.addBb(disbanded, AQUA + lang("you.are.no.longer.at.war", c.getName(), getColorTag()));
|
||||
c.addBb(disbanded, lang("you.are.no.longer.at.war", c.getName(), getColorTag()));
|
||||
}
|
||||
|
||||
if (c.removeRival(getTag())) {
|
||||
c.addBb(disbanded, AQUA + lang("has.been.disbanded.rivalry.ended", getName()));
|
||||
c.addBb(disbanded, lang("has.been.disbanded.rivalry.ended", getName()));
|
||||
}
|
||||
|
||||
if (c.removeAlly(getTag())) {
|
||||
c.addBb(disbanded, AQUA + lang("has.been.disbanded.alliance.ended", getName()));
|
||||
c.addBb(disbanded, lang("has.been.disbanded.alliance.ended", getName()));
|
||||
}
|
||||
}
|
||||
|
||||
SimpleClans.getInstance().getRequestManager().removeRequest(getTag());
|
||||
|
||||
SimpleClans.getInstance().getServer().getScheduler().scheduleSyncDelayedTask(SimpleClans.getInstance(), () -> {
|
||||
@@ -1462,7 +1473,7 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
warring.add(targetClan.getTag());
|
||||
flags.put(WARRING_KEY, warring);
|
||||
if (requestPlayer != null) {
|
||||
addBb(requestPlayer.getName(), AQUA + lang("you.are.at.war",
|
||||
addBb(requestPlayer.getName(), lang("you.are.at.war",
|
||||
getName(), targetClan.getColorTag()));
|
||||
}
|
||||
SimpleClans.getInstance().getStorageManager().updateClan(this);
|
||||
|
||||
@@ -823,6 +823,11 @@ public class ClanPlayer implements Serializable, Comparable<ClanPlayer> {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Placeholder("has_rank")
|
||||
public boolean hasRank() {
|
||||
return !getRankId().isEmpty();
|
||||
}
|
||||
|
||||
@Placeholder("rank")
|
||||
public @NotNull String getRankId() {
|
||||
return flags.getString("rank", "");
|
||||
|
||||
@@ -6,5 +6,5 @@ package net.sacredlabyrinth.phaed.simpleclans;
|
||||
*/
|
||||
public enum ClanRequest
|
||||
{
|
||||
DEMOTE, PROMOTE, DISBAND, INVITE, CREATE_ALLY, BREAK_RIVALRY, START_WAR, END_WAR
|
||||
DEMOTE, PROMOTE, DISBAND, INVITE, CREATE_ALLY, BREAK_RIVALRY, START_WAR, END_WAR, RENAME
|
||||
}
|
||||
@@ -75,7 +75,9 @@ public class Dates {
|
||||
}
|
||||
|
||||
/**
|
||||
* @author RoboMWM, LaxWasHere
|
||||
* <p>
|
||||
* authors: RoboMWM, LaxWasHere
|
||||
* </p>
|
||||
* @param seconds the time in seconds
|
||||
* @param depth Max amount of detail (e.g. only display days and hours if set to 1 and seconds {@literal >} 1 day)
|
||||
* @return the string representation of the amount of time labeled as days, hours, minutes, seconds
|
||||
|
||||
@@ -20,8 +20,7 @@ public final class Request {
|
||||
private ClanPlayer requester;
|
||||
private int askCount;
|
||||
|
||||
public Request(SimpleClans plugin,
|
||||
ClanRequest type,
|
||||
public Request(ClanRequest type,
|
||||
@Nullable List<ClanPlayer> acceptors,
|
||||
ClanPlayer requester,
|
||||
String target,
|
||||
|
||||
@@ -3,18 +3,20 @@ package net.sacredlabyrinth.phaed.simpleclans;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.SCCommandManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.papi.SimpleClansExpansion;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageMigration;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageResource;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.listeners.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.CSVBankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.migrations.BbMigration;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.migrations.ChatFormatMigration;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.migrations.LanguageMigration;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.proxy.BungeeManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.proxy.ProxyManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.tasks.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryController;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatFormatMigration;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.TagValidator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.UpdateChecker;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
@@ -62,6 +64,7 @@ public class SimpleClans extends JavaPlugin {
|
||||
private static final Pattern ACF_PLACEHOLDER_PATTERN = Pattern.compile("\\{(?<key>[a-zA-Z]+?)}");
|
||||
|
||||
private BankLogger bankLogger;
|
||||
private TagValidator tagValidator;
|
||||
|
||||
/**
|
||||
* @return the logger
|
||||
@@ -98,6 +101,8 @@ public class SimpleClans extends JavaPlugin {
|
||||
instance = this;
|
||||
new LanguageMigration(this).migrate();
|
||||
settingsManager = new SettingsManager(this);
|
||||
new BbMigration(settingsManager);
|
||||
new ChatFormatMigration(settingsManager);
|
||||
languageResource = new LanguageResource();
|
||||
this.hasUUID = UUIDMigration.canReturnUUID();
|
||||
|
||||
@@ -110,12 +115,13 @@ public class SimpleClans extends JavaPlugin {
|
||||
protectionManager = new ProtectionManager();
|
||||
protectionManager.registerListeners();
|
||||
chatManager = new ChatManager(this);
|
||||
migrateChatFormat();
|
||||
registerEvents();
|
||||
permissionsManager.loadPermissions();
|
||||
commandManager = new SCCommandManager(this);
|
||||
bankLogger = new CSVBankLogger(this);
|
||||
|
||||
tagValidator = new TagValidator(settingsManager, permissionsManager);
|
||||
|
||||
logStatus();
|
||||
startTasks();
|
||||
startMetrics();
|
||||
@@ -141,12 +147,6 @@ public class SimpleClans extends JavaPlugin {
|
||||
pm.registerEvents(new FriendlyFire(this), this);
|
||||
}
|
||||
|
||||
private void migrateChatFormat() {
|
||||
ChatFormatMigration chatFormatMigration = new ChatFormatMigration();
|
||||
chatFormatMigration.migrateAllyChat();
|
||||
chatFormatMigration.migrateClanChat();
|
||||
}
|
||||
|
||||
private void hookIntoPAPI() {
|
||||
if (getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
getLogger().info("PlaceholderAPI found. Registering hook...");
|
||||
@@ -354,4 +354,8 @@ public class SimpleClans extends JavaPlugin {
|
||||
public void setUUID(boolean trueOrFalse) {
|
||||
this.hasUUID = trueOrFalse;
|
||||
}
|
||||
|
||||
public TagValidator getTagValidator() {
|
||||
return tagValidator;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,10 @@ package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class War {
|
||||
private final Map<Clan, Integer> clans = new HashMap<>();
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -43,7 +44,7 @@ public class SpyChatHandler implements ChatHandler {
|
||||
}
|
||||
|
||||
private List<ClanPlayer> getOnlineSpies() {
|
||||
return Bukkit.getOnlinePlayers().stream().
|
||||
return new ArrayList<>(Bukkit.getOnlinePlayers()).stream().
|
||||
filter(Objects::nonNull).
|
||||
filter(player -> permissionsManager.has(player, "simpleclans.admin.all-seeing-eye")).
|
||||
map(player -> plugin.getClanManager().getCreateClanPlayer(player.getUniqueId())).
|
||||
|
||||
@@ -219,11 +219,11 @@ public class SCCommandManager extends PaperCommandManager {
|
||||
SUBCOMMANDS = Arrays.asList("setbanner", "resetkdr", "place", "rank", "home", "war", "regroup",
|
||||
"mostkilled", "kills", "globalff", "reload", "unban", "ban", "verify", "disband", "resign", "ff",
|
||||
"clanff", "demote", "promote", "untrust", "trust", "purge", "fee", "bank", "kick", "invite", "toggle",
|
||||
"modtag", "bb", "clear", "rival", "ally", "add", "remove", "stats", "coords", "vitals", "rivalries",
|
||||
"modtag", "bb", "display", "clear", "rival", "ally", "add", "remove", "stats", "coords", "vitals", "rivalries",
|
||||
"alliances", "leaderboard", "allow", "block", "auto", "check", "assign", "unassign", "delete", "me",
|
||||
"setdisplayname", "permissions", "tag", "deposit", "withdraw", "set", "status", "tp", "all", "everyone",
|
||||
"lookup", "roster", "profile", "list", "create", "description", "start", "end", "admin", "help", "mod",
|
||||
"setdefault", "removedefault", "land", "break", "interact", "place_block", "damage", "interact_entity",
|
||||
"container", "permanent", "take", "give", "join", "leave", "mute", "confirm", "balance", "discord");
|
||||
"container", "permanent", "take", "give", "join", "leave", "mute", "confirm", "balance", "discord", "rename", "locale");
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.REVERT;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.COMMAND;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.REVERT;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@@ -71,17 +71,15 @@ public class BankCommand extends BaseCommand {
|
||||
*/
|
||||
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
|
||||
switch (clan.withdraw(operator, COMMAND, amount)) {
|
||||
case SUCCESS:
|
||||
if (permissions.playerGrantMoney(player, amount)) {
|
||||
case SUCCESS -> {
|
||||
if (permissions.grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
|
||||
clan.addBb(player.getName(), AQUA + lang("bb.clan.withdraw", amount, player.getName()));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", amount, player.getName()));
|
||||
} else {
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.WITHDRAW, clan.getBalance() + amount);
|
||||
}
|
||||
break;
|
||||
case NOT_ENOUGH_BALANCE:
|
||||
player.sendMessage(lang("clan.bank.not.enough.money", player));
|
||||
break;
|
||||
}
|
||||
case NOT_ENOUGH_BALANCE -> player.sendMessage(lang("clan.bank.not.enough.money", player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +127,9 @@ public class BankCommand extends BaseCommand {
|
||||
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
|
||||
EconomyResponse response = clan.deposit(operator, COMMAND, amount);
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
if (permissions.playerChargeMoney(player, amount)) {
|
||||
if (permissions.chargePlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
|
||||
clan.addBb(player.getName(), AQUA + lang("bb.clan.deposit", amount, player.getName()));
|
||||
clan.addBb(player.getName(), lang("bb.clan.deposit", amount, player.getName()));
|
||||
} else {
|
||||
//Reverts the deposit if something went wrong with Vault
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.DEPOSIT, clan.getBalance() - amount);
|
||||
|
||||
@@ -5,13 +5,14 @@ import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|verified")
|
||||
@@ -21,6 +22,8 @@ public class BbCommand extends BaseCommand {
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
|
||||
@Subcommand("%bb")
|
||||
@CommandPermission("simpleclans.member.bb")
|
||||
@@ -46,7 +49,8 @@ public class BbCommand extends BaseCommand {
|
||||
@Description("{@@command.description.bb.post}")
|
||||
public void postMessage(Player player, @Name("message") String msg) {
|
||||
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(player.getUniqueId()));
|
||||
clan.addBb(player.getName(), AQUA + player.getName() + ": " + WHITE + msg);
|
||||
clan.addBb(lang("bulletin.board.message", player.getName(), msg));
|
||||
clan.displayBb(player);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ChatManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel.CLAN;
|
||||
|
||||
+16
-16
@@ -10,12 +10,12 @@ import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.TagChangeEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.TagValidator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
@@ -91,9 +91,9 @@ public class ClanCommands extends BaseCommand {
|
||||
tag = event.getNewTag();
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
|
||||
TagValidator validator = new TagValidator(plugin, player, tag);
|
||||
if (validator.getErrorMessage() != null) {
|
||||
ChatBlock.sendMessage(player, validator.getErrorMessage());
|
||||
Optional<String> validationError = plugin.getTagValidator().validate(player, tag);
|
||||
if (validationError.isPresent()) {
|
||||
ChatBlock.sendMessage(player, validationError.get());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ClanCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), AQUA + lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
|
||||
clan.addBb(player.getName(), lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
|
||||
clan.changeClanTag(tag);
|
||||
cm.updateDisplayName(player);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class ClanCommands extends BaseCommand {
|
||||
@Description("{@@command.description.invite}")
|
||||
public void invite(Player sender, ClanPlayer cp, Clan clan,
|
||||
@Conditions("not_banned|not_in_clan|online:ignore_vanished") @Name("player") ClanPlayerInput invited) {
|
||||
if (!invited.getClanPlayer().isInviteEnabled()){
|
||||
if (!invited.getClanPlayer().isInviteEnabled()) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("invitedplayer.invite.off", sender));
|
||||
return;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class ClanCommands extends BaseCommand {
|
||||
}
|
||||
if (cm.purchaseMemberFeeSet(player)) {
|
||||
clan.setMemberFee(fee);
|
||||
clan.addBb(player.getName(), AQUA + lang("bb.fee.set", fee));
|
||||
clan.addBb(player.getName(), lang("bb.fee.set", fee));
|
||||
ChatBlock.sendMessage(player, AQUA + lang("fee.set", player));
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public class ClanCommands extends BaseCommand {
|
||||
@Conditions("rank:name=FRIENDLYFIRE")
|
||||
@Description("{@@command.description.clanff.allow}")
|
||||
public void allowClanFf(Player player, Clan clan) {
|
||||
clan.addBb(player.getName(), AQUA + lang("clan.wide.friendly.fire.is.allowed"));
|
||||
clan.addBb(player.getName(), lang("clan.wide.friendly.fire.is.allowed"));
|
||||
clan.setFriendlyFire(true);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class ClanCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.leader.ff")
|
||||
@Description("{@@command.description.clanff.block}")
|
||||
public void blockClanFf(Player player, Clan clan) {
|
||||
clan.addBb(player.getName(), AQUA + lang("clan.wide.friendly.fire.blocked"));
|
||||
clan.addBb(player.getName(), lang("clan.wide.friendly.fire.blocked"));
|
||||
clan.setFriendlyFire(false);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
@@ -252,9 +252,9 @@ public class ClanCommands extends BaseCommand {
|
||||
if (!issuerClan.reachedRivalLimit()) {
|
||||
if (!issuerClan.isRival(rivalInput.getTag())) {
|
||||
issuerClan.addRival(rivalInput);
|
||||
rivalInput.addBb(player.getName(), AQUA + lang("has.initiated.a.rivalry", issuerClan.getName(),
|
||||
rivalInput.addBb(player.getName(), lang("has.initiated.a.rivalry", issuerClan.getName(),
|
||||
rivalInput.getName()), false);
|
||||
issuerClan.addBb(player.getName(), AQUA + lang("has.initiated.a.rivalry", player.getName(),
|
||||
issuerClan.addBb(player.getName(), lang("has.initiated.a.rivalry", player.getName(),
|
||||
rivalInput.getName()));
|
||||
} else {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clans.are.already.rivals", player));
|
||||
@@ -329,9 +329,9 @@ public class ClanCommands extends BaseCommand {
|
||||
public void removeAlly(Player player, Clan issuerClan, @Conditions("different|allied_clan") @Name("clan") ClanInput ally) {
|
||||
Clan allyInput = ally.getClan();
|
||||
issuerClan.removeAlly(allyInput);
|
||||
allyInput.addBb(player.getName(), AQUA + lang("has.broken.the.alliance", issuerClan.getName(),
|
||||
allyInput.addBb(player.getName(), lang("has.broken.the.alliance", issuerClan.getName(),
|
||||
allyInput.getName()), false);
|
||||
issuerClan.addBb(player.getName(), AQUA + lang("has.broken.the.alliance", player.getName(),
|
||||
issuerClan.addBb(player.getName(), lang("has.broken.the.alliance", player.getName(),
|
||||
allyInput.getName()));
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public class ClanCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), AQUA + lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
clan.addBb(sender.getName(), lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
sender.getName(), sender));
|
||||
clan.removePlayerFromClan(clanPlayer.getUniqueId());
|
||||
}
|
||||
@@ -365,11 +365,11 @@ public class ClanCommands extends BaseCommand {
|
||||
@HelpSearchTags("leave")
|
||||
public void resignConfirm(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (clan.isPermanent() || !clan.isLeader(player) || clan.getLeaders().size() > 1) {
|
||||
clan.addBb(player.getName(), AQUA + lang("0.has.resigned", player.getName()));
|
||||
clan.addBb(player.getName(), lang("0.has.resigned", player.getName()));
|
||||
cp.addResignTime(clan.getTag());
|
||||
clan.removePlayerFromClan(player.getUniqueId());
|
||||
|
||||
ChatBlock.sendMessage(cp,AQUA + lang("resign.success", player));
|
||||
ChatBlock.sendMessage(cp, AQUA + lang("resign.success", player));
|
||||
} else if (clan.isLeader(player) && clan.getLeaders().size() == 1) {
|
||||
clan.disband(player, true, false);
|
||||
ChatBlock.sendMessage(cp, RED + lang("clan.has.been.disbanded", player, clan.getName()));
|
||||
|
||||
@@ -49,7 +49,7 @@ public class LandCommand extends BaseCommand {
|
||||
cp.allow(action, land.getId());
|
||||
}
|
||||
if (notify) {
|
||||
ChatBlock.sendMessageKey(cp.toPlayer(), "land.allowed.action");
|
||||
ChatBlock.sendMessageKey(cp, "land.allowed.action");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class LandCommand extends BaseCommand {
|
||||
cp.disallow(action, land.getId());
|
||||
}
|
||||
if (notify) {
|
||||
ChatBlock.sendMessageKey(cp.toPlayer(), "land.blocked.action");
|
||||
ChatBlock.sendMessageKey(cp, "land.blocked.action");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-14
@@ -2,10 +2,7 @@ package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.DisbandPrompt;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
@@ -18,8 +15,10 @@ import org.bukkit.entity.Player;
|
||||
import java.util.Objects;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent.Cause.DISCORD_CREATION;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|leader")
|
||||
@@ -63,7 +62,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
player));
|
||||
return;
|
||||
}
|
||||
clan.addBb(player.getName(), AQUA + lang("demoted.back.to.member", otherCp.getName()));
|
||||
clan.addBb(player.getName(), lang("demoted.back.to.member", otherCp.getName()));
|
||||
clan.demote(otherCp.getUniqueId());
|
||||
}
|
||||
|
||||
@@ -90,13 +89,13 @@ public class LeaderCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
if (settings.is(CLAN_CONFIRMATION_FOR_PROMOTE) && clan.getLeaders().size() > 1) {
|
||||
requestManager.addPromoteRequest(cp, otherPl.getName(), clan);
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.PROMOTE, otherPl.getName(), "asking.for.the.promotion", otherPl.getName());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("promotion.vote.has.been.requested.from.all.leaders",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), AQUA + lang("promoted.to.leader", otherPl.getName()));
|
||||
clan.addBb(player.getName(), lang("promoted.to.leader", otherPl.getName()));
|
||||
clan.promote(otherPl.getUniqueId());
|
||||
}
|
||||
|
||||
@@ -105,7 +104,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
@Description("{@@command.description.disband}")
|
||||
public void disband(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.addDisbandRequest(cp, clan);
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.DISBAND, clan.getTag(), "asking.to.disband");
|
||||
ChatBlock.sendMessage(player, AQUA +
|
||||
lang("clan.disband.vote.has.been.requested.from.all.leaders", player));
|
||||
return;
|
||||
@@ -133,7 +132,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
}
|
||||
if (cm.purchaseVerification(player)) {
|
||||
clan.verifyClan();
|
||||
clan.addBb(player.getName(), AQUA + lang("clan.0.has.been.verified", clan.getName()));
|
||||
clan.addBb(player.getName(), lang("clan.0.has.been.verified", clan.getName()));
|
||||
ChatBlock.sendMessage(player, AQUA + lang("the.clan.has.been.verified", player));
|
||||
}
|
||||
}
|
||||
@@ -156,7 +155,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
ChatBlock.sendMessage(player, ChatColor.RED + lang("this.player.is.already.trusted", player));
|
||||
return;
|
||||
}
|
||||
clan.addBb(player.getName(), AQUA + lang("has.been.given.trusted.status.by", trustedInput.getName(),
|
||||
clan.addBb(player.getName(), lang("has.been.given.trusted.status.by", trustedInput.getName(),
|
||||
player.getName()));
|
||||
trustedInput.setTrusted(true);
|
||||
storage.updateClanPlayer(trustedInput);
|
||||
@@ -181,12 +180,34 @@ public class LeaderCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), AQUA + lang("has.been.given.untrusted.status.by", trustedInput.getName(),
|
||||
clan.addBb(player.getName(), lang("has.been.given.untrusted.status.by", trustedInput.getName(),
|
||||
player.getName()));
|
||||
trustedInput.setTrusted(false);
|
||||
storage.updateClanPlayer(trustedInput);
|
||||
}
|
||||
|
||||
@Subcommand("%rename")
|
||||
@CommandPermission("simpleclans.leader.rename")
|
||||
@CommandCompletion("@nothing")
|
||||
@Description("{@@command.description.rename}")
|
||||
public void rename(ClanPlayer cp, Clan clan, @Name("name") String clanName) {
|
||||
if (clanName.contains("&")) {
|
||||
ChatBlock.sendMessageKey(cp, "your.clan.name.cannot.contain.color.codes");
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.RENAME, "asking.to.rename", clanName);
|
||||
ChatBlock.sendMessageKey(cp, "rename.vote.has.been.requested.from.all.leaders");
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setName(clanName);
|
||||
storage.updateClan(clan);
|
||||
|
||||
ChatBlock.sendMessageKey(cp, "you.have.successfully.renamed.your.clan", clanName);
|
||||
}
|
||||
|
||||
@Subcommand("%discord %create")
|
||||
@CommandPermission("simpleclans.leader.discord.create")
|
||||
@Description("{@@command.description.discord.create}")
|
||||
@@ -205,7 +226,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!permissions.playerChargeMoney(player, amount)) {
|
||||
if (!permissions.chargePlayer(player, amount, DISCORD_CREATION)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +237,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
} catch (DiscordHookException ex) {
|
||||
// Return player's money if clan creation went wrong
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
permissions.playerGrantMoney(player, amount);
|
||||
permissions.grantPlayer(player, amount, DISCORD_CREATION);
|
||||
}
|
||||
String messageKey = ex.getMessageKey();
|
||||
if (messageKey != null) {
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageResource;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class LocaleCompletion extends AbstractStaticCompletion {
|
||||
|
||||
private final List<String> availableLocales;
|
||||
|
||||
public LocaleCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
availableLocales = LanguageResource.getAvailableLocales().stream().
|
||||
map(locale -> locale.toLanguageTag().replace("-", "_")).
|
||||
toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<String> getCompletions() {
|
||||
return availableLocales;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "locales";
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.ConditionContext;
|
||||
import co.aikar.commands.ConditionFailedException;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
|
||||
+33
-9
@@ -5,22 +5,22 @@ import co.aikar.commands.CommandHelp;
|
||||
import co.aikar.commands.CommandParameter;
|
||||
import co.aikar.commands.HelpEntry;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.data.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.CreateClanTagPrompt;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.RequestCanceller;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.ResetKdrPrompt;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerResetKdrEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.RequestManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryDrawer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.MainFrame;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -62,6 +62,17 @@ public class GeneralCommands extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%locale")
|
||||
@CommandPermission("simpleclans.anyone.locale")
|
||||
@Description("{@@command.description.locale}")
|
||||
@CommandCompletion("@locales")
|
||||
public void locale(ClanPlayer cp, @Values("@locales") @Name("locale") String locale) {
|
||||
cp.setLocale(Helper.forLanguageTag(locale.replace("_", "-")));
|
||||
plugin.getStorageManager().updateClanPlayer(cp);
|
||||
|
||||
ChatBlock.sendMessage(cp, lang("locale.has.been.changed"));
|
||||
}
|
||||
|
||||
@Subcommand("%create")
|
||||
@CommandPermission("simpleclans.leader.create")
|
||||
@Description("{@@command.description.create}")
|
||||
@@ -156,17 +167,30 @@ public class GeneralCommands extends BaseCommand {
|
||||
ChatBlock.sendMessage(player, AQUA + lang("friendy.fire.is.now.managed.by.your.clan", player));
|
||||
}
|
||||
|
||||
@Subcommand("%resetkdr %confirm")
|
||||
@CommandPermission("simpleclans.vip.resetkdr")
|
||||
@Description("{@@command.description.resetkdr}")
|
||||
public void resetKdrConfirm(Player player, ClanPlayer cp) {
|
||||
if (!settings.is(ALLOW_RESET_KDR)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("disabled.command", player));
|
||||
return;
|
||||
}
|
||||
PlayerResetKdrEvent event = new PlayerResetKdrEvent(cp);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled() && cm.purchaseResetKdr(player)) {
|
||||
cm.resetKdr(cp);
|
||||
ChatBlock.sendMessage(player, RED + lang("you.have.reseted.your.kdr", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%resetkdr")
|
||||
@CommandPermission("simpleclans.vip.resetkdr")
|
||||
@Description("{@@command.description.resetkdr}")
|
||||
public void resetKdr(Player player, ClanPlayer cp) {
|
||||
if (!settings.is(ALLOW_RESET_KDR)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("disabled.command", player));
|
||||
return;
|
||||
}
|
||||
if (cm.purchaseResetKdr(player)) {
|
||||
cm.resetKdr(cp);
|
||||
ChatBlock.sendMessage(player, RED + lang("you.have.reseted.your.kdr", player));
|
||||
} else {
|
||||
new SCConversation(plugin, player, new ResetKdrPrompt(cm), 60).begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class BankCommand extends BaseCommand {
|
||||
switch (economyResponse) {
|
||||
case SUCCESS:
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.take", sender, amount, clan.getName()));
|
||||
clan.addBb(sender.getName(), AQUA + lang("bb.clan.take", sender, amount, sender.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.take", sender, amount, sender.getName()));
|
||||
break;
|
||||
case NOT_ENOUGH_BALANCE:
|
||||
sender.sendMessage(RED + lang("clan.admin.bank.not.enough.money", sender, clan.getName()));
|
||||
@@ -67,7 +67,7 @@ public class BankCommand extends BaseCommand {
|
||||
EconomyResponse economyResponse = clan.deposit(operator, ClanBalanceUpdateEvent.Cause.COMMAND, amount);
|
||||
if (economyResponse == EconomyResponse.SUCCESS) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.give", sender, amount, clan.getName()));
|
||||
clan.addBb(sender.getName(), AQUA + lang("bb.clan.give", sender, amount, sender.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.give", sender, amount, sender.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class BankCommand extends BaseCommand {
|
||||
EconomyResponse response = clan.setBalance(operator, ClanBalanceUpdateEvent.Cause.COMMAND, BankLogger.Operation.SET, amount);
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.set", sender, clan.getName(), amount));
|
||||
clan.addBb(sender.getName(), AQUA + lang("bb.clan.set", sender, amount, sender.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.set", sender, amount, sender.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,17 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.staff;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Conditions;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Name;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.WHITE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
@@ -31,9 +22,13 @@ public class BbCommand extends BaseCommand {
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
|
||||
@Default
|
||||
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
|
||||
@Subcommand("%display")
|
||||
@CommandPermission("simpleclans.mod.bb")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.mod.bb.display}")
|
||||
public void display(Player sender, @Name("clan") ClanInput input) {
|
||||
input.getClan().displayBb(sender);
|
||||
@@ -41,6 +36,7 @@ public class BbCommand extends BaseCommand {
|
||||
|
||||
@Subcommand("%clear")
|
||||
@CommandPermission("simpleclans.mod.bb-clear")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.mod.bb.clear}")
|
||||
public void clear(Player player, @Name("clan") ClanInput input) {
|
||||
input.getClan().clearBb();
|
||||
@@ -49,10 +45,12 @@ public class BbCommand extends BaseCommand {
|
||||
|
||||
@Subcommand("%add")
|
||||
@CommandPermission("simpleclans.mod.bb-add")
|
||||
@CommandCompletion("@clans @nothing")
|
||||
@Description("{@@command.description.mod.bb.post}")
|
||||
public void postMessage(Player player, @Name("clan") ClanInput input, @Name("message") String msg) {
|
||||
Clan clan = input.getClan();
|
||||
clan.addBb(player.getName(), AQUA + player.getName() + ": " + WHITE + msg);
|
||||
clan.addBb(lang("bulletin.board.message", player.getName(), msg));
|
||||
clan.displayBb(player);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
|
||||
+55
-20
@@ -6,6 +6,7 @@ import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerHomeSetEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerResetKdrEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.TagChangeEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageResource;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
@@ -22,6 +23,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
@@ -65,14 +67,14 @@ public class StaffCommands extends BaseCommand {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.move.the.last.leader", sender));
|
||||
return;
|
||||
} else {
|
||||
oldClan.addBb(oldCp.getName(), AQUA + lang("0.has.resigned", oldCp.getName()));
|
||||
oldClan.addBb(oldCp.getName(), lang("0.has.resigned", oldCp.getName()));
|
||||
oldClan.removePlayerFromClan(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
ClanPlayer cp = cm.getCreateClanPlayer(uuid);
|
||||
|
||||
newClan.addBb(AQUA + lang("joined.the.clan", cp.getName()));
|
||||
newClan.addBb(lang("joined.the.clan", cp.getName()));
|
||||
cm.serverAnnounce(lang("has.joined", cp.getName(), newClan.getName()));
|
||||
newClan.addPlayerToClan(cp);
|
||||
}
|
||||
@@ -90,9 +92,9 @@ public class StaffCommands extends BaseCommand {
|
||||
tag = event.getNewTag();
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
|
||||
TagValidator validator = new TagValidator(plugin, player, tag);
|
||||
if (validator.getErrorMessage() != null) {
|
||||
ChatBlock.sendMessage(player, validator.getErrorMessage());
|
||||
Optional<String> validationError = plugin.getTagValidator().validate(player, tag);
|
||||
if (validationError.isPresent()) {
|
||||
ChatBlock.sendMessage(player, validationError.get());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +104,7 @@ public class StaffCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), AQUA + lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
|
||||
clan.addBb(player.getName(), lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
|
||||
clan.changeClanTag(tag);
|
||||
player.sendMessage(lang("0.tag.changed.to.1", player, clan.getTag(), tag));
|
||||
}
|
||||
@@ -226,7 +228,7 @@ public class StaffCommands extends BaseCommand {
|
||||
|
||||
if (!clanInput.isVerified()) {
|
||||
clanInput.verifyClan();
|
||||
clanInput.addBb(sender.getName(), AQUA + lang("clan.0.has.been.verified", clanInput.getName()));
|
||||
clanInput.addBb(sender.getName(), lang("clan.0.has.been.verified", clanInput.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("the.clan.has.been.verified", sender));
|
||||
} else {
|
||||
ChatBlock.sendMessage(sender, RED + lang("the.clan.is.already.verified", sender));
|
||||
@@ -263,7 +265,7 @@ public class StaffCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), AQUA + lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
clan.addBb(sender.getName(), lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
sender.getName(), sender));
|
||||
clan.removePlayerFromClan(clanPlayer.getUniqueId());
|
||||
}
|
||||
@@ -294,7 +296,7 @@ public class StaffCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), AQUA + lang("promoted.to.leader", promotePl.getName()));
|
||||
clan.addBb(sender.getName(), lang("promoted.to.leader", promotePl.getName()));
|
||||
clan.promote(promotePl.getUniqueId());
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.successfully.promoted", sender));
|
||||
}
|
||||
@@ -317,7 +319,7 @@ public class StaffCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
clan.demote(otherCp.getUniqueId());
|
||||
clan.addBb(sender.getName(), AQUA + lang("demoted.back.to.member", otherCp.getName()));
|
||||
clan.addBb(sender.getName(), lang("demoted.back.to.member", otherCp.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.successfully.demoted", sender));
|
||||
}
|
||||
|
||||
@@ -326,7 +328,11 @@ public class StaffCommands extends BaseCommand {
|
||||
@Description("{@@command.description.resetkdr.everyone}")
|
||||
public void resetKdr(CommandSender sender) {
|
||||
for (ClanPlayer cp : cm.getAllClanPlayers()) {
|
||||
cm.resetKdr(cp);
|
||||
PlayerResetKdrEvent event = new PlayerResetKdrEvent(cp);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
cm.resetKdr(cp);
|
||||
}
|
||||
}
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.have.reseted.kdr.of.all.players", sender));
|
||||
}
|
||||
@@ -335,20 +341,49 @@ public class StaffCommands extends BaseCommand {
|
||||
@CommandCompletion("@players")
|
||||
@CommandPermission("simpleclans.admin.resetkdr")
|
||||
@Description("{@@command.description.resetkdr.player}")
|
||||
public void resetKdr(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
ClanPlayer cp = player.getClanPlayer();
|
||||
cm.resetKdr(cp);
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.have.reseted.0.kdr", sender, cp.getName()));
|
||||
public void resetKdr(CommandSender sender, @Name("player") ClanPlayerInput clanPlayer) {
|
||||
ClanPlayer cp = clanPlayer.getClanPlayer();
|
||||
PlayerResetKdrEvent event = new PlayerResetKdrEvent(cp);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
cm.resetKdr(cp);
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.have.reseted.0.kdr", sender, cp.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%admin %permanent")
|
||||
@CommandCompletion("@clans")
|
||||
@CommandPermission("simpleclans.admin.permanent")
|
||||
@Description("{@@command.description.admin.permanent}")
|
||||
public void togglePermanent(CommandSender sender, @Name("clan") ClanInput clan) {
|
||||
boolean permanent = !clan.getClan().isPermanent();
|
||||
clan.getClan().setPermanent(permanent);
|
||||
clan.getClan().addBb(sender.getName(), lang((permanent) ? "permanent.status.enabled" : "permanent.status.disabled", sender.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("you.have.toggled.permanent.status", sender, clan.getClan().getName()));
|
||||
public void togglePermanent(CommandSender sender, @Name("clan") ClanInput clanInput) {
|
||||
Clan clan = clanInput.getClan();
|
||||
boolean permanent = !clan.isPermanent();
|
||||
clan.setPermanent(permanent);
|
||||
clan.addBb(sender.getName(), lang((permanent) ? "permanent.status.enabled" : "permanent.status.disabled", sender.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("you.have.toggled.permanent.status", sender, clan.getName()));
|
||||
}
|
||||
|
||||
@Subcommand("%mod %rename")
|
||||
@CommandCompletion("@clans @nothing")
|
||||
@CommandPermission("simpleclans.mod.rename")
|
||||
@Description("{@@command.description.mod.rename}")
|
||||
public void rename(CommandSender sender, @Name("clan") ClanInput clanInput, @Name("name") String clanName) {
|
||||
Clan clan = clanInput.getClan();
|
||||
clan.setName(clanName);
|
||||
storage.updateClan(clan);
|
||||
|
||||
ChatBlock.sendMessageKey(sender, "you.have.successfully.renamed.the.clan", clanName);
|
||||
}
|
||||
|
||||
@Subcommand("%mod %locale")
|
||||
@CommandPermission("simpleclans.mod.locale")
|
||||
@Description("{@@command.description.mod.locale}")
|
||||
@CommandCompletion("@locales")
|
||||
public void locale(CommandSender sender, @Name("player") ClanPlayerInput input, @Values("@locales") @Name("locale") String locale) {
|
||||
ClanPlayer cp = input.getClanPlayer();
|
||||
cp.setLocale(Helper.forLanguageTag(locale.replace("_", "-")));
|
||||
plugin.getStorageManager().updateClanPlayer(cp);
|
||||
|
||||
ChatBlock.sendMessage(sender, lang("locale.has.been.changed"));
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -66,8 +66,7 @@ public class CreateClanNamePrompt extends StringPrompt {
|
||||
plugin.getClanManager().createClan(player, tag, name);
|
||||
|
||||
Clan clan = plugin.getClanManager().getClan(tag);
|
||||
clan.addBb(player.getName(), AQUA +
|
||||
lang("clan.created", name));
|
||||
clan.addBb(player.getName(), lang("clan.created", name));
|
||||
plugin.getStorageManager().updateClan(clan);
|
||||
|
||||
if (plugin.getSettingsManager().is(REQUIRE_VERIFICATION)) {
|
||||
|
||||
+4
-8
@@ -2,7 +2,6 @@ package net.sacredlabyrinth.phaed.simpleclans.conversation;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.TagValidator;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
@@ -11,6 +10,8 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
public class CreateClanTagPrompt extends StringPrompt {
|
||||
@@ -52,12 +53,7 @@ public class CreateClanTagPrompt extends StringPrompt {
|
||||
lang("clan.with.this.tag.already.exists", player), this);
|
||||
}
|
||||
|
||||
TagValidator validator = new TagValidator(plugin, player, clanTag);
|
||||
String errorMessage = validator.getErrorMessage();
|
||||
if (errorMessage == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new MessagePromptImpl(errorMessage, this);
|
||||
}
|
||||
Optional<String> validationError = plugin.getTagValidator().validate(player, clanTag);
|
||||
return validationError.map(error -> new MessagePromptImpl(error, this)).orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,10 @@ public class DisbandPrompt extends ConfirmationPrompt {
|
||||
|
||||
@Override
|
||||
protected Prompt confirm(ClanPlayer sender, Clan clan) {
|
||||
if (clan.isPermanent()) {
|
||||
return new MessagePromptImpl(RED + lang("cannot.disband.permanent", sender));
|
||||
}
|
||||
|
||||
clan.disband(sender.toPlayer(), true, false);
|
||||
return new MessagePromptImpl(RED + lang("clan.has.been.disbanded", sender, clan.getName()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.conversation;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerResetKdrEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
public class ResetKdrPrompt extends ConfirmationPrompt {
|
||||
|
||||
private final ClanManager cm;
|
||||
|
||||
public ResetKdrPrompt(ClanManager cm) {
|
||||
this.cm = cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt confirm(ClanPlayer sender, Clan clan) {
|
||||
PlayerResetKdrEvent event = new PlayerResetKdrEvent(sender);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled() && cm.purchaseResetKdr(sender.toPlayer())) {
|
||||
cm.resetKdr(sender);
|
||||
return new MessagePromptImpl(RED + lang("you.have.reseted.your.kdr", sender));
|
||||
} else {
|
||||
return END_OF_CONVERSATION;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPromptTextKey() {
|
||||
return "resetkdr.confirmation";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDeclineTextKey() {
|
||||
return "resetkdr.request.cancelled";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class ResignPrompt extends ConfirmationPrompt {
|
||||
@Override
|
||||
protected Prompt confirm(ClanPlayer sender, Clan clan) {
|
||||
if (clan.isPermanent() || !sender.isLeader() || clan.getLeaders().size() > 1) {
|
||||
clan.addBb(sender.getName(), AQUA + lang("0.has.resigned", sender.getName()));
|
||||
clan.addBb(sender.getName(), lang("0.has.resigned", sender.getName()));
|
||||
sender.addResignTime(clan.getTag());
|
||||
clan.removePlayerFromClan(sender.getUniqueId());
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.events;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.events;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is fired when money is granted or charged from a player's account.
|
||||
* <p>Note: Cancelling this event will deny the transaction.</p>
|
||||
*
|
||||
* @see PermissionsManager#grantPlayer(OfflinePlayer, double, Cause)
|
||||
* @see PermissionsManager#chargePlayer(OfflinePlayer, double, Cause)
|
||||
*/
|
||||
public class EconomyTransactionEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final OfflinePlayer player;
|
||||
private double amount;
|
||||
private final Cause cause;
|
||||
private final TransactionType transactionType;
|
||||
private boolean cancelled;
|
||||
|
||||
public EconomyTransactionEvent(@NotNull OfflinePlayer affected, double amount,
|
||||
@NotNull Cause cause, @NotNull TransactionType transactionType) {
|
||||
this.player = affected;
|
||||
this.amount = amount;
|
||||
this.cause = cause;
|
||||
this.transactionType = transactionType;
|
||||
}
|
||||
|
||||
public OfflinePlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Cause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public TransactionType getTransactionType() {
|
||||
return transactionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* If cancelled, the transaction will result as denied.
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public enum Cause {
|
||||
CLAN_CREATION,
|
||||
CLAN_VERIFICATION,
|
||||
CLAN_INVITATION,
|
||||
CLAN_REGROUP,
|
||||
CLAN_HOME_TELEPORT,
|
||||
CLAN_HOME_TELEPORT_SET,
|
||||
DISCORD_CREATION,
|
||||
PLAYER_KILLED,
|
||||
MEMBER_FEE_SET,
|
||||
RESET_KDR
|
||||
}
|
||||
|
||||
public enum TransactionType {
|
||||
DEPOSIT, WITHDRAW
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
*/
|
||||
package net.sacredlabyrinth.phaed.simpleclans.events;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import org.bukkit.Location;
|
||||
@@ -14,6 +12,9 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author edson
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.events;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author ThiagoROX
|
||||
*/
|
||||
public class PlayerResetKdrEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final ClanPlayer clanPlayer;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* Event called before a player's kill death rate is reset
|
||||
*
|
||||
* @param clanPlayer The ClanPlayer whose kill death rate going to be reset
|
||||
*/
|
||||
public PlayerResetKdrEvent(@NotNull ClanPlayer clanPlayer) {
|
||||
this.clanPlayer = clanPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player whose kill death rate going to be reset
|
||||
*
|
||||
* @return The player whose kill death rate going to be reset
|
||||
*/
|
||||
@NotNull
|
||||
public ClanPlayer getClanPlayer() {
|
||||
return clanPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
+73
-50
@@ -70,16 +70,13 @@ public class DiscordHook implements Listener {
|
||||
|
||||
private static final int MAX_CHANNELS_PER_CATEGORY = 50;
|
||||
private static final int MAX_CHANNELS_PER_GUILD = 500;
|
||||
|
||||
private final SimpleClans plugin;
|
||||
private final SettingsManager settingsManager;
|
||||
private final ChatManager chatManager;
|
||||
private final ClanManager clanManager;
|
||||
private final AccountLinkManager accountManager = DiscordSRV.getPlugin().getAccountLinkManager();
|
||||
|
||||
private final Guild guild = DiscordSRV.getPlugin().getMainGuild();
|
||||
private final List<String> textCategories;
|
||||
private final List<String> discordClanTags;
|
||||
private final List<String> clanTags;
|
||||
private final Role leaderRole;
|
||||
private final List<String> whitelist;
|
||||
@@ -89,14 +86,15 @@ public class DiscordHook implements Listener {
|
||||
settingsManager = plugin.getSettingsManager();
|
||||
chatManager = plugin.getChatManager();
|
||||
clanManager = plugin.getClanManager();
|
||||
|
||||
textCategories = settingsManager.getStringList(DISCORDCHAT_TEXT_CATEGORY_IDS).stream().
|
||||
filter(this::categoryExists).collect(Collectors.toList());
|
||||
whitelist = settingsManager.getStringList(DISCORDCHAT_TEXT_WHITELIST);
|
||||
|
||||
clanTags = clanManager.getClans().stream().map(Clan::getTag).collect(Collectors.toList());
|
||||
discordClanTags = getCachedChannels().stream().map(GuildChannel::getName).collect(Collectors.toList());
|
||||
|
||||
leaderRole = getLeaderRole();
|
||||
|
||||
setupDiscord();
|
||||
}
|
||||
|
||||
@@ -260,9 +258,12 @@ public class DiscordHook implements Listener {
|
||||
}
|
||||
|
||||
protected void setupDiscord() {
|
||||
clearChannels();
|
||||
resetPermissions();
|
||||
createChannels();
|
||||
Map<String, TextChannel> discordTagChannels = getCachedChannels().stream().
|
||||
collect(Collectors.toMap(TextChannel::getName, textChannel -> textChannel));
|
||||
|
||||
clearChannels(discordTagChannels);
|
||||
resetPermissions(discordTagChannels);
|
||||
createChannels(discordTagChannels);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -352,7 +353,6 @@ public class DiscordHook implements Listener {
|
||||
* <p>Sets positive {@link Permission#VIEW_CHANNEL} permission to all linked clan members.</p>
|
||||
*
|
||||
* @param clanTag the clan tag
|
||||
*
|
||||
* @throws InvalidChannelException clan is not verified or permanent,
|
||||
* no one member is linked or clan is not in the whitelist.
|
||||
* @throws ChannelExistsException if channel is already exist
|
||||
@@ -396,10 +396,8 @@ public class DiscordHook implements Listener {
|
||||
* Retrieves channel in SimpleClans categories.
|
||||
*
|
||||
* @param channelName the channel name
|
||||
*
|
||||
* @see #getCachedCategories() retreive categories.
|
||||
*
|
||||
* @return the channel
|
||||
* @see #getCachedCategories() retreive categories.
|
||||
*/
|
||||
public Optional<TextChannel> getCachedChannel(@NotNull String channelName) {
|
||||
return getCachedChannels().stream().filter(textChannel -> textChannel.getName().equals(channelName)).findFirst();
|
||||
@@ -409,9 +407,8 @@ public class DiscordHook implements Listener {
|
||||
* Checks if a category can be obtained by id.
|
||||
*
|
||||
* @param categoryId the category id
|
||||
* @see #channelExists(String)
|
||||
*
|
||||
* @return true if the category exists
|
||||
* @see #channelExists(String)
|
||||
*/
|
||||
public boolean categoryExists(String categoryId) {
|
||||
return guild.getCategoryById(categoryId) != null;
|
||||
@@ -423,7 +420,18 @@ public class DiscordHook implements Listener {
|
||||
* @see #categoryExists(String)
|
||||
*/
|
||||
public boolean channelExists(String clanTag) {
|
||||
return getChannels().stream().map(TextChannel::getName).anyMatch(name -> name.equals(clanTag));
|
||||
return getChannel(clanTag).isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the channel in SimpleClans categories.
|
||||
*
|
||||
* @param channelName the channel name
|
||||
* @return the channel
|
||||
* @see #getCachedChannel(String) retreive the <b>cached</b> channel.
|
||||
*/
|
||||
public Optional<TextChannel> getChannel(@NotNull String channelName) {
|
||||
return getChannels().stream().filter(textChannel -> textChannel.getName().equals(channelName)).findAny();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,18 +439,20 @@ public class DiscordHook implements Listener {
|
||||
* If there are no channels, removes category as well.
|
||||
*
|
||||
* @param channelName the channel name
|
||||
*
|
||||
* @return true, if channel was deleted and false if not.
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public boolean deleteChannel(@NotNull String channelName) {
|
||||
boolean deleted = false;
|
||||
|
||||
if (channelExists(channelName)) {
|
||||
for (Category category : getCachedCategories()) {
|
||||
if (category.getTextChannels().size() > 0) {
|
||||
for (TextChannel textChannel : category.getTextChannels()) {
|
||||
if (textChannel.getName().equals(channelName)) {
|
||||
textChannel.delete().complete();
|
||||
return true;
|
||||
deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +462,8 @@ public class DiscordHook implements Listener {
|
||||
settingsManager.save();
|
||||
category.delete().complete();
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -502,51 +514,54 @@ public class DiscordHook implements Listener {
|
||||
return DiscordUtil.getMemberById(discordId);
|
||||
}
|
||||
|
||||
private void clearChannels() {
|
||||
private void clearChannels(Map<String, TextChannel> discordTagChannels) {
|
||||
// Removes abandoned channels
|
||||
ArrayList<String> clansToDelete = new ArrayList<>(discordClanTags);
|
||||
ArrayList<String> clansToDelete = new ArrayList<>(discordTagChannels.keySet());
|
||||
clansToDelete.removeAll(clanTags);
|
||||
clansToDelete.forEach(this::deleteChannel);
|
||||
clansToDelete.forEach(clanChannel -> {
|
||||
deleteChannel(clanChannel);
|
||||
discordTagChannels.remove(clanChannel);
|
||||
});
|
||||
|
||||
// Removes invalid channels
|
||||
for (String clanTag : clanTags) {
|
||||
Iterator<String> iterator = discordTagChannels.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String clanChannel = iterator.next();
|
||||
try {
|
||||
validateChannel(clanTag);
|
||||
validateChannel(clanChannel);
|
||||
} catch (InvalidChannelException ex) {
|
||||
SimpleClans.debug(ex.getMessage());
|
||||
deleteChannel(clanTag);
|
||||
|
||||
deleteChannel(clanChannel);
|
||||
iterator.remove();
|
||||
} catch (ChannelExistsException | ChannelsLimitException ex) {
|
||||
SimpleClans.debug(ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resetPermissions() {
|
||||
getCachedChannels().stream().
|
||||
map(TextChannel::getMemberPermissionOverrides).
|
||||
flatMap(Collection::stream).
|
||||
filter(permissionOverride -> !Objects.equals(permissionOverride.getPermissionHolder(), guild.getPublicRole())).
|
||||
filter(permissionOverride -> !Objects.equals(permissionOverride.getMember(), guild.getSelfMember())).
|
||||
forEach(permissionOverride -> permissionOverride.delete().queue());
|
||||
private void resetPermissions(Map<String, TextChannel> discordClanChannels) {
|
||||
for (Map.Entry<String, TextChannel> channelEntry : discordClanChannels.entrySet()) {
|
||||
TextChannel channel = channelEntry.getValue();
|
||||
Clan clan = clanManager.getClan(channelEntry.getKey());
|
||||
Map<ClanPlayer, Member> discordPlayers = getDiscordPlayers(clan);
|
||||
|
||||
clanTags.stream().map(clanManager::getClan).
|
||||
filter(Objects::nonNull).
|
||||
map(Clan::getMembers).
|
||||
flatMap(Collection::stream).
|
||||
forEach(clanPlayer -> {
|
||||
Member member = getMember(clanPlayer);
|
||||
Clan clan = clanPlayer.getClan();
|
||||
if (member != null && clan != null) {
|
||||
updateViewPermission(member, clan, ADD);
|
||||
}
|
||||
});
|
||||
for (Member member : discordPlayers.values()) {
|
||||
PermissionOverride override = channel.getPermissionOverride(member);
|
||||
if (override != null) {
|
||||
override.delete().queue(afterSuccess -> updateViewPermission(member, channel, ADD));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createChannels() {
|
||||
private void createChannels(Map<String, TextChannel> discordClanChannels) {
|
||||
if (!settingsManager.is(DISCORDCHAT_AUTO_CREATION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Removes already used discord channels from creation
|
||||
clanTags.removeAll(discordClanChannels.keySet());
|
||||
|
||||
for (String clan : clanTags) {
|
||||
try {
|
||||
createChannel(clan);
|
||||
@@ -622,17 +637,25 @@ public class DiscordHook implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateViewPermission(@Nullable Member member, @NotNull GuildChannel channel, @NotNull DiscordAction action) {
|
||||
if (member == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == ADD) {
|
||||
channel.upsertPermissionOverride(member).
|
||||
setPermissions(Collections.singletonList(VIEW_CHANNEL), Collections.emptyList()).queue();
|
||||
} else {
|
||||
channel.getManager().removePermissionOverride(member).queue();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateViewPermission(@NotNull Member member, @NotNull Clan clan, DiscordAction action) {
|
||||
Optional<TextChannel> channel = getCachedChannel(clan.getTag());
|
||||
String tag = clan.getTag();
|
||||
Optional<TextChannel> channel = getCachedChannel(tag).map(Optional::of).orElse(getChannel(tag));
|
||||
if (channel.isPresent()) {
|
||||
TextChannel textChannel = channel.get();
|
||||
|
||||
if (action == ADD) {
|
||||
textChannel.upsertPermissionOverride(member).
|
||||
setPermissions(Collections.singletonList(VIEW_CHANNEL), Collections.emptyList()).queue();
|
||||
} else {
|
||||
textChannel.getManager().removePermissionOverride(member).queue();
|
||||
}
|
||||
updateViewPermission(member, textChannel, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-1
@@ -4,25 +4,34 @@ import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.DataStore;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import me.ryanhamshire.GriefPrevention.events.ClaimCreatedEvent;
|
||||
import me.ryanhamshire.GriefPrevention.events.ClaimResizeEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.Coordinate;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.Land;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.ProtectionProvider;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class GriefPreventionProvider implements ProtectionProvider {
|
||||
public class GriefPreventionProvider implements ProtectionProvider, Listener {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Bukkit.getPluginManager().registerEvents(this, SimpleClans.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,4 +113,25 @@ public class GriefPreventionProvider implements ProtectionProvider {
|
||||
return Bukkit.getOfflinePlayer(claim.getOwnerName()).getUniqueId();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
private void onResize(ClaimResizeEvent event) {
|
||||
ClanManager clanManager = SimpleClans.getInstance().getClanManager();
|
||||
|
||||
Land originalLand = getLand(event.getFrom());
|
||||
Land newLand = getLand(event.getTo());
|
||||
if (originalLand == null || newLand == null) {
|
||||
return;
|
||||
}
|
||||
for (UUID owner : originalLand.getOwners()) {
|
||||
ClanPlayer cp = clanManager.getAnyClanPlayer(owner);
|
||||
if (cp == null) continue;
|
||||
for (ProtectionManager.Action action : ProtectionManager.Action.values()) {
|
||||
if (cp.isAllowed(action, originalLand.getId())) {
|
||||
cp.disallow(action, originalLand.getId());
|
||||
cp.allow(action, newLand.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,38 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.listeners;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Events {
|
||||
public final class Events {
|
||||
|
||||
private Events() {}
|
||||
private Events() {
|
||||
// Can't instantiate this class
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Contract("null -> null")
|
||||
public static Player getAttacker(@Nullable EntityDamageEvent parentEvent) {
|
||||
if (parentEvent instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) parentEvent;
|
||||
if (parentEvent instanceof EntityDamageByEntityEvent sub) {
|
||||
Entity damager = sub.getDamager();
|
||||
|
||||
if (sub.getDamager() instanceof Player) {
|
||||
return (Player) sub.getDamager();
|
||||
if (damager instanceof Player attacker) {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
if (sub.getDamager() instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) sub.getDamager();
|
||||
|
||||
if (projectile.getShooter() instanceof Player) {
|
||||
return (Player) projectile.getShooter();
|
||||
}
|
||||
if (damager instanceof Projectile projectile && projectile.getShooter() instanceof Player attacker) {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
if (damager instanceof TNTPrimed tnt && tnt.getSource() instanceof Player attacker) {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.GLOBAL_FRIENDLY_FIRE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.SAFE_CIVILIANS;
|
||||
|
||||
public class FriendlyFire extends SCListener {
|
||||
|
||||
|
||||
+163
-173
@@ -16,18 +16,30 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager.Action.*;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
@@ -49,13 +61,154 @@ public class LandProtection implements Listener {
|
||||
}
|
||||
|
||||
public void registerListeners() {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
registerBlockBreakListener();
|
||||
registerBlockPlaceListener();
|
||||
registerEntityDamageListener();
|
||||
registerInteractEntityListener();
|
||||
registerInteractListener();
|
||||
registerInventoryOpenListener();
|
||||
registerListener(BlockBreakEvent.class, (event, cancel) -> {
|
||||
Block block = event.getBlock();
|
||||
if (settingsManager.getIgnoredList(BREAK).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(HangingBreakByEntityEvent.class, (event, cancel) -> {
|
||||
Entity remover = event.getRemover();
|
||||
if (!(remover instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, event.getEntity().getLocation(), ((Player) remover))) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(HangingPlaceEvent.class, (event, cancel) -> {
|
||||
Player player = event.getPlayer();
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, event.getBlock().getLocation(), player)) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(StructureGrowEvent.class, (event, cancel) -> {
|
||||
if (event.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, event.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(BlockPlaceEvent.class, (event, cancel) -> {
|
||||
Block block = event.getBlock();
|
||||
if (settingsManager.getIgnoredList(PLACE).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerBucketEmptyEvent.class, (event, cancel) -> {
|
||||
Block block = event.getBlockClicked();
|
||||
if (settingsManager.getIgnoredList(PLACE).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerBucketFillEvent.class, (event, cancel) -> {
|
||||
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
|
||||
if (settingsManager.getIgnoredList(BREAK).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(VehicleDestroyEvent.class, (event, cancel) -> {
|
||||
if (!(event.getAttacker() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, event.getVehicle().getLocation(), ((Player) event.getAttacker()))) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(EntityChangeBlockEvent.class, (event, cancel) -> {
|
||||
if (!(event.getEntity() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, event.getBlock().getLocation(), ((Player) event.getEntity()))) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(EntityDamageByEntityEvent.class, (event, cancel) -> {
|
||||
Player attacker = Events.getAttacker(event);
|
||||
if (attacker == null) {
|
||||
return;
|
||||
}
|
||||
Player victim = event.getEntity() instanceof Player ? ((Player) event.getEntity()) : null;
|
||||
if (victim == null) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(DAMAGE, event.getEntity().getLocation(), attacker, victim)) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerInteractAtEntityEvent.class, (event, cancel) -> {
|
||||
if (protectionManager.can(INTERACT_ENTITY, event.getRightClicked().getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerInteractEntityEvent.class, (event, cancel) -> {
|
||||
if (protectionManager.can(INTERACT_ENTITY, event.getRightClicked().getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(VehicleExitEvent.class, (event, cancel) -> {
|
||||
Vehicle vehicle = event.getVehicle();
|
||||
if (vehicle instanceof Tameable && event.getExited() instanceof Player) {
|
||||
if (protectionManager.can(INTERACT_ENTITY, vehicle.getLocation(), ((Player) event.getExited()))) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
}
|
||||
});
|
||||
registerListener(InventoryOpenEvent.class, (event, cancel) -> {
|
||||
InventoryHolder holder = event.getInventory().getHolder();
|
||||
Location location = getLocation(holder);
|
||||
if (holder instanceof Entity && holder == event.getPlayer()) return;
|
||||
if (location == null) return;
|
||||
|
||||
if (protectionManager.can(CONTAINER, location, ((Player) event.getPlayer()))) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerInteractEvent.class, (event, cancel) -> {
|
||||
if (event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
ProtectionManager.Action action = getInteractEventAction(event);
|
||||
if (protectionManager.can(action, event.getClickedBlock().getLocation(), event.getPlayer())) {
|
||||
event.setUseInteractedBlock(cancel ? Result.DENY : Result.ALLOW);
|
||||
event.setUseItemInHand(cancel ? Result.DENY : Result.ALLOW);
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
registerListener(PlayerBedEnterEvent.class, (event, cancel) -> {
|
||||
if (protectionManager.can(INTERACT, event.getBed().getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(cancel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private <T extends Event> void registerListener(Class<T> clazz, BiConsumer<T, Boolean> listener) {
|
||||
Bukkit.getPluginManager().registerEvent(clazz, this, EventPriority.LOWEST, (l, event) -> {
|
||||
if (clazz.isInstance(event)) {
|
||||
listener.accept(clazz.cast(event), true);
|
||||
}
|
||||
}, plugin, false);
|
||||
Bukkit.getPluginManager().registerEvent(clazz, this, priority, (l, event) -> {
|
||||
if (clazz.isInstance(event)) {
|
||||
listener.accept(clazz.cast(event), false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
public void registerCreateLandEvent(ProtectionProvider provider, @Nullable Class<? extends Event> createLandEvent) {
|
||||
@@ -95,169 +248,6 @@ public class LandProtection implements Listener {
|
||||
((Cancellable) event).setCancelled(true);
|
||||
}
|
||||
|
||||
private void registerBlockBreakListener() {
|
||||
Bukkit.getPluginManager().registerEvent(BlockBreakEvent.class, this, priority, (listener, event) -> {
|
||||
if (!(event instanceof BlockBreakEvent)) {
|
||||
return;
|
||||
}
|
||||
BlockBreakEvent blockBreakEvent = (BlockBreakEvent) event;
|
||||
Block block = blockBreakEvent.getBlock();
|
||||
if (settingsManager.getIgnoredList(BREAK).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, block.getLocation(), blockBreakEvent.getPlayer())) {
|
||||
blockBreakEvent.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
private void registerBlockPlaceListener() {
|
||||
Bukkit.getPluginManager().registerEvent(BlockPlaceEvent.class, this, priority, (listener, event) -> {
|
||||
if (!(event instanceof BlockPlaceEvent)) {
|
||||
return;
|
||||
}
|
||||
BlockPlaceEvent blockPlaceEvent = (BlockPlaceEvent) event;
|
||||
Block block = blockPlaceEvent.getBlock();
|
||||
if (settingsManager.getIgnoredList(PLACE).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, block.getLocation(), blockPlaceEvent.getPlayer())) {
|
||||
blockPlaceEvent.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
private void registerEntityDamageListener() {
|
||||
Bukkit.getPluginManager().registerEvent(EntityDamageByEntityEvent.class, this, priority,
|
||||
(listener, event) -> {
|
||||
if (!(event instanceof EntityDamageByEntityEvent)) {
|
||||
return;
|
||||
}
|
||||
EntityDamageByEntityEvent entityEvent = (EntityDamageByEntityEvent) event;
|
||||
if (!(entityEvent.getDamager() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player attacker = ((Player) entityEvent.getDamager());
|
||||
Player victim = entityEvent.getEntity() instanceof Player ? ((Player) entityEvent.getEntity()) : null;
|
||||
if (protectionManager.can(DAMAGE, entityEvent.getEntity().getLocation(), attacker, victim)) {
|
||||
entityEvent.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
private void registerInteractEntityListener() {
|
||||
Bukkit.getPluginManager().registerEvent(PlayerInteractEntityEvent.class, this, priority, (listener, event) -> {
|
||||
if (!(event instanceof PlayerInteractEntityEvent)) {
|
||||
return;
|
||||
}
|
||||
PlayerInteractEntityEvent interactEvent = (PlayerInteractEntityEvent) event;
|
||||
if (protectionManager.can(INTERACT_ENTITY, interactEvent.getRightClicked().getLocation(), interactEvent.getPlayer())) {
|
||||
interactEvent.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
private void registerInventoryOpenListener() {
|
||||
Bukkit.getPluginManager().registerEvent(InventoryOpenEvent.class, this, priority, (l, e) -> {
|
||||
if (!(e instanceof InventoryOpenEvent)) {
|
||||
return;
|
||||
}
|
||||
InventoryOpenEvent event = ((InventoryOpenEvent) e);
|
||||
InventoryHolder holder = event.getInventory().getHolder();
|
||||
Location location = getLocation(holder);
|
||||
if (holder instanceof Entity && holder == event.getPlayer()) return;
|
||||
if (location == null) return;
|
||||
|
||||
if (protectionManager.can(CONTAINER, location, ((Player) event.getPlayer()))) {
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
private void registerInteractListener() {
|
||||
Bukkit.getPluginManager().registerEvent(PlayerInteractEvent.class, this, priority, (listener, event) -> {
|
||||
if (!(event instanceof PlayerInteractEvent)) {
|
||||
return;
|
||||
}
|
||||
PlayerInteractEvent interactEvent = (PlayerInteractEvent) event;
|
||||
if (interactEvent.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
ProtectionManager.Action action = getInteractEventAction(interactEvent);
|
||||
if (protectionManager.can(action, interactEvent.getClickedBlock().getLocation(), interactEvent.getPlayer())) {
|
||||
interactEvent.setUseInteractedBlock(Event.Result.ALLOW);
|
||||
interactEvent.setUseItemInHand(Event.Result.ALLOW);
|
||||
interactEvent.setCancelled(false);
|
||||
}
|
||||
}, plugin, false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if (settingsManager.getIgnoredList(BREAK).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(BREAK, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlace(BlockPlaceEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if (settingsManager.getIgnoredList(PLACE).contains(block.getType().name())) {
|
||||
return;
|
||||
}
|
||||
if (protectionManager.can(PLACE, block.getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDamage(EntityDamageByEntityEvent event) {
|
||||
Entity damager = event.getDamager();
|
||||
if (!(damager instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
Player victim = event.getEntity() instanceof Player ? ((Player) event.getEntity()) : null;
|
||||
if (protectionManager.can(DAMAGE, event.getEntity().getLocation(), (Player) damager, victim)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
InventoryHolder holder = event.getInventory().getHolder();
|
||||
Location location = getLocation(holder);
|
||||
if (holder instanceof Entity && holder == event.getPlayer()) return;
|
||||
if (location == null) return;
|
||||
|
||||
if (protectionManager.can(CONTAINER, location, ((Player) event.getPlayer()))) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (protectionManager.can(INTERACT_ENTITY, event.getRightClicked().getLocation(), event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
if (event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
ProtectionManager.Action action = getInteractEventAction(event);
|
||||
if (protectionManager.can(action, event.getClickedBlock().getLocation(), event.getPlayer())) {
|
||||
event.setUseItemInHand(Event.Result.DENY);
|
||||
event.setUseInteractedBlock(Event.Result.DENY);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable Location getLocation(@Nullable InventoryHolder holder) {
|
||||
if (holder instanceof BlockState) {
|
||||
return ((BlockState) holder).getLocation();
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent.Cause.PLAYER_KILLED;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,7 @@ public class PlayerDeath extends SCListener {
|
||||
// record death for victim
|
||||
victimCp.addDeath();
|
||||
plugin.getStorageManager().updateClanPlayer(victimCp);
|
||||
plugin.getStorageManager().updateClanPlayer(attackerCp);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -98,7 +100,7 @@ public class PlayerDeath extends SCListener {
|
||||
}
|
||||
player.sendMessage(ChatColor.AQUA + lang("player.got.money", player, money,
|
||||
victim.getName(), attacker.getKDR()));
|
||||
plugin.getPermissionsManager().playerGrantMoney(player, money);
|
||||
plugin.getPermissionsManager().grantPlayer(player, money, PLAYER_KILLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.managers;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.CreateClanEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent.Cause;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
@@ -29,6 +31,7 @@ import java.util.logging.Level;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
/**
|
||||
@@ -393,8 +396,9 @@ public final class ClanManager {
|
||||
if (plugin.getSettingsManager().is(DISABLE_MESSAGES)) {
|
||||
return;
|
||||
}
|
||||
plugin.getProxyManager().sendMessage("ALL", ChatColor.DARK_GRAY + "* " + ChatColor.AQUA + msg);
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.AQUA + "[" + lang("server.announce") + "] " + ChatColor.WHITE + msg);
|
||||
|
||||
plugin.getProxyManager().sendMessage("ALL", ChatColor.DARK_GRAY + "* " + AQUA + msg);
|
||||
Bukkit.getConsoleSender().sendMessage(AQUA + "[" + lang("server.announce") + "] " + ChatColor.WHITE + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -524,7 +528,7 @@ public final class ClanManager {
|
||||
if (h.getType().equals(XMaterial.CHAINMAIL_HELMET.parseMaterial())) {
|
||||
out += ChatColor.WHITE + lang("armor.h", player);
|
||||
} else if (h.getType().equals(XMaterial.DIAMOND_HELMET.parseMaterial())) {
|
||||
out += ChatColor.AQUA + lang("armor.h", player);
|
||||
out += AQUA + lang("armor.h", player);
|
||||
} else if (h.getType().equals(XMaterial.GOLDEN_HELMET.parseMaterial())) {
|
||||
out += ChatColor.YELLOW + lang("armor.h", player);
|
||||
} else if (h.getType().equals(XMaterial.IRON_HELMET.parseMaterial())) {
|
||||
@@ -543,7 +547,7 @@ public final class ClanManager {
|
||||
if (c.getType().equals(XMaterial.CHAINMAIL_CHESTPLATE.parseMaterial())) {
|
||||
out += ChatColor.WHITE + lang("armor.c", player);
|
||||
} else if (c.getType().equals(XMaterial.DIAMOND_CHESTPLATE.parseMaterial())) {
|
||||
out += ChatColor.AQUA + lang("armor.c", player);
|
||||
out += AQUA + lang("armor.c", player);
|
||||
} else if (c.getType().equals(XMaterial.GOLDEN_CHESTPLATE.parseMaterial())) {
|
||||
out += ChatColor.YELLOW + lang("armor.c", player);
|
||||
} else if (c.getType().equals(XMaterial.IRON_CHESTPLATE.parseMaterial())) {
|
||||
@@ -581,7 +585,7 @@ public final class ClanManager {
|
||||
if (b.getType().equals(XMaterial.CHAINMAIL_BOOTS.parseMaterial())) {
|
||||
out += ChatColor.WHITE + lang("armor.B", player);
|
||||
} else if (b.getType().equals(XMaterial.DIAMOND_BOOTS.parseMaterial())) {
|
||||
out += ChatColor.AQUA + lang("armor.B", player);
|
||||
out += AQUA + lang("armor.B", player);
|
||||
} else if (b.getType().equals(XMaterial.GOLDEN_BOOTS.parseMaterial())) {
|
||||
out += ChatColor.YELLOW + lang("armor.B", player);
|
||||
} else if (b.getType().equals(XMaterial.IRON_BOOTS.parseMaterial())) {
|
||||
@@ -620,7 +624,7 @@ public final class ClanManager {
|
||||
|
||||
if (count > 0) {
|
||||
String countString = count > 1 ? count + "" : "";
|
||||
out += ChatColor.AQUA + lang("weapon.S", player) + headColor + countString;
|
||||
out += AQUA + lang("weapon.S", player) + headColor + countString;
|
||||
}
|
||||
|
||||
count = getItemCount(inv, XMaterial.GOLDEN_SWORD);
|
||||
@@ -927,7 +931,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.MEMBER_FEE_SET);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -950,7 +954,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_CREATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -973,7 +977,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_INVITATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -996,7 +1000,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_HOME_TELEPORT);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -1019,7 +1023,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_HOME_TELEPORT_SET);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -1042,10 +1046,10 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.RESET_KDR);
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("account.has.been.debited", player), price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("not.sufficient.money", player), price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1072,29 +1076,25 @@ public final class ClanManager {
|
||||
price = price * VanishUtils.getNonVanished(player, clan).size();
|
||||
}
|
||||
|
||||
if (plugin.getSettingsManager().is(ECONOMY_ISSUER_PAYS_REGROUP)) {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
return false;
|
||||
}
|
||||
if (plugin.getSettingsManager().is(ECONOMY_ISSUER_PAYS_REGROUP) && plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_REGROUP);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
double money = plugin.getPermissionsManager().playerGetMoney(player);
|
||||
switch (clan.withdraw(new BankOperator(player, money), ClanBalanceUpdateEvent.Cause.COMMAND, price)) {
|
||||
case SUCCESS:
|
||||
if (plugin.getPermissionsManager().playerGrantMoney(player, price)) {
|
||||
player.sendMessage(ChatColor.AQUA + lang("player.clan.withdraw", player, price));
|
||||
clan.addBb(player.getName(), ChatColor.AQUA + lang("bb.clan.withdraw", price));
|
||||
case SUCCESS -> {
|
||||
if (plugin.getPermissionsManager().grantPlayer(player, price)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, price));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", price));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case NOT_ENOUGH_BALANCE:
|
||||
player.sendMessage(lang("clan.bank.not.enough.money", player));
|
||||
break;
|
||||
}
|
||||
case NOT_ENOUGH_BALANCE -> player.sendMessage(lang("clan.bank.not.enough.money", player));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1113,7 +1113,7 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().playerChargeMoney(player, price);
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_VERIFICATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
@@ -1146,11 +1146,11 @@ public final class ClanManager {
|
||||
if (command.equals(lang("on", player))) {
|
||||
cp.setGlobalChat(true);
|
||||
plugin.getStorageManager().updateClanPlayer(cp);
|
||||
ChatBlock.sendMessage(player, ChatColor.AQUA + "You have enabled global chat");
|
||||
ChatBlock.sendMessage(player, AQUA + "You have enabled global chat");
|
||||
} else if (command.equals(lang("off", player))) {
|
||||
cp.setGlobalChat(false);
|
||||
plugin.getStorageManager().updateClanPlayer(cp);
|
||||
ChatBlock.sendMessage(player, ChatColor.AQUA + "You have disabled global chat");
|
||||
ChatBlock.sendMessage(player, AQUA + "You have disabled global chat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
+128
-30
@@ -2,23 +2,29 @@ package net.sacredlabyrinth.phaed.simpleclans.managers;
|
||||
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent.Cause;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.ENABLE_AUTO_GROUPS;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PERMISSIONS_AUTO_GROUP_GROUPNAME;
|
||||
import static org.bukkit.Bukkit.getPluginManager;
|
||||
|
||||
/**
|
||||
* @author phaed
|
||||
@@ -50,7 +56,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Whether economy plugin exists and is enabled
|
||||
*
|
||||
*/
|
||||
public boolean hasEconomy() {
|
||||
return economy != null && economy.isEnabled();
|
||||
@@ -80,7 +85,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Adds all permissions for a clan
|
||||
*
|
||||
*/
|
||||
public void updateClanPermissions(Clan clan) {
|
||||
for (ClanPlayer cp : clan.getMembers()) {
|
||||
@@ -90,7 +94,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Adds permissions for a player
|
||||
*
|
||||
*/
|
||||
public void addPlayerPermissions(@Nullable ClanPlayer cp) {
|
||||
if (cp == null) {
|
||||
@@ -120,7 +123,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Removes permissions for a clan (when it gets disbanded for example)
|
||||
*
|
||||
*/
|
||||
public void removeClanPermissions(Clan clan) {
|
||||
for (ClanPlayer cp : clan.getMembers()) {
|
||||
@@ -131,7 +133,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Removes permissions for a player (when he gets kicked for example)
|
||||
*
|
||||
*/
|
||||
public void removeClanPlayerPermissions(@Nullable ClanPlayer cp) {
|
||||
if (cp != null && cp.getClan() != null && cp.toPlayer() != null) {
|
||||
@@ -166,20 +167,128 @@ public final class PermissionsManager {
|
||||
return permissions.get(clan.getTag());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge a player some money
|
||||
*
|
||||
* @deprecated use {@link PermissionsManager#chargePlayer(OfflinePlayer, double)} instead
|
||||
*/
|
||||
@Deprecated(since = "2.19.0", forRemoval = true)
|
||||
public boolean playerChargeMoney(OfflinePlayer player, double money) {
|
||||
return economy.withdrawPlayer(player, money).transactionSuccess();
|
||||
return chargePlayer(player, money);
|
||||
}
|
||||
|
||||
/**
|
||||
* Charges the specified amount of money from the player's account.
|
||||
* <p>
|
||||
* As the {@link EconomyTransactionEvent.Cause} is not passed, this method won't fire the {@link EconomyTransactionEvent}.
|
||||
* Use this method when you don't need to track the cause or handle custom transaction events.
|
||||
* </p>
|
||||
*
|
||||
* @param player The player whose account will be charged.
|
||||
* @param money The amount of money to charge.
|
||||
* @see EconomyTransactionEvent
|
||||
*/
|
||||
public boolean chargePlayer(OfflinePlayer player, double money) {
|
||||
return chargePlayer(player, money, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Charges the specified amount of money from the player's account.
|
||||
*
|
||||
* @param player The player whose account will be charged.
|
||||
* @param money The amount of money to charge.
|
||||
* @param cause The cause of the transaction.
|
||||
* @return {@code true} if the charge was successful, {@code false} otherwise.
|
||||
* @see EconomyTransactionEvent
|
||||
*/
|
||||
public boolean chargePlayer(@NotNull OfflinePlayer player, double money, @Nullable Cause cause) {
|
||||
EconomyResponse response = Objects.requireNonNull(economy, "Can't find economy provider").withdrawPlayer(player, money);
|
||||
if (!response.transactionSuccess()) {
|
||||
return false;
|
||||
} else if (cause == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EconomyTransactionEvent event = new EconomyTransactionEvent(player, money, cause, EconomyTransactionEvent.TransactionType.WITHDRAW);
|
||||
getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
economy.depositPlayer(player, money);
|
||||
return false;
|
||||
}
|
||||
|
||||
// handle EconomyTransactionEvent#setAmount
|
||||
double difference = event.getAmount() - response.amount;
|
||||
if (difference > 0) {
|
||||
economy.withdrawPlayer(player, difference);
|
||||
}
|
||||
if (difference < 0) {
|
||||
economy.depositPlayer(player, Math.abs(difference));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants a player some money
|
||||
*
|
||||
* @deprecated use {@link PermissionsManager#grantPlayer(OfflinePlayer, double)} instead
|
||||
*/
|
||||
@Deprecated(since = "2.19.0", forRemoval = true)
|
||||
public boolean playerGrantMoney(OfflinePlayer player, double money) {
|
||||
return economy.depositPlayer(player, money).transactionSuccess();
|
||||
return grantPlayer(player, money);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants the specified amount of money to the player's account.
|
||||
* <p>
|
||||
* As the {@link EconomyTransactionEvent.Cause} is not passed, this method won't fire the {@link EconomyTransactionEvent}.
|
||||
* Use this method when you don't need to track the cause or handle custom transaction events.
|
||||
* </p>
|
||||
*
|
||||
* @param player The player to whom the money will be granted.
|
||||
* @param money The amount of money to grant.
|
||||
* @see PermissionsManager#grantPlayer(OfflinePlayer, double, Cause)
|
||||
* @see EconomyTransactionEvent
|
||||
*/
|
||||
public boolean grantPlayer(OfflinePlayer player, double money) {
|
||||
return grantPlayer(player, money, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants the specified amount of money to the player's account.
|
||||
*
|
||||
* @param player The player to whom the money will be granted.
|
||||
* @param money The amount of money to grant.
|
||||
* @param cause The cause of the transaction.
|
||||
* @return {@code true} if the grant was successful, {@code false} otherwise.
|
||||
* @see EconomyTransactionEvent
|
||||
*/
|
||||
public boolean grantPlayer(@NotNull OfflinePlayer player, double money, @Nullable Cause cause) {
|
||||
EconomyResponse response = Objects.requireNonNull(economy, "Can't find economy provider").depositPlayer(player, money);
|
||||
if (!response.transactionSuccess() || cause == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EconomyTransactionEvent event = new EconomyTransactionEvent(player, response.amount, cause, EconomyTransactionEvent.TransactionType.DEPOSIT);
|
||||
getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
economy.withdrawPlayer(player, money);
|
||||
return false;
|
||||
}
|
||||
|
||||
// handle EconomyTransactionEvent#setAmount
|
||||
double difference = event.getAmount() - response.amount;
|
||||
if (difference > 0) {
|
||||
economy.depositPlayer(player, difference);
|
||||
}
|
||||
if (difference < 0) {
|
||||
economy.withdrawPlayer(player, Math.abs(difference));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,10 +335,9 @@ public final class PermissionsManager {
|
||||
/**
|
||||
* Checks if the player has the rank permission or the permission level, and the equivalent Bukkit permission
|
||||
*
|
||||
* @param player the player
|
||||
* @param player the player
|
||||
* @param permission the rank permission
|
||||
* @param notify notify the player if they don't have permission
|
||||
*
|
||||
* @param notify notify the player if they don't have permission
|
||||
* @deprecated use {@link PermissionsManager#has(Player, RankPermission, boolean)} or {@link PermissionsManager#has(Player, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -250,14 +358,10 @@ public final class PermissionsManager {
|
||||
|
||||
boolean hasLevel = false;
|
||||
if (level != null) {
|
||||
switch (level) {
|
||||
case LEADER:
|
||||
hasLevel = clanPlayer.isLeader();
|
||||
break;
|
||||
case TRUSTED:
|
||||
hasLevel = clanPlayer.isTrusted();
|
||||
break;
|
||||
}
|
||||
hasLevel = switch (level) {
|
||||
case LEADER -> clanPlayer.isLeader();
|
||||
case TRUSTED -> clanPlayer.isTrusted();
|
||||
};
|
||||
}
|
||||
|
||||
boolean hasRankPermission = false;
|
||||
@@ -282,9 +386,9 @@ public final class PermissionsManager {
|
||||
/**
|
||||
* Checks if the player has the rank permission or the permission level, and the equivalent Bukkit permission
|
||||
*
|
||||
* @param player the player
|
||||
* @param player the player
|
||||
* @param permission the rank permission
|
||||
* @param notify notify the player if they don't have permission
|
||||
* @param notify notify the player if they don't have permission
|
||||
*/
|
||||
public boolean has(Player player, RankPermission permission, boolean notify) {
|
||||
if (player == null || permission == null) {
|
||||
@@ -307,15 +411,10 @@ public final class PermissionsManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasLevel = false;
|
||||
switch (permission.getPermissionLevel()) {
|
||||
case LEADER:
|
||||
hasLevel = clanPlayer.isLeader();
|
||||
break;
|
||||
case TRUSTED:
|
||||
hasLevel = clanPlayer.isTrusted();
|
||||
break;
|
||||
}
|
||||
boolean hasLevel = switch (permission.getPermissionLevel()) {
|
||||
case LEADER -> clanPlayer.isLeader();
|
||||
case TRUSTED -> clanPlayer.isTrusted();
|
||||
};
|
||||
|
||||
boolean hasRankPermission = false;
|
||||
String rankName = clanPlayer.getRankId();
|
||||
@@ -339,7 +438,6 @@ public final class PermissionsManager {
|
||||
|
||||
/**
|
||||
* Gives the player permissions linked to a clan
|
||||
*
|
||||
*/
|
||||
public void addClanPermissions(ClanPlayer cp) {
|
||||
if (!plugin.getSettingsManager().is(ENABLE_AUTO_GROUPS) || cp == null || permission == null) {
|
||||
|
||||
@@ -9,7 +9,10 @@ import net.sacredlabyrinth.phaed.simpleclans.events.WarStartEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.Land;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.ProtectionProvider;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.listeners.LandProtection;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+173
-136
@@ -7,7 +7,6 @@ import net.sacredlabyrinth.phaed.simpleclans.events.WarEndEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -42,124 +41,145 @@ public final class RequestManager {
|
||||
}
|
||||
|
||||
public void addDemoteRequest(ClanPlayer requester, String demotedName, Clan clan) {
|
||||
if (requests.containsKey(clan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("asking.for.the.demotion"), requester.getName(), demotedName);
|
||||
if (requests.containsKey(clan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("asking.for.the.demotion"), requester.getName(), demotedName);
|
||||
|
||||
ClanPlayer demotedTp = plugin.getClanManager().getClanPlayer(UUIDMigration.getForcedPlayerUUID(demotedName));
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(clan.getLeaders());
|
||||
acceptors.remove(demotedTp);
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.DEMOTE, acceptors, requester, demotedName, clan, msg);
|
||||
Request req = new Request(ClanRequest.DEMOTE, acceptors, requester, demotedName, clan, msg);
|
||||
req.vote(requester.getName(), VoteResult.ACCEPT);
|
||||
requests.put(req.getClan().getTag(), req);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addPromoteRequest(ClanPlayer requester, String promotedName, Clan clan) {
|
||||
if (requests.containsKey(clan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("asking.for.the.promotion"), requester.getName(), promotedName);
|
||||
/**
|
||||
* This method asks <i>all</i> leaders about
|
||||
* some action <i>inside</i> their clan.
|
||||
* <p>
|
||||
* Example of possible requests:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>Disband request can be asked from all leaders</li>
|
||||
* <li>Rename request can be asked from all leaders</li>
|
||||
* <li>Promote request can be asked from all leaders</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* Examples of incompatible requests:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>Demote request can be asked from all leaders,
|
||||
* <b>except the demoted one.</b></li>
|
||||
* <li>Invite request has to ask someone <b>outside</b> of leaders clan</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param requester the clan player, who sent the request
|
||||
* @param request the type of request, see: {@link ClanRequest}
|
||||
* @param target the target which will be used in request processing
|
||||
* @param key the language key that would be translated and send the message to all leaders
|
||||
* @param args the language objects, requires in some language strings.
|
||||
* @throws IllegalArgumentException if passed incompatible request
|
||||
*/
|
||||
public void requestAllLeaders(@NotNull ClanPlayer requester, @NotNull ClanRequest request,
|
||||
@NotNull String target, @NotNull String key, @Nullable Object... args) {
|
||||
if (request.equals(ClanRequest.INVITE) || request.equals(ClanRequest.DEMOTE)) {
|
||||
throw new IllegalArgumentException("Unsupported request: " + request.name());
|
||||
}
|
||||
|
||||
Clan clan = requester.getClan();
|
||||
if (clan == null || requests.containsKey(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = MessageFormat.format(lang(key), args);
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(clan.getLeaders());
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.PROMOTE, acceptors, requester, promotedName, clan, msg);
|
||||
requests.put(req.getClan().getTag(), req);
|
||||
req.vote(requester.getName(), VoteResult.ACCEPT);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addDisbandRequest(ClanPlayer requester, Clan clan) {
|
||||
if (requests.containsKey(clan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("asking.for.the.deletion"), requester.getName());
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(clan.getLeaders());
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.DISBAND, acceptors, requester, clan.getTag(), clan, msg);
|
||||
Request req = new Request(request, acceptors, requester, target, clan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
req.vote(requester.getName(), VoteResult.ACCEPT);
|
||||
|
||||
ask(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a member invite request
|
||||
*
|
||||
* @param requester the requester
|
||||
* @param requester the requester
|
||||
* @param invitedName the invited Player
|
||||
* @param clan the Clan
|
||||
* @param clan the Clan
|
||||
*/
|
||||
public void addInviteRequest(ClanPlayer requester, String invitedName, Clan clan) {
|
||||
if (requests.containsKey(invitedName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
if (requests.containsKey(invitedName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(invitedName);
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = lang("inviting.you.to.join", player, requester.getName(), clan.getName());
|
||||
Request req = new Request(plugin, ClanRequest.INVITE, null, requester, invitedName, clan, msg);
|
||||
String msg = lang("inviting.you.to.join", player, requester.getName(), clan.getName());
|
||||
Request req = new Request(ClanRequest.INVITE, null, requester, invitedName, clan, msg);
|
||||
requests.put(invitedName.toLowerCase(), req);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addWarStartRequest(ClanPlayer requester, Clan warClan, Clan requestingClan) {
|
||||
if (requests.containsKey(warClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.war"), requestingClan.getName(), ChatUtils.stripColors(warClan.getColorTag()));
|
||||
if (requests.containsKey(warClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.war"), requestingClan.getName(), ChatUtils.stripColors(warClan.getColorTag()));
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(warClan.getLeaders());
|
||||
acceptors.remove(requester);
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.START_WAR, acceptors, requester, warClan.getTag(), requestingClan, msg);
|
||||
Request req = new Request(ClanRequest.START_WAR, acceptors, requester, warClan.getTag(), requestingClan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addWarEndRequest(ClanPlayer requester, Clan warClan, Clan requestingClan) {
|
||||
if (requests.containsKey(warClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.to.end.the.war"), requestingClan.getName(), ChatUtils.stripColors(warClan.getColorTag()));
|
||||
if (requests.containsKey(warClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.to.end.the.war"), requestingClan.getName(), ChatUtils.stripColors(warClan.getColorTag()));
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(warClan.getLeaders());
|
||||
acceptors.remove(requester);
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.END_WAR, acceptors, requester, warClan.getTag(), requestingClan, msg);
|
||||
Request req = new Request(ClanRequest.END_WAR, acceptors, requester, warClan.getTag(), requestingClan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addAllyRequest(ClanPlayer requester, Clan allyClan, Clan requestingClan) {
|
||||
if (requests.containsKey(allyClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.an.alliance"), requestingClan.getName(), ChatUtils.stripColors(allyClan.getColorTag()));
|
||||
if (requests.containsKey(allyClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.an.alliance"), requestingClan.getName(), ChatUtils.stripColors(allyClan.getColorTag()));
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(allyClan.getLeaders());
|
||||
acceptors.remove(requester);
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.CREATE_ALLY, acceptors, requester, allyClan.getTag(), requestingClan, msg);
|
||||
Request req = new Request(ClanRequest.CREATE_ALLY, acceptors, requester, allyClan.getTag(), requestingClan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
ask(req);
|
||||
}
|
||||
|
||||
public void addRivalryBreakRequest(ClanPlayer requester, Clan rivalClan, Clan requestingClan) {
|
||||
if (requests.containsKey(rivalClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.to.end.the.rivalry"), requestingClan.getName(), ChatUtils.stripColors(rivalClan.getColorTag()));
|
||||
if (requests.containsKey(rivalClan.getTag())) {
|
||||
return;
|
||||
}
|
||||
String msg = MessageFormat.format(lang("proposing.to.end.the.rivalry"), requestingClan.getName(), ChatUtils.stripColors(rivalClan.getColorTag()));
|
||||
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(rivalClan.getLeaders());
|
||||
acceptors.remove(requester);
|
||||
|
||||
Request req = new Request(plugin, ClanRequest.BREAK_RIVALRY, acceptors, requester, rivalClan.getTag(), requestingClan, msg);
|
||||
Request req = new Request(ClanRequest.BREAK_RIVALRY, acceptors, requester, rivalClan.getTag(), requestingClan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
ask(req);
|
||||
}
|
||||
@@ -209,7 +229,7 @@ public final class RequestManager {
|
||||
|
||||
if (maxMembers > 0 && maxMembers > clan.getSize()) {
|
||||
ChatBlock.sendMessageKey(invited, "accepted.invitation", clan.getName());
|
||||
clan.addBb(ChatColor.AQUA + lang("joined.the.clan", invited.getName()));
|
||||
clan.addBb(lang("joined.the.clan", invited.getName()));
|
||||
plugin.getClanManager().serverAnnounce(lang("has.joined", invited.getName(), clan.getName()));
|
||||
clan.addPlayerToClan(cp);
|
||||
} else {
|
||||
@@ -222,86 +242,102 @@ public final class RequestManager {
|
||||
}
|
||||
|
||||
public void processResults(Request req) {
|
||||
Clan requestClan = req.getClan();
|
||||
ClanPlayer requester = req.getRequester();
|
||||
|
||||
String target = req.getTarget();
|
||||
Clan requestClan = req.getClan();
|
||||
ClanPlayer requester = req.getRequester();
|
||||
|
||||
String target = req.getTarget();
|
||||
|
||||
@Nullable
|
||||
Clan targetClan = plugin.getClanManager().getClan(target);
|
||||
Clan targetClan = plugin.getClanManager().getClan(target);
|
||||
|
||||
@Nullable
|
||||
UUID targetPlayer = UUIDMigration.getForcedPlayerUUID(target);
|
||||
|
||||
List<String> accepts = req.getAccepts();
|
||||
List<String> denies = req.getDenies();
|
||||
|
||||
switch (req.getType()) {
|
||||
case START_WAR:
|
||||
processStartWar(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case END_WAR:
|
||||
processEndWar(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case CREATE_ALLY:
|
||||
processCreateAlly(requester, requestClan, targetClan, accepts, denies);
|
||||
UUID targetPlayer = UUIDMigration.getForcedPlayerUUID(target);
|
||||
|
||||
List<String> accepts = req.getAccepts();
|
||||
List<String> denies = req.getDenies();
|
||||
|
||||
switch (req.getType()) {
|
||||
case START_WAR:
|
||||
processStartWar(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case BREAK_RIVALRY:
|
||||
processBreakRivalry(requester, requestClan, targetClan, accepts, denies);
|
||||
case END_WAR:
|
||||
processEndWar(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case DEMOTE: case PROMOTE:
|
||||
if (!req.votingFinished() || targetPlayer == null) {
|
||||
return;
|
||||
}
|
||||
target = requestClan.getTag();
|
||||
|
||||
if (req.getType() == ClanRequest.DEMOTE) {
|
||||
processDemote(req, requestClan, targetPlayer, denies);
|
||||
}
|
||||
if (req.getType() == ClanRequest.PROMOTE) {
|
||||
processPromote(req, requestClan, targetPlayer, denies);
|
||||
}
|
||||
break;
|
||||
case DISBAND:
|
||||
if (!req.votingFinished()) {
|
||||
return;
|
||||
}
|
||||
case CREATE_ALLY:
|
||||
processCreateAlly(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case BREAK_RIVALRY:
|
||||
processBreakRivalry(requester, requestClan, targetClan, accepts, denies);
|
||||
break;
|
||||
case DEMOTE:
|
||||
case PROMOTE:
|
||||
if (!req.votingFinished() || targetPlayer == null) {
|
||||
return;
|
||||
}
|
||||
target = requestClan.getTag();
|
||||
|
||||
if (req.getType() == ClanRequest.DEMOTE) {
|
||||
processDemote(req, requestClan, targetPlayer, denies);
|
||||
}
|
||||
if (req.getType() == ClanRequest.PROMOTE) {
|
||||
processPromote(req, requestClan, targetPlayer, denies);
|
||||
}
|
||||
break;
|
||||
case DISBAND:
|
||||
if (!req.votingFinished()) {
|
||||
return;
|
||||
}
|
||||
processDisband(requester, requestClan, denies);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
case RENAME:
|
||||
if (!req.votingFinished()) {
|
||||
return;
|
||||
}
|
||||
|
||||
processRename(req);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
requests.remove(target);
|
||||
SimpleClans.getInstance().getServer().getPluginManager().callEvent(new RequestFinishedEvent(req));
|
||||
req.cleanVotes();
|
||||
}
|
||||
|
||||
private void processRename(Request request) {
|
||||
if (request.getDenies().isEmpty()) {
|
||||
request.getClan().setName(request.getTarget());
|
||||
} else {
|
||||
String deniers = String.join(", ", request.getDenies());
|
||||
request.getClan().leaderAnnounce(RED + lang("rename.refused", deniers));
|
||||
}
|
||||
}
|
||||
|
||||
private void processDisband(ClanPlayer requester, Clan requestClan, List<String> denies) {
|
||||
if (denies.isEmpty()) {
|
||||
if (denies.isEmpty()) {
|
||||
requestClan.disband(requester.toPlayer(), true, false);
|
||||
} else {
|
||||
String deniers = String.join(", ", denies);
|
||||
requestClan.leaderAnnounce(RED + lang("clan.deletion", deniers));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String deniers = String.join(", ", denies);
|
||||
requestClan.leaderAnnounce(RED + lang("clan.deletion", deniers));
|
||||
}
|
||||
}
|
||||
|
||||
private void processPromote(Request req, Clan requestClan, UUID targetPlayer, List<String> denies) {
|
||||
String promotedName = req.getTarget();
|
||||
if (denies.isEmpty()) {
|
||||
requestClan.addBb(lang("leaders"), ChatColor.AQUA + lang("promoted.to.leader", promotedName));
|
||||
requestClan.promote(targetPlayer);
|
||||
} else {
|
||||
String deniers = String.join(", ", denies);
|
||||
requestClan.leaderAnnounce(RED + lang("denied.the.promotion", deniers, promotedName));
|
||||
}
|
||||
}
|
||||
private void processPromote(Request req, Clan requestClan, UUID targetPlayer, List<String> denies) {
|
||||
String promotedName = req.getTarget();
|
||||
if (denies.isEmpty()) {
|
||||
requestClan.addBb(lang("leaders"), lang("promoted.to.leader", promotedName));
|
||||
requestClan.promote(targetPlayer);
|
||||
} else {
|
||||
String deniers = String.join(", ", denies);
|
||||
requestClan.leaderAnnounce(RED + lang("denied.the.promotion", deniers, promotedName));
|
||||
}
|
||||
}
|
||||
|
||||
private void processDemote(Request req, Clan requestClan, UUID targetPlayer, List<String> denies) {
|
||||
private void processDemote(Request req, Clan requestClan, UUID targetPlayer, List<String> denies) {
|
||||
String demotedName = req.getTarget();
|
||||
if (denies.isEmpty()) {
|
||||
requestClan.addBb(lang("leaders"), ChatColor.AQUA
|
||||
+ lang("demoted.back.to.member", demotedName));
|
||||
requestClan.addBb(lang("leaders"), lang("demoted.back.to.member", demotedName));
|
||||
requestClan.demote(targetPlayer);
|
||||
} else {
|
||||
String deniers = String.join(", ", denies);
|
||||
@@ -315,11 +351,11 @@ public final class RequestManager {
|
||||
if (targetClan != null && requestClan != null) {
|
||||
if (!accepts.isEmpty()) {
|
||||
requestClan.removeRival(targetClan);
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("broken.the.rivalry", accepts.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("broken.the.rivalry.with", requester.getName(), targetClan.getName()));
|
||||
targetClan.addBb(requester.getName(), lang("broken.the.rivalry", accepts.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), lang("broken.the.rivalry.with", requester.getName(), targetClan.getName()));
|
||||
} else {
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("denied.to.make.peace", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("peace.agreement.denied", targetClan.getName()));
|
||||
targetClan.addBb(requester.getName(), lang("denied.to.make.peace", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), lang("peace.agreement.denied", targetClan.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -330,11 +366,11 @@ public final class RequestManager {
|
||||
if (!accepts.isEmpty()) {
|
||||
requestClan.addAlly(targetClan);
|
||||
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("accepted.an.alliance", accepts.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("created.an.alliance", requester.getName(), targetClan.getName()));
|
||||
targetClan.addBb(requester.getName(), lang("accepted.an.alliance", accepts.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), lang("created.an.alliance", requester.getName(), targetClan.getName()));
|
||||
} else {
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("denied.an.alliance", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("the.alliance.was.denied", targetClan.getName()));
|
||||
targetClan.addBb(requester.getName(), lang("denied.an.alliance", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), lang("the.alliance.was.denied", targetClan.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,11 +384,11 @@ public final class RequestManager {
|
||||
requestClan.removeWarringClan(targetClan);
|
||||
targetClan.removeWarringClan(requestClan);
|
||||
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("you.are.no.longer.at.war", accepts.get(0), requestClan.getColorTag()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("you.are.no.longer.at.war", requestClan.getName(), targetClan.getColorTag()));
|
||||
targetClan.addBb(requester.getName(), lang("you.are.no.longer.at.war", accepts.get(0), requestClan.getColorTag()));
|
||||
requestClan.addBb(requester.getName(), lang("you.are.no.longer.at.war", requestClan.getName(), targetClan.getColorTag()));
|
||||
} else {
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("denied.war.end", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("end.war.denied", targetClan.getName()));
|
||||
targetClan.addBb(requester.getName(), lang("denied.war.end", denies.get(0), requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), lang("end.war.denied", targetClan.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,9 +399,9 @@ public final class RequestManager {
|
||||
if (!accepts.isEmpty()) {
|
||||
plugin.getProtectionManager().addWar(requester, requestClan, targetClan);
|
||||
} else {
|
||||
targetClan.addBb(requester.getName(), ChatColor.AQUA + lang("denied.war.req", denies.get(0),
|
||||
targetClan.addBb(requester.getName(), lang("denied.war.req", denies.get(0),
|
||||
requestClan.getName()));
|
||||
requestClan.addBb(requester.getName(), ChatColor.AQUA + lang("end.war.denied",
|
||||
requestClan.addBb(requester.getName(), lang("end.war.denied",
|
||||
targetClan.getName()));
|
||||
}
|
||||
}
|
||||
@@ -406,10 +442,10 @@ public final class RequestManager {
|
||||
* Starts the task that asks for the votes of all requests
|
||||
*/
|
||||
public void askerTask() {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Iterator<Map.Entry<String, Request>> iter = requests.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Request req = iter.next().getValue();
|
||||
|
||||
@@ -422,9 +458,10 @@ public final class RequestManager {
|
||||
}
|
||||
|
||||
ask(req);
|
||||
req.incrementAskCount();
|
||||
}
|
||||
}}.runTaskTimerAsynchronously(plugin, 0, plugin.getSettingsManager().getSeconds(REQUEST_FREQUENCY));
|
||||
req.incrementAskCount();
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(plugin, 0, plugin.getSettingsManager().getSeconds(REQUEST_FREQUENCY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -307,13 +307,14 @@ public final class SettingsManager {
|
||||
ALLOW_RESET_KDR("settings.allow-reset-kdr", false),
|
||||
REJOIN_COOLDOWN("settings.rejoin-cooldown", 60),
|
||||
ENABLE_REJOIN_COOLDOWN("settings.rejoin-cooldown-enabled", false),
|
||||
ACCEPT_OTHER_ALPHABETS_LETTERS("settings.accept-other-alphabets-letters-on-tag", false),
|
||||
RANKING_TYPE("settings.ranking-type", "DENSE"),
|
||||
LIST_DEFAULT_ORDER_BY("settings.list-default-order-by", "kdr"),
|
||||
LORE_LENGTH("settings.lore-length", 36),
|
||||
PVP_ONLY_WHILE_IN_WAR("settings.pvp-only-while-at-war", false),
|
||||
PAST_CLANS_LIMIT("settings.past-clans-limit", 10),
|
||||
USERNAME_REGEX("settings.username-regex", "^\\**[a-zA-Z0-9_$]{1,16}$"),
|
||||
TAG_REGEX("settings.tag-regex", ""),
|
||||
ACCEPT_OTHER_ALPHABETS_LETTERS("settings.accept-other-alphabets-letters-on-tag", false),
|
||||
/*
|
||||
================
|
||||
> Tag Settings
|
||||
@@ -321,12 +322,12 @@ public final class SettingsManager {
|
||||
*
|
||||
*/
|
||||
TAG_DEFAULT_COLOR("tag.default-color", "8"),
|
||||
TAG_MAX_LENGTH("tag.max-length", 5),
|
||||
TAG_BRACKET_COLOR("tag.bracket.color", "8"),
|
||||
TAG_BRACKET_LEADER_COLOR("tag.bracket.leader-color", "4"),
|
||||
TAG_BRACKET_LEFT("tag.bracket.left", ""),
|
||||
TAG_BRACKET_RIGHT("tag.bracket.right", ""),
|
||||
TAG_MAX_LENGTH("tag.max-length", 5),
|
||||
TAG_MIN_LENGTH("tag.min-length", 2),
|
||||
TAG_BRACKET_RIGHT("tag.bracket.right", ""),
|
||||
TAG_SEPARATOR_COLOR("tag.separator.color", "8"),
|
||||
TAG_SEPARATOR_LEADER_COLOR("tag.separator.leader-color", "4"),
|
||||
TAG_SEPARATOR_CHAR("tag.separator.char", " ."),
|
||||
@@ -514,8 +515,7 @@ public final class SettingsManager {
|
||||
> BB Settings
|
||||
================
|
||||
*/
|
||||
BB_COLOR("bb.color", "e"),
|
||||
BB_ACCENT_COLOR("bb.accent-color", "8"),
|
||||
BB_PREFIX("bb.prefix", "&8* &e"),
|
||||
BB_SHOW_ON_LOGIN("bb.show-on-login", true),
|
||||
BB_SIZE("bb.size", 6),
|
||||
BB_LOGIN_SIZE("bb.login-size", 6),
|
||||
|
||||
@@ -20,10 +20,12 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
@@ -899,7 +901,7 @@ public final class StorageManager {
|
||||
public void deleteClanPlayer(ClanPlayer cp) {
|
||||
final Clan clan = cp.getClan();
|
||||
if (clan != null) {
|
||||
clan.addBbWithoutSaving(ChatColor.AQUA + MessageFormat.format(lang("has.been.purged"), cp.getName()));
|
||||
clan.addBbWithoutSaving(MessageFormat.format(lang("has.been.purged"), cp.getName()));
|
||||
updateClan(clan, false);
|
||||
}
|
||||
plugin.getProxyManager().sendDelete(cp);
|
||||
@@ -1221,9 +1223,11 @@ public final class StorageManager {
|
||||
|
||||
/**
|
||||
* Saves modified Clans and ClanPlayers to the database
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* @since 2.10.2
|
||||
* @since 2.10.2
|
||||
*
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
* </p>
|
||||
*/
|
||||
public void saveModified() {
|
||||
try (PreparedStatement pst = prepareUpdateClanPlayerStatement(core.getConnection())) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.migrations;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
|
||||
/**
|
||||
* Class responsible to migrate from old bb format to new one.
|
||||
* <p>
|
||||
* `bb.accent-color` and `bb.color` replaced to `bb.prefix`.
|
||||
* </p>
|
||||
*
|
||||
* @since 2.19.0
|
||||
*/
|
||||
public class BbMigration extends ConfigMigration {
|
||||
|
||||
public BbMigration(SettingsManager settingsManager) {
|
||||
super(settingsManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate() {
|
||||
if (config.contains("bb.accent-color")) {
|
||||
config.set("bb.accent-color", null);
|
||||
}
|
||||
|
||||
if (config.contains("bb.color")) {
|
||||
config.set("bb.color", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.migrations;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
|
||||
/**
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public class ChatFormatMigration extends ConfigMigration {
|
||||
|
||||
public ChatFormatMigration(SettingsManager settingsManager) {
|
||||
super(settingsManager);
|
||||
}
|
||||
|
||||
public void migrateClanChat() {
|
||||
if (config.getString("clanchat.name-color") == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(CLANCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(CLANCHAT_BRACKET_LEFT));
|
||||
sb.append("%clan%");
|
||||
sb.append("&");
|
||||
sb.append(settings.getColored(CLANCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(CLANCHAT_BRACKET_RIGHT));
|
||||
sb.append(" ");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(CLANCHAT_NAME_COLOR));
|
||||
sb.append(settings.getString(CLANCHAT_PLAYER_BRACKET_LEFT));
|
||||
sb.append("%nick-color%");
|
||||
sb.append("%player%");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(CLANCHAT_NAME_COLOR));
|
||||
sb.append(settings.getString(CLANCHAT_PLAYER_BRACKET_RIGHT));
|
||||
sb.append(" %rank%: ");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(CLANCHAT_MESSAGE_COLOR));
|
||||
sb.append("%message%");
|
||||
|
||||
config.set("clanchat.format", sb.toString());
|
||||
config.set("clanchat.rank", "&f[%rank%&f]");
|
||||
config.set("clanchat.rank.color", null);
|
||||
config.set("clanchat.name-color", null);
|
||||
config.set("clanchat.player-bracket", null);
|
||||
config.set("clanchat.message-color", null);
|
||||
config.set("clanchat.tag-bracket", null);
|
||||
}
|
||||
|
||||
public void migrateAllyChat() {
|
||||
//Checks if the old format is still in use
|
||||
if (config.getString("allychat.tag-color") == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(ALLYCHAT_BRACKET_lEFT));
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_TAG_COLOR));
|
||||
sb.append(settings.getString(COMMANDS_ALLY));
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(ALLYCHAT_BRACKET_RIGHT));
|
||||
sb.append(" ");
|
||||
sb.append("&4<%clan%&4> ");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(ALLYCHAT_PLAYER_BRACKET_LEFT));
|
||||
sb.append("%nick-color%");
|
||||
sb.append("%player%");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(settings.getString(ALLYCHAT_PLAYER_BRACKET_RIGHT));
|
||||
sb.append(" %rank%: ");
|
||||
sb.append('&');
|
||||
sb.append(settings.getColored(ALLYCHAT_MESSAGE_COLOR));
|
||||
sb.append("%message%");
|
||||
|
||||
config.set("allychat.format", sb.toString());
|
||||
config.set("allychat.rank", "&f[%rank%&f]");
|
||||
config.set("allychat.tag-color", null);
|
||||
config.set("allychat.name-color", null);
|
||||
config.set("allychat.player-bracket", null);
|
||||
config.set("allychat.message-color", null);
|
||||
config.set("allychat.tag-bracket", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate() {
|
||||
migrateClanChat();
|
||||
migrateAllyChat();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.migrations;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public abstract class ConfigMigration implements Migration {
|
||||
|
||||
protected final SettingsManager settings;
|
||||
protected final FileConfiguration config;
|
||||
|
||||
public ConfigMigration(SettingsManager settingsManager) {
|
||||
this.settings = settingsManager;
|
||||
this.config = settings.getConfig();
|
||||
|
||||
migrate();
|
||||
settings.save();
|
||||
}
|
||||
}
|
||||
+19
-26
@@ -1,37 +1,29 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.language;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
package net.sacredlabyrinth.phaed.simpleclans.migrations;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Utility class that migrates old language files (yaml) to the new format (properties)
|
||||
*
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*
|
||||
*/
|
||||
public class LanguageMigration {
|
||||
|
||||
private SimpleClans plugin;
|
||||
public class LanguageMigration implements Migration {
|
||||
|
||||
private final SimpleClans plugin;
|
||||
|
||||
public LanguageMigration(SimpleClans plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Migrates all language files in the plugin's data folder
|
||||
*/
|
||||
@@ -43,7 +35,7 @@ public class LanguageMigration {
|
||||
File[] languageFiles = dataFolder.listFiles(f -> {
|
||||
return f.getName().startsWith("language") && f.getName().endsWith(".yml");
|
||||
});
|
||||
|
||||
|
||||
for (File file : languageFiles) {
|
||||
convert(file);
|
||||
backup(file);
|
||||
@@ -53,21 +45,22 @@ public class LanguageMigration {
|
||||
|
||||
/**
|
||||
* Copies the file to the backup folder
|
||||
*
|
||||
* @param file the file to backup
|
||||
*
|
||||
* @param file the file to back up
|
||||
*/
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private void backup(File file) {
|
||||
File backupFolder = new File(plugin.getDataFolder(), "language_backup");
|
||||
if (!backupFolder.exists()) {
|
||||
backupFolder.mkdir();
|
||||
}
|
||||
|
||||
file.renameTo(new File(backupFolder, file.getName()));
|
||||
|
||||
file.renameTo(new File(backupFolder, file.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the yaml file to properties
|
||||
*
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
private void convert(File file) {
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.migrations;
|
||||
|
||||
public interface Migration {
|
||||
|
||||
void migrate();
|
||||
}
|
||||
+1
-1
@@ -5,8 +5,8 @@ import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.proxy.listeners;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.proxy.BungeeManager;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.debug;
|
||||
@@ -15,6 +16,14 @@ public class DeleteClan extends MessageListener {
|
||||
public void accept(ByteArrayDataInput data) {
|
||||
String tag = data.readUTF();
|
||||
getClanManager().removeClan(tag);
|
||||
for (ClanPlayer cp : getClanManager().getAllClanPlayers()) {
|
||||
if (tag.equals(cp.getTag())) {
|
||||
cp.setClan(null);
|
||||
cp.setJoinDate(0);
|
||||
cp.setRank(null);
|
||||
cp.setLeader(false);
|
||||
}
|
||||
}
|
||||
debug(String.format("Deleted clan %s", tag));
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class CollectFeeTask extends BukkitRunnable {
|
||||
|
||||
for (ClanPlayer cp : clan.getFeePayers()) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(cp.getUniqueId());
|
||||
boolean success = pm.playerChargeMoney(player, memberFee);
|
||||
boolean success = pm.chargePlayer(player, memberFee);
|
||||
if (success) {
|
||||
ChatBlock.sendMessage(cp, AQUA + lang("fee.collected", cp, memberFee));
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CollectFeeTask extends BukkitRunnable {
|
||||
plugin.getStorageManager().updateClan(clan);
|
||||
} else {
|
||||
clan.removePlayerFromClan(cp.getUniqueId());
|
||||
clan.addBb(AQUA + lang("bb.fee.player.kicked", cp.getName()));
|
||||
clan.addBb(lang("bb.fee.player.kicked", cp.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.text.MessageFormat;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -60,7 +59,7 @@ public class CollectUpkeepTask extends BukkitRunnable {
|
||||
clan.disband(null, true, false);
|
||||
}
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
clan.addBb(AQUA + MessageFormat.format(lang("upkeep.collected"), upkeep), false);
|
||||
clan.addBb(MessageFormat.format(lang("upkeep.collected"), upkeep), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.threads;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -27,7 +27,7 @@ import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.COMMANDS_CLAN;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ public class InventoryController implements Listener {
|
||||
if (!(entity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
frames.remove(entity.getUniqueId());
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ public class InventoryController implements Listener {
|
||||
if (frame == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
|
||||
if (event.getClickedInventory() == null || event.getClickedInventory().getType() == InventoryType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SCComponent component = frame.getComponent(event.getSlot());
|
||||
if (component == null) {
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ public class InventoryController implements Listener {
|
||||
InventoryDrawer.open(new WarningFrame(frame, (Player) entity, null));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Object permission = component.getPermission(click);
|
||||
if (permission != null) {
|
||||
if (!hasPermission((Player) entity, permission)) {
|
||||
@@ -124,7 +124,7 @@ public class InventoryController implements Listener {
|
||||
|
||||
/**
|
||||
* Checks if the player has the permission
|
||||
*
|
||||
*
|
||||
* @param player the Player
|
||||
* @param permission the permission
|
||||
* @return true if they have permission
|
||||
@@ -147,8 +147,8 @@ public class InventoryController implements Listener {
|
||||
/**
|
||||
* Registers the frame in the InventoryController
|
||||
* @param frame the frame
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
*/
|
||||
public static void register(@NotNull SCFrame frame) {
|
||||
frames.put(frame.getViewer().getUniqueId(), frame);
|
||||
@@ -169,15 +169,16 @@ public class InventoryController implements Listener {
|
||||
* @param player the Player
|
||||
* @param subcommand the subcommand
|
||||
* @param update whether to update the inventory instead of closing
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
* </p>
|
||||
*/
|
||||
public static void runSubcommand(@NotNull Player player, @NotNull String subcommand, boolean update, String... args) {
|
||||
SimpleClans plugin = SimpleClans.getInstance();
|
||||
String baseCommand = plugin.getSettingsManager().getString(COMMANDS_CLAN);
|
||||
String finalCommand = String.format("%s %s ", baseCommand, subcommand) + String.join(" ", args);
|
||||
new BukkitRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.performCommand(finalCommand);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.RankPermission;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.RankPermission;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Class that represents a button
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.ui;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RoinujNosde
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.ui.frames;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.RankPermission;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
|
||||
@@ -17,7 +17,8 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.ECONOMY_INVITE_PRICE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.ECONOMY_PURCHASE_CLAN_INVITE;
|
||||
|
||||
public class InviteFrame extends SCFrame {
|
||||
|
||||
|
||||
@@ -87,19 +87,24 @@ public class MainFrame extends SCFrame {
|
||||
}
|
||||
|
||||
public void addResetKdr() {
|
||||
List<String> resetKrLore;
|
||||
if (!plugin.getPermissionsManager().has(getViewer(), "simpleclans.vip.resetkdr")) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> resetKdrLore;
|
||||
if (plugin.getSettingsManager().is(ECONOMY_PURCHASE_RESET_KDR)) {
|
||||
resetKrLore = Arrays.asList(
|
||||
resetKdrLore = Arrays.asList(
|
||||
lang("gui.main.reset.kdr.lore.price", getViewer(), plugin.getSettingsManager().getString(ECONOMY_RESET_KDR_PRICE)),
|
||||
lang("gui.main.reset.kdr.lore", getViewer()));
|
||||
} else {
|
||||
resetKrLore = Collections.singletonList(lang("gui.main.reset.kdr.lore", getViewer()));
|
||||
resetKdrLore = Collections.singletonList(lang("gui.main.reset.kdr.lore", getViewer()));
|
||||
}
|
||||
SCComponent resetKdr = new SCComponentImpl(lang("gui.main.reset.kdr.title", getViewer()),
|
||||
resetKrLore, XMaterial.ANVIL, 5);
|
||||
resetKdrLore, XMaterial.ANVIL, 5);
|
||||
resetKdr.setListener(ClickType.LEFT, () -> InventoryController.runSubcommand(getViewer(), "resetkdr", false));
|
||||
resetKdr.setConfirmationRequired(ClickType.LEFT);
|
||||
resetKdr.setPermission(ClickType.LEFT, "simpleclans.vip.resetkdr");
|
||||
|
||||
add(resetKdr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ChatFormatMigration {
|
||||
|
||||
SimpleClans plugin = SimpleClans.getInstance();
|
||||
|
||||
|
||||
public void migrateClanChat() {
|
||||
SettingsManager sm = plugin.getSettingsManager();
|
||||
FileConfiguration c = sm.getConfig();
|
||||
|
||||
if (c.getString("clanchat.name-color") == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(CLANCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(CLANCHAT_BRACKET_LEFT));
|
||||
sb.append("%clan%");
|
||||
sb.append("&");
|
||||
sb.append(sm.getColored(CLANCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(CLANCHAT_BRACKET_RIGHT));
|
||||
sb.append(" ");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(CLANCHAT_NAME_COLOR));
|
||||
sb.append(sm.getString(CLANCHAT_PLAYER_BRACKET_LEFT));
|
||||
sb.append("%nick-color%");
|
||||
sb.append("%player%");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(CLANCHAT_NAME_COLOR));
|
||||
sb.append(sm.getString(CLANCHAT_PLAYER_BRACKET_RIGHT));
|
||||
sb.append(" %rank%: ");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(CLANCHAT_MESSAGE_COLOR));
|
||||
sb.append("%message%");
|
||||
|
||||
c.set("clanchat.format", sb.toString());
|
||||
c.set("clanchat.rank", "&f[%rank%&f]");
|
||||
c.set("clanchat.rank.color", null);
|
||||
c.set("clanchat.name-color", null);
|
||||
c.set("clanchat.player-bracket", null);
|
||||
c.set("clanchat.message-color", null);
|
||||
c.set("clanchat.tag-bracket", null);
|
||||
sm.save();
|
||||
}
|
||||
|
||||
public void migrateAllyChat() {
|
||||
SettingsManager sm = SimpleClans.getInstance().getSettingsManager();
|
||||
FileConfiguration c = sm.getConfig();
|
||||
|
||||
//Checks if the old format is still in use
|
||||
if (c.getString("allychat.tag-color") == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(ALLYCHAT_BRACKET_lEFT));
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_TAG_COLOR));
|
||||
sb.append(sm.getString(COMMANDS_ALLY));
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(ALLYCHAT_BRACKET_RIGHT));
|
||||
sb.append(" ");
|
||||
sb.append("&4<%clan%&4> ");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(ALLYCHAT_PLAYER_BRACKET_LEFT));
|
||||
sb.append("%nick-color%");
|
||||
sb.append("%player%");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_BRACKET_COLOR));
|
||||
sb.append(sm.getString(ALLYCHAT_PLAYER_BRACKET_RIGHT));
|
||||
sb.append(" %rank%: ");
|
||||
sb.append('&');
|
||||
sb.append(sm.getColored(ALLYCHAT_MESSAGE_COLOR));
|
||||
sb.append("%message%");
|
||||
|
||||
c.set("allychat.format", sb.toString());
|
||||
c.set("allychat.rank", "&f[%rank%&f]");
|
||||
c.set("allychat.tag-color", null);
|
||||
c.set("allychat.name-color", null);
|
||||
c.set("allychat.player-bracket", null);
|
||||
c.set("allychat.message-color", null);
|
||||
c.set("allychat.tag-bracket", null);
|
||||
sm.save();
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public class ChatUtils {
|
||||
|
||||
private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("(%([A-Za-z]+)%)");
|
||||
private static final Pattern HEX_COLOR_PATTERN = Pattern.compile("&#([0-9A-Fa-f]{6})");
|
||||
private static final Pattern STRIP_COLOR_PATTERN = Pattern.compile("[&§][0-9a-fA-Fk-orK-OR]");
|
||||
private static final Pattern HEX_STRIP_COLOR_PATTERN = Pattern.compile("([&§]#[0-9A-Fa-f]{6})|([&§][0-9a-fA-Fk-orK-OR])|([&§]x([&§][a-fA-F0-9]){6})");
|
||||
|
||||
static {
|
||||
try {
|
||||
@@ -55,15 +57,13 @@ public class ChatUtils {
|
||||
}
|
||||
|
||||
public static String stripColors(String text) {
|
||||
if (HEX_COLOR_SUPPORT) {
|
||||
Matcher matcher = HEX_COLOR_PATTERN.matcher(text);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, "");
|
||||
}
|
||||
text = matcher.appendTail(buffer).toString();
|
||||
Pattern pattern = HEX_COLOR_SUPPORT ? HEX_STRIP_COLOR_PATTERN : STRIP_COLOR_PATTERN;
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, "");
|
||||
}
|
||||
return oldStripColors(text);
|
||||
return matcher.appendTail(buffer).toString();
|
||||
}
|
||||
|
||||
public static String getLastColorCode(String msg) {
|
||||
@@ -74,7 +74,7 @@ public class ChatUtils {
|
||||
String one = msg.substring(msg.length() - 2, msg.length() - 1);
|
||||
String two = msg.substring(msg.length() - 1);
|
||||
|
||||
if (one.equals("\u00a7")) {
|
||||
if (one.equals("§")) {
|
||||
return one + two;
|
||||
}
|
||||
|
||||
@@ -85,12 +85,6 @@ public class ChatUtils {
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String oldStripColors(String text) {
|
||||
return text.replaceAll("[&][0-9A-Fa-fk-orx]", "")
|
||||
.replaceAll(String.valueOf((char) 194), "") //don't know why
|
||||
.replaceAll("[\u00a7][0-9A-Fa-fk-orx]", "");
|
||||
}
|
||||
|
||||
public static BaseComponent[] toBaseComponents(@Nullable CommandSender receiver, @NotNull String text) {
|
||||
ComponentBuilder builder = new ComponentBuilder("");
|
||||
ArrayList<String> placeholders = new ArrayList<>();
|
||||
|
||||
@@ -36,10 +36,8 @@ public class Paginator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* author: RoinujNosde
|
||||
* @return the total elements
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public int getTotalElements() {
|
||||
if (collection != null) {
|
||||
@@ -49,40 +47,36 @@ public class Paginator {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* author: RoinujNosde
|
||||
* @return the size per page
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public int getSizePerPage() {
|
||||
return sizePerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* author: RoinujNosde
|
||||
* @return the minimal index based on the current page
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public int getMinIndex() {
|
||||
return getCurrentPage() * getSizePerPage();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* author: RoinujNosde
|
||||
* @return the max index based on the current page
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public int getMaxIndex() {
|
||||
return (getCurrentPage() + 1) * getSizePerPage();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the current page, starting at 0
|
||||
* author: RoinujNosde
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* @return the current page, starting at 0
|
||||
*/
|
||||
public int getCurrentPage() {
|
||||
return currentPage;
|
||||
@@ -91,7 +85,9 @@ public class Paginator {
|
||||
/**
|
||||
* Increases the page number if there are elements to display
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
* </p>
|
||||
*/
|
||||
public boolean nextPage() {
|
||||
if (!hasNextPage()) {
|
||||
@@ -111,8 +107,9 @@ public class Paginator {
|
||||
|
||||
/**
|
||||
* Decreases the page number if current {@literal >} 0
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
* </p>
|
||||
*/
|
||||
public boolean previousPage() {
|
||||
if (hasPreviousPage()) {
|
||||
@@ -134,7 +131,9 @@ public class Paginator {
|
||||
* @param index the index
|
||||
* @return if this index will not cause any IndexOutOfBoundsException
|
||||
*
|
||||
* @author RoinujNosde
|
||||
* <p>
|
||||
* author: RoinujNosde
|
||||
* </p>
|
||||
*/
|
||||
public boolean isValidIndex(int index) {
|
||||
return index >= getMinIndex() && index < getMaxIndex() && index < getTotalElements();
|
||||
|
||||
+4
-1
@@ -2,7 +2,10 @@ package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,72 +1,82 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
public class TagValidator {
|
||||
|
||||
private final SimpleClans plugin;
|
||||
private final Player player;
|
||||
private final String tag;
|
||||
private final SettingsManager settings;
|
||||
private final PermissionsManager permissions;
|
||||
@Nullable
|
||||
private Pattern tagRegex;
|
||||
@Nullable
|
||||
private String error;
|
||||
|
||||
public TagValidator(@NotNull SimpleClans plugin, @NotNull Player player, @NotNull String tag) {
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
this.tag = tag;
|
||||
public TagValidator(@NotNull SettingsManager settings, @NotNull PermissionsManager permissions) {
|
||||
this.settings = settings;
|
||||
this.permissions = permissions;
|
||||
|
||||
String regex = settings.getString(TAG_REGEX);
|
||||
if (!regex.isEmpty()) {
|
||||
tagRegex = Pattern.compile(regex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an error message or null if the tag is valid
|
||||
* Validates a clan tag
|
||||
*
|
||||
* @return an error message or null
|
||||
* @param player player who tried to create a clan
|
||||
* @param tag clan tag
|
||||
* @return error message if any
|
||||
*/
|
||||
@Nullable
|
||||
public String getErrorMessage() {
|
||||
String cleanTag = ChatUtils.stripColors(this.tag);
|
||||
if (tag.length() > 255 && plugin.getSettingsManager().is(MYSQL_ENABLE)) {
|
||||
return lang("your.clan.color.tag.cannot.be.longer.than.characters", player, 255);
|
||||
public Optional<String> validate(@NotNull Player player, @NotNull String tag) {
|
||||
error = null;
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
if (tag.length() > 255 && settings.is(MYSQL_ENABLE)) {
|
||||
return Optional.of(lang("your.clan.color.tag.cannot.be.longer.than.characters", player, 255));
|
||||
}
|
||||
|
||||
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.bypass")) {
|
||||
if (plugin.getSettingsManager().isDisallowedWord(cleanTag.toLowerCase())) {
|
||||
error = RED + lang("that.tag.name.is.disallowed", player);
|
||||
if (!permissions.has(player, "simpleclans.mod.bypass")) {
|
||||
if (settings.isDisallowedWord(cleanTag)) {
|
||||
error = lang("that.tag.name.is.disallowed", player);
|
||||
}
|
||||
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.coloredtag") && tag.contains("&")) {
|
||||
error = RED + lang("your.tag.cannot.contain.color.codes", player);
|
||||
if (!permissions.has(player, "simpleclans.leader.coloredtag") && tag.contains("&")) {
|
||||
error = lang("your.tag.cannot.contain.color.codes", player);
|
||||
}
|
||||
if (cleanTag.length() < plugin.getSettingsManager().getInt(TAG_MIN_LENGTH)) {
|
||||
error = RED +
|
||||
lang("your.clan.tag.must.be.longer.than.characters", player,
|
||||
plugin.getSettingsManager().getInt(TAG_MIN_LENGTH));
|
||||
int minLength = settings.getInt(TAG_MIN_LENGTH);
|
||||
if (cleanTag.length() < minLength) {
|
||||
error = lang("your.clan.tag.must.be.longer.than.characters", player, minLength);
|
||||
}
|
||||
if (cleanTag.length() > plugin.getSettingsManager().getInt(TAG_MAX_LENGTH)) {
|
||||
error = RED +
|
||||
lang("your.clan.tag.cannot.be.longer.than.characters", player,
|
||||
plugin.getSettingsManager().getInt(TAG_MAX_LENGTH));
|
||||
int maxLength = settings.getInt(TAG_MAX_LENGTH);
|
||||
if (cleanTag.length() > maxLength) {
|
||||
error = lang("your.clan.tag.cannot.be.longer.than.characters", player, maxLength);
|
||||
}
|
||||
if (plugin.getSettingsManager().hasDisallowedColor(tag)) {
|
||||
error = RED +
|
||||
lang("your.tag.cannot.contain.the.following.colors", player,
|
||||
plugin.getSettingsManager().getDisallowedColorString());
|
||||
if (settings.hasDisallowedColor(tag)) {
|
||||
error = lang("your.tag.cannot.contain.the.following.colors", player, settings.getDisallowedColorString());
|
||||
}
|
||||
}
|
||||
checkAlphabet();
|
||||
|
||||
return error;
|
||||
if (tagRegex == null) {
|
||||
checkAlphabet(player, cleanTag);
|
||||
} else if (!tagRegex.matcher(cleanTag).matches()) {
|
||||
error = lang("your.tag.doesnt.meet.the.requirements", player);
|
||||
}
|
||||
|
||||
return Optional.ofNullable(error);
|
||||
}
|
||||
|
||||
private void checkAlphabet() {
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
String alphabetError = RED + lang("your.clan.tag.can.only.contain.letters.numbers.and.color.codes", player);
|
||||
if (plugin.getSettingsManager().is(ACCEPT_OTHER_ALPHABETS_LETTERS)) {
|
||||
private void checkAlphabet(@NotNull Player player, @NotNull String cleanTag) {
|
||||
String alphabetError = lang("your.clan.tag.can.only.contain.letters.numbers.and.color.codes", player);
|
||||
if (settings.is(ACCEPT_OTHER_ALPHABETS_LETTERS)) {
|
||||
for (char c : cleanTag.toCharArray()) {
|
||||
if (!Character.isLetterOrDigit(c) || Character.isSpaceChar(c)) {
|
||||
error = alphabetError;
|
||||
@@ -75,6 +85,7 @@ public class TagValidator {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cleanTag.matches("[0-9a-zA-Z]*")) {
|
||||
error = alphabetError;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -7,15 +14,6 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RoinujNosde
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.uuid;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author NeT32
|
||||
|
||||
@@ -2,12 +2,12 @@ safe-civilians: false
|
||||
tag:
|
||||
default-color: '8'
|
||||
max-length: 5
|
||||
min-length: 2
|
||||
bracket:
|
||||
color: '8'
|
||||
leader-color: '4'
|
||||
left: ''
|
||||
right: ''
|
||||
min-length: 2
|
||||
separator:
|
||||
color: '8'
|
||||
leader-color: '4'
|
||||
@@ -26,6 +26,7 @@ settings:
|
||||
chat-compatibility-mode: true
|
||||
rival-limit-percent: 50
|
||||
use-colorcode-from-prefix-for-name: true
|
||||
accept-other-alphabets-letters-on-tag: false
|
||||
display-chat-tags: true
|
||||
global-friendly-fire: false
|
||||
unrivable-clans:
|
||||
@@ -49,12 +50,12 @@ settings:
|
||||
allow-reset-kdr: false
|
||||
rejoin-cooldown: 60
|
||||
rejoin-cooldown-enabled: false
|
||||
accept-other-alphabets-letters-on-tag: false
|
||||
ranking-type: "DENSE"
|
||||
list-default-order-by: kdr
|
||||
lore-length: 36
|
||||
past-clans-limit: 10
|
||||
username-regex: '^(\.|\*){0,1}[a-zA-Z0-9_$]{1,16}$'
|
||||
username-regex: '(\.|\*){0,1}[a-zA-Z0-9_$]{1,16}'
|
||||
tag-regex: ''
|
||||
war-and-protection:
|
||||
war-enabled: false
|
||||
land-sharing: true
|
||||
@@ -202,8 +203,7 @@ request:
|
||||
ask-frequency-secs: 60
|
||||
max-asks-per-request: 1440
|
||||
bb:
|
||||
color: e
|
||||
accent-color: '8'
|
||||
prefix: "&8* &e"
|
||||
show-on-login: true
|
||||
size: 6
|
||||
login-size: 6
|
||||
|
||||
@@ -43,8 +43,10 @@ assign.command=assign
|
||||
unassign.command=unassign
|
||||
rival.command=rival
|
||||
bb.command=bb
|
||||
display.command=display
|
||||
clear.command=clear
|
||||
modtag.command=modtag
|
||||
rename.command=rename
|
||||
toggle.command=toggle
|
||||
tag.command=tag
|
||||
deposit.command=deposit
|
||||
@@ -228,6 +230,10 @@ command.description.rank.permissions.available=Lists the available rank permissi
|
||||
command.description.rank.permissions.rank=Lists a rank''s permissions
|
||||
command.description.rank.permissions.add=Adds a permission to a rank
|
||||
command.description.rank.permissions.remove=Removes a permission from a rank
|
||||
command.description.rename=Renames your clan
|
||||
command.description.mod.rename=Renames a clan
|
||||
command.description.locale=Sets your language
|
||||
command.description.mod.locale=Sets player language
|
||||
home-menu=/{0} home{1} - Teleport to clan home-base
|
||||
home-set-menu=/{0} home set{1} - Set the clan''s home base
|
||||
home-clear-menu=/{0} home clear{1} - Clear the clan''s home base
|
||||
@@ -288,6 +294,7 @@ membership.invitation={0} has denied the membership invitation
|
||||
joined.the.clan={0} has joined the clan
|
||||
signed.off.request.cancelled={0} has signed off. {1} request cancelled.
|
||||
clan.deletion={0} denied the clan deletion. Consensus failed.
|
||||
rename.refused={0} denied the clan rename. Consensus failed.
|
||||
has.been.disbanded=Clan {0} has been disbanded
|
||||
denied.the.promotion={0} denied the promotion of {1}. Consensus failed.
|
||||
demoted.back.to.member={0} has been demoted back to member
|
||||
@@ -303,9 +310,10 @@ has.joined={0} has joined {1}
|
||||
proposing.to.end.the.rivalry={0} is proposing to end the rivalry with {1}
|
||||
proposing.an.alliance={0} is proposing an alliance with {1}
|
||||
inviting.you.to.join={0} is inviting you to join {1}
|
||||
asking.for.the.deletion={0} is asking for the deletion of the clan
|
||||
asking.for.the.promotion={0} is asking for the promotion of {1}
|
||||
asking.for.the.demotion={0} is asking for the demotion of {1}
|
||||
asking.to.disband={0} is asking to disband the clan
|
||||
asking.to.rename={0} is asking to rename the clan to {1}
|
||||
# suppress inspection "TrailingSpacesInProperty"
|
||||
request.message= \n &8[&8{0}&8] &b{1}\n %accept% &bor %deny%\n
|
||||
clickable.accept=&a&l[ACCEPT]
|
||||
@@ -330,7 +338,8 @@ you.have.already.voted=You have already voted
|
||||
has.voted.to.deny={0} has voted to deny
|
||||
view.next.page=Type /{0} to view next page.
|
||||
voted.to.accept={0} voted to accept
|
||||
bulletin.board.header={0}* {1}{2} bulletin board
|
||||
bulletin.board.header=&8* &e{0} &fbulletin board
|
||||
bulletin.board.message={0}: &f{1}
|
||||
has.been.disbanded.rivalry.ended={0} has been disbanded. Rivalry has ended.
|
||||
has.been.disbanded.alliance.ended={0} has been disbanded. Alliance has ended.
|
||||
clan.disbanded=Clan Disbanded
|
||||
@@ -357,16 +366,17 @@ clan.wide.friendly.fire.blocked=Clan-wide friendly-fire blocked
|
||||
clan.wide.friendly.fire.is.allowed=Clan-wide friendly-fire is allowed
|
||||
you.are.the.only.member.online=You are the only member online
|
||||
your.clan.color.tag.cannot.be.longer.than.characters=&cYour clan''s colored tag cannot be longer than {0} characters
|
||||
your.clan.tag.cannot.be.longer.than.characters=Your clan''s tag cannot be longer than {0} characters
|
||||
your.clan.tag.must.be.longer.than.characters=Your clan''s tag must be longer than {0} characters
|
||||
your.tag.cannot.contain.the.following.colors=Your tag cannot contain the following colors: {0}
|
||||
your.tag.cannot.contain.color.codes=Your tag cannot contain color codes
|
||||
your.clan.tag.cannot.be.longer.than.characters=&cYour clan''s tag cannot be longer than {0} characters
|
||||
your.clan.tag.must.be.longer.than.characters=&cYour clan''s tag must be longer than {0} characters
|
||||
your.tag.cannot.contain.the.following.colors=&cYour tag cannot contain the following colors: {0}
|
||||
your.tag.doesnt.meet.the.requirements=&cYour tag doesn''t meet the requirements.
|
||||
your.tag.cannot.contain.color.codes=&cYour tag cannot contain color codes
|
||||
your.clan.tag.can.only.contain.letters.numbers.and.color.codes=&cYour clan''s tag can only contain letters, numbers, and color codes
|
||||
you.cannot.set.colored.ranks=You cannot set colored ranks
|
||||
your.clan.name.cannot.be.longer.than.characters=Your clan''s name cannot be longer than {0} characters
|
||||
your.clan.name.must.be.longer.than.characters=Your clan''s name must be longer than {0} characters
|
||||
your.clan.tag.can.only.contain.letters.numbers.and.color.codes=Your clan''s tag can only contain letters, numbers, and color codes
|
||||
your.clan.name.cannot.contain.color.codes=Your clan''s name cannot contain color codes
|
||||
that.tag.name.is.disallowed=That tag name is disallowed
|
||||
that.tag.name.is.disallowed=&cThat tag name is disallowed
|
||||
you.must.first.resign=You must first resign from {0}
|
||||
clan.with.this.tag.already.exists=A clan with this tag already exists
|
||||
get.your.clan.verified.to.access.advanced.features=Get your clan verified to access advanced features
|
||||
@@ -383,7 +393,7 @@ global.friendy.fire.is.now.managed.by.each.clan=Global friendy-fire is now manag
|
||||
global.friendy.fire.is.already.being.managed.by.each.clan=Global friendy-fire is already being managed by each clan
|
||||
global.friendly.fire.is.set.to.allowed=Global friendly-fire is set to allowed
|
||||
global.friendly.fire.is.already.being.allowed=Global friendly-fire is already being allowed
|
||||
the.player.doesn.t.not.have.the.permissions.to.join.clans=The player doesn''t not have the permissions to join clans
|
||||
the.player.doesn.t.not.have.the.permissions.to.join.clans=The player doesn''t have the permissions to join clans
|
||||
you.cannot.invite.yourself=You cannot invite yourself
|
||||
you.did.not.answer.in.time=You didn''t answer in time, canceling...
|
||||
this.player.is.banned.from.using.clan.commands=This player is banned from using clan commands
|
||||
@@ -405,6 +415,7 @@ kdr.0=KDR: {0}
|
||||
inactive.0=Inactive: {0}
|
||||
clan.commands=clan commands
|
||||
you.can.only.modify.the.color.and.case.of.the.tag=You can only modify the color and case of the tag
|
||||
locale.has.been.changed=&cYour language has been changed
|
||||
tag.changed.to.0=Tag changed to {0}
|
||||
0.tag.changed.to.1=&bSuccessfully changed {0}''s tag to {1}
|
||||
name.0=Name: {0}
|
||||
@@ -525,6 +536,8 @@ this.clan.has.reached.the.member.limit=&bThis clan has reached the member limit
|
||||
you.have.reseted.your.kdr=You have reseted your KDR
|
||||
you.have.reseted.0.kdr=You have reseted {0}''s KDR
|
||||
you.have.reseted.kdr.of.all.players=You have reseted the KDR of all players
|
||||
you.have.successfully.renamed.your.clan=&bYou have successfully renamed your clan to {0}
|
||||
you.have.successfully.renamed.the.clan=&bYou have successfully renamed the clan to {0}
|
||||
you.have.toggled.permanent.status=You have toggled permanent status for {0}
|
||||
permanent.status.enabled=Your clan''s permanent status has been enabled by {0}
|
||||
permanent.status.disabled=Your clan''s permanent status has been disabled by {0}
|
||||
@@ -532,6 +545,7 @@ yes=Yes
|
||||
cancel=Cancel
|
||||
resign.confirmation=Are you sure you want to resign? {0}
|
||||
disband.confirmation=Are you sure you want to disband your clan? {0}
|
||||
resetkdr.confirmation=Are you sure you want to reset your KDR? {0}
|
||||
resign.success=You have successfully resigned from your clan
|
||||
you.cannot.demote.the.last.leader=You cannot demote the last leader
|
||||
you.cannot.move.the.last.leader=You cannot move the last leader
|
||||
@@ -544,7 +558,7 @@ bb.minutes= \ minutes
|
||||
bb.one.minute=1 minute
|
||||
bb.hours= \ hours
|
||||
bb.one.hour=1 hour
|
||||
bb.days= days
|
||||
bb.days= \ days
|
||||
bb.one.day=1 day
|
||||
the.fee.is.0.and.its.current.value.is.1=The fee is {0} and the its current value is {1} $
|
||||
fee.enabled=enabled
|
||||
@@ -582,9 +596,11 @@ deposit.not.allowed=Deposit is not allowed, use /%clan %toggle %deposit to allow
|
||||
withdraw.not.allowed=Withdraw is not allowed, use /%clan %toggle %withdraw to allow it
|
||||
resign.request.cancelled=Resign request cancelled
|
||||
disband.request.cancelled=Disband request cancelled
|
||||
resetkdr.request.cancelled=KDR reset request cancelled
|
||||
clan.create.request.cancelled=Clan create request cancelled
|
||||
rank.create.request.cancelled=Rank create request cancelled
|
||||
promotion.vote.has.been.requested.from.all.leaders=Promotion vote has been requested from all leaders
|
||||
rename.vote.has.been.requested.from.all.leaders=&bRename vote has been requested from all leaders
|
||||
allowed=allowed
|
||||
blocked=blocked
|
||||
chat.joined=joined
|
||||
|
||||
@@ -60,6 +60,8 @@ permissions:
|
||||
description: Can list clans by balance
|
||||
simpleclans.anyone.profile:
|
||||
description: Can view a clan's profile
|
||||
simpleclans.anyone.locale:
|
||||
description: Can set his language
|
||||
simpleclans.anyone.roster:
|
||||
description: Can veiw a clan's member list
|
||||
simpleclans.anyone.lookup:
|
||||
@@ -140,6 +142,9 @@ permissions:
|
||||
description: Can set his clan's banner
|
||||
simpleclans.leader.discord.create:
|
||||
description: Can create discord channel for his clan
|
||||
simpleclans.leader.rename:
|
||||
description: Can rename his clan's name
|
||||
default: false
|
||||
simpleclans.member.land:
|
||||
description: Can use land commands
|
||||
simpleclans.member.kills:
|
||||
@@ -150,6 +155,8 @@ permissions:
|
||||
description: Can check his clan's fee
|
||||
simpleclans.mod.bb-clear:
|
||||
description: Can clear a clan's bb
|
||||
simpleclans.mod.rename:
|
||||
description: Can rename a clan's name
|
||||
simpleclans.mod.bb:
|
||||
description: Can view a clan's bulletin board
|
||||
simpleclans.mod.bb-add:
|
||||
@@ -164,6 +171,8 @@ permissions:
|
||||
description: Can change a clan's tag
|
||||
simpleclans.mod.staffgui:
|
||||
description: Can open the staff gui
|
||||
simpleclans.mod.locale:
|
||||
description: Can set players language
|
||||
simpleclans.leader.fee:
|
||||
description: Can enable and set the clan fee
|
||||
simpleclans.leader.invite:
|
||||
@@ -249,6 +258,7 @@ permissions:
|
||||
simpleclans.mod.bb-clear: true
|
||||
simpleclans.mod.bb: true
|
||||
simpleclans.mod.bb-add: true
|
||||
simpleclans.mod.locale: true
|
||||
simpleclans.anyone.*:
|
||||
description: Permissions for anyone
|
||||
default: true
|
||||
@@ -261,6 +271,7 @@ permissions:
|
||||
simpleclans.anyone.alliances: true
|
||||
simpleclans.anyone.rivalries: true
|
||||
simpleclans.anyone.invite-toggle: true
|
||||
simpleclans.anyone.locale: true
|
||||
simpleclans.member.land.*:
|
||||
description: Permissions for allowing/blocking actions in lands
|
||||
default: false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.hooks;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
+23
-15
@@ -1,28 +1,30 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.language;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class ResourceControlTest {
|
||||
|
||||
@Test
|
||||
public void getFallbackLocaleAcf() {
|
||||
LanguageResource.ResourceControl resourceControl = new LanguageResource.ResourceControl(Locale.ENGLISH,
|
||||
true);
|
||||
LanguageResource.ResourceControl resourceControl = new LanguageResource.ResourceControl(Locale.ENGLISH, true);
|
||||
String acfBaseName = "acf";
|
||||
Locale locale = resourceControl.getFallbackLocale(acfBaseName, Locale.ENGLISH);
|
||||
Assert.assertNull(locale);
|
||||
assertNull(locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(acfBaseName, new Locale("es", "ES"));
|
||||
Assert.assertEquals(Locale.ENGLISH, locale);
|
||||
assertEquals(Locale.ENGLISH, locale);
|
||||
|
||||
Locale ptBR = new Locale("pt", "BR");
|
||||
resourceControl = new LanguageResource.ResourceControl(ptBR, true);
|
||||
locale = resourceControl.getFallbackLocale(acfBaseName, Locale.ENGLISH);
|
||||
Assert.assertNull(locale);
|
||||
assertNull(locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(acfBaseName, ptBR);
|
||||
Assert.assertEquals(Locale.ENGLISH, locale);
|
||||
assertEquals(Locale.ENGLISH, locale);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -31,21 +33,27 @@ public class ResourceControlTest {
|
||||
true);
|
||||
String pluginBaseName = "messages";
|
||||
Locale locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.ENGLISH);
|
||||
Assert.assertEquals(Locale.ROOT, locale);
|
||||
assertEquals(Locale.ROOT, locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.ROOT);
|
||||
Assert.assertNull(locale);
|
||||
assertNull(locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.CANADA);
|
||||
Assert.assertNotSame(Locale.CANADA, locale);
|
||||
assertNotSame(Locale.CANADA, locale);
|
||||
|
||||
Locale ptBR = new Locale("pt", "BR");
|
||||
resourceControl = new LanguageResource.ResourceControl(ptBR, true);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, ptBR);
|
||||
Assert.assertEquals(Locale.ROOT, locale);
|
||||
assertEquals(Locale.ROOT, locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.ROOT);
|
||||
Assert.assertNull(locale);
|
||||
assertNull(locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.CANADA);
|
||||
Assert.assertNotSame(Locale.CANADA, locale);
|
||||
assertNotSame(Locale.CANADA, locale);
|
||||
|
||||
locale = resourceControl.getFallbackLocale(pluginBaseName, Locale.ENGLISH);
|
||||
Assert.assertEquals(ptBR, locale);
|
||||
assertEquals(ptBR, locale);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@@ -10,13 +11,32 @@ public class ChatUtilsTest {
|
||||
public void getLastColors() {
|
||||
String lastColors = ChatUtils.getLastColors("§aa mensagem§x termina com §4vermelho");
|
||||
assertEquals("§4", lastColors);
|
||||
|
||||
lastColors = ChatUtils.getLastColors("§aa mensagem§x termina com §a§4vermelho");
|
||||
assertEquals("§a§4", lastColors);
|
||||
|
||||
lastColors = ChatUtils.getLastColors("§aa mensagem§x termina com §a§4ver§fmel§§§§§§§§§§ho");
|
||||
assertEquals("§f", lastColors);
|
||||
|
||||
lastColors = ChatUtils.getLastColors("§aa mensagem§x termina com");
|
||||
assertEquals("§x", lastColors);
|
||||
|
||||
lastColors = ChatUtils.getLastColors("§aa mensagem§ ax termina com");
|
||||
assertEquals("§a", lastColors);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseColors() {
|
||||
assertEquals("Hello", ChatUtils.parseColors("Hello"));
|
||||
assertEquals("§aHello §x§a§a§a§a§a§aWorld", ChatUtils.parseColors("&aHello &#aaaaaaWorld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stripColors() {
|
||||
assertEquals("Hello", ChatUtils.stripColors("Hello"));
|
||||
assertEquals("&xHello", ChatUtils.stripColors("&xHello"));
|
||||
assertEquals("Hello", ChatUtils.stripColors("��Hello"));
|
||||
assertEquals("&aHello", ChatUtils.stripColors("�&�aHello"));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class ObjectUtilsTest {
|
||||
|
||||
@@ -13,7 +15,7 @@ public class ObjectUtilsTest {
|
||||
private Clan clanOrigin;
|
||||
private Clan clanDest;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
cpOrigin = new ClanPlayer();
|
||||
cpOrigin.setName("Test");
|
||||
@@ -25,16 +27,15 @@ public class ObjectUtilsTest {
|
||||
@Test
|
||||
public void updateFields() throws IllegalAccessException {
|
||||
ObjectUtils.updateFields(cpOrigin, cpDest);
|
||||
Assert.assertEquals("Test", cpDest.getName());
|
||||
assertEquals("Test", cpDest.getName());
|
||||
|
||||
clanOrigin.setMemberFee(0.222);
|
||||
|
||||
ObjectUtils.updateFields(clanOrigin, clanDest);
|
||||
Assert.assertEquals(0.222, clanDest.getMemberFee(), 0);
|
||||
assertEquals(0.222, clanDest.getMemberFee(), 0);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void updateFieldsDifferentType() throws IllegalAccessException {
|
||||
ObjectUtils.updateFields(clanOrigin, cpOrigin);
|
||||
@Test
|
||||
public void updateFieldsDifferentType() {
|
||||
assertThrows(IllegalArgumentException.class, () -> ObjectUtils.updateFields(clanOrigin, cpOrigin));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.uuid;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class UUIDFetcherTest {
|
||||
|
||||
private UUID ghostUUID;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
ghostUUID = UUID.fromString("bfe9a44f-e44d-453b-8219-74eb186c3932");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUUIDOf() throws Exception {
|
||||
Assert.assertEquals(ghostUUID, UUIDFetcher.getUUIDOf("GhostTheWolf"));
|
||||
assertEquals(ghostUUID, UUIDFetcher.getUUIDOf("GhostTheWolf"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUUIDOfThrottled() throws IOException, InterruptedException {
|
||||
Assert.assertEquals(ghostUUID, UUIDFetcher.getUUIDOfThrottled("GhostTheWolf"));
|
||||
assertEquals(ghostUUID, UUIDFetcher.getUUIDOfThrottled("GhostTheWolf"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user