Compare commits
82
Commits
mojang-api
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07c630deaf | ||
|
|
88ff9fe559
|
||
|
|
a0b4b2ffa0
|
||
|
|
541b3c1c72
|
||
|
|
56dfe76ffa
|
||
|
|
42a07a697b
|
||
|
|
78a41622f4
|
||
|
|
59bd8d87ab | ||
|
|
46e776cdc5 | ||
|
|
a3993384d9 | ||
|
|
00c08e6eb5 | ||
|
|
ace6904cf6 | ||
|
|
e2d3ebfe70 | ||
|
|
a61ae9894f | ||
|
|
0d6f429e1e | ||
|
|
a02ef45497 | ||
|
|
6650799f71 | ||
|
|
449c0b3961 | ||
|
|
6d5e6f38e6 | ||
|
|
035f4dcba6 | ||
|
|
cf583f481e | ||
|
|
7091da2d3d | ||
|
|
358bb00180 | ||
|
|
a9e6f3fa4d | ||
|
|
bb4cd6fc1b | ||
|
|
2a0a181399 | ||
|
|
32e90b1c80 | ||
|
|
3f13f63c18 | ||
|
|
240a1fc42d | ||
|
|
e85a4007eb | ||
|
|
870bff28c8 | ||
|
|
76c728688e | ||
|
|
245fa36e1d | ||
|
|
f437980d8e | ||
|
|
f1cceaca0c | ||
|
|
3b152d6578 | ||
|
|
0782fd753d | ||
|
|
941cd4c20d | ||
|
|
9ce6641489 | ||
|
|
3886c87637 | ||
|
|
1e70ade03e | ||
|
|
700e29ce97 | ||
|
|
3de15c9adb | ||
|
|
0406c61b0f | ||
|
|
3969d52184 | ||
|
|
f4d413e0b3 | ||
|
|
28e545a4ff | ||
|
|
9c921be01a | ||
|
|
a2e59c9401 | ||
|
|
b1b5fef7bf | ||
|
|
2bdd6bc3bf | ||
|
|
f7081499b2 | ||
|
|
0f50d498cb | ||
|
|
da8d343897 | ||
|
|
ee1feb4276 | ||
|
|
24af2c03d0 | ||
|
|
6b2a3f85ac | ||
|
|
57076fb033 | ||
|
|
52ff77e6c1 | ||
|
|
146713fd48 | ||
|
|
c8e67cfd4f | ||
|
|
f4f47b2060 | ||
|
|
13cf348084 | ||
|
|
b37512be7d | ||
|
|
9097fa02fa | ||
|
|
a759884b8d | ||
|
|
f5e1387246 | ||
|
|
cddde547b1 | ||
|
|
f466a86309 | ||
|
|
9f4f39a420 | ||
|
|
46702f90ab | ||
|
|
5a490b11a3 | ||
|
|
3b51299dd6 | ||
|
|
5212296d62 | ||
|
|
67d3e70f58 | ||
|
|
8cd0b2e454 | ||
|
|
da9ec6c917 | ||
|
|
cb314dbe7b | ||
|
|
01c79862b9 | ||
|
|
c9df6acb13 | ||
|
|
ad910e9c30 | ||
|
|
d4d144fe36 |
No files matched your search
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -1,5 +0,0 @@
|
||||
root: ./wiki
|
||||
|
||||
structure:
|
||||
readme: README.md
|
||||
summary: SUMMARY.md
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
@@ -1,30 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Run the command '...'
|
||||
2. Click on a mob '....'
|
||||
3. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Software (please complete the following information):**
|
||||
- Server: [e.g. Spigot 1.12]
|
||||
- Plugin version [e.g. 2.12.1]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,37 +0,0 @@
|
||||
# This workflow will build a Java project with Maven
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: true
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
java-version: [ 16, 17 ]
|
||||
runs-on: ubuntu-latest
|
||||
name: Java ${{ matrix.java-version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: "Set up JDK ${{ matrix.java-version }}"
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: "${{ matrix.java-version }}"
|
||||
distribution: 'adopt'
|
||||
cache: 'maven'
|
||||
- name: Build with Maven
|
||||
run: ./mvnw -B -U package --file pom.xml
|
||||
- name: Upload Build Artifact
|
||||
if: "${{ matrix.java-version == 16 }}"
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: SimpleClans
|
||||
path: target/SimpleClans.jar
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Publish to CurseForge
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: itsmeow/curseforge-upload@v3
|
||||
with:
|
||||
token: ${{ secrets.CURSEFORGE_TOKEN }}
|
||||
project_id: 380814
|
||||
game_endpoint: minecraft
|
||||
file_path: target/SimpleClans.jar
|
||||
changelog: ${{ github.event.release.body }}
|
||||
changelog_type: markdown
|
||||
display_name: ${{ github.event.release.tag_name }}
|
||||
game_versions: 8849,8503,7915,7667,7330,7105,6588,630,591,585,531
|
||||
release_type: release
|
||||
relations: vault:optionalDependency,worldguard:optionalDependency,grief-prevention:optionalDependency
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Publish to Modrinth
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: RubixDev/modrinth-upload@v1.0.0
|
||||
with:
|
||||
token: ${{ secrets.MODRINTH_TOKEN }}
|
||||
project_id: quLDfyDl
|
||||
file_path: target/SimpleClans.jar
|
||||
changelog: ${{ github.event.release.body }}
|
||||
name: ${{ github.event.release.tag_name }}
|
||||
version: ${{ github.event.release.tag_name }}
|
||||
game_versions: 1.19,1.18,1.17,1.16,1.15,1.14,1.13,1.12,1.11,1.10,1.9,1.8
|
||||
release_type: release
|
||||
loaders: spigot
|
||||
featured: true
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Publish to Reposilite
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
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: ./mvnw -B package --file pom.xml
|
||||
- name: Publish to Reposilite
|
||||
run: ./mvnw -B deploy
|
||||
env:
|
||||
MAVEN_USERNAME: simpleclans
|
||||
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_TOKEN }}
|
||||
@@ -1,15 +0,0 @@
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
name: release-please
|
||||
jobs:
|
||||
release-please:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
with:
|
||||
release-type: maven
|
||||
package-name: SimpleClans
|
||||
token: ${{ secrets.PAT_TOKEN }}
|
||||
fork: false
|
||||
+7
-6
@@ -1,10 +1,11 @@
|
||||
/target/
|
||||
/.idea/
|
||||
/bin/
|
||||
/.classpath
|
||||
/.project
|
||||
.idea/
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
*.jar
|
||||
build/
|
||||
.gradle/
|
||||
.settings
|
||||
.factorypath
|
||||
SimpleClans.iml
|
||||
dependency-reduced-pom.xml
|
||||
/unions.txt
|
||||
@@ -0,0 +1,6 @@
|
||||
[submodule "libs/Utilities-OG"]
|
||||
path = libs/Utilities-OG
|
||||
url = https://git.trueog.net/trueog/Utilities-OG
|
||||
[submodule "libs/DiamondBank-OG"]
|
||||
path = libs/DiamondBank-OG
|
||||
url = https://git.trueog.net/trueog/DiamondBank-OG
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
# 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
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
# Use https://travis-ci.org/ for automatic testing
|
||||
|
||||
# This is a java project
|
||||
language: java
|
||||
|
||||
script: mvn install
|
||||
|
||||
jdk: [openjdk8]
|
||||
|
||||
# if one build failed, exit testing
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
addons:
|
||||
artifacts: true
|
||||
|
||||
# Disable caching in order to get notified if there are some repo/dependency issues
|
||||
## Cache maven dependencies
|
||||
#sudo: false
|
||||
#cache:
|
||||
# directories:
|
||||
# - '$HOME/.m2/repository'
|
||||
+102
-96
@@ -1,120 +1,126 @@
|
||||
# Changelog
|
||||
# Unions-OG Changelog
|
||||
|
||||
## [2.19.2](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.1...v2.19.2) (2023-08-03)
|
||||
This changelog records only changes made by the Unions-OG soft fork relative
|
||||
to upstream [SimpleClans](https://github.com/RoinujNosde/SimpleClans). Changes
|
||||
inherited unchanged from SimpleClans are intentionally omitted.
|
||||
|
||||
## [2.5.1] - 2026-08-15
|
||||
|
||||
### Bug Fixes
|
||||
- Inactivity purges removed. Unions and player data are no longer deleted on startup.
|
||||
|
||||
* cause check should return true on granting ([#397](https://github.com/RoinujNosde/SimpleClans/issues/397)) ([f29bc74](https://github.com/RoinujNosde/SimpleClans/commit/f29bc746af4940b493ebc43b1e25ff0fc00ab8d0))
|
||||
## [2.5] - 2026-08-13
|
||||
|
||||
## [2.19.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.0...v2.19.1) (2023-08-03)
|
||||
### Added
|
||||
|
||||
- Clickable chat buttons for request responses. Accept and deny regroup requests
|
||||
now display green `[ACCEPT]` and red `[DENY]` buttons in chat that players can
|
||||
click instead of typing commands. Hover text explains each button's action.
|
||||
Command-based responses still work for full backward compatibility.
|
||||
- Adventure/MiniMessage dependency for rich text rendering and interactive chat
|
||||
components.
|
||||
- Fix union commands and help menu
|
||||
|
||||
### Bug Fixes
|
||||
## [2.4] - 2026-08-10
|
||||
|
||||
* charge money on deposit ([#394](https://github.com/RoinujNosde/SimpleClans/issues/394)) ([fe60b25](https://github.com/RoinujNosde/SimpleClans/commit/fe60b25f6107281a9771f6498400c3f8ce81c916))
|
||||
* consider uppercase when checking for disallowed colors ([#391](https://github.com/RoinujNosde/SimpleClans/issues/391)) ([503d679](https://github.com/RoinujNosde/SimpleClans/commit/503d67903e386b1c4b6eb7903a1addbfd42a684a))
|
||||
### Added
|
||||
|
||||
## [2.19.0](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.1...v2.19.0) (2023-07-27)
|
||||
- Unions decide by member vote. `disband`, `home set` and `war start` now open
|
||||
a proposal that passes when half the members are in favour, is rejected once
|
||||
half becomes unreachable, and expires after 7 days. Votes are stored in the
|
||||
database, so members can vote when they next log in.
|
||||
- `/union vote` shows the open proposal and its tally; `/union vote yes|no`
|
||||
casts a vote. A vote screen in the GUI does the same, and is shown once on
|
||||
login to members who have not voted.
|
||||
- Disbanding a union splits its bank evenly between all members. Inert until
|
||||
union bank accounts are enabled.
|
||||
- `/clan`, `/clans`, `/factions`, `/guilds`, `/party`, `/tribe`, `/nation`,
|
||||
`/crew`, `/squad` and `/gang` tell the player to use `/union` instead.
|
||||
`/f`, `/faction` and `/guild` are left to Utilities-OG.
|
||||
|
||||
### Changed
|
||||
|
||||
### Features
|
||||
- Unions are flat. Every union command is member-level, and the three actions
|
||||
above are the only ones needing more than one member's say-so.
|
||||
- Folded `unionsog.leader.*` into `unionsog.member.*`, which is granted by
|
||||
default. Union ally management is `unionsog.member.ally-set` and union
|
||||
friendly fire is `unionsog.member.union-ff`, to avoid clashing with the
|
||||
existing ally-chat and personal-friendly-fire nodes.
|
||||
- Renamed clan to union across the API, config sections and message keys:
|
||||
`Clan` is `Union`, `clan:` is `union:`, `clanchat:` is `unionchat:`.
|
||||
Database identifiers and PlaceholderAPI placeholder names deliberately keep
|
||||
their `clan` spelling.
|
||||
- Renamed `/union clanff` to `/union unionff`.
|
||||
- Chat and display formats accept `{union}`; `{clan}` still works.
|
||||
- A union now ends with its last member.
|
||||
- `/union war start` no longer asks the target union, so the member-count
|
||||
guard always applies. Removed `war-and-protection.war-start.request-enabled`.
|
||||
- Inter-union requests are answered by the first member of the asked union
|
||||
rather than by its leaders.
|
||||
- Set the union GUI title to "Union Management".
|
||||
|
||||
* 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))
|
||||
### Removed
|
||||
|
||||
- Ranks, promotion and demotion, with their commands, settings, events and GUI
|
||||
screens.
|
||||
- The leader role: no leader flag, leader-only command, tag colour, Discord
|
||||
role or `sc_leader` LuckPerms group. The `sc_players.leader` column is kept
|
||||
and always written `0` for data compatibility.
|
||||
- The leaders-only land creation option.
|
||||
- The in-game Crowdin translation prompts.
|
||||
|
||||
### Bug Fixes
|
||||
### Fixed
|
||||
|
||||
* 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))
|
||||
- `/union lookup` and `/union profile` no longer print a literal
|
||||
`%player_rank%` or `%clan_leaders%`.
|
||||
- Removed a stale `%rank%` token from the default chat formats.
|
||||
- `/union unionff block` now requires union membership, matching
|
||||
`/union unionff allow`.
|
||||
- The legacy database importer no longer reads or writes leader relationships.
|
||||
|
||||
## [2.3] - Initial release
|
||||
|
||||
### Performance Improvements
|
||||
### Added
|
||||
|
||||
* **discord:** remove discord channels from creation ([#353](https://github.com/RoinujNosde/SimpleClans/issues/353)) ([36084db](https://github.com/RoinujNosde/SimpleClans/commit/36084dbfa3e73aedccb156e49af5062e40639927))
|
||||
- `/union` and `/unions` as primary command aliases, keeping `/clan` and
|
||||
`/clans`.
|
||||
- `/u [message]` for union chat. Running `/u` alone toggles the channel.
|
||||
- `/union color <color>` with named, legacy and hex color support.
|
||||
- `simpleunions` PlaceholderAPI aliases alongside the legacy `simpleclans`
|
||||
identifier, plus MiniPlaceholders support through Utilities-OG.
|
||||
- A Union Banking preview in the main GUI.
|
||||
- A configuration-gated legacy database migration from `unions_parties` and
|
||||
`unions_players`. It never touches the source tables, requires empty
|
||||
transactional destinations, is idempotent, and aborts startup on failure so
|
||||
the server cannot run on partially migrated data.
|
||||
|
||||
### Changed
|
||||
|
||||
### Documentation
|
||||
- Renamed the plugin and artifact to Unions-OG, moved the namespace to
|
||||
`net.trueog.unionsog` and permission nodes to `unionsog.*`.
|
||||
- Replaced Vault with DiamondBank-OG and its shard-based balances. Legacy
|
||||
Vault-denominated union balances are zeroed once. Union-bank commands are
|
||||
disabled until DiamondBank-OG provides union-owned accounts.
|
||||
- Unions are treated as verified without the upstream verification workflow.
|
||||
- Reserved `None` as a union name or tag, and made the no-union color-tag
|
||||
placeholder return a stable `&8None`.
|
||||
- Bulletin-board messages no longer show on login by default.
|
||||
- Reordered the main GUI around the union overview, banking preview, lists,
|
||||
leaderboards and administrative tools.
|
||||
- Replaced the WorldGuard 6 reflection provider with the WorldEdit and
|
||||
WorldGuard 7 APIs.
|
||||
- Updated MySQL driver loading for Connector/J 8, MariaDB and JDBC service
|
||||
discovery.
|
||||
- Migrated the build from Maven to Gradle with a Java 17 toolchain,
|
||||
reproducible shaded jars, and the Utilities-OG and DiamondBank-OG submodules.
|
||||
|
||||
* 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))
|
||||
### Removed
|
||||
|
||||
## [2.18.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.0...v2.18.1) (2022-11-29)
|
||||
- The Vault dependency, along with the member-fee and upkeep tasks it backed.
|
||||
- The legacy WorldGuard 6 provider.
|
||||
- bStats telemetry.
|
||||
|
||||
## Fork baseline
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* added check for clan_member on land commands ([fc81e76](https://github.com/RoinujNosde/SimpleClans/commit/fc81e765211bebe22a7a6aa5d5158754580bbdc5))
|
||||
* attempt at fixing NPE on getAllClanPlayers ([26ba9f7](https://github.com/RoinujNosde/SimpleClans/commit/26ba9f73296a772eaa698d2ede6fbc3831da850c))
|
||||
* **bungee:** error deserializing clan banners ([56c7908](https://github.com/RoinujNosde/SimpleClans/commit/56c7908c332167cec9cca6a4ea054977d0d68b9f))
|
||||
* channel auto creation setting not respected on join/link ([7f9d133](https://github.com/RoinujNosde/SimpleClans/commit/7f9d133051b9011837d0a5114abc6c3637a3f02c))
|
||||
* default ranks were getting re-added on config load ([7a37382](https://github.com/RoinujNosde/SimpleClans/commit/7a37382264ff4dd5456f6930045b5102bf491897))
|
||||
* missing getHandlerList on HomeRegroupEvent ([#338](https://github.com/RoinujNosde/SimpleClans/issues/338)) ([8fa465d](https://github.com/RoinujNosde/SimpleClans/commit/8fa465da385f36b1fb075031c375ef94df78ea52))
|
||||
* money was not given back when channel creation failed ([#336](https://github.com/RoinujNosde/SimpleClans/issues/336)) ([d8cb61b](https://github.com/RoinujNosde/SimpleClans/commit/d8cb61b0fc9584bb58f421faf98596816621053f))
|
||||
* wrong path of discord economy section ([#334](https://github.com/RoinujNosde/SimpleClans/issues/334)) ([3f1b06d](https://github.com/RoinujNosde/SimpleClans/commit/3f1b06dcf996e51a878b7fc281069e236ebcbfce))
|
||||
|
||||
## [2.18.0](https://github.com/RoinujNosde/SimpleClans/compare/v2.17.0...v2.18.0) (2022-10-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add help-size config ([25197cd](https://github.com/RoinujNosde/SimpleClans/commit/25197cdd729cea63d7e223dc1e0aaef830613327))
|
||||
* added method for registering protection providers ([2ea7444](https://github.com/RoinujNosde/SimpleClans/commit/2ea744443f502970b15859818e9d5e45ca69d453))
|
||||
* adds permission to bypass the teleport delay ([d56a0a9](https://github.com/RoinujNosde/SimpleClans/commit/d56a0a979a47a140115742518e934a2469e6f880))
|
||||
* adds PlayerHomeClearEvent ([becb88b](https://github.com/RoinujNosde/SimpleClans/commit/becb88b763380bed5a2e1dd209c32c8363a7f88b))
|
||||
* adds starter-ranks ([a440834](https://github.com/RoinujNosde/SimpleClans/commit/a4408343479d7efa6ae5a65894f8b822ecd47ebb))
|
||||
* Improves Bungee support ([#327](https://github.com/RoinujNosde/SimpleClans/issues/327)) ([2c9b0f9](https://github.com/RoinujNosde/SimpleClans/commit/2c9b0f98fe3942ea74190c1a81d61be2c8647db8))
|
||||
* **lang:** new crowdin updates ([#319](https://github.com/RoinujNosde/SimpleClans/issues/319)) ([87ece22](https://github.com/RoinujNosde/SimpleClans/commit/87ece22036fb674c8c362b6a1b86fe884543e6ad))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* changes size of some frames for better visualization on Bedrock ([1adec0b](https://github.com/RoinujNosde/SimpleClans/commit/1adec0b89d676767cdb94dcdf91ba37a231eb4a8))
|
||||
* ConfigurationSerializableAdapter NPE ([30a501c](https://github.com/RoinujNosde/SimpleClans/commit/30a501c063aa9dbcf596df83adc2b15baf0e4bb9))
|
||||
* getPastClans() preserves the insertion order ([af07988](https://github.com/RoinujNosde/SimpleClans/commit/af079881030bd299b9bae1ebf0cc62353af7e6fc))
|
||||
* NoClassDefFoundError in WorldGuard6Provider ([a859928](https://github.com/RoinujNosde/SimpleClans/commit/a8599286225ba603ea124b8b52510245b94ffd24))
|
||||
* NPE while collecting fees ([c47289c](https://github.com/RoinujNosde/SimpleClans/commit/c47289c5bf8113a9d6a8e1ee74a5afb0358647b6))
|
||||
* NPE while purging data ([f14c425](https://github.com/RoinujNosde/SimpleClans/commit/f14c42548846feef01b484acbb5f02bcbcabd8db))
|
||||
* NPE while sending a message to spies ([#322](https://github.com/RoinujNosde/SimpleClans/issues/322)) ([e7f756f](https://github.com/RoinujNosde/SimpleClans/commit/e7f756f3063c646e21415e08eea73f123d2818a0))
|
||||
* removes duplicate /clan from help ([f7e7ec6](https://github.com/RoinujNosde/SimpleClans/commit/f7e7ec66243359e26d3c456a9740a53753951c48))
|
||||
* removes rank and join date on disband ([2a1ad5b](https://github.com/RoinujNosde/SimpleClans/commit/2a1ad5b5c8d2937a8ee6dd6f7f43d85c86f08307))
|
||||
* set useSSL to false ([f484bc1](https://github.com/RoinujNosde/SimpleClans/commit/f484bc16c6176ccd13e05aae2169400e7bcf5d62))
|
||||
* supports '.' and '*' as username prefix by default ([37f0ecf](https://github.com/RoinujNosde/SimpleClans/commit/37f0ecff506d06f3047e3598848117a14c2b7ead))
|
||||
* updates join date when joining a clan ([#326](https://github.com/RoinujNosde/SimpleClans/issues/326)) ([96a13d8](https://github.com/RoinujNosde/SimpleClans/commit/96a13d8d6cc18c91d4dee20dd632cd5d65db5213))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* improved UUID lookup performance ([4ab53d1](https://github.com/RoinujNosde/SimpleClans/commit/4ab53d16135ecf5a4067b1a63d058da392dc5313))
|
||||
The fork last merged upstream SimpleClans history through commit `0406c61b`
|
||||
on 2026-03-30. Earlier SimpleClans release history belongs to the upstream
|
||||
project.
|
||||
@@ -1,85 +1,140 @@
|
||||
[](https://www.spigotmc.org/resources/simpleclans.71242/)
|
||||

|
||||
|
||||
SimpleClans
|
||||
==========
|
||||
# Unions-OG
|
||||
|
||||
Full featured clan system for PVP Minecraft Servers!
|
||||
A full-featured union system for PvP Minecraft servers.
|
||||
|
||||
[](https://ci.roinujnosde.me/job/SimpleClans/)
|
||||
[](https://www.spigotmc.org/resources/simpleclans.71242/)
|
||||
[](https://github.com/RoinujNosde/SimpleClans/issues)
|
||||
[](https://crowdin.com/project/simpleclans)
|
||||
[](https://discord.gg/CkNwgdE)
|
||||
[](https://bstats.org/plugin/bukkit/SimpleClans/7131)
|
||||
[](https://bstats.org/plugin/bukkit/SimpleClans/7131)
|
||||
> [!IMPORTANT]
|
||||
> Unions-OG is an unofficial soft fork of
|
||||
> [SimpleClans](https://github.com/RoinujNosde/SimpleClans), maintained for the
|
||||
> TrueOG Network. Upstream behavior is retained where practical, while
|
||||
> branding, integrations, and selected gameplay behavior intentionally differ.
|
||||
|
||||
Current fork version: **2.4**
|
||||
|
||||
#### Download Link
|
||||
- [Fork-only changelog](CHANGELOG.md)
|
||||
- [PlaceholderAPI and MiniPlaceholders reference](placeholder-info.txt)
|
||||
- [Upstream SimpleClans project](https://github.com/RoinujNosde/SimpleClans)
|
||||
|
||||
* [Download from Spigot](https://www.spigotmc.org/resources/simpleclans.71242/)
|
||||
## Main fork differences
|
||||
|
||||
#### Documentation
|
||||
### Flat unions
|
||||
|
||||
* [Documentation](https://simpleclans.gitbook.io/simpleclans/)
|
||||
* Commands & Permissions
|
||||
* [Permissions](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/permissions)
|
||||
* [Commands](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/commands)
|
||||
* [Clan Alliances and Rivalries](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/aliances-and-rivalries)
|
||||
* [Clan Ranks with Permissions](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/ranks-with-permissions)
|
||||
* How to Setup
|
||||
* [Configuration](https://simpleclans.gitbook.io/simpleclans/how-to-setup/configuration)
|
||||
* [Translation](https://simpleclans.gitbook.io/simpleclans/how-to-setup/translation)
|
||||
* [Clan Member Fee](https://simpleclans.gitbook.io/simpleclans/how-to-setup/member-fee)
|
||||
* [Clan Upkeep](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-upkeep)
|
||||
* [Clan name above players head](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-below-players-name)
|
||||
* [Clan name on Tablist](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-on-tablist)
|
||||
* Plugins & Development
|
||||
* [SimpleClans API Example](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)
|
||||
* [PlaceholderAPI Placeholders](https://simpleclans.gitbook.io/simpleclans/other/placeholderapi-support)
|
||||
* [Land Protection Plugins](https://simpleclans.gitbook.io/simpleclans/other/land-claims)
|
||||
|
||||
#### Support & Suggestions
|
||||
Unions have no internal hierarchy. Ranks, promotion, demotion and the leader
|
||||
role itself were removed, so every member holds the same powers.
|
||||
|
||||
* [Discord Support](https://discord.gg/CkNwgdE)
|
||||
* [Bugs and Suggestions](https://github.com/RoinujNosde/SimpleClans/issues)
|
||||
- Every union command is member-level. There is no leader flag, no rank
|
||||
system, and no way to grant one member authority over another.
|
||||
- A union ends with its last member: resigning, or being kicked or moved out
|
||||
as the only member, disbands it.
|
||||
|
||||
### Decisions by member consensus
|
||||
|
||||
#### Developers
|
||||
Three actions need a vote of the union's own members instead of a leader's
|
||||
say-so: **disband**, **home set**, and **war start**.
|
||||
|
||||
Including SimpleClans with Maven:
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>roinujnosde-repo</id>
|
||||
<url>https://repo.roinujnosde.me/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<version>2.18.1</version> <!-- You can find the latest version at the bottom -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
- A proposal passes as soon as half the members (rounded up) vote in favour,
|
||||
and is rejected as soon as enough vote against that half can no longer be
|
||||
reached.
|
||||
- Votes are stored in the database, so a member who is offline when a
|
||||
proposal opens can still vote the next time they log in. Proposals expire
|
||||
after 7 days.
|
||||
- A union can only have one proposal open at a time.
|
||||
- Members vote with `/union vote yes|no`, or by clicking the vote buttons in
|
||||
the union GUI. The GUI is presented once on login to members who have not
|
||||
voted yet.
|
||||
- `/union vote` on its own shows the open proposal and the running tally.
|
||||
|
||||
### Other differences
|
||||
|
||||
- Uses Unions-OG branding and union terminology throughout, including config
|
||||
sections (`union:`, `unionchat:`) and message keys.
|
||||
- Provides `/union` and `/unions`. Other group words — `/clan`, `/clans`,
|
||||
`/factions`, `/guilds`, `/party`, `/tribe`, `/nation`, `/crew`, `/squad` and
|
||||
`/gang` — are registered as signposts that tell the player to run the same command with
|
||||
`/union` instead. `/f`, `/faction` and `/guild` belong to Utilities-OG,
|
||||
which already redirects them.
|
||||
- Uses `/u` for union chat; a bare `/u` toggles the union-chat channel.
|
||||
- Adds `/union rename <name>` and `/union color <color>`, both open to any
|
||||
member.
|
||||
- Union-wide friendly fire is `/union unionff allow|block`, aliased as
|
||||
`/union pvp on|off`. The per-player friendly fire opt-in (`/union ff`)
|
||||
is removed, so friendly fire is decided only by the union setting or the
|
||||
staff-wide `globalff` override.
|
||||
- Supports both `simpleclans` and `simpleunions` placeholder identifiers in
|
||||
PlaceholderAPI and MiniPlaceholders.
|
||||
- Uses DiamondBank-OG instead of Vault for player economy access. Union-owned
|
||||
bank accounts remain under development, so their commands are currently
|
||||
disabled. Once enabled, disbanding a union splits its bank evenly between
|
||||
all members.
|
||||
- Treats unions as verified without requiring the upstream verification
|
||||
workflow.
|
||||
- Includes a configuration-gated, transactional importer for the legacy
|
||||
unions database.
|
||||
|
||||
See the [changelog](CHANGELOG.md) for the complete list of changes maintained
|
||||
by this fork. Upstream SimpleClans changes are intentionally not repeated
|
||||
there.
|
||||
|
||||
## Documentation
|
||||
|
||||
The [Unions-OG wiki](wiki/) documents this fork, and is the reference to use.
|
||||
|
||||
- [Commands](wiki/commands-and-permissions/commands.md)
|
||||
- [Permissions](wiki/commands-and-permissions/permissions.md)
|
||||
- [Proposals and Voting](wiki/commands-and-permissions/proposals-and-voting.md)
|
||||
- [Union Alliances and Rivalries](wiki/commands-and-permissions/alliances-and-rivalries.md)
|
||||
- [Configuration](wiki/how-to-setup/configuration.md)
|
||||
- [PlaceholderAPI Support](wiki/other/placeholderapi-support.md)
|
||||
- [API example](wiki/other/unions-og-api.md)
|
||||
|
||||
> [!WARNING]
|
||||
> The [upstream SimpleClans documentation](https://simpleclans.gitbook.io/simpleclans/)
|
||||
> no longer describes this fork. Its pages on leaders, ranks, promotion,
|
||||
> demotion, member fees and upkeep do **not** apply, and its command,
|
||||
> permission and configuration names have all been renamed here.
|
||||
|
||||
For the unmodified upstream plugin and its public releases, use the
|
||||
[SimpleClans Spigot page](https://www.spigotmc.org/resources/simpleclans.71242/).
|
||||
That download is not an Unions-OG build.
|
||||
|
||||
## Building
|
||||
|
||||
The build requires Java 17. Clone with submodules, then run:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
Using Gradle:
|
||||
```groovy
|
||||
repositories {
|
||||
maven {
|
||||
url "https://repo.roinujnosde.me/releases/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
compileOnly "net.sacredlabyrinth.phaed.simpleclans:SimpleClans:2.18.1"
|
||||
}
|
||||
```
|
||||
The shaded plugin is produced under `build/libs/` with the
|
||||
`Unions-OG-2.4.jar` name.
|
||||
|
||||
Feel free to learn our [Javadoc](https://ci.roinujnosde.me/job/SimpleClans/Javadoc/).
|
||||
##### Latest version:
|
||||
[](https://repo.roinujnosde.me/#/releases/net/sacredlabyrinth/phaed/simpleclans/SimpleClans)
|
||||
##### API Examples
|
||||
* [Examples of how to use the API](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)
|
||||
## Developer compatibility
|
||||
|
||||
- Java and Gradle namespace: `net.trueog.unionsog`
|
||||
- Bukkit main class: `net.trueog.unionsog.UnionsOG`
|
||||
- API types use union naming: `Union`, `UnionPlayer`, `UnionManager`,
|
||||
`Proposal`, `DisbandUnionEvent`
|
||||
- Permission prefix: `unionsog.*`. Union actions all live under
|
||||
`unionsog.member.*`, which is granted by default; there is no
|
||||
`unionsog.leader.*` tree
|
||||
- Command aliases: `union` and `unions`. Other group words are redirect-only
|
||||
signposts, not aliases, and never execute a union command
|
||||
- Placeholder identifiers: `simpleunions` and the retained `simpleclans`
|
||||
compatibility identifier. Placeholder **names** deliberately keep their
|
||||
upstream `clan` spelling (`%simpleunions_clan_name%`) so existing setups
|
||||
keep resolving
|
||||
- Database identifiers are unchanged for live-data compatibility: the table
|
||||
prefix stays `sc_`, and the `clans` table and `leader` column are retained
|
||||
even though the leader column is no longer used
|
||||
- Chat and display formats accept `{union}`; the legacy `{clan}` token still
|
||||
works
|
||||
|
||||
The old SimpleClans Maven coordinates and Java packages do not describe this
|
||||
fork and should not be used as Unions-OG API coordinates.
|
||||
|
||||
## Credits and license
|
||||
|
||||
Unions-OG is derived from SimpleClans by its original and upstream
|
||||
contributors. This fork remains licensed under the [GNU GPL v3](LICENSE).
|
||||
File diff suppressed because it is too large.
Load diff
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Fetch all submodule content.
|
||||
git submodule update --force --recursive --init
|
||||
@@ -0,0 +1,181 @@
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
|
||||
/* ------------------------------ Plugins ------------------------------ */
|
||||
plugins {
|
||||
id("java") // Import Java plugin.
|
||||
id("java-library") // Import Java Library plugin.
|
||||
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
|
||||
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
|
||||
id("checkstyle") // Import Checkstyle plugin.
|
||||
eclipse // Import Eclipse plugin.
|
||||
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
|
||||
}
|
||||
|
||||
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
|
||||
}
|
||||
}
|
||||
|
||||
kotlin { jvmToolchain(17) }
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "net.trueog.unionsog" // Declare bundle identifier.
|
||||
|
||||
version = "2.5.1" // Declare plugin version (will be in .jar).
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
/* ----------------------------- Resources ----------------------------- */
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
val props = mapOf("version" to version, "apiVersion" to apiVersion)
|
||||
inputs.properties(props) // Indicates to rerun if version changes.
|
||||
filesMatching("plugin.yml") { expand(props) }
|
||||
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
|
||||
}
|
||||
|
||||
/* ---------------------------- Repos ---------------------------------- */
|
||||
repositories {
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") }
|
||||
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
|
||||
maven { url = uri("https://repo.aikar.co/content/groups/aikar/") }
|
||||
maven { url = uri("https://maven.enginehub.org/repo/") }
|
||||
maven { url = uri("https://nexus.scarsz.me/content/groups/public/") }
|
||||
maven { url = uri("https://eldonexus.de/repository/maven-public") }
|
||||
maven { url = uri("https://jitpack.io") }
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let {
|
||||
val dir = file(it)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
mavenLocal()
|
||||
}
|
||||
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly("net.luckperms:api:5.5") // Import LuckPerms API.
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:DiamondBank-OG")) {
|
||||
attributes { attribute(kotlinAttribute, true) }
|
||||
} // Import TrueOG network DiamondBank-OG Kotlin API (from source).
|
||||
compileOnly("me.clip:placeholderapi:2.11.3")
|
||||
compileOnly("org.jetbrains:annotations:24.0.1")
|
||||
implementation("io.papermc:paperlib:1.0.8-SNAPSHOT")
|
||||
implementation("net.kyori:adventure-api:4.14.0")
|
||||
implementation("net.kyori:adventure-text-minimessage:4.14.0")
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
|
||||
implementation("co.aikar:acf-paper:0.5.1-SNAPSHOT")
|
||||
implementation("com.github.cryptomorin:XSeries:11.2.0.1")
|
||||
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT") { isTransitive = false }
|
||||
compileOnly("com.sk89q.worldedit:worldedit-core:7.3.0-SNAPSHOT") { isTransitive = false }
|
||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.8") { isTransitive = false }
|
||||
compileOnly("com.sk89q.worldguard:worldguard-core:7.0.8") { isTransitive = false }
|
||||
compileOnly("com.github.TechFortress:GriefPrevention:17.0.0")
|
||||
compileOnly("com.discordsrv:discordsrv:1.28.0")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
testImplementation("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.3")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.3")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.3")
|
||||
testImplementation("org.mockito:mockito-core:5.14.2")
|
||||
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
|
||||
testImplementation("com.h2database:h2:2.3.232")
|
||||
}
|
||||
|
||||
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
/* ----------------------------- Shadow -------------------------------- */
|
||||
tasks.shadowJar {
|
||||
relocate("io.papermc.lib", "net.trueog.unionsog.paperlib")
|
||||
relocate("co.aikar.commands", "net.trueog.unionsog.acf")
|
||||
relocate("co.aikar.locales", "net.trueog.unionsog.locales")
|
||||
relocate("com.cryptomorin.xseries", "net.trueog.unionsog.xseries")
|
||||
relocate("com.google.gson", "net.trueog.unionsog.gson")
|
||||
dependencies { exclude(dependency("org.jetbrains:annotations:.*")) }
|
||||
archiveBaseName.set("Unions-OG")
|
||||
archiveClassifier.set("")
|
||||
}
|
||||
|
||||
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
|
||||
|
||||
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar, tasks.javadoc) } // Build depends on spotless and shadow.
|
||||
|
||||
/* --------------------------- Javac opts ------------------------------- */
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
|
||||
tasks.test { useJUnitPlatform() }
|
||||
|
||||
/* ----------------------------- Auto Formatting ------------------------ */
|
||||
spotless {
|
||||
java {
|
||||
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
|
||||
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
|
||||
removeUnusedImports() // Remove imports that aren't being called.
|
||||
}
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
|
||||
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.18.1" // Declare checkstyle version to use.
|
||||
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
|
||||
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
|
||||
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
|
||||
}
|
||||
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
|
||||
/* ------------------------------ Eclipse SHIM ------------------------- */
|
||||
|
||||
// This can't be put in eclipse.gradle.kts because Gradle is weird.
|
||||
subprojects {
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "eclipse")
|
||||
eclipse.project.name = "${project.name}-${rootProject.name}"
|
||||
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
|
||||
}
|
||||
|
||||
tasks.register<Copy>("copyToTestServer") {
|
||||
val out = System.getenv("TEST_SERVER")?.let { file("$it/plugins") }
|
||||
onlyIf { out != null }
|
||||
dependsOn(tasks.shadowJar)
|
||||
from(tasks.shadowJar)
|
||||
into(out ?: layout.buildDirectory.dir("noop").get().asFile)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="FinalLocalVariable"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="Indentation">
|
||||
<property name="severity" value="ignore"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="(?<!\w)fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
@@ -0,0 +1,151 @@
|
||||
/* This is free and unencumbered software released into the public domain */
|
||||
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel
|
||||
import java.nio.file.Files
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import javax.xml.transform.OutputKeys
|
||||
import javax.xml.transform.TransformerFactory
|
||||
import javax.xml.transform.dom.DOMSource
|
||||
import javax.xml.transform.stream.StreamResult
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
val kotlinPluginProjects = configurations
|
||||
.getByName("compileClasspath")
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.filter { it -> it.attributes.getAttribute(kotlinAttribute) != null }
|
||||
.map { it.path }
|
||||
kotlinPluginProjects.forEach { evaluationDependsOn(it) }
|
||||
|
||||
val ideLibs: Configuration by
|
||||
configurations.creating {
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
|
||||
configure<EclipseModel> {
|
||||
project {
|
||||
name = "Template-OG-Plugin"
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add(ideLibs)
|
||||
}
|
||||
}
|
||||
|
||||
val ideLibDir = layout.buildDirectory.dir("ide-libs")
|
||||
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
|
||||
|
||||
val copyTasks = mutableListOf<TaskProvider<Copy>>()
|
||||
|
||||
kotlinPluginProjects.forEach { path ->
|
||||
val sub = project(path)
|
||||
val shadowJarProv = sub.tasks.named("shadowJar")
|
||||
val copyTask =
|
||||
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
|
||||
dependsOn(shadowJarProv)
|
||||
from(shadowJarProv)
|
||||
into(ideLibDir)
|
||||
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
|
||||
}
|
||||
copyTasks += copyTask
|
||||
}
|
||||
|
||||
/* Ensure the jars exist before .classpath is generated */
|
||||
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
|
||||
|
||||
/* Supply those jars to the ideLibs configuration (after evaluation) */
|
||||
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
|
||||
|
||||
val injectIdeLibs =
|
||||
tasks.register("injectIdeLibs") {
|
||||
dependsOn("eclipse") // run after all eclipse files are generated
|
||||
doLast {
|
||||
val cpFile = file(".classpath")
|
||||
if (!cpFile.exists()) return@doLast
|
||||
|
||||
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
|
||||
if (jars.isEmpty()) return@doLast
|
||||
|
||||
// Parse DOM
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val doc = dbf.newDocumentBuilder().parse(cpFile)
|
||||
val root = doc.documentElement
|
||||
|
||||
// Helper to see if an entry already exists
|
||||
fun exists(path: String): Boolean =
|
||||
root.getElementsByTagName("classpathentry").let { list ->
|
||||
(0 until list.length).any { i ->
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue
|
||||
kind == "lib" && p == path
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any entry that points to ide-libs dir (folder or jars) to avoid dupes
|
||||
val toRemove = mutableListOf<org.w3c.dom.Node>()
|
||||
val list = root.getElementsByTagName("classpathentry")
|
||||
val dirPath = ideLibDir.get().asFile.absolutePath
|
||||
for (i in 0 until list.length) {
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
|
||||
if (kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))) {
|
||||
toRemove += n
|
||||
}
|
||||
}
|
||||
toRemove.forEach { root.removeChild(it) }
|
||||
|
||||
// Append our jar entries LAST
|
||||
jars.forEach { f ->
|
||||
val abs = f.absolutePath
|
||||
if (!exists(abs)) {
|
||||
val entry = doc.createElement("classpathentry")
|
||||
entry.setAttribute("kind", "lib")
|
||||
entry.setAttribute("path", abs)
|
||||
root.appendChild(entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Write back pretty
|
||||
val tf =
|
||||
TransformerFactory.newInstance().newTransformer().apply {
|
||||
setOutputProperty(OutputKeys.INDENT, "yes")
|
||||
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
|
||||
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
|
||||
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
|
||||
}
|
||||
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
|
||||
|
||||
val eclipseModel = extensions.getByType<EclipseModel>()
|
||||
|
||||
fun Project.addResolvableEclipseConfigs() {
|
||||
val jarAttr =
|
||||
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
|
||||
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
|
||||
|
||||
val compileOnlyRes =
|
||||
configurations.create("eclipseCompileOnly") {
|
||||
extendsFrom(configurations.getByName("compileOnly"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
val compileOnlyApiRes =
|
||||
configurations.create("eclipseCompileOnlyApi") {
|
||||
extendsFrom(configurations.getByName("compileOnlyApi"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
|
||||
}
|
||||
|
||||
addResolvableEclipseConfigs()
|
||||
@@ -0,0 +1,2 @@
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
Submodule
+1
Submodule libs/DiamondBank-OG added at 39d5a2b936.
Submodule
+1
Submodule libs/Utilities-OG added at 8b5c86cc9c.
@@ -1,308 +0,0 @@
|
||||
#!/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 "$@"
|
||||
@@ -1,205 +0,0 @@
|
||||
@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%
|
||||
@@ -0,0 +1,194 @@
|
||||
Unions-OG Placeholder Reference
|
||||
===============================
|
||||
|
||||
Unions-OG registers legacy PlaceholderAPI placeholders when PlaceholderAPI is installed.
|
||||
It also registers MiniPlaceholders through the Utilities-OG API when Utilities-OG is installed.
|
||||
|
||||
Identifiers
|
||||
-----------
|
||||
|
||||
All placeholders use both identifiers:
|
||||
|
||||
- simpleclans
|
||||
- simpleunions
|
||||
|
||||
In the syntax patterns below, replace {id} with either identifier.
|
||||
|
||||
Legacy PlaceholderAPI syntax:
|
||||
|
||||
- Player placeholder: %{id}_{player-placeholder}%
|
||||
- Union placeholder: %{id}_clan_{union-placeholder}%
|
||||
- Union compatibility alias: %{id}_union_{union-placeholder}%
|
||||
- Relational color placeholder: %rel_{id}_color%
|
||||
|
||||
MiniPlaceholders syntax:
|
||||
|
||||
- Player placeholder: <{id}_{player-placeholder}>
|
||||
- Union placeholder: <{id}_clan_{union-placeholder}>
|
||||
- Union compatibility alias: <{id}_union_{union-placeholder}>
|
||||
- Relational color placeholder: <{id}_rel_color>
|
||||
|
||||
MiniPlaceholders are audience placeholders unless marked relational. They require a player audience.
|
||||
Relational MiniPlaceholders require a relational MiniPlaceholders context.
|
||||
|
||||
Boolean output follows PlaceholderAPI's boolean.true and boolean.false config values when PlaceholderAPI is loaded.
|
||||
Without PlaceholderAPI, boolean placeholders return yes or no.
|
||||
|
||||
Player Placeholders
|
||||
-------------------
|
||||
|
||||
These resolve against the requested player:
|
||||
|
||||
- name
|
||||
- clean_name
|
||||
- lastseendays
|
||||
- total_kills
|
||||
- rival_kills
|
||||
- civilian_kills
|
||||
- neutral_kills
|
||||
- ally_kills
|
||||
- is_friendlyfire_on
|
||||
- deaths
|
||||
- weighted_kills
|
||||
- kdr
|
||||
- topplayers_position
|
||||
- join_date
|
||||
- lastseen
|
||||
- inactive_days
|
||||
- in_clan
|
||||
- tag
|
||||
- tag_label
|
||||
- is_trusted
|
||||
- is_member
|
||||
- clanchat_player_color
|
||||
- allychat_player_color
|
||||
- is_bb_enabled
|
||||
- is_invite_enabled
|
||||
- is_tag_enabled
|
||||
- is_muted
|
||||
- is_mutedally
|
||||
|
||||
Player compatibility aliases:
|
||||
|
||||
- in_union maps to in_clan
|
||||
- unionchat_player_color maps to clanchat_player_color
|
||||
|
||||
Examples:
|
||||
|
||||
- %simpleclans_name%
|
||||
- %simpleunions_in_union%
|
||||
- <simpleclans_name>
|
||||
- <simpleunions_in_union>
|
||||
|
||||
Union Placeholders
|
||||
------------------
|
||||
|
||||
These resolve against the requested player's union:
|
||||
|
||||
- name
|
||||
- balance
|
||||
- balance_formatted
|
||||
- tag
|
||||
- color
|
||||
- inactivedays
|
||||
- friendly_fire
|
||||
- allies_count
|
||||
- founded
|
||||
- color_tag
|
||||
- size
|
||||
- rivals_count
|
||||
- is_permanent
|
||||
- onlinemembers_count
|
||||
- total_kdr
|
||||
- topclans_position
|
||||
- total_deaths
|
||||
- average_wk
|
||||
- total_kills
|
||||
- total_rival
|
||||
- total_neutral
|
||||
- total_civilian
|
||||
- total_ally
|
||||
- is_anyonline
|
||||
- is_unrivable
|
||||
- allow_withdraw
|
||||
- allow_deposit
|
||||
|
||||
Union compatibility aliases:
|
||||
|
||||
- Use union_ instead of clan_ for any union placeholder.
|
||||
- topunions_position maps to topclans_position.
|
||||
|
||||
Examples:
|
||||
|
||||
- %simpleclans_clan_name%
|
||||
- %simpleclans_union_name%
|
||||
- %simpleunions_clan_color_tag%
|
||||
- %simpleunions_union_topunions_position%
|
||||
- <simpleclans_clan_name>
|
||||
- <simpleclans_union_name>
|
||||
- <simpleunions_clan_color_tag>
|
||||
- <simpleunions_union_topunions_position>
|
||||
|
||||
Top Player Placeholders
|
||||
-----------------------
|
||||
|
||||
Legacy PlaceholderAPI syntax:
|
||||
|
||||
- %{id}_topplayers_{position}_{player-placeholder}%
|
||||
|
||||
MiniPlaceholders syntax:
|
||||
|
||||
- <{id}_topplayers_{player-placeholder}:{position}>
|
||||
|
||||
The {position} value is 1-based. The {player-placeholder} value can be any player placeholder or player compatibility alias listed above.
|
||||
|
||||
Examples:
|
||||
|
||||
- %simpleclans_topplayers_1_name%
|
||||
- %simpleunions_topplayers_3_kdr%
|
||||
- <simpleclans_topplayers_name:1>
|
||||
- <simpleunions_topplayers_kdr:3>
|
||||
|
||||
Top Union Placeholders
|
||||
----------------------
|
||||
|
||||
Legacy PlaceholderAPI syntax:
|
||||
|
||||
- %{id}_topclans_{position}_clan_{union-placeholder}%
|
||||
- %{id}_topunions_{position}_union_{union-placeholder}%
|
||||
|
||||
MiniPlaceholders syntax:
|
||||
|
||||
- <{id}_topclans_clan_{union-placeholder}:{position}>
|
||||
- <{id}_topunions_union_{union-placeholder}:{position}>
|
||||
|
||||
The {position} value is 1-based. The {union-placeholder} value can be any union placeholder or union compatibility alias listed above.
|
||||
|
||||
Examples:
|
||||
|
||||
- %simpleclans_topclans_1_clan_name%
|
||||
- %simpleclans_topunions_1_union_name%
|
||||
- %simpleunions_topclans_5_clan_total_kdr%
|
||||
- <simpleclans_topclans_clan_name:1>
|
||||
- <simpleclans_topunions_union_name:1>
|
||||
- <simpleunions_topclans_clan_total_kdr:5>
|
||||
|
||||
Relational Color Placeholder
|
||||
----------------------------
|
||||
|
||||
The relational color placeholder returns a color code based on the relationship between two players:
|
||||
|
||||
- same union: &a
|
||||
- ally: &b
|
||||
- rival: &c
|
||||
- unrelated: empty string
|
||||
|
||||
Legacy PlaceholderAPI syntax:
|
||||
|
||||
- %rel_simpleclans_color%
|
||||
- %rel_simpleunions_color%
|
||||
|
||||
MiniPlaceholders syntax:
|
||||
|
||||
- <simpleclans_rel_color>
|
||||
- <simpleunions_rel_color>
|
||||
@@ -1,330 +0,0 @@
|
||||
<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.19.3-SNAPSHOT</version>
|
||||
<name>SimpleClans</name>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
|
||||
<!-- Resources -->
|
||||
<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>
|
||||
|
||||
<!-- Plugins -->
|
||||
<plugins>
|
||||
<!-- Compilation plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- JAR creation plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Release plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Shade plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<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>
|
||||
|
||||
<transformers>
|
||||
<!-- Avoid overlapping MANIFEST.MF file -->
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
|
||||
<resource>MANIFEST.MF</resource>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Dependency plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.6.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>4.9.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>revision</goal>
|
||||
</goals>
|
||||
<phase>validate</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>javadoc</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
<doclint>all,-missing</doclint>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<!-- Dependencies -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<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>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</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>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.aikar</groupId>
|
||||
<artifactId>acf-paper</artifactId>
|
||||
<version>0.5.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>XSeries</artifactId>
|
||||
<version>8.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>16.18.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.discordsrv</groupId>
|
||||
<artifactId>discordsrv</artifactId>
|
||||
<version>1.24.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>biz.princeps</groupId>
|
||||
<artifactId>landlord-latest</artifactId>
|
||||
<version>4.351</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<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 -->
|
||||
<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>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- Upstream Distribution -->
|
||||
|
||||
<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>
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
rootProject.name = "Unions-OG"
|
||||
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
}
|
||||
|
||||
file("libs")
|
||||
.listFiles()
|
||||
?.filter { it.isDirectory && !it.name.startsWith(".") }
|
||||
?.forEach { dir ->
|
||||
include(":libs:${dir.name}")
|
||||
project(":libs:${dir.name}").projectDir = dir
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,10 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
/**
|
||||
* Clan Requests
|
||||
* @author phaed
|
||||
*/
|
||||
public enum ClanRequest
|
||||
{
|
||||
DEMOTE, PROMOTE, DISBAND, INVITE, CREATE_ALLY, BREAK_RIVALRY, START_WAR, END_WAR, RENAME
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class Kill {
|
||||
|
||||
private final ClanPlayer killer;
|
||||
private final ClanPlayer victim;
|
||||
private final LocalDateTime time;
|
||||
|
||||
public Kill(ClanPlayer killer, ClanPlayer victim, LocalDateTime time) {
|
||||
this.killer = killer;
|
||||
this.victim = victim;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public ClanPlayer getKiller() {
|
||||
return killer;
|
||||
}
|
||||
|
||||
public ClanPlayer getVictim() {
|
||||
return victim;
|
||||
}
|
||||
|
||||
public LocalDateTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
CIVILIAN("c"), RIVAL("r"), NEUTRAL("n"), ALLY("a");
|
||||
|
||||
Type(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
private final String shortName;
|
||||
|
||||
public String getShortname() {
|
||||
return shortName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
public enum PermissionLevel {
|
||||
LEADER, TRUSTED
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*/
|
||||
public class Rank implements Comparable<Rank> {
|
||||
|
||||
private String name;
|
||||
private String displayName;
|
||||
private Set<String> permissions;
|
||||
|
||||
public Rank(String name) {
|
||||
setName(name);
|
||||
permissions = new HashSet<>();
|
||||
setDisplayName(displayName);
|
||||
}
|
||||
|
||||
public Rank(String name, @Nullable String displayName, Set<String> permissions) {
|
||||
setName(name);
|
||||
setDisplayName(displayName);
|
||||
setPermissions(permissions);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
if (name == null || name.isEmpty()) {
|
||||
throw new IllegalArgumentException("name cannot be null or empty");
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDisplayName(@Nullable String displayName) {
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = name;
|
||||
}
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public void setPermissions(Set<String> permissions) {
|
||||
if (permissions == null) {
|
||||
permissions = new HashSet<>();
|
||||
}
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Rank other = (Rank) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rank's permissions
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Set<String> getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rank's display name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rank's name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Rank other) {
|
||||
return Integer.compare(permissions.size(), other.permissions.size());
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author RoinujNosde
|
||||
*
|
||||
*/
|
||||
public enum RankPermission {
|
||||
|
||||
ALLY_ADD("simpleclans.leader.ally", PermissionLevel.LEADER),
|
||||
ALLY_CHAT("simpleclans.member.ally", PermissionLevel.TRUSTED),
|
||||
ALLY_REMOVE("simpleclans.leader.ally", PermissionLevel.LEADER),
|
||||
BANK_BALANCE("simpleclans.member.bank", PermissionLevel.TRUSTED),
|
||||
BANK_DEPOSIT("simpleclans.member.bank", PermissionLevel.LEADER),
|
||||
BANK_WITHDRAW("simpleclans.member.bank", PermissionLevel.LEADER),
|
||||
BB_ADD("simpleclans.member.bb-add", PermissionLevel.TRUSTED),
|
||||
BB_CLEAR("simpleclans.leader.bb-clear", PermissionLevel.LEADER),
|
||||
COORDS("simpleclans.member.coords", PermissionLevel.TRUSTED),
|
||||
FEE_ENABLE("simpleclans.leader.fee", PermissionLevel.LEADER),
|
||||
FEE_SET("simpleclans.leader.fee", PermissionLevel.LEADER),
|
||||
FEE_BYPASS("", PermissionLevel.LEADER),
|
||||
REGROUP_HOME("simpleclans.leader.regroup.home", PermissionLevel.LEADER),
|
||||
REGROUP_ME("simpleclans.leader.regroup.me", PermissionLevel.LEADER),
|
||||
HOME_SET("simpleclans.leader.home-set", PermissionLevel.LEADER),
|
||||
HOME_TP("simpleclans.member.home", PermissionLevel.TRUSTED),
|
||||
INVITE("simpleclans.leader.invite", PermissionLevel.LEADER),
|
||||
KICK("simpleclans.leader.kick", PermissionLevel.LEADER),
|
||||
MODTAG("simpleclans.leader.modtag", PermissionLevel.LEADER),
|
||||
RANK_DISPLAYNAME("simpleclans.leader.rank.setdisplayname", PermissionLevel.LEADER),
|
||||
RANK_LIST("simpleclans.leader.rank.list", PermissionLevel.LEADER),
|
||||
RIVAL_ADD("simpleclans.leader.rival", PermissionLevel.LEADER),
|
||||
RIVAL_REMOVE("simpleclans.leader.rival", PermissionLevel.LEADER),
|
||||
WAR_END("simpleclans.leader.war", PermissionLevel.LEADER),
|
||||
WAR_START("simpleclans.leader.war", PermissionLevel.LEADER),
|
||||
STATS("simpleclans.member.stats", PermissionLevel.TRUSTED),
|
||||
VITALS("simpleclans.member.vitals", PermissionLevel.TRUSTED),
|
||||
KILLS("simpleclans.member.kills", PermissionLevel.TRUSTED),
|
||||
DESCRIPTION("simpleclans.leader.description", PermissionLevel.LEADER),
|
||||
MOSTKILLED("simpleclans.mod.mostkilled", PermissionLevel.TRUSTED),
|
||||
FRIENDLYFIRE("simpleclans.leader.ff", PermissionLevel.LEADER),
|
||||
SETBANNER("simpleclans.leader.setbanner", PermissionLevel.LEADER);
|
||||
|
||||
private final String bukkitPermission;
|
||||
private final PermissionLevel permissionLevel;
|
||||
|
||||
RankPermission(String bukkitPermission, PermissionLevel permissionLevel) {
|
||||
this.bukkitPermission = bukkitPermission;
|
||||
this.permissionLevel = permissionLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the Bukkit equivalent to this rank permission
|
||||
*/
|
||||
public String getBukkitPermission() {
|
||||
return bukkitPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the PermissionLevel
|
||||
*
|
||||
*/
|
||||
public PermissionLevel getPermissionLevel() {
|
||||
return permissionLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().replace("_", ".").toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param permission the permission
|
||||
* @return true if this is a valid rank permission
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public static boolean isValid(@Nullable String permission) {
|
||||
for (RankPermission p : values()) {
|
||||
if (p.toString().equalsIgnoreCase(permission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
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<>();
|
||||
|
||||
public War(@NotNull Clan clan1, @NotNull Clan clan2) {
|
||||
clans.put(clan1, 0);
|
||||
clans.put(clan2, 0);
|
||||
}
|
||||
|
||||
public List<Clan> getClans() {
|
||||
return new ArrayList<>(clans.keySet());
|
||||
}
|
||||
|
||||
public int getTotalCasualties() {
|
||||
return clans.values().stream().mapToInt(value -> value).sum();
|
||||
}
|
||||
|
||||
public int getCasualties(@NotNull Clan clan) {
|
||||
return clans.getOrDefault(clan, 0);
|
||||
}
|
||||
|
||||
public void increaseCasualties(@NotNull Clan clan) {
|
||||
clans.computeIfPresent(clan, (c, i) -> i + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof War) {
|
||||
return clans.equals(((War) obj).clans);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return clans.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.chat;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ChatManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
|
||||
public interface ChatHandler {
|
||||
|
||||
SimpleClans plugin = SimpleClans.getInstance();
|
||||
SettingsManager settingsManager = plugin.getSettingsManager();
|
||||
ChatManager chatManager = plugin.getChatManager();
|
||||
PermissionsManager permissionsManager = plugin.getPermissionsManager();
|
||||
|
||||
void sendMessage(SCMessage message);
|
||||
|
||||
boolean canHandle(SCMessage.Source source);
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.chat.handlers;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.chat.ChatHandler;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PERFORMANCE_USE_BUNGEECORD;
|
||||
|
||||
public class ProxyChatHandler implements ChatHandler {
|
||||
|
||||
@Override
|
||||
public void sendMessage(SCMessage message) {
|
||||
plugin.getProxyManager().sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(Source source) {
|
||||
return source == Source.SPIGOT && settingsManager.is(PERFORMANCE_USE_BUNGEECORD);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.chat.handlers;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.chat.ChatHandler;
|
||||
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;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source.*;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PERFORMANCE_USE_BUNGEECORD;
|
||||
|
||||
/**
|
||||
* Handles delivering messages from {@link Source#SPIGOT} or {@link Source#DISCORD} to internal spy chat.
|
||||
*/
|
||||
public class SpyChatHandler implements ChatHandler {
|
||||
|
||||
@Override
|
||||
public void sendMessage(SCMessage message) {
|
||||
ConfigField formatField = ConfigField.valueOf(String.format("%sCHAT_SPYFORMAT",
|
||||
message.getSource() == DISCORD ? "DISCORD" : message.getChannel()));
|
||||
String format = settingsManager.getString(formatField);
|
||||
message.setContent(ChatUtils.stripColors(message.getContent()));
|
||||
String formattedMessage = chatManager.parseChatFormat(format, message);
|
||||
|
||||
List<ClanPlayer> onlineSpies = getOnlineSpies();
|
||||
|
||||
// Don't send a duplicate message if a spy is inside the clan
|
||||
onlineSpies.removeAll(message.getReceivers());
|
||||
onlineSpies.forEach(receiver -> ChatBlock.sendMessage(receiver, formattedMessage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(SCMessage.Source source) {
|
||||
return source == SPIGOT || (source == PROXY && settingsManager.is(PERFORMANCE_USE_BUNGEECORD))
|
||||
|| (source == DISCORD && chatManager.isDiscordHookEnabled());
|
||||
}
|
||||
|
||||
private List<ClanPlayer> getOnlineSpies() {
|
||||
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())).
|
||||
filter(Objects::nonNull).
|
||||
filter(clanPlayer -> !clanPlayer.isMuted()).
|
||||
collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ClanInput {
|
||||
|
||||
private final Clan clan;
|
||||
|
||||
public ClanInput(@NotNull Clan clan) {
|
||||
this.clan = clan;
|
||||
}
|
||||
|
||||
public Clan getClan() {
|
||||
return clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ClanInput clanInput = (ClanInput) o;
|
||||
return clan.equals(clanInput.clan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clan);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ClanPlayerInput {
|
||||
|
||||
private final ClanPlayer clanPlayer;
|
||||
|
||||
public ClanPlayerInput(@NotNull ClanPlayer clanPlayer) {
|
||||
this.clanPlayer = clanPlayer;
|
||||
}
|
||||
|
||||
public ClanPlayer getClanPlayer() {
|
||||
return clanPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ClanPlayerInput that = (ClanPlayerInput) o;
|
||||
return clanPlayer.equals(that.clanPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clanPlayer);
|
||||
}
|
||||
}
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
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.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.ALLY;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel.NONE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source.SPIGOT;
|
||||
|
||||
@CommandAlias("%ally_chat")
|
||||
@Description("{@@command.description.ally}")
|
||||
@CommandPermission("simpleclans.member.ally")
|
||||
@Conditions("%basic_conditions|clan_member|can_chat:type=ALLY|rank:name=ALLY_CHAT")
|
||||
public class AllyChatCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private ChatManager chatManager;
|
||||
@Dependency
|
||||
private SettingsManager settingsManager;
|
||||
@Dependency
|
||||
private StorageManager storageManager;
|
||||
|
||||
@Default
|
||||
@HelpSearchTags("chat")
|
||||
public void sendMessage(ClanPlayer cp, @Name("message") String message) {
|
||||
chatManager.processChat(SPIGOT, ALLY, cp, message);
|
||||
}
|
||||
|
||||
@Subcommand("%join")
|
||||
public void join(ClanPlayer clanPlayer) {
|
||||
if (clanPlayer.getChannel() == ALLY) {
|
||||
ChatBlock.sendMessage(clanPlayer, lang("already.joined.ally.chat"));
|
||||
return;
|
||||
}
|
||||
|
||||
clanPlayer.setChannel(ALLY);
|
||||
storageManager.updateClanPlayer(clanPlayer);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("joined.ally.chat"));
|
||||
}
|
||||
|
||||
@Subcommand("%leave")
|
||||
public void leave(ClanPlayer clanPlayer) {
|
||||
if (clanPlayer.getChannel() == ALLY) {
|
||||
clanPlayer.setChannel(NONE);
|
||||
storageManager.updateClanPlayer(clanPlayer);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("left.ally.chat", clanPlayer));
|
||||
} else {
|
||||
ChatBlock.sendMessage(clanPlayer, lang("chat.didnt.join", clanPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%mute")
|
||||
public void mute(ClanPlayer clanPlayer) {
|
||||
if (!clanPlayer.isMutedAlly()) {
|
||||
clanPlayer.mute(ALLY, true);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("muted.ally.chat", clanPlayer));
|
||||
} else {
|
||||
clanPlayer.mute(ALLY, false);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("unmuted.ally.chat", clanPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
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.EconomyResponse;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.BankDepositEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.BankWithdrawEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
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.COMMAND;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.REVERT;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Subcommand("%bank")
|
||||
@Conditions("%basic_conditions|economy|verified")
|
||||
public class BankCommand extends BaseCommand {
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
|
||||
@Subcommand("%status")
|
||||
@CommandPermission("simpleclans.member.bank")
|
||||
@Conditions("rank:name=BANK_BALANCE")
|
||||
@Description("{@@command.description.bank.status}")
|
||||
public void bankStatus(Player player, Clan clan) {
|
||||
player.sendMessage(AQUA + lang("clan.balance", player, clan.getBalanceFormatted()));
|
||||
}
|
||||
|
||||
@Subcommand("%withdraw %all")
|
||||
@CommandPermission("simpleclans.member.bank")
|
||||
@Conditions("rank:name=BANK_WITHDRAW")
|
||||
@Description("{@@command.description.bank.withdraw.all}")
|
||||
public void bankWithdraw(Player player, Clan clan) {
|
||||
processWithdraw(player, clan, clan.getBalance());
|
||||
}
|
||||
|
||||
@Subcommand("%withdraw")
|
||||
@CommandPermission("simpleclans.member.bank")
|
||||
@Conditions("rank:name=BANK_WITHDRAW")
|
||||
@Description("{@@command.description.bank.withdraw.amount}")
|
||||
public void bankWithdraw(Player player, Clan clan, double amount) {
|
||||
processWithdraw(player, clan, amount);
|
||||
}
|
||||
|
||||
private void processWithdraw(Player player, Clan clan, double amount) {
|
||||
if (!clan.isAllowWithdraw()) {
|
||||
String message = getCurrentCommandManager().getCommandReplacements()
|
||||
.replace(lang("withdraw.not.allowed", player));
|
||||
ChatBlock.sendMessage(player, RED + message);
|
||||
return;
|
||||
}
|
||||
amount = Math.abs(amount);
|
||||
/*
|
||||
TODO: Remove at SimpleClans 3.0
|
||||
*/
|
||||
BankWithdrawEvent event = new BankWithdrawEvent(player, clan, amount);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* ——————————————————————————————————
|
||||
*/
|
||||
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
|
||||
switch (clan.withdraw(operator, COMMAND, amount)) {
|
||||
case SUCCESS -> {
|
||||
if (permissions.grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, CurrencyFormat.format(amount)));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", CurrencyFormat.format(amount), player.getName()));
|
||||
} else {
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.WITHDRAW, clan.getBalance() + amount);
|
||||
}
|
||||
}
|
||||
case NOT_ENOUGH_BALANCE -> player.sendMessage(lang("clan.bank.not.enough.money", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%deposit %all")
|
||||
@CommandPermission("simpleclans.member.bank")
|
||||
@Conditions("rank:name=BANK_DEPOSIT")
|
||||
@Description("{@@command.description.bank.deposit.all}")
|
||||
public void bankDeposit(Player player, Clan clan) {
|
||||
processDeposit(player, clan, permissions.playerGetMoney(player));
|
||||
}
|
||||
|
||||
@Subcommand("%deposit")
|
||||
@CommandPermission("simpleclans.member.bank")
|
||||
@Conditions("rank:name=BANK_DEPOSIT")
|
||||
@Description("{@@command.description.bank.deposit.amount}")
|
||||
public void bankDeposit(Player player, Clan clan, double amount) {
|
||||
processDeposit(player, clan, amount);
|
||||
}
|
||||
|
||||
private void processDeposit(Player player, Clan clan, double amount) {
|
||||
if (!clan.isAllowDeposit()) {
|
||||
String message = getCurrentCommandManager().getCommandReplacements()
|
||||
.replace(lang("deposit.not.allowed", player));
|
||||
ChatBlock.sendMessage(player, RED + message);
|
||||
return;
|
||||
}
|
||||
amount = Math.abs(amount);
|
||||
|
||||
/*
|
||||
TODO: Remove at SimpleClans 3.0
|
||||
*/
|
||||
BankDepositEvent event = new BankDepositEvent(player, clan, amount);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* ——————————————————————————————————
|
||||
*/
|
||||
|
||||
if (!permissions.playerHasMoney(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, CurrencyFormat.format(amount)));
|
||||
return;
|
||||
}
|
||||
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
|
||||
EconomyResponse response = clan.deposit(operator, COMMAND, amount);
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
if (permissions.chargePlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, CurrencyFormat.format(amount)));
|
||||
clan.addBb(player.getName(), lang("bb.clan.deposit", CurrencyFormat.format(amount), player.getName()));
|
||||
} else {
|
||||
//Reverts the deposit if something went wrong with Vault
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.DEPOSIT, clan.getBalance() - amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
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.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.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|verified")
|
||||
public class BbCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
|
||||
@Subcommand("%bb")
|
||||
@CommandPermission("simpleclans.member.bb")
|
||||
@Description("{@@command.description.bb.display}")
|
||||
public void display(Player sender) {
|
||||
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(sender.getUniqueId()));
|
||||
clan.displayBb(sender);
|
||||
}
|
||||
|
||||
@Subcommand("%bb %clear")
|
||||
@CommandPermission("simpleclans.leader.bb-clear")
|
||||
@Conditions("rank:name=BB_CLEAR")
|
||||
@Description("{@@command.description.bb.clear}")
|
||||
public void clear(Player player) {
|
||||
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(player.getUniqueId()));
|
||||
clan.clearBb();
|
||||
ChatBlock.sendMessage(player, RED + lang("cleared.bb", player));
|
||||
}
|
||||
|
||||
@Subcommand("%bb %add")
|
||||
@CommandPermission("simpleclans.member.bb-add")
|
||||
@Conditions("rank:name=BB_ADD")
|
||||
@Description("{@@command.description.bb.post}")
|
||||
public void postMessage(Player player, @Name("message") String msg) {
|
||||
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(player.getUniqueId()));
|
||||
clan.addBb(lang("bulletin.board.message", player.getName(), msg));
|
||||
clan.displayBb(player);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
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.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ChatManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel.CLAN;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel.NONE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source.SPIGOT;
|
||||
|
||||
@CommandAlias("%clan_chat")
|
||||
@Conditions("%basic_conditions|clan_member|can_chat:type=CLAN")
|
||||
@CommandPermission("simpleclans.member.chat")
|
||||
@Description("{@@command.description.chat}")
|
||||
public class ChatCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private ChatManager chatManager;
|
||||
@Dependency
|
||||
private StorageManager storageManager;
|
||||
|
||||
@Default
|
||||
@HelpSearchTags("chat")
|
||||
public void sendMessage(ClanPlayer cp, @Name("message") String message) {
|
||||
chatManager.processChat(SPIGOT, CLAN, cp, message);
|
||||
}
|
||||
|
||||
@Subcommand("%join")
|
||||
public void join(ClanPlayer clanPlayer) {
|
||||
if (clanPlayer.getChannel() == CLAN) {
|
||||
ChatBlock.sendMessage(clanPlayer, lang("already.joined.clan.chat"));
|
||||
return;
|
||||
}
|
||||
|
||||
clanPlayer.setChannel(CLAN);
|
||||
storageManager.updateClanPlayer(clanPlayer);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("joined.clan.chat"));
|
||||
}
|
||||
|
||||
@Subcommand("%leave")
|
||||
public void leave(ClanPlayer clanPlayer) {
|
||||
if (clanPlayer.getChannel() == CLAN) {
|
||||
clanPlayer.setChannel(NONE);
|
||||
storageManager.updateClanPlayer(clanPlayer);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("left.clan.chat", clanPlayer));
|
||||
} else {
|
||||
ChatBlock.sendMessage(clanPlayer, lang("chat.didnt.join", clanPlayer));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%mute")
|
||||
public void mute(ClanPlayer clanPlayer) {
|
||||
if (!clanPlayer.isMuted()) {
|
||||
clanPlayer.mute(CLAN, true);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("muted.clan.chat", clanPlayer));
|
||||
} else {
|
||||
clanPlayer.mute(CLAN, false);
|
||||
ChatBlock.sendMessage(clanPlayer, lang("unmuted.clan.chat", clanPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.ResignPrompt;
|
||||
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.CurrencyFormat;
|
||||
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.*;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
public class ClanCommands extends BaseCommand {
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
@Dependency
|
||||
private RequestManager requestManager;
|
||||
@Dependency
|
||||
private ProtectionManager protectionManager;
|
||||
|
||||
@Subcommand("%war %start")
|
||||
@CommandPermission("simpleclans.leader.war")
|
||||
@Conditions("verified|rank:name=WAR_START")
|
||||
@Description("{@@command.description.war.start}")
|
||||
@CommandCompletion("@rivals")
|
||||
public void startWar(Player player, ClanPlayer requester, Clan requestClan, @Conditions("can_war_target") @Name("clan") ClanInput targetClanInput) {
|
||||
Clan targetClan = targetClanInput.getClan();
|
||||
|
||||
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(requestClan.getLeaders());
|
||||
|
||||
if (settings.is(WAR_START_REQUEST_ENABLED)) {
|
||||
if (!onlineLeaders.isEmpty()) {
|
||||
requestManager.addWarStartRequest(requester, targetClan, requestClan);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("leaders.have.been.asked.to.accept.the.war.request",
|
||||
player, targetClan.getName()));
|
||||
} else {
|
||||
ChatBlock.sendMessage(player, RED + lang("at.least.one.leader.accept.the.alliance", player));
|
||||
}
|
||||
} else {
|
||||
protectionManager.addWar(requester, requestClan, targetClan);
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%war %end")
|
||||
@CommandPermission("simpleclans.leader.war")
|
||||
@Conditions("verified|rank:name=WAR_END")
|
||||
@Description("{@@command.description.war.end}")
|
||||
@CommandCompletion("@warring_clans")
|
||||
public void endWar(ClanPlayer cp, Clan issuerClan, @Name("clan") ClanInput other) {
|
||||
Clan war = other.getClan();
|
||||
if (issuerClan.isWarring(war.getTag())) {
|
||||
requestManager.addWarEndRequest(cp, war, issuerClan);
|
||||
ChatBlock.sendMessage(cp, AQUA + lang("leaders.asked.to.end.rivalry", cp, war.getName()));
|
||||
} else {
|
||||
ChatBlock.sendMessage(cp, RED + lang("clans.not.at.war", cp));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%modtag")
|
||||
@CommandPermission("simpleclans.leader.modtag")
|
||||
@Conditions("verified|rank:name=MODTAG")
|
||||
@Description("{@@command.description.modtag}")
|
||||
public void modtag(Player player, Clan clan, @Single @Name("tag") String tag) {
|
||||
TagChangeEvent event = new TagChangeEvent(player, clan, tag);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
tag = event.getNewTag();
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
|
||||
Optional<String> validationError = plugin.getTagValidator().validate(player, tag);
|
||||
if (validationError.isPresent()) {
|
||||
ChatBlock.sendMessage(player, validationError.get());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cleanTag.equals(clan.getTag())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.can.only.modify.the.color.and.case.of.the.tag",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
|
||||
clan.changeClanTag(tag);
|
||||
cm.updateDisplayName(player);
|
||||
}
|
||||
|
||||
@Subcommand("%setbanner")
|
||||
@CommandPermission("simpleclans.leader.setbanner")
|
||||
@Conditions("verified|rank:name=SETBANNER")
|
||||
@Description("{@@command.description.setbanner}")
|
||||
public void setbanner(Player player, Clan clan) {
|
||||
@SuppressWarnings("deprecation")
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (!hand.getType().toString().contains("BANNER")) {
|
||||
ChatBlock.sendMessageKey(player, "you.must.hold.a.banner");
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setBanner(hand);
|
||||
storage.updateClan(clan);
|
||||
ChatBlock.sendMessageKey(player, "you.changed.clan.banner");
|
||||
}
|
||||
|
||||
@Subcommand("%invite")
|
||||
@CommandPermission("simpleclans.leader.invite")
|
||||
@CommandCompletion("@non_members:ignore_vanished")
|
||||
@Conditions("rank:name=INVITE")
|
||||
@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()) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("invitedplayer.invite.off", sender));
|
||||
return;
|
||||
}
|
||||
Player invitedPlayer = invited.getClanPlayer().toPlayer();
|
||||
if (invitedPlayer == null) return;
|
||||
if (!permissions.has(invitedPlayer, "simpleclans.member.can-join")) {
|
||||
ChatBlock.sendMessage(sender, RED +
|
||||
lang("the.player.doesn.t.not.have.the.permissions.to.join.clans", sender));
|
||||
return;
|
||||
}
|
||||
if (invitedPlayer.getUniqueId().equals(sender.getUniqueId())) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.invite.yourself", sender));
|
||||
return;
|
||||
}
|
||||
long minutesBeforeRejoin = cm.getMinutesBeforeRejoin(invited.getClanPlayer(), clan);
|
||||
if (minutesBeforeRejoin != 0) {
|
||||
ChatBlock.sendMessage(sender, RED +
|
||||
lang("the.player.must.wait.0.before.joining.your.clan.again", sender, minutesBeforeRejoin));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getSize() >= settings.getInt(CLAN_MAX_MEMBERS) && settings.getInt(CLAN_MAX_MEMBERS) > 0) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("the.clan.members.reached.limit", sender));
|
||||
return;
|
||||
}
|
||||
if (!cm.purchaseInvite(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestManager.addInviteRequest(cp, invitedPlayer.getName(), clan);
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("has.been.asked.to.join",
|
||||
sender, invitedPlayer.getName(), clan.getName()));
|
||||
}
|
||||
|
||||
@Subcommand("%fee %check")
|
||||
@Conditions("member_fee_enabled|verified")
|
||||
@CommandPermission("simpleclans.member.fee-check")
|
||||
@Description("{@@command.description.fee.check}")
|
||||
public void checkFee(Player player, Clan clan) {
|
||||
ChatBlock.sendMessage(player, AQUA
|
||||
+ lang("the.fee.is.0.and.its.current.value.is.1", player, clan.isMemberFeeEnabled() ?
|
||||
lang("fee.enabled", player) : lang("fee.disabled", player),
|
||||
clan.getMemberFee()
|
||||
));
|
||||
}
|
||||
|
||||
@Subcommand("%fee %set")
|
||||
@CommandPermission("simpleclans.leader.fee")
|
||||
@Conditions("rank:name=FEE_SET|change_fee")
|
||||
@Description("{@@command.description.fee.set}")
|
||||
public void setFee(Player player, Clan clan, @Name("fee") double fee) {
|
||||
fee = Math.abs(fee);
|
||||
double maxFee = settings.getDouble(ECONOMY_MAX_MEMBER_FEE);
|
||||
if (fee > maxFee) {
|
||||
ChatBlock.sendMessage(player, RED
|
||||
+ lang("max.fee.allowed.is.0", player, CurrencyFormat.format(maxFee)));
|
||||
return;
|
||||
}
|
||||
if (cm.purchaseMemberFeeSet(player)) {
|
||||
clan.setMemberFee(fee);
|
||||
clan.addBb(player.getName(), lang("bb.fee.set", CurrencyFormat.format(fee)));
|
||||
ChatBlock.sendMessage(player, AQUA + lang("fee.set", player));
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%clanff %allow")
|
||||
@CommandPermission("simpleclans.leader.ff")
|
||||
@Conditions("rank:name=FRIENDLYFIRE")
|
||||
@Description("{@@command.description.clanff.allow}")
|
||||
public void allowClanFf(Player player, Clan clan) {
|
||||
clan.addBb(player.getName(), lang("clan.wide.friendly.fire.is.allowed"));
|
||||
clan.setFriendlyFire(true);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
@Subcommand("%clanff %block")
|
||||
@CommandPermission("simpleclans.leader.ff")
|
||||
@Description("{@@command.description.clanff.block}")
|
||||
public void blockClanFf(Player player, Clan clan) {
|
||||
clan.addBb(player.getName(), lang("clan.wide.friendly.fire.blocked"));
|
||||
clan.setFriendlyFire(false);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
@Subcommand("%description")
|
||||
@CommandPermission("simpleclans.leader.description")
|
||||
@Conditions("verified|rank:name=DESCRIPTION")
|
||||
@Description("{@@command.description.description}")
|
||||
public void setDescription(Player player, Clan clan, @Name("description") String description) {
|
||||
if (description.length() < settings.getInt(CLAN_MIN_DESCRIPTION_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.description.must.be.longer.than",
|
||||
player, settings.getInt(CLAN_MIN_DESCRIPTION_LENGTH)));
|
||||
return;
|
||||
}
|
||||
if (description.length() > settings.getInt(CLAN_MAX_DESCRIPTION_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.description.cannot.be.longer.than",
|
||||
player, settings.getInt(CLAN_MAX_DESCRIPTION_LENGTH)));
|
||||
return;
|
||||
}
|
||||
clan.setDescription(description);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("description.changed", player));
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
@Subcommand("%rival %add")
|
||||
@CommandPermission("simpleclans.leader.rival")
|
||||
@Conditions("verified|rivable|minimum_to_rival|rank:name=RIVAL_ADD")
|
||||
@CommandCompletion("@clans:hide_own")
|
||||
@Description("{@@command.description.rival.add}")
|
||||
public void addRival(Player player, Clan issuerClan, @Conditions("verified|different") @Name("clan") ClanInput rival) {
|
||||
Clan rivalInput = rival.getClan();
|
||||
if (settings.isUnrivable(rivalInput.getTag())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("the.clan.cannot.be.rivaled", player));
|
||||
return;
|
||||
}
|
||||
if (!issuerClan.reachedRivalLimit()) {
|
||||
if (!issuerClan.isRival(rivalInput.getTag())) {
|
||||
issuerClan.addRival(rivalInput);
|
||||
rivalInput.addBb(player.getName(), lang("has.initiated.a.rivalry", issuerClan.getName(),
|
||||
rivalInput.getName()), false);
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
ChatBlock.sendMessage(player, RED + lang("rival.limit.reached", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%rival %remove")
|
||||
@CommandPermission("simpleclans.leader.rival")
|
||||
@Conditions("verified|rank:name=RIVAL_REMOVE")
|
||||
@CommandCompletion("@rivals")
|
||||
@Description("{@@command.description.rival.remove}")
|
||||
public void removeRival(Player player,
|
||||
ClanPlayer cp,
|
||||
Clan issuerClan,
|
||||
@Conditions("different") @Name("clan") ClanInput rival) {
|
||||
Clan rivalInput = rival.getClan();
|
||||
if (issuerClan.isRival(rivalInput.getTag())) {
|
||||
requestManager.addRivalryBreakRequest(cp, rivalInput, issuerClan);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("leaders.asked.to.end.rivalry", player,
|
||||
rivalInput.getName()));
|
||||
} else {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clans.are.not.rivals", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%ally %add")
|
||||
@CommandPermission("simpleclans.leader.ally")
|
||||
@Conditions("verified|rank:name=ALLY_ADD|minimum_to_ally")
|
||||
@CommandCompletion("@clans:hide_own")
|
||||
@Description("{@@command.description.ally.add}")
|
||||
public void addAlly(Player player,
|
||||
ClanPlayer cp,
|
||||
Clan issuerClan,
|
||||
@Conditions("verified|different") @Name("clan") ClanInput other) {
|
||||
Clan input = other.getClan();
|
||||
if (issuerClan.isAlly(input.getTag())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clans.are.already.allies", player));
|
||||
return;
|
||||
}
|
||||
int maxAlliances = settings.getInt(CLAN_MAX_ALLIANCES);
|
||||
if (maxAlliances != -1) {
|
||||
if (issuerClan.getAllies().size() >= maxAlliances) {
|
||||
ChatBlock.sendMessage(player, lang("your.clan.reached.max.alliances", player));
|
||||
return;
|
||||
}
|
||||
if (input.getAllies().size() >= maxAlliances) {
|
||||
ChatBlock.sendMessage(player, lang("other.clan.reached.max.alliances", player));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(issuerClan.getLeaders());
|
||||
if (onlineLeaders.isEmpty()) {
|
||||
ChatBlock.sendMessage(player, RED + lang("at.least.one.leader.accept.the.alliance",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
|
||||
requestManager.addAllyRequest(cp, input, issuerClan);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("leaders.have.been.asked.for.an.alliance",
|
||||
player, input.getName()));
|
||||
}
|
||||
|
||||
@Subcommand("%ally %remove")
|
||||
@Conditions("verified|rank:name=ALLY_REMOVE")
|
||||
@CommandPermission("simpleclans.leader.ally")
|
||||
@Description("{@@command.description.ally.remove}")
|
||||
@CommandCompletion("@allied_clans")
|
||||
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(), lang("has.broken.the.alliance", issuerClan.getName(),
|
||||
allyInput.getName()), false);
|
||||
issuerClan.addBb(player.getName(), lang("has.broken.the.alliance", player.getName(),
|
||||
allyInput.getName()));
|
||||
}
|
||||
|
||||
@Subcommand("%kick")
|
||||
@CommandPermission("simpleclans.leader.kick")
|
||||
@CommandCompletion("@clan_members:hide_own")
|
||||
@Conditions("rank:name=KICK")
|
||||
@Description("{@@command.description.kick}")
|
||||
public void kick(@Conditions("clan_member") Player sender,
|
||||
@Conditions("same_clan") @Name("member") ClanPlayerInput other) {
|
||||
ClanPlayer clanPlayer = other.getClanPlayer();
|
||||
if (sender.getUniqueId().equals(clanPlayer.getUniqueId())) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.kick.yourself", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
Clan clan = cm.getClanByPlayerUniqueId(sender.getUniqueId());
|
||||
if (Objects.requireNonNull(clan).isLeader(clanPlayer.getUniqueId())) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.kick.another.leader", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
sender.getName(), sender));
|
||||
clan.removePlayerFromClan(clanPlayer.getUniqueId());
|
||||
}
|
||||
|
||||
@Subcommand("%resign %confirm")
|
||||
@CommandPermission("simpleclans.member.resign")
|
||||
@Description("{@@command.description.resign}")
|
||||
@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(), lang("0.has.resigned", player.getName()));
|
||||
cp.addResignTime(clan.getTag());
|
||||
clan.removePlayerFromClan(player.getUniqueId());
|
||||
|
||||
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()));
|
||||
} else {
|
||||
ChatBlock.sendMessage(cp, RED +
|
||||
lang("last.leader.cannot.resign.you.must.appoint.another.leader.or.disband.the.clan", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%resign")
|
||||
@CommandPermission("simpleclans.member.resign")
|
||||
@Description("{@@command.description.resign}")
|
||||
@HelpSearchTags("leave")
|
||||
public void resign(@Conditions("clan_member") Player player) {
|
||||
new SCConversation(plugin, player, new ResignPrompt()).begin();
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
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.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.data.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|verified")
|
||||
public class DataCommands extends BaseCommand {
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
|
||||
@Subcommand("%vitals")
|
||||
@CommandPermission("simpleclans.member.vitals")
|
||||
@Conditions("rank:name=VITALS")
|
||||
@Description("{@@command.description.vitals}")
|
||||
public void vitals(CommandSender sender, Clan clan) {
|
||||
Vitals vitals = new Vitals(plugin, sender, clan);
|
||||
vitals.send();
|
||||
}
|
||||
|
||||
@Subcommand("%stats")
|
||||
@CommandPermission("simpleclans.member.stats")
|
||||
@Conditions("rank:name=STATS")
|
||||
@Description("{@@command.description.stats}")
|
||||
public void stats(Player player, Clan clan) {
|
||||
ClanStats stats = new ClanStats(plugin, player, clan);
|
||||
stats.send();
|
||||
}
|
||||
|
||||
@Subcommand("%profile")
|
||||
@CommandPermission("simpleclans.member.profile")
|
||||
@Description("{@@command.description.profile}")
|
||||
public void profile(CommandSender sender, Clan clan) {
|
||||
ClanProfile p = new ClanProfile(plugin, sender, clan);
|
||||
p.send();
|
||||
}
|
||||
|
||||
@Subcommand("%roster")
|
||||
@CommandPermission("simpleclans.member.roster")
|
||||
@Description("{@@command.description.roster}")
|
||||
public void roster(Player player, Clan clan) {
|
||||
ClanRoster r = new ClanRoster(plugin, player, clan);
|
||||
r.send();
|
||||
}
|
||||
|
||||
@Subcommand("%coords")
|
||||
@CommandPermission("simpleclans.member.coords")
|
||||
@Conditions("rank:name=COORDS")
|
||||
@HelpSearchTags("local location")
|
||||
@Description("{@@command.description.coords}")
|
||||
public void coords(Player player, Clan clan) {
|
||||
if (VanishUtils.getNonVanished(player, clan).size() == 1) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.are.the.only.member.online", player));
|
||||
return;
|
||||
}
|
||||
ClanCoords c = new ClanCoords(plugin, player, clan);
|
||||
c.send();
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.HomeRegroupEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerHomeClearEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerHomeSetEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|verified")
|
||||
public class HomeCommands extends BaseCommand {
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
@Dependency
|
||||
private ProtectionManager protection;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
|
||||
@Subcommand("%regroup %me")
|
||||
@CommandPermission("simpleclans.leader.regroup.me")
|
||||
@Conditions("rank:name=REGROUP_ME")
|
||||
@Description("{@@command.description.regroup.me}")
|
||||
public void regroupMe(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (!settings.is(ALLOW_REGROUP)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
|
||||
return;
|
||||
}
|
||||
|
||||
processRegroup(player, cp, clan, player.getLocation());
|
||||
}
|
||||
|
||||
private void processRegroup(Player player, ClanPlayer cp, Clan clan, Location location) {
|
||||
HomeRegroupEvent homeRegroupEvent = new HomeRegroupEvent(clan, cp, VanishUtils.getNonVanished(player, clan), location);
|
||||
plugin.getServer().getPluginManager().callEvent(homeRegroupEvent);
|
||||
|
||||
if (homeRegroupEvent.isCancelled() || !cm.purchaseHomeRegroup(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getTeleportManager().teleport(player, clan, location);
|
||||
}
|
||||
|
||||
@Subcommand("%regroup %home")
|
||||
@CommandPermission("simpleclans.leader.regroup.home")
|
||||
@Conditions("rank:name=REGROUP_HOME")
|
||||
@Description("{@@command.description.regroup.home}")
|
||||
public void regroupHome(Player player, ClanPlayer cp, @Conditions("can_teleport") Clan clan) {
|
||||
if (!settings.is(ALLOW_REGROUP)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
|
||||
return;
|
||||
}
|
||||
Location location = clan.getHomeLocation();
|
||||
processRegroup(player, cp, clan, location);
|
||||
}
|
||||
|
||||
@Subcommand("%home")
|
||||
@CommandPermission("simpleclans.member.home")
|
||||
@Conditions("rank:name=HOME_TP")
|
||||
@Description("{@@command.description.home.tp}")
|
||||
public void teleport(Player player, @Conditions("can_teleport") Clan clan, ClanPlayer cp) {
|
||||
Location homeLocation = clan.getHomeLocation();
|
||||
|
||||
if (cm.purchaseHomeTeleport(player)) {
|
||||
plugin.getTeleportManager().addPlayer(player, homeLocation, clan.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%home %clear")
|
||||
@CommandPermission("simpleclans.leader.home-set")
|
||||
@Conditions("rank:name=HOME_SET")
|
||||
@Description("{@@command.description.home.clear}")
|
||||
public void clear(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (settings.is(CLAN_HOMEBASE_CAN_BE_SET_ONLY_ONCE) && clan.getHomeLocation() != null &&
|
||||
!permissions.has(player, "simpleclans.mod.home")) {
|
||||
ChatBlock.sendMessage(player, RED + lang("home.base.only.once", player));
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerHomeClearEvent event = new PlayerHomeClearEvent(clan, cp);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setHomeLocation(null);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("hombase.cleared", player));
|
||||
}
|
||||
|
||||
@Subcommand("%home %set")
|
||||
@Conditions("rank:name=HOME_SET")
|
||||
@CommandPermission("simpleclans.leader.home-set")
|
||||
@Description("{@@command.description.home.set}")
|
||||
public void set(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (settings.is(CLAN_HOMEBASE_CAN_BE_SET_ONLY_ONCE) && clan.getHomeLocation() != null &&
|
||||
!permissions.has(player, "simpleclans.mod.home")) {
|
||||
ChatBlock.sendMessage(player, RED + lang("home.base.only.once", player));
|
||||
return;
|
||||
}
|
||||
if (settings.is(LAND_SET_BASE_ONLY_IN_LAND)) {
|
||||
if (!protection.isOwner(player, player.getLocation())) {
|
||||
ChatBlock.sendMessageKey(player, "you.can.only.set.base.in.your.land");
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlayerHomeSetEvent homeSetEvent = new PlayerHomeSetEvent(clan, cp, player.getLocation());
|
||||
plugin.getServer().getPluginManager().callEvent(homeSetEvent);
|
||||
|
||||
if (homeSetEvent.isCancelled() || !cm.purchaseHomeTeleportSet(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setHomeLocation(player.getLocation());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("hombase.set", player, YELLOW +
|
||||
Helper.toLocationString(player.getLocation())));
|
||||
}
|
||||
}
|
||||
-265
@@ -1,265 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
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;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.discord.DiscordHook;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.discord.exceptions.DiscordHookException;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
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.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions|leader")
|
||||
public class LeaderCommands extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
@Dependency
|
||||
private RequestManager requestManager;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private ChatManager chatManager;
|
||||
|
||||
@Subcommand("%demote")
|
||||
@CommandCompletion("@clan_leaders")
|
||||
@CommandPermission("simpleclans.leader.demote")
|
||||
@Description("{@@command.description.demote}")
|
||||
public void demote(Player player,
|
||||
ClanPlayer cp,
|
||||
Clan clan,
|
||||
@Conditions("same_clan") @Name("leader") ClanPlayerInput other) {
|
||||
ClanPlayer otherCp = other.getClanPlayer();
|
||||
if (!clan.enoughLeadersOnlineToDemote(otherCp)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("not.enough.leaders.online.to.vote.on.demotion", player));
|
||||
return;
|
||||
}
|
||||
if (!clan.isLeader(otherCp.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("player.is.not.a.leader.of.your.clan", player));
|
||||
return;
|
||||
}
|
||||
if (clan.getLeaders().size() > 2 && settings.is(CLAN_CONFIRMATION_FOR_DEMOTE)) {
|
||||
requestManager.addDemoteRequest(cp, otherCp.getName(), clan);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("demotion.vote.has.been.requested.from.all.leaders",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
clan.addBb(player.getName(), lang("demoted.back.to.member", otherCp.getName()));
|
||||
clan.demote(otherCp.getUniqueId());
|
||||
}
|
||||
|
||||
@Subcommand("%promote")
|
||||
@CommandPermission("simpleclans.leader.promote")
|
||||
@CommandCompletion("@clan_non_leaders")
|
||||
@Description("{@@command.description.promote}")
|
||||
public void promote(Player player,
|
||||
Clan clan,
|
||||
ClanPlayer cp,
|
||||
@Conditions("online|same_clan") @Name("member") ClanPlayerInput other) {
|
||||
Player otherPl = Objects.requireNonNull(other.getClanPlayer().toPlayer());
|
||||
if (!permissions.has(otherPl, "simpleclans.leader.promotable")) {
|
||||
ChatBlock.sendMessage(player, RED + lang("the.player.does.not.have.the.permissions.to.lead.a.clan",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
if (otherPl.getUniqueId().equals(player.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.cannot.promote.yourself", player));
|
||||
return;
|
||||
}
|
||||
if (clan.isLeader(otherPl.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("the.player.is.already.a.leader", player));
|
||||
return;
|
||||
}
|
||||
if (settings.is(CLAN_CONFIRMATION_FOR_PROMOTE) && clan.getLeaders().size() > 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.PROMOTE, otherPl.getName(), "asking.for.the.promotion",
|
||||
player.getName(), otherPl.getName());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("promotion.vote.has.been.requested.from.all.leaders",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(player.getName(), lang("promoted.to.leader", otherPl.getName()));
|
||||
clan.promote(otherPl.getUniqueId());
|
||||
}
|
||||
|
||||
@Subcommand("%disband")
|
||||
@CommandPermission("simpleclans.leader.disband")
|
||||
@Description("{@@command.description.disband}")
|
||||
public void disband(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.DISBAND, clan.getTag(), "asking.to.disband",
|
||||
player.getName());
|
||||
ChatBlock.sendMessage(player, AQUA +
|
||||
lang("clan.disband.vote.has.been.requested.from.all.leaders", player));
|
||||
return;
|
||||
}
|
||||
|
||||
new SCConversation(plugin, player, new DisbandPrompt()).begin();
|
||||
}
|
||||
|
||||
@Subcommand("%verify")
|
||||
@CommandPermission("simpleclans.leader.verify")
|
||||
@Description("{@@command.description.verify}")
|
||||
public void verify(Player player, Clan clan) {
|
||||
if (clan.isVerified()) {
|
||||
ChatBlock.sendMessageKey(player, "your.clan.already.verified");
|
||||
return;
|
||||
}
|
||||
if (!settings.is(ECONOMY_PURCHASE_CLAN_VERIFY)) {
|
||||
ChatBlock.sendMessageKey(player, "staff.member.verify.clan");
|
||||
return;
|
||||
}
|
||||
int minToVerify = settings.getInt(CLAN_MIN_TO_VERIFY);
|
||||
if (minToVerify > clan.getMembers().size()) {
|
||||
ChatBlock.sendMessage(player, lang("your.clan.must.have.members.to.verify", player, minToVerify));
|
||||
return;
|
||||
}
|
||||
if (cm.purchaseVerification(player)) {
|
||||
clan.verifyClan();
|
||||
clan.addBb(player.getName(), lang("clan.0.has.been.verified", clan.getName()));
|
||||
ChatBlock.sendMessage(player, AQUA + lang("the.clan.has.been.verified", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%trust")
|
||||
@CommandPermission("simpleclans.leader.settrust")
|
||||
@CommandCompletion("@clan_members")
|
||||
@Description("{@@command.description.trust}")
|
||||
public void trust(Player player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput trusted) {
|
||||
ClanPlayer trustedInput = trusted.getClanPlayer();
|
||||
if (player.getUniqueId().equals(trustedInput.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.cannot.trust.yourself", player));
|
||||
return;
|
||||
}
|
||||
if (clan.isLeader(trustedInput.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("leaders.are.already.trusted", player));
|
||||
return;
|
||||
}
|
||||
if (trustedInput.isTrusted()) {
|
||||
ChatBlock.sendMessage(player, ChatColor.RED + lang("this.player.is.already.trusted", player));
|
||||
return;
|
||||
}
|
||||
clan.addBb(player.getName(), lang("has.been.given.trusted.status.by", trustedInput.getName(),
|
||||
player.getName()));
|
||||
trustedInput.setTrusted(true);
|
||||
storage.updateClanPlayer(trustedInput);
|
||||
}
|
||||
|
||||
@Subcommand("%untrust")
|
||||
@CommandPermission("simpleclans.leader.settrust")
|
||||
@CommandCompletion("@clan_members")
|
||||
@Description("{@@command.description.untrust}")
|
||||
public void untrust(Player player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput trusted) {
|
||||
ClanPlayer trustedInput = trusted.getClanPlayer();
|
||||
if (trustedInput.getUniqueId().equals(player.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.cannot.untrust.yourself", player));
|
||||
return;
|
||||
}
|
||||
if (clan.isLeader(trustedInput.getUniqueId())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("leaders.cannot.be.untrusted", player));
|
||||
return;
|
||||
}
|
||||
if (!trustedInput.isTrusted()) {
|
||||
ChatBlock.sendMessage(player, RED + lang("this.player.is.already.untrusted", player));
|
||||
return;
|
||||
}
|
||||
|
||||
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(Player player, ClanPlayer cp, Clan clan, @Name("name") String clanName) {
|
||||
if (clanName.contains("&")) {
|
||||
ChatBlock.sendMessageKey(cp, "your.clan.name.cannot.contain.color.codes");
|
||||
return;
|
||||
}
|
||||
boolean bypass = plugin.getPermissionsManager().has(player, "simpleclans.mod.bypass");
|
||||
if (!bypass) {
|
||||
if (ChatUtils.stripColors(clanName).length() > plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.name.cannot.be.longer.than.characters",
|
||||
player, plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)));
|
||||
return;
|
||||
}
|
||||
if (ChatUtils.stripColors(clanName).length() <= plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.name.must.be.longer.than.characters",
|
||||
player, plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.RENAME, clanName, "asking.to.rename", cp.getName(), 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}")
|
||||
@Conditions("verified")
|
||||
public void discord(Player player, Clan clan) {
|
||||
DiscordHook discordHook = chatManager.getDiscordHook();
|
||||
if (discordHook == null) {
|
||||
ChatBlock.sendMessageKey(player, "discordhook.is.disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = settings.getDouble(ECONOMY_DISCORD_CREATION_PRICE);
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
if (!permissions.playerHasMoney(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, CurrencyFormat.format(amount)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!permissions.chargePlayer(player, amount, DISCORD_CREATION)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
discordHook.createChannel(clan.getTag());
|
||||
ChatBlock.sendMessageKey(player, "discord.created.successfully");
|
||||
} catch (DiscordHookException ex) {
|
||||
// Return player's money if clan creation went wrong
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
permissions.grantPlayer(player, amount, DISCORD_CREATION);
|
||||
}
|
||||
String messageKey = ex.getMessageKey();
|
||||
if (messageKey != null) {
|
||||
ChatBlock.sendMessage(player, RED + lang(messageKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.CreateRankNamePrompt;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.RequestCanceller;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.DeleteRankEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerRankUpdateEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Subcommand("%rank")
|
||||
@Conditions("%basic_conditions|verified|leader")
|
||||
public class RankCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
|
||||
@Subcommand("%assign")
|
||||
@CommandPermission("simpleclans.leader.rank.assign")
|
||||
@CommandCompletion("@clan_members @ranks")
|
||||
@Description("{@@command.description.rank.assign}")
|
||||
public void assign(ClanPlayer player,
|
||||
Clan clan,
|
||||
@Name("member") @Conditions("same_clan") ClanPlayerInput member,
|
||||
@Name("rank") Rank rank) {
|
||||
ClanPlayer memberInput = member.getClanPlayer();
|
||||
|
||||
PlayerRankUpdateEvent event = new PlayerRankUpdateEvent(player, memberInput, clan, clan.getRank(memberInput.getRankId()), rank);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
if (memberInput.getRankId().equals(rank.getName())) {
|
||||
ChatBlock.sendMessage(player, lang("player.already.has.that.rank", player));
|
||||
return;
|
||||
}
|
||||
|
||||
memberInput.setRank(rank.getName());
|
||||
storage.updateClanPlayer(memberInput);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("player.rank.changed", player));
|
||||
}
|
||||
|
||||
@Subcommand("%unassign")
|
||||
@CommandPermission("simpleclans.leader.rank.unassign")
|
||||
@CommandCompletion("@clan_members")
|
||||
@Description("{@@command.description.rank.unassign}")
|
||||
public void unassign(ClanPlayer player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput cp) {
|
||||
ClanPlayer memberInput = cp.getClanPlayer();
|
||||
|
||||
PlayerRankUpdateEvent event = new PlayerRankUpdateEvent(player, memberInput, clan, clan.getRank(memberInput.getRankId()), null);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
|
||||
memberInput.setRank(null);
|
||||
storage.updateClanPlayer(memberInput);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("player.unassigned.from.rank", player));
|
||||
}
|
||||
|
||||
@Subcommand("%create")
|
||||
@CommandPermission("simpleclans.leader.rank.create")
|
||||
@Description("{@@command.description.rank.create}")
|
||||
public void create(Player player, Clan clan) {
|
||||
SCConversation conversation = new SCConversation(plugin, player, new CreateRankNamePrompt(), 60);
|
||||
conversation.addConversationCanceller(new RequestCanceller(player, RED + lang("rank.create.request.cancelled", player)));
|
||||
conversation.getContext().setSessionData("clan", clan);
|
||||
conversation.begin();
|
||||
}
|
||||
|
||||
@Subcommand("%delete")
|
||||
@CommandPermission("simpleclans.leader.rank.delete")
|
||||
@CommandCompletion("@ranks")
|
||||
@Description("{@@command.description.rank.delete}")
|
||||
public void delete(Player player, Clan clan, @Name("rank") Rank rank) {
|
||||
DeleteRankEvent event = new DeleteRankEvent(player, clan, rank);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
clan.deleteRank(rank.getName());
|
||||
storage.updateClan(clan, true);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("rank.0.deleted", player, rank.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%list")
|
||||
@CommandPermission("simpleclans.leader.rank.list")
|
||||
@Description("{@@command.description.rank.list}")
|
||||
public void list(Player player, Clan clan) {
|
||||
List<Rank> ranks = clan.getRanks();
|
||||
|
||||
if (ranks.isEmpty()) {
|
||||
ChatBlock.sendMessage(player, RED + lang("no.ranks", player));
|
||||
return;
|
||||
}
|
||||
|
||||
ranks.sort(Comparator.reverseOrder());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("clans.ranks", player));
|
||||
int count = 1;
|
||||
for (Rank rank : ranks) {
|
||||
ChatBlock.sendMessage(player, AQUA + lang("ranks.list.item", player, count,
|
||||
ChatUtils.parseColors(rank.getDisplayName()) + AQUA, rank.getName()));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%setdisplayname")
|
||||
@CommandPermission("simpleclans.leader.rank.setdisplayname")
|
||||
@CommandCompletion("@ranks @nothing")
|
||||
@Description("{@@command.description.rank.setdisplayname}")
|
||||
public void setDisplayName(Player player, Clan clan, @Name("rank") Rank rank, @Name("displayname") String displayName) {
|
||||
if (displayName.contains("&") && !permissions.has(player, "simpleclans.leader.coloredrank")) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.cannot.set.colored.ranks", player));
|
||||
return;
|
||||
}
|
||||
rank.setDisplayName(displayName);
|
||||
storage.updateClan(clan, true);
|
||||
ChatBlock.sendMessage(player, ChatColor.AQUA + lang("rank.displayname.updated", player));
|
||||
}
|
||||
|
||||
@Subcommand("%setdefault")
|
||||
@CommandPermission("simpleclans.leader.rank.setdefault")
|
||||
@CommandCompletion("@ranks")
|
||||
@Description("{@@command.description.rank.setdefault}")
|
||||
public void setDefault(Player player, Clan clan, @Name("rank") Rank rank) {
|
||||
clan.setDefaultRank(rank.getName());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("rank.setdefault", player, rank.getDisplayName()));
|
||||
}
|
||||
|
||||
@Subcommand("%removedefault")
|
||||
@CommandPermission("simpleclans.leader.rank.removedefault")
|
||||
@Description("{@@command.description.rank.removedefault}")
|
||||
public void removeDefault(Player player, Clan clan) {
|
||||
clan.setDefaultRank(null);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("rank.removedefault", player));
|
||||
}
|
||||
|
||||
@Subcommand("%permissions")
|
||||
public class PermissionsCommand extends BaseCommand {
|
||||
private final String validPermissionsToMessage = String.join(",", Helper.fromPermissionArray());
|
||||
|
||||
@Default
|
||||
@CommandPermission("simpleclans.leader.rank.permissions.available")
|
||||
@Description("{@@command.description.rank.permissions.available}")
|
||||
public void availablePermissions(Player player) {
|
||||
ChatBlock.sendMessage(player, AQUA + lang("available.rank.permissions", player));
|
||||
ChatBlock.sendMessage(player, AQUA + validPermissionsToMessage);
|
||||
}
|
||||
|
||||
@Default
|
||||
@CommandPermission("simpleclans.leader.rank.permissions.list")
|
||||
@CommandCompletion("@ranks")
|
||||
@Description("{@@command.description.rank.permissions.rank}")
|
||||
public void list(Player player, @Name("rank") Rank rank) {
|
||||
Set<String> permissions = rank.getPermissions();
|
||||
if (permissions.isEmpty()) {
|
||||
ChatBlock.sendMessage(player, RED + lang("rank.no.permissions", player));
|
||||
return;
|
||||
}
|
||||
ChatBlock.sendMessage(player, AQUA + lang("rank.0.permissions", player, rank.getDisplayName()));
|
||||
ChatBlock.sendMessage(player, AQUA + String.join(",", permissions));
|
||||
}
|
||||
|
||||
@Subcommand("%add")
|
||||
@CommandPermission("simpleclans.leader.rank.permissions.add")
|
||||
@CommandCompletion("@ranks @rank_permissions")
|
||||
@Description("{@@command.description.rank.permissions.add}")
|
||||
public void add(Player player,
|
||||
Clan clan,
|
||||
@Name("rank") Rank rank,
|
||||
@Values("@rank_permissions") @Name("permission") String permission) {
|
||||
Set<String> permissions = rank.getPermissions();
|
||||
permissions.add(permission);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("permission.0.added.to.rank.1", player, permission,
|
||||
rank.getDisplayName()));
|
||||
storage.updateClan(clan, true);
|
||||
}
|
||||
|
||||
@Subcommand("%remove")
|
||||
@CommandCompletion("@ranks @rank_permissions")
|
||||
@CommandPermission("simpleclans.leader.rank.permissions.remove")
|
||||
@Description("{@@command.description.rank.permissions.remove}")
|
||||
public void remove(Player player,
|
||||
Clan clan,
|
||||
@Name("rank") Rank rank,
|
||||
@Values("@rank_permissions") @Name("permission") String permission) {
|
||||
Set<String> permissions = rank.getPermissions();
|
||||
permissions.remove(permission);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("permission.0.removed.from.rank.1", player,
|
||||
permission, rank.getDisplayName()));
|
||||
storage.updateClan(clan, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
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.managers.StorageManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Subcommand("%toggle")
|
||||
@Conditions("%basic_conditions")
|
||||
public class ToggleCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
|
||||
@Conditions("verified")
|
||||
public class Verified extends BaseCommand {
|
||||
|
||||
@Subcommand("%bb")
|
||||
@CommandPermission("simpleclans.member.bb-toggle")
|
||||
@Description("{@@command.description.toggle.bb}")
|
||||
public void bb(Player player, ClanPlayer cp) {
|
||||
toggle(player, "bbon", "bboff", cp.isBbEnabled(), cp::setBbEnabled);
|
||||
}
|
||||
|
||||
@Subcommand("%tag")
|
||||
@CommandPermission("simpleclans.member.tag-toggle")
|
||||
@Description("{@@command.description.toggle.tag}")
|
||||
public void tag(Player player, ClanPlayer cp) {
|
||||
toggle(player, "tagon", "tagoff", cp.isTagEnabled(), cp::setTagEnabled);
|
||||
}
|
||||
|
||||
@Subcommand("%deposit")
|
||||
@CommandPermission("simpleclans.leader.deposit-toggle")
|
||||
@Conditions("leader")
|
||||
@Description("{@@command.description.toggle.deposit}")
|
||||
public void deposit(Player player, Clan clan) {
|
||||
toggle(player, "depositon", "depositoff", clan.isAllowDeposit(),
|
||||
clan::setAllowDeposit);
|
||||
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
@Subcommand("%fee")
|
||||
@CommandPermission("simpleclans.leader.fee")
|
||||
@Conditions("rank:name=FEE_ENABLE|change_fee")
|
||||
@Description("{@@command.description.toggle.fee}")
|
||||
public void fee(Player player, Clan clan) {
|
||||
toggle(player, "feeon", "feeoff", clan.isMemberFeeEnabled(),
|
||||
clan::setMemberFeeEnabled);
|
||||
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
@Subcommand("%withdraw")
|
||||
@CommandPermission("simpleclans.leader.withdraw-toggle")
|
||||
@Conditions("leader")
|
||||
@Description("{@@command.description.toggle.withdraw}")
|
||||
public void withdraw(Player player, Clan clan) {
|
||||
toggle(player, "withdrawon", "withdrawoff", clan.isAllowWithdraw(),
|
||||
clan::setAllowWithdraw);
|
||||
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%invite")
|
||||
@CommandPermission("simpleclans.anyone.invite-toggle")
|
||||
@Description("{@@command.description.toggle.invite}")
|
||||
public void invite(Player player, ClanPlayer cp) {
|
||||
toggle(player, "inviteon", "inviteoff", cp.isInviteEnabled(), cp::setInviteEnabled);
|
||||
}
|
||||
|
||||
private void toggle(CommandSender sender, String onMessageKey, String offMessageKey, boolean status,
|
||||
Consumer<Boolean> consumer) {
|
||||
String messageOn = AQUA + lang(onMessageKey, sender);
|
||||
String messageOff = AQUA + lang(offMessageKey, sender);
|
||||
|
||||
ChatBlock.sendMessage(sender, status ? messageOff : messageOn);
|
||||
consumer.accept(!status);
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractCompletion implements IdentifiableCompletion {
|
||||
|
||||
protected final SimpleClans plugin;
|
||||
protected final ClanManager clanManager;
|
||||
|
||||
public AbstractCompletion(@NotNull SimpleClans plugin) {
|
||||
this.plugin = plugin;
|
||||
this.clanManager = plugin.getClanManager();
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class AllNonLeadersCompletion extends AbstractSyncCompletion {
|
||||
public AllNonLeadersCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
|
||||
return clanManager
|
||||
.getAllClanPlayers().stream().filter(cp -> !cp.isLeader() && cp.getClan() != null)
|
||||
.map(ClanPlayer::getName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "all_non_leaders";
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ClanLeadersCompletion extends AbstractSyncCompletion {
|
||||
public ClanLeadersCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
|
||||
Player player = c.getPlayer();
|
||||
if (player != null) {
|
||||
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
|
||||
if (clan != null) {
|
||||
return clan.getLeaders().stream().map(ClanPlayer::getName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "clan_leaders";
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ClanNonLeadersCompletion extends AbstractSyncCompletion {
|
||||
public ClanNonLeadersCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
|
||||
Player player = c.getPlayer();
|
||||
if (player != null) {
|
||||
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
|
||||
if (clan != null) {
|
||||
return clan.getNonLeaders().stream().map(ClanPlayer::getName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return Collections.emptyList(); }
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "clan_non_leaders";
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ClansCompletion extends AbstractSyncCompletion {
|
||||
public ClansCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
|
||||
List<Clan> clans = clanManager.getClans();
|
||||
if (c.hasConfig("has_home")) {
|
||||
clans.removeIf(clan -> clan.getHomeLocation() == null);
|
||||
}
|
||||
if (c.hasConfig("unverified")) {
|
||||
clans.removeIf(Clan::isVerified);
|
||||
}
|
||||
if (c.hasConfig("hide_own")) {
|
||||
Clan clan = getClan(c.getIssuer());
|
||||
if (clan != null) {
|
||||
clans.remove(clan);
|
||||
}
|
||||
}
|
||||
return clans.stream().map(Clan::getTag).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "clans";
|
||||
}
|
||||
|
||||
private @Nullable Clan getClan(CommandIssuer issuer) {
|
||||
return clanManager.getClanByPlayerUniqueId(issuer.getUniqueId());
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class RankPermissionsCompletion extends AbstractStaticCompletion {
|
||||
public RankPermissionsCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Collection<String> getCompletions() {
|
||||
return Arrays.asList(Helper.fromPermissionArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "rank_permissions";
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandCompletionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Rank;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RanksCompletion extends AbstractSyncCompletion {
|
||||
public RanksCompletion(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
|
||||
Player player = context.getPlayer();
|
||||
if (player != null) {
|
||||
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
|
||||
if (clan != null) {
|
||||
return clan.getRanks().stream().map(Rank::getName).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return Collections.emptyList(); }
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "ranks";
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.CommandConditions;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractCommandCondition extends AbstractCondition implements CommandConditions.Condition<BukkitCommandIssuer> {
|
||||
public AbstractCommandCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class AlliedClanCondition extends AbstractParameterCondition<ClanInput> {
|
||||
public AlliedClanCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanInput> getType() {
|
||||
return ClanInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext,
|
||||
ClanInput value) throws InvalidCommandArgument {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
Clan clan = Conditions.assertClanMember(clanManager, issuer);
|
||||
if (!clan.isAlly(value.getClan().getTag())) {
|
||||
throw new ConditionFailedException(RED + lang("your.clans.are.not.allies", issuer));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "allied_clan";
|
||||
}
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static java.time.temporal.ChronoUnit.MINUTES;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class CanChangeFeeCondition extends AbstractCommandCondition {
|
||||
|
||||
private static final float HOUR_IN_MINUTES = 60;
|
||||
|
||||
public CanChangeFeeCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime collectTime = getCollectTime();
|
||||
long interval = now.until(collectTime, MINUTES);
|
||||
if (interval <= settingsManager.getInt(ECONOMY_MEMBER_FEE_LAST_MINUTE_CHANGE_INTERVAL) * HOUR_IN_MINUTES) {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
String error = lang("cannot.change.member.fee.now", issuer);
|
||||
if (interval <= 60) {
|
||||
error += lang("cannot.change.member.fee.minutes", issuer, interval);
|
||||
} else {
|
||||
error += lang("cannot.change.member.fee.hours", issuer, Math.ceil(interval / HOUR_IN_MINUTES));
|
||||
}
|
||||
throw new ConditionFailedException(error);
|
||||
}
|
||||
}
|
||||
|
||||
private LocalDateTime getCollectTime() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime collectTime = now.withHour(settingsManager.getInt(TASKS_COLLECT_FEE_HOUR))
|
||||
.withMinute(settingsManager.getInt(TASKS_COLLECT_FEE_MINUTE));
|
||||
if (collectTime.isBefore(now)) {
|
||||
collectTime = collectTime.plusDays(1);
|
||||
}
|
||||
return collectTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "change_fee";
|
||||
}
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.WAR_MAX_MEMBERS_DIFFERENCE;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.WAR_START_REQUEST_ENABLED;
|
||||
|
||||
public class CanWarTargetCondition extends AbstractParameterCondition<ClanInput> {
|
||||
public CanWarTargetCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanInput> getType() {
|
||||
return ClanInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context, BukkitCommandExecutionContext execContext, ClanInput target) throws InvalidCommandArgument {
|
||||
BukkitCommandIssuer issuer = execContext.getIssuer();
|
||||
Clan issuerClan = Conditions.assertClanMember(clanManager, issuer);
|
||||
Clan targetClan = target.getClan();
|
||||
|
||||
if (!issuerClan.isRival(targetClan.getTag())) {
|
||||
throw new ConditionFailedException(lang("you.can.only.start.war.with.rivals", issuer));
|
||||
}
|
||||
|
||||
if (issuerClan.isWarring(targetClan)) {
|
||||
throw new ConditionFailedException(lang("clans.already.at.war", issuer));
|
||||
}
|
||||
|
||||
boolean isWarRequestEnabled = settingsManager.is(WAR_START_REQUEST_ENABLED);
|
||||
int maxDifference = settingsManager.getInt(WAR_MAX_MEMBERS_DIFFERENCE);
|
||||
|
||||
if (!isWarRequestEnabled && maxDifference >= 0) {
|
||||
int difference = Math.abs(issuerClan.getOnlineMembers().size() - targetClan.getOnlineMembers().size());
|
||||
if (difference > maxDifference)
|
||||
throw new ConditionFailedException(lang("you.cant.start.war.online.members.difference", issuer));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "can_war_target";
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.ConditionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ClanMemberCondition extends AbstractParameterCondition<ClanPlayer> {
|
||||
public ClanMemberCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayer> getType() {
|
||||
return ClanPlayer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext, ClanPlayer value)
|
||||
throws InvalidCommandArgument {
|
||||
Conditions.assertClanMember(clanManager, context.getIssuer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "clan_member";
|
||||
}
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class DifferentClanCondition extends AbstractParameterCondition<ClanInput> {
|
||||
|
||||
public DifferentClanCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanInput> getType() {
|
||||
return ClanInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext,
|
||||
ClanInput value) throws InvalidCommandArgument {
|
||||
if (execContext.getIssuer().isPlayer()) {
|
||||
Player player = execContext.getPlayer();
|
||||
ClanPlayer cp = clanManager.getAnyClanPlayer(player.getUniqueId());
|
||||
if (cp != null && cp.getClan() != null) {
|
||||
if (value.getClan().equals(cp.getClan())) {
|
||||
throw new ConditionFailedException(lang("cannot.be.same.clan", player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "different";
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
public class InputClanMemberCondition extends AbstractParameterCondition<ClanPlayerInput> {
|
||||
public InputClanMemberCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayerInput> getType() {
|
||||
return ClanPlayerInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
|
||||
throws InvalidCommandArgument {
|
||||
if (value.getClanPlayer().getClan() == null) {
|
||||
throw new ConditionFailedException(RED + lang("player.not.a.member.of.any.clan",
|
||||
execContext.getSender()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "clan_member";
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class InputVerifiedCondition extends AbstractParameterCondition<ClanInput> {
|
||||
|
||||
public InputVerifiedCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanInput> getType() {
|
||||
return ClanInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext,
|
||||
ClanInput value)
|
||||
throws InvalidCommandArgument {
|
||||
if (!value.getClan().isVerified() && !context.getIssuer().hasPermission("simpleclans.mod.bypass")) {
|
||||
throw new ConditionFailedException(lang("other.clan.not.verified", execContext.getSender()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "verified";
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class LeaderCondition extends AbstractCommandCondition {
|
||||
public LeaderCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
Player player = Conditions.assertPlayer(context.getIssuer());
|
||||
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
|
||||
if (!clan.isLeader(player)) {
|
||||
throw new ConditionFailedException(ChatColor.RED + lang("no.leader.permissions", player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "leader";
|
||||
}
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.ECONOMY_MEMBER_FEE_ENABLED;
|
||||
|
||||
public class MemberFeeEnabledCondition extends AbstractCommandCondition {
|
||||
public MemberFeeEnabledCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
if (!settingsManager.is(ECONOMY_MEMBER_FEE_ENABLED)) {
|
||||
throw new ConditionFailedException(ChatColor.RED + lang("disabled.command",
|
||||
context.getIssuer().getIssuer()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "member_fee_enabled";
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.CLAN_MIN_SIZE_TO_SET_ALLY;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MinimumToAllyCondition extends AbstractCommandCondition {
|
||||
public MinimumToAllyCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
|
||||
if (clan.getSize() < settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_ALLY)) {
|
||||
throw new ConditionFailedException(RED +
|
||||
lang("minimum.to.make.alliance", context.getIssuer(), settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_ALLY)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "minimum_to_ally";
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.CLAN_MIN_SIZE_TO_SET_RIVAL;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class MinimumToRivalCondition extends AbstractCommandCondition {
|
||||
public MinimumToRivalCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
Clan clan = Conditions.assertClanMember(clanManager, issuer);
|
||||
if (clan.getSize() < settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_RIVAL)) {
|
||||
throw new ConditionFailedException(RED + lang("min.players.rivalries", issuer,
|
||||
settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_RIVAL)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "minimum_to_rival";
|
||||
}
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NotBannedInputCondition extends AbstractParameterCondition<ClanPlayerInput> {
|
||||
|
||||
public NotBannedInputCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayerInput> getType() {
|
||||
return ClanPlayerInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
|
||||
throws InvalidCommandArgument {
|
||||
UUID uniqueId = value.getClanPlayer().getUniqueId();
|
||||
if (settingsManager.isBanned(uniqueId)) {
|
||||
throw new ConditionFailedException(RED + lang("this.player.is.banned.from.using.clan.commands",
|
||||
execContext.getSender()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "not_banned";
|
||||
}
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.debug;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NotInClanCondition extends AbstractParameterCondition<ClanPlayerInput> {
|
||||
|
||||
public NotInClanCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayerInput> getType() {
|
||||
return ClanPlayerInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
|
||||
throws InvalidCommandArgument {
|
||||
ClanPlayer clanPlayer = value.getClanPlayer();
|
||||
debug(String.format("NotInClanCondition -> %s %s", clanPlayer.getName(), clanPlayer.getUniqueId()));
|
||||
if (clanPlayer.getClan() != null) {
|
||||
throw new ConditionFailedException(RED + lang("the.player.is.already.member.of.another.clan",
|
||||
execContext.getSender()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "not_in_clan";
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.debug;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class OnlineCondition extends AbstractParameterCondition<ClanPlayerInput> {
|
||||
|
||||
public OnlineCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayerInput> getType() {
|
||||
return ClanPlayerInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context, BukkitCommandExecutionContext execContext, ClanPlayerInput value) throws InvalidCommandArgument {
|
||||
ClanPlayer clanPlayer = value.getClanPlayer();
|
||||
debug(String.format("OnlineCondition -> %s %s", clanPlayer.getName(), clanPlayer.getUniqueId()));
|
||||
Player player = clanPlayer.toPlayer();
|
||||
|
||||
if (player != null) {
|
||||
boolean isVanished = VanishUtils.isVanished(execContext.getSender(), player);
|
||||
if (!isVanished || !context.hasConfig("ignore_vanished")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ConditionFailedException(lang("other.player.must.be.online", execContext.getSender()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return "online";
|
||||
}
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.RankPermission;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class RankPermissionCondition extends AbstractCommandCondition {
|
||||
|
||||
public RankPermissionCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
String name = context.getConfigValue("name", (String) null);
|
||||
Player player = context.getIssuer().getPlayer();
|
||||
if (player == null || name == null) {
|
||||
return;
|
||||
}
|
||||
RankPermission rankPermission = net.sacredlabyrinth.phaed.simpleclans.RankPermission.valueOf(name);
|
||||
|
||||
if (!permissionsManager.has(player, rankPermission, true)) {
|
||||
throw new ConditionFailedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "rank";
|
||||
}
|
||||
}
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
import co.aikar.commands.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class SameClanCondition extends AbstractParameterCondition<ClanPlayerInput> {
|
||||
public SameClanCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayerInput> getType() {
|
||||
return ClanPlayerInput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext execContext,
|
||||
ClanPlayerInput value) throws InvalidCommandArgument {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
Clan clan = Conditions.assertClanMember(clanManager, issuer);
|
||||
if (value == null || value.getClanPlayer().getClan() == null ||
|
||||
!value.getClanPlayer().getClan().equals(clan)) {
|
||||
throw new ConditionFailedException(lang("the.player.is.not.a.member.of.your.clan", issuer));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "same_clan";
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
|
||||
|
||||
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.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class VerifiedCondition extends AbstractCommandCondition {
|
||||
|
||||
public VerifiedCondition(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
|
||||
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
|
||||
if (!clan.isVerified()) {
|
||||
throw new ConditionFailedException(lang("clan.is.not.verified",
|
||||
context.getIssuer()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "verified";
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractContextResolver<T> {
|
||||
|
||||
protected final @NotNull SimpleClans plugin;
|
||||
protected final @NotNull ClanManager clanManager;
|
||||
|
||||
public AbstractContextResolver(@NotNull SimpleClans plugin) {
|
||||
this.plugin = plugin;
|
||||
clanManager = plugin.getClanManager();
|
||||
}
|
||||
|
||||
public abstract Class<T> getType();
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ClanContextResolver extends AbstractIssuerOnlyContextResolver<Clan> {
|
||||
public ClanContextResolver(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clan getContext(BukkitCommandExecutionContext c) throws InvalidCommandArgument {
|
||||
return Contexts.assertClanMember(clanManager, c.getIssuer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Clan> getType() {
|
||||
return Clan.class;
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ClanInputContextResolver extends AbstractInputOnlyContextResolver<ClanInput> {
|
||||
public ClanInputContextResolver(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClanInput getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
|
||||
String arg = context.popFirstArg();
|
||||
Clan clan = clanManager.getClan(arg);
|
||||
if (clan == null) {
|
||||
throw new InvalidCommandArgument(RED + lang("the.clan.does.not.exist", context.getSender()),
|
||||
false);
|
||||
}
|
||||
return new ClanInput(clan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanInput> getType() {
|
||||
return ClanInput.class;
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ClanPlayerContextResolver extends AbstractIssuerOnlyContextResolver<ClanPlayer> {
|
||||
public ClanPlayerContextResolver(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClanPlayer getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
|
||||
Player player = Contexts.assertPlayer(context.getIssuer());
|
||||
return clanManager.getCreateClanPlayer(player.getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ClanPlayer> getType() {
|
||||
return ClanPlayer.class;
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
|
||||
|
||||
import co.aikar.commands.BukkitCommandExecutionContext;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Rank;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class RankContextResolver extends AbstractInputOnlyContextResolver<Rank> {
|
||||
public RankContextResolver(@NotNull SimpleClans plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rank getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
|
||||
Clan clan = Contexts.assertClanMember(clanManager, context.getIssuer());
|
||||
String rankName = context.isLastArg() ? context.joinArgs() : context.popFirstArg();
|
||||
Rank rank = clan.getRank(rankName);
|
||||
if (rank == null) {
|
||||
throw new InvalidCommandArgument(RED + lang("rank.0.does.not.exist", context.getIssuer(), rankName),
|
||||
false);
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Rank> getType() {
|
||||
return Rank.class;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PAGE_SEPARATOR;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.SERVER_NAME;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.DARK_GRAY;
|
||||
|
||||
public class Alliances extends Sendable {
|
||||
|
||||
public Alliances(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
|
||||
super(plugin, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
List<Clan> clans = cm.getClans();
|
||||
cm.sortClansByKDR(clans);
|
||||
sendHeader();
|
||||
|
||||
for (Clan clan : clans) {
|
||||
if (!clan.isVerified()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getAllyString(DARK_GRAY + ", ", sender));
|
||||
}
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void sendHeader() {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(SERVER_NAME) + subColor + " " +
|
||||
lang("alliances", sender) + " " + headColor +
|
||||
Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setAlignment("l", "l");
|
||||
chatBlock.addRow(" " + headColor + lang("clan", sender), lang("allies", sender));
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
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.utils.RankingNumberResolver.RankingType.ORDINAL;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class ClanList extends Sendable {
|
||||
|
||||
private final @Nullable String type;
|
||||
private final @Nullable String order;
|
||||
|
||||
public ClanList(@NotNull SimpleClans plugin,
|
||||
@NotNull CommandSender sender,
|
||||
@Nullable String type,
|
||||
@Nullable String order) {
|
||||
super(plugin, sender);
|
||||
this.type = type;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
List<Clan> clans = getListableClans();
|
||||
if (clans.isEmpty()) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("no.clans.have.been.created", sender));
|
||||
return;
|
||||
}
|
||||
RankingNumberResolver<Clan, ? extends Comparable<?>> ranking = getRankingResolver(clans, type, order);
|
||||
sendHeader(clans);
|
||||
for (Clan clan : clans) {
|
||||
addLine(ranking, clan);
|
||||
}
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private RankingNumberResolver<Clan, ? extends Comparable<?>> getRankingResolver(List<Clan> clans,
|
||||
@Nullable String type,
|
||||
@Nullable String order) {
|
||||
boolean ascending = order == null || lang("list.order.asc").equalsIgnoreCase(order);
|
||||
if (type == null) {
|
||||
type = sm.getString(LIST_DEFAULT_ORDER_BY);
|
||||
}
|
||||
if (type.equalsIgnoreCase(lang("list.type.size"))) {
|
||||
return new RankingNumberResolver<>(clans, Clan::getSize, order != null && ascending, ORDINAL);
|
||||
}
|
||||
if (type.equalsIgnoreCase(lang("list.type.active"))) {
|
||||
return new RankingNumberResolver<>(clans, Clan::getLastUsed, order != null && ascending, ORDINAL);
|
||||
}
|
||||
if (type.equalsIgnoreCase(lang("list.type.founded"))) {
|
||||
return new RankingNumberResolver<>(clans, Clan::getFounded, ascending, ORDINAL);
|
||||
}
|
||||
if (type.equalsIgnoreCase(lang("list.type.name"))) {
|
||||
return new RankingNumberResolver<>(clans, Clan::getName, ascending, ORDINAL);
|
||||
}
|
||||
return new RankingNumberResolver<>(clans, clan -> KDRFormat.toBigDecimal(clan.getTotalKDR()),
|
||||
order != null && ascending, sm.getRankingType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<Clan> getListableClans() {
|
||||
List<Clan> clans = plugin.getClanManager().getClans();
|
||||
clans = clans.stream().filter(clan -> clan.isVerified() || sm.is(SHOW_UNVERIFIED_ON_LIST))
|
||||
.collect(Collectors.toList());
|
||||
return clans;
|
||||
}
|
||||
|
||||
private void sendHeader(List<Clan> clans) {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(SERVER_NAME) + subColor + " " + lang("clans.lower", sender)
|
||||
+ " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("total.clans", sender) + " " + subColor + clans.size());
|
||||
ChatBlock.sendBlank(sender);
|
||||
chatBlock.setAlignment("c", "l", "c", "c");
|
||||
chatBlock.setFlexibility(false, true, false, false);
|
||||
chatBlock.addRow(" " + headColor + lang("rank", sender), lang("name", sender),
|
||||
lang("kdr", sender), lang("members", sender));
|
||||
}
|
||||
|
||||
private void addLine(RankingNumberResolver<Clan, ? extends Comparable<?>> ranking, Clan clan) {
|
||||
String tag = sm.getColored(CLANCHAT_BRACKET_COLOR) + sm.getString(CLANCHAT_BRACKET_LEFT)
|
||||
+ sm.getColored(TAG_DEFAULT_COLOR) + clan.getColorTag() + sm.getColored(CLANCHAT_BRACKET_COLOR)
|
||||
+ sm.getString(CLANCHAT_BRACKET_RIGHT);
|
||||
String name = (clan.isVerified() ? sm.getColored(PAGE_CLAN_NAME_COLOR) : GRAY) + clan.getName();
|
||||
String fullname = tag + " " + name;
|
||||
String size = WHITE + "" + clan.getSize();
|
||||
String kdr = clan.isVerified() ? YELLOW + "" + KDRFormat.format(clan.getTotalKDR()) : "";
|
||||
|
||||
chatBlock.addRow(" " + ranking.getRankingNumber(clan), fullname, kdr, size);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PAGE_LEADER_COLOR;
|
||||
|
||||
public class ClanProfile extends Sendable {
|
||||
|
||||
private final Clan clan;
|
||||
|
||||
public ClanProfile(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
|
||||
super(plugin, sender);
|
||||
this.clan = clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
String message = lang("clan.profile").replace("%clan_name%", clan.getName())
|
||||
.replace("%clan_color_tag%", clan.getColorTag())
|
||||
.replace("%clan_description%", getDescription())
|
||||
.replace("%clan_status%", Helper.getFormattedClanStatus(clan, sender))
|
||||
.replace("%clan_leaders%", clan.getLeadersString(sm.getColored(PAGE_LEADER_COLOR), subColor + ", "))
|
||||
.replace("%clan_online_count%", String.valueOf(VanishUtils.getNonVanished(sender, clan).size()))
|
||||
.replace("%clan_size%", String.valueOf(clan.getSize()))
|
||||
.replace("%clan_kdr%", KDRFormat.format(clan.getTotalKDR()))
|
||||
.replace("%clan_rival_kills%", String.valueOf(clan.getTotalRival()))
|
||||
.replace("%clan_neutral_kills%", String.valueOf(clan.getTotalNeutral()))
|
||||
.replace("%clan_civilian_kills%", String.valueOf(clan.getTotalCivilian()))
|
||||
.replace("%clan_ally_kills%", String.valueOf(clan.getTotalAlly()))
|
||||
.replace("%clan_deaths%", String.valueOf(clan.getTotalDeaths()))
|
||||
.replace("%clan_fee_enabled%", getFeeEnabled())
|
||||
.replace("%clan_fee_value%", String.valueOf(clan.getMemberFee()))
|
||||
.replace("%clan_allies%", clan.getAllyString(subColor + ", ", sender))
|
||||
.replace("%clan_rivals%", clan.getRivalString(subColor + ", ", sender))
|
||||
.replace("%clan_founded%", clan.getFoundedString())
|
||||
.replace("%clan_inactive_days%", String.valueOf(clan.getInactiveDays()))
|
||||
.replace("%clan_max_inactive_days%", Helper.formatMaxInactiveDays(clan.getMaxInactiveDays()));
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getFeeEnabled() {
|
||||
return clan.isMemberFeeEnabled() ? lang("fee.enabled", sender) : lang("fee.disabled", sender);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getDescription() {
|
||||
return clan.getDescription() != null && !clan.getDescription().isEmpty() ? clan.getDescription() :
|
||||
lang("no.description", sender);
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class ClanRoster extends Sendable {
|
||||
|
||||
private final Clan clan;
|
||||
|
||||
public ClanRoster(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
|
||||
super(plugin, sender);
|
||||
this.clan = clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
configureAndSendHeader();
|
||||
addLeaders();
|
||||
addMembers();
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void addMembers() {
|
||||
List<ClanPlayer> members = clan.getNonLeaders();
|
||||
plugin.getClanManager().sortClanPlayersByLastSeen(members);
|
||||
for (ClanPlayer cp : members) {
|
||||
String name = (cp.isTrusted() ? sm.getColored(PAGE_TRUSTED_COLOR) : sm.getColored(PAGE_UNTRUSTED_COLOR)) + cp.getName();
|
||||
String lastSeen = VanishUtils.isVanished(sender, cp) ? WHITE + cp.getLastSeenDaysString(sender) : GREEN + lang("online", sender);
|
||||
|
||||
chatBlock.addRow(" " + name, YELLOW + ChatUtils.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
|
||||
}
|
||||
}
|
||||
|
||||
private void addLeaders() {
|
||||
List<ClanPlayer> leaders = clan.getLeaders();
|
||||
plugin.getClanManager().sortClanPlayersByLastSeen(leaders);
|
||||
for (ClanPlayer cp : leaders) {
|
||||
String name = sm.getColored(PAGE_LEADER_COLOR) + cp.getName();
|
||||
String lastSeen = VanishUtils.isVanished(sender, cp) ? WHITE + cp.getLastSeenDaysString(sender) :
|
||||
GREEN + lang("online", sender);
|
||||
|
||||
chatBlock.addRow(" " + name, YELLOW + ChatUtils.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
|
||||
}
|
||||
}
|
||||
|
||||
private void configureAndSendHeader() {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(PAGE_CLAN_NAME_COLOR) + clan.getName() + subColor + " " +
|
||||
lang("roster", sender) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("legend", sender) + " " + sm.getColored(PAGE_LEADER_COLOR) +
|
||||
lang("leader", sender) + headColor + ", " + sm.getColored(PAGE_TRUSTED_COLOR) + lang("trusted", sender) +
|
||||
headColor + ", " + sm.getColored(PAGE_UNTRUSTED_COLOR) + lang("untrusted", sender));
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setFlexibility(false, true, false, true);
|
||||
chatBlock.addRow(" " + headColor + lang("player", sender), lang("rank", sender),
|
||||
lang("seen", sender));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class ClanStats extends Sendable {
|
||||
|
||||
private final Clan clan;
|
||||
|
||||
public ClanStats(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
|
||||
super(plugin, sender);
|
||||
this.clan = clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
configureAndSendHeader();
|
||||
|
||||
List<ClanPlayer> leaders = clan.getLeaders();
|
||||
cm.sortClanPlayersByKDR(leaders);
|
||||
addRows(leaders);
|
||||
|
||||
List<ClanPlayer> members = clan.getNonLeaders();
|
||||
cm.sortClanPlayersByKDR(members);
|
||||
addRows(members);
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void configureAndSendHeader() {
|
||||
ChatBlock.saySingle(sender, sm.getColored(PAGE_CLAN_NAME_COLOR) + clan.getName() + subColor + " " +
|
||||
lang("stats", sender) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("kdr", sender) + " = " + subColor +
|
||||
lang("kill.death.ratio", sender));
|
||||
ChatBlock.sendMessage(sender, headColor + lang("weights", sender) + " = " + lang("rival", sender)
|
||||
+ ": " + subColor + sm.getDouble(KILL_WEIGHTS_RIVAL) + headColor + " " + lang("neutral", sender) + ": " + subColor +
|
||||
sm.getDouble(KILL_WEIGHTS_NEUTRAL) + headColor + " " + lang("civilian", sender) + ": " + subColor +
|
||||
sm.getDouble(KILL_WEIGHTS_CIVILIAN));
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setFlexibility(true, false, false, false, false, false, false);
|
||||
chatBlock.setAlignment("l", "c", "c", "c", "c", "c", "c");
|
||||
chatBlock.addRow(" " + headColor + lang("name", sender), lang("kdr", sender),
|
||||
lang("rival", sender), lang("neutral", sender), lang("civilian.abbreviation", sender),
|
||||
lang("deaths", sender));
|
||||
}
|
||||
|
||||
private void addRows(List<ClanPlayer> clanPlayers) {
|
||||
for (ClanPlayer cpm : clanPlayers) {
|
||||
String name = (cpm.isLeader() ? sm.getColored(PAGE_LEADER_COLOR) : (cpm.isTrusted() ? sm.getColored(PAGE_TRUSTED_COLOR) :
|
||||
sm.getColored(PAGE_UNTRUSTED_COLOR)) + cpm.getName());
|
||||
String rival = NumberFormat.getInstance().format(cpm.getRivalKills());
|
||||
String neutral = NumberFormat.getInstance().format(cpm.getNeutralKills());
|
||||
String civilian = NumberFormat.getInstance().format(cpm.getCivilianKills());
|
||||
String deaths = NumberFormat.getInstance().format(cpm.getDeaths());
|
||||
String kdr = KDRFormat.format(cpm.getKDR());
|
||||
|
||||
chatBlock.addRow(" " + name, YELLOW + kdr, WHITE + rival, GRAY + neutral, DARK_GRAY + civilian,
|
||||
DARK_RED + deaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class Leaderboard extends Sendable {
|
||||
|
||||
private final RankingNumberResolver<ClanPlayer, BigDecimal> rankingResolver;
|
||||
private final List<ClanPlayer> clanPlayers;
|
||||
|
||||
public Leaderboard(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
|
||||
super(plugin, sender);
|
||||
clanPlayers = cm.getAllClanPlayers();
|
||||
rankingResolver = new RankingNumberResolver<>(clanPlayers,
|
||||
c -> KDRFormat.toBigDecimal(c.getKDR()), false, sm.getRankingType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
configureAndSendHeader();
|
||||
addLines();
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void addLines() {
|
||||
for (ClanPlayer cp : clanPlayers) {
|
||||
boolean online = !VanishUtils.isVanished(cp);
|
||||
|
||||
String name = (cp.isLeader() ? sm.getColored(PAGE_LEADER_COLOR) : (cp.isTrusted() ? sm.getColored(PAGE_TRUSTED_COLOR) :
|
||||
sm.getColored(PAGE_UNTRUSTED_COLOR))) + cp.getName();
|
||||
String lastSeen = online ? GREEN + lang("online", sender) : WHITE + cp.getLastSeenDaysString(sender);
|
||||
|
||||
String clanTag = WHITE + lang("free.agent", sender);
|
||||
|
||||
if (cp.getClan() != null) {
|
||||
clanTag = cp.getClan().getColorTag();
|
||||
}
|
||||
|
||||
chatBlock.addRow(" " + rankingResolver.getRankingNumber(cp),
|
||||
name, YELLOW + "" + KDRFormat.format(cp.getKDR()), WHITE + clanTag, lastSeen);
|
||||
}
|
||||
}
|
||||
|
||||
private void configureAndSendHeader() {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(SERVER_NAME) + subColor + " " + lang("leaderboard.command", sender)
|
||||
+ " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("total.clan.players.0", sender, subColor +
|
||||
clanPlayers.size()));
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setAlignment("c", "l", "c", "c", "c", "c");
|
||||
chatBlock.addRow(" " + headColor + lang("rank", sender), lang("player", sender),
|
||||
lang("kdr", sender), lang("clan", sender), lang("seen", sender));
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PAGE_SEPARATOR;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.SERVER_NAME;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class Rivalries extends Sendable {
|
||||
|
||||
public Rivalries(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
|
||||
super(plugin, sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
List<Clan> clans = cm.getClans();
|
||||
cm.sortClansByKDR(clans);
|
||||
sendHeader();
|
||||
|
||||
for (Clan clan : clans) {
|
||||
if (!clan.isVerified()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getRivalString(DARK_GRAY + ", ", sender));
|
||||
}
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void sendHeader() {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(SERVER_NAME) + subColor + " " +
|
||||
lang("rivalries", sender) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("legend", sender) + DARK_RED + " [" +
|
||||
lang("war", sender) + "]");
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setAlignment("l", "l");
|
||||
chatBlock.addRow(lang("clan", sender), lang("rivals", sender));
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
public class Vitals extends Sendable {
|
||||
|
||||
private final Clan clan;
|
||||
|
||||
public Vitals(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
|
||||
super(plugin, sender);
|
||||
this.clan = clan;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send() {
|
||||
configureAndSendHeader();
|
||||
|
||||
List<ClanPlayer> members = Helper.stripOffLinePlayers(clan.getLeaders());
|
||||
members.addAll(Helper.stripOffLinePlayers(clan.getNonLeaders()));
|
||||
|
||||
addRows(members);
|
||||
|
||||
chatBlock.addRow(" -- Allies -- ", "", "", "", "", "");
|
||||
|
||||
addRows(clan.getAllAllyMembers());
|
||||
|
||||
sendBlock();
|
||||
}
|
||||
|
||||
private void configureAndSendHeader() {
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.saySingle(sender, sm.getColored(PAGE_CLAN_NAME_COLOR) + clan.getName() + subColor + " " +
|
||||
lang("vitals", sender) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
|
||||
ChatBlock.sendBlank(sender);
|
||||
ChatBlock.sendMessage(sender, headColor + lang("weapons", sender) + ": " +
|
||||
lang("0.s.sword.1.2.b.bow.3.4.a.arrow", sender, WHITE, DARK_GRAY, WHITE, DARK_GRAY, WHITE));
|
||||
ChatBlock.sendMessage(sender, headColor + lang("materials", sender) + ": " + AQUA +
|
||||
lang("diamond", sender) + DARK_GRAY + ", " + YELLOW + lang("gold", sender) + DARK_GRAY + ", "
|
||||
+ GRAY + lang("stone", sender) + DARK_GRAY + ", " + WHITE + lang("iron", sender) + DARK_GRAY +
|
||||
", " + GOLD + lang("wood", sender));
|
||||
|
||||
ChatBlock.sendBlank(sender);
|
||||
|
||||
chatBlock.setFlexibility(true, false, false, false, false, false);
|
||||
chatBlock.setAlignment("l", "l", "l", "c", "c", "c");
|
||||
|
||||
chatBlock.addRow(" " + headColor + lang("name", sender), lang("health", sender),
|
||||
lang("hunger", sender), lang("food", sender), lang("armor", sender),
|
||||
lang("weapons", sender));
|
||||
}
|
||||
|
||||
private void addRows(Collection<ClanPlayer> players){
|
||||
for (ClanPlayer cpm : players) {
|
||||
Player p = cpm.toPlayer();
|
||||
|
||||
if (p != null) {
|
||||
String name = (cpm.isLeader() ? sm.getColored(PAGE_LEADER_COLOR) : (cpm.isTrusted() ? sm.getColored(PAGE_TRUSTED_COLOR)
|
||||
: sm.getColored(PAGE_UNTRUSTED_COLOR))) + cpm.getName();
|
||||
String health = cm.getBar(p.getHealth());
|
||||
String hunger = cm.getBar(p.getFoodLevel());
|
||||
String armor = cm.getArmorString(p.getInventory());
|
||||
String weapons = cm.getWeaponString(p.getInventory());
|
||||
String food = cm.getFoodString(p.getInventory());
|
||||
|
||||
chatBlock.addRow(" " + name, RED + health, hunger, WHITE + food, armor, weapons);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-314
@@ -1,314 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.general;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
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.*;
|
||||
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;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.conversation.CreateClanNamePrompt.NAME_KEY;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.conversation.CreateClanTagPrompt.TAG_KEY;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.*;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
public class GeneralCommands extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private RequestManager requestManager;
|
||||
|
||||
@Default
|
||||
@Description("{@@command.description.clan}")
|
||||
@HelpSearchTags("menu gui interface ui")
|
||||
public void main(CommandSender sender) {
|
||||
if (sender instanceof Player && settings.is(ENABLE_GUI)) {
|
||||
InventoryDrawer.open(new MainFrame((Player) sender));
|
||||
} else {
|
||||
help(sender, new CommandHelp(getCurrentCommandManager(),
|
||||
getCurrentCommandManager().getRootCommand(getName()), getCurrentCommandIssuer()));
|
||||
}
|
||||
}
|
||||
|
||||
@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}")
|
||||
public void create(Player player, @Optional @Name("tag") String tag, @Optional @Name("name") String name) {
|
||||
ClanPlayer cp = cm.getAnyClanPlayer(player.getUniqueId());
|
||||
|
||||
if (cp != null && cp.getClan() != null) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.must.first.resign", player,
|
||||
cp.getClan().getName()));
|
||||
return;
|
||||
}
|
||||
HashMap<Object, Object> initialData = new HashMap<>();
|
||||
initialData.put(TAG_KEY, tag);
|
||||
initialData.put(NAME_KEY, name);
|
||||
SCConversation conversation = new SCConversation(plugin, player, new CreateClanTagPrompt(), initialData);
|
||||
conversation.addConversationCanceller(new RequestCanceller(player, RED + lang("clan.create.request.cancelled", player)));
|
||||
conversation.begin();
|
||||
}
|
||||
|
||||
@Subcommand("%leaderboard")
|
||||
@CommandPermission("simpleclans.anyone.leaderboard")
|
||||
@Description("{@@command.description.leaderboard}")
|
||||
public void leaderboard(CommandSender sender) {
|
||||
Leaderboard l = new Leaderboard(plugin, sender);
|
||||
l.send();
|
||||
}
|
||||
|
||||
@Subcommand("%lookup")
|
||||
@CommandCompletion("@players")
|
||||
@CommandPermission("simpleclans.anyone.lookup")
|
||||
@Description("{@@command.description.lookup.other}")
|
||||
public void lookup(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
Lookup l = new Lookup(plugin, sender, player.getClanPlayer().getUniqueId());
|
||||
l.send();
|
||||
}
|
||||
|
||||
@Subcommand("%lookup")
|
||||
@CommandPermission("simpleclans.member.lookup")
|
||||
@Description("{@@command.description.lookup}")
|
||||
public void lookup(Player sender) {
|
||||
Lookup l = new Lookup(plugin, sender, sender.getUniqueId());
|
||||
l.send();
|
||||
}
|
||||
|
||||
@Subcommand("%kills")
|
||||
@CommandPermission("simpleclans.member.kills")
|
||||
@Conditions("verified|rank:name=KILLS")
|
||||
@CommandCompletion("@players")
|
||||
@Description("{@@command.description.kills}")
|
||||
public void kills(Player sender, @Optional @Name("player") ClanPlayerInput player) {
|
||||
String name = sender.getName();
|
||||
if (player != null) {
|
||||
name = player.getClanPlayer().getName();
|
||||
}
|
||||
Kills k = new Kills(plugin, sender, name);
|
||||
k.send();
|
||||
}
|
||||
|
||||
@Subcommand("%profile")
|
||||
@CommandPermission("simpleclans.anyone.profile")
|
||||
@CommandCompletion("@clans:hide_own")
|
||||
@Description("{@@command.description.profile.other}")
|
||||
public void profile(CommandSender sender, @Conditions("verified") @Name("clan") ClanInput clan) {
|
||||
ClanProfile p = new ClanProfile(plugin, sender, clan.getClan());
|
||||
p.send();
|
||||
}
|
||||
|
||||
@Subcommand("%roster")
|
||||
@CommandCompletion("@clans:hide_own")
|
||||
@CommandPermission("simpleclans.anyone.roster")
|
||||
@Description("{@@command.description.roster.other}")
|
||||
public void roster(CommandSender sender, @Conditions("verified") @Name("clan") ClanInput clan) {
|
||||
ClanRoster r = new ClanRoster(plugin, sender, clan.getClan());
|
||||
r.send();
|
||||
}
|
||||
|
||||
@Subcommand("%ff %allow")
|
||||
@CommandPermission("simpleclans.member.ff")
|
||||
@Description("{@@command.description.ff.allow}")
|
||||
public void allowPersonalFf(Player player, ClanPlayer cp) {
|
||||
cp.setFriendlyFire(true);
|
||||
storage.updateClanPlayer(cp);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("personal.friendly.fire.is.set.to.allowed", player));
|
||||
}
|
||||
|
||||
@Subcommand("%ff %auto")
|
||||
@CommandPermission("simpleclans.member.ff")
|
||||
@Description("{@@command.description.ff.auto}")
|
||||
public void autoPersonalFf(Player player, ClanPlayer cp) {
|
||||
cp.setFriendlyFire(false);
|
||||
storage.updateClanPlayer(cp);
|
||||
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));
|
||||
} else {
|
||||
new SCConversation(plugin, player, new ResetKdrPrompt(cm), 60).begin();
|
||||
}
|
||||
}
|
||||
|
||||
@CommandAlias("%accept")
|
||||
@Description("{@@command.description.accept}")
|
||||
@Conditions("can_vote")
|
||||
public void accept(Player player, ClanPlayer cp) {
|
||||
Clan clan = cp.getClan();
|
||||
if (clan != null) {
|
||||
clan.leaderAnnounce(GREEN + lang("voted.to.accept", player.getName()));
|
||||
}
|
||||
requestManager.accept(cp);
|
||||
}
|
||||
|
||||
@CommandAlias("%deny")
|
||||
@Description("{@@command.description.deny}")
|
||||
@Conditions("can_vote")
|
||||
public void deny(Player player, ClanPlayer cp) {
|
||||
Clan clan = cp.getClan();
|
||||
if (clan != null) {
|
||||
clan.leaderAnnounce(RED + lang("has.voted.to.deny", player.getName()));
|
||||
}
|
||||
requestManager.deny(cp);
|
||||
}
|
||||
|
||||
@CommandAlias("%more")
|
||||
@Description("{@@command.description.more}")
|
||||
public void more(Player player) {
|
||||
ChatBlock chatBlock = storage.getChatBlock(player);
|
||||
|
||||
if (chatBlock == null || chatBlock.size() <= 0) {
|
||||
ChatBlock.sendMessage(player, RED + lang("nothing.more.to.see", player));
|
||||
return;
|
||||
}
|
||||
|
||||
chatBlock.sendBlock(player, settings.getInt(PAGE_SIZE));
|
||||
|
||||
if (chatBlock.size() > 0) {
|
||||
ChatBlock.sendBlank(player);
|
||||
ChatBlock.sendMessage(player, settings.getColored(PAGE_HEADINGS_COLOR) + lang("view.next.page", player,
|
||||
settings.getString(COMMANDS_MORE)));
|
||||
}
|
||||
ChatBlock.sendBlank(player);
|
||||
}
|
||||
|
||||
@CatchUnknown
|
||||
@Subcommand("%help")
|
||||
@Description("{@@command.description.help}")
|
||||
public void help(CommandSender sender, CommandHelp help) {
|
||||
boolean inClan = sender instanceof Player && cm.getClanByPlayerUniqueId(((Player) sender).getUniqueId()) != null;
|
||||
for (HelpEntry helpEntry : help.getHelpEntries()) {
|
||||
for (@SuppressWarnings("rawtypes") CommandParameter parameter : helpEntry.getParameters()) {
|
||||
if (parameter.getType().equals(Clan.class) && !inClan) {
|
||||
helpEntry.setSearchScore(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
help.showHelp();
|
||||
}
|
||||
|
||||
@Subcommand("%mostkilled")
|
||||
@CommandPermission("simpleclans.mod.mostkilled")
|
||||
@Conditions("verified|rank:name=MOSTKILLED")
|
||||
@Description("{@@command.description.mostkilled}")
|
||||
public void mostKilled(Player player) {
|
||||
MostKilled mk = new MostKilled(plugin, player);
|
||||
mk.send();
|
||||
}
|
||||
|
||||
@Subcommand("%list %balance")
|
||||
@CommandPermission("simpleclans.anyone.list.balance")
|
||||
@Description("{@@command.description.list.balance}")
|
||||
public void listBalance(CommandSender sender) {
|
||||
List<Clan> clans = cm.getClans();
|
||||
if (clans.isEmpty()) {
|
||||
sender.sendMessage(RED + lang("no.clans.have.been.created", sender));
|
||||
return;
|
||||
}
|
||||
clans.sort(Comparator.comparingDouble(Clan::getBalance).reversed());
|
||||
|
||||
sender.sendMessage(lang("clan.list.balance.header", sender, settings.getColored(SERVER_NAME), clans.size()));
|
||||
String lineFormat = lang("clan.list.balance.line", sender);
|
||||
|
||||
String leftBracket = settings.getColored(TAG_BRACKET_COLOR) + settings.getColored(TAG_BRACKET_LEFT);
|
||||
String rightBracket = settings.getColored(TAG_BRACKET_COLOR) + settings.getColored(TAG_BRACKET_RIGHT);
|
||||
for (int i = 0; i < 10 && i < clans.size(); i++) {
|
||||
Clan clan = clans.get(i);
|
||||
String name = " " + (clan.isVerified() ? settings.getColored(PAGE_CLAN_NAME_COLOR) : GRAY) + clan.getName();
|
||||
String line = MessageFormat.format(lineFormat, i + 1, leftBracket, clan.getColorTag(),
|
||||
rightBracket, name, clan.getBalanceFormatted());
|
||||
sender.sendMessage(line);
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%list")
|
||||
@CommandPermission("simpleclans.anyone.list")
|
||||
@Description("{@@command.description.list}")
|
||||
@CommandCompletion("@clan_list_type @order")
|
||||
public void list(CommandSender sender, @Optional @Values("@clan_list_type") String type,
|
||||
@Optional @Single @Values("@order") String order) {
|
||||
ClanList list = new ClanList(plugin, sender, type, order);
|
||||
list.send();
|
||||
}
|
||||
|
||||
@Subcommand("%rivalries")
|
||||
@CommandPermission("simpleclans.anyone.rivalries")
|
||||
@Description("{@@command.description.rivalries}")
|
||||
public void rivalries(CommandSender sender) {
|
||||
Rivalries rivalries = new Rivalries(plugin, sender);
|
||||
rivalries.send();
|
||||
}
|
||||
|
||||
@Subcommand("%alliances")
|
||||
@CommandPermission("simpleclans.anyone.alliances")
|
||||
@Description("{@@command.description.alliances}")
|
||||
public void alliances(CommandSender sender) {
|
||||
Alliances a = new Alliances(plugin, sender);
|
||||
a.send();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.staff;
|
||||
|
||||
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.EconomyResponse;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.md_5.bungee.api.ChatColor.RED;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
@Subcommand("%admin %bank")
|
||||
public class BankCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
|
||||
@Subcommand("%status")
|
||||
@CommandPermission("simpleclans.admin.bank.status")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.bank.admin.status}")
|
||||
public void status(CommandSender sender, @Name("clan") ClanInput clanInput) {
|
||||
Clan clan = clanInput.getClan();
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.balance", sender, clan.getName(), clan.getBalanceFormatted()));
|
||||
}
|
||||
|
||||
@Subcommand("%take")
|
||||
@CommandPermission("simpleclans.admin.bank.take")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.bank.admin.take}")
|
||||
public void take(CommandSender sender, @Name("clan") ClanInput clanInput, @Name("amount") double amount) {
|
||||
Clan clan = clanInput.getClan();
|
||||
amount = Math.abs(amount);
|
||||
BankOperator operator = new BankOperator(sender, sender instanceof Player ? permissions.playerGetMoney((Player) sender) : 0);
|
||||
|
||||
EconomyResponse economyResponse = clan.withdraw(operator, ClanBalanceUpdateEvent.Cause.COMMAND, amount);
|
||||
switch (economyResponse) {
|
||||
case SUCCESS:
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.take", sender, CurrencyFormat.format(amount), clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.take", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
break;
|
||||
case NOT_ENOUGH_BALANCE:
|
||||
sender.sendMessage(RED + lang("clan.admin.bank.not.enough.money", sender, clan.getName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%give")
|
||||
@CommandPermission("simpleclans.admin.bank.give")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.bank.admin.give}")
|
||||
public void give(CommandSender sender, @Name("clan") ClanInput clanInput, @Name("amount") double amount) {
|
||||
Clan clan = clanInput.getClan();
|
||||
amount = Math.abs(amount);
|
||||
BankOperator operator = new BankOperator(sender, sender instanceof Player ? permissions.playerGetMoney((Player) sender) : 0);
|
||||
|
||||
EconomyResponse economyResponse = clan.deposit(operator, ClanBalanceUpdateEvent.Cause.COMMAND, amount);
|
||||
if (economyResponse == EconomyResponse.SUCCESS) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.give", sender, CurrencyFormat.format(amount), clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.give", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%set")
|
||||
@CommandPermission("simpleclans.admin.bank.set")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.bank.admin.set}")
|
||||
public void set(CommandSender sender, @Name("clan") ClanInput clanInput, @Name("amount") double amount) {
|
||||
Clan clan = clanInput.getClan();
|
||||
amount = Math.abs(amount);
|
||||
BankOperator operator = new BankOperator(sender, sender instanceof Player ? permissions.playerGetMoney((Player) sender) : 0);
|
||||
|
||||
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(), CurrencyFormat.format(amount)));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.set", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.staff;
|
||||
|
||||
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.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 net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
@Subcommand("%mod %bb")
|
||||
public class BbCommand extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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();
|
||||
ChatBlock.sendMessage(player, RED + lang("cleared.bb", player));
|
||||
}
|
||||
|
||||
@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(lang("bulletin.board.message", player.getName(), msg));
|
||||
clan.displayBb(player);
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
}
|
||||
-389
@@ -1,389 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.commands.staff;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
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;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryController;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.TagValidator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
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;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.GLOBAL_FRIENDLY_FIRE;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Conditions("%basic_conditions")
|
||||
public class StaffCommands extends BaseCommand {
|
||||
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private ClanManager cm;
|
||||
@Dependency
|
||||
private PermissionsManager permissions;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
@Dependency
|
||||
private StorageManager storage;
|
||||
|
||||
@Subcommand("%mod %place")
|
||||
@CommandPermission("simpleclans.mod.place")
|
||||
@CommandCompletion("@players @clans")
|
||||
@HelpSearchTags("move put")
|
||||
@Description("{@@command.description.place}")
|
||||
public void place(CommandSender sender, @Name("player") ClanPlayerInput cpInput, @Name("clan") ClanInput clanInput) {
|
||||
UUID uuid = cpInput.getClanPlayer().getUniqueId();
|
||||
ClanPlayer oldCp = cm.getClanPlayer(uuid);
|
||||
Clan newClan = clanInput.getClan();
|
||||
|
||||
if (oldCp != null) {
|
||||
Clan oldClan = Objects.requireNonNull(oldCp.getClan());
|
||||
|
||||
if (oldClan.equals(newClan)) {
|
||||
ChatBlock.sendMessage(sender, lang("player.already.in.this.clan", sender));
|
||||
return;
|
||||
}
|
||||
if (!oldClan.isPermanent() && oldClan.isLeader(uuid) && oldClan.getLeaders().size() <= 1) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.move.the.last.leader", sender));
|
||||
return;
|
||||
} else {
|
||||
oldClan.addBb(oldCp.getName(), lang("0.has.resigned", oldCp.getName()));
|
||||
oldClan.removePlayerFromClan(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
ClanPlayer cp = cm.getCreateClanPlayer(uuid);
|
||||
|
||||
newClan.addBb(lang("joined.the.clan", cp.getName()));
|
||||
cm.serverAnnounce(lang("has.joined", cp.getName(), newClan.getName()));
|
||||
newClan.addPlayerToClan(cp);
|
||||
}
|
||||
|
||||
@Subcommand("%mod %modtag")
|
||||
@CommandPermission("simpleclans.mod.modtag")
|
||||
@Description("{@@command.description.modtag.other}")
|
||||
public void modtag(Player player, @Name("clan") ClanInput clanInput, @Single @Name("tag") String tag) {
|
||||
Clan clan = clanInput.getClan();
|
||||
TagChangeEvent event = new TagChangeEvent(player, clan, tag);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
tag = event.getNewTag();
|
||||
String cleanTag = Helper.cleanTag(tag);
|
||||
|
||||
Optional<String> validationError = plugin.getTagValidator().validate(player, tag);
|
||||
if (validationError.isPresent()) {
|
||||
ChatBlock.sendMessage(player, validationError.get());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cleanTag.equals(clan.getTag())) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.can.only.modify.the.color.and.case.of.the.tag",
|
||||
player));
|
||||
return;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@Subcommand("%admin %reload")
|
||||
@CommandPermission("simpleclans.admin.reload")
|
||||
@Description("{@@command.description.reload}")
|
||||
public void reload(CommandSender sender) {
|
||||
storage.saveModified();
|
||||
plugin.reloadConfig();
|
||||
LanguageResource.clearCache();
|
||||
settings.loadAndSave();
|
||||
storage.importFromDatabase();
|
||||
permissions.loadPermissions();
|
||||
|
||||
for (Clan clan : cm.getClans()) {
|
||||
permissions.updateClanPermissions(clan);
|
||||
}
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("configuration.reloaded", sender));
|
||||
}
|
||||
|
||||
@Subcommand("%mod %home %set")
|
||||
@CommandPermission("simpleclans.mod.home")
|
||||
@CommandCompletion("@clans")
|
||||
@Description("{@@command.description.mod.home.set}")
|
||||
public void homeSet(Player player, ClanPlayer cp, @Name("clan") ClanInput clanInput) {
|
||||
Location loc = player.getLocation();
|
||||
Clan clan = clanInput.getClan();
|
||||
|
||||
PlayerHomeSetEvent event = new PlayerHomeSetEvent(clan, cp, loc);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setHomeLocation(loc);
|
||||
ChatBlock.sendMessage(player, AQUA + lang("hombase.mod.set", player, clan.getName()) + " " +
|
||||
ChatColor.YELLOW + Helper.toLocationString(loc));
|
||||
}
|
||||
|
||||
@Subcommand("%mod %home %tp")
|
||||
@CommandCompletion("@clans:has_home")
|
||||
@CommandPermission("simpleclans.mod.hometp")
|
||||
@Description("{@@command.description.mod.home.tp}")
|
||||
public void homeTp(Player player, @Name("clan") @Conditions("can_teleport") ClanInput clan) {
|
||||
plugin.getTeleportManager().teleportToHome(player, clan.getClan());
|
||||
}
|
||||
|
||||
@Subcommand("%mod %ban")
|
||||
@CommandPermission("simpleclans.mod.ban")
|
||||
@CommandCompletion("@players")
|
||||
@Description("{@@command.description.ban}")
|
||||
public void ban(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
UUID uuid = player.getClanPlayer().getUniqueId();
|
||||
if (settings.isBanned(uuid)) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("this.player.is.already.banned", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
cm.ban(uuid);
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.added.to.banned.list", sender));
|
||||
|
||||
Player pl = sender.getServer().getPlayer(uuid);
|
||||
if (pl != null) {
|
||||
ChatBlock.sendMessage(pl, AQUA + lang("you.banned", sender));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%mod %unban")
|
||||
@CommandPermission("simpleclans.mod.ban")
|
||||
@CommandCompletion("@players")
|
||||
@Description("{@@command.description.unban}")
|
||||
public void unban(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
UUID uuid = player.getClanPlayer().getUniqueId();
|
||||
if (!settings.isBanned(uuid)) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("this.player.is.not.banned", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
Player pl = Bukkit.getPlayer(uuid);
|
||||
if (pl != null) {
|
||||
ChatBlock.sendMessage(pl, AQUA + lang("you.have.been.unbanned.from.clan.commands", sender));
|
||||
}
|
||||
|
||||
settings.removeBanned(uuid);
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.removed.from.the.banned.list", sender));
|
||||
}
|
||||
|
||||
@Subcommand("%mod %globalff %allow")
|
||||
@CommandPermission("simpleclans.mod.globalff")
|
||||
@Description("{@@command.description.globalff.allow}")
|
||||
public void allowGlobalFf(CommandSender sender) {
|
||||
if (settings.is(GLOBAL_FRIENDLY_FIRE)) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("global.friendly.fire.is.already.being.allowed", sender));
|
||||
} else {
|
||||
settings.set(GLOBAL_FRIENDLY_FIRE, true);
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("global.friendly.fire.is.set.to.allowed", sender));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%mod %globalff %auto")
|
||||
@CommandPermission("simpleclans.mod.globalff")
|
||||
@Description("{@@command.description.globalff.auto}")
|
||||
public void autoGlobalFf(CommandSender sender) {
|
||||
if (!settings.is(GLOBAL_FRIENDLY_FIRE)) {
|
||||
ChatBlock.sendMessage(sender, AQUA +
|
||||
lang("global.friendy.fire.is.already.being.managed.by.each.clan", sender));
|
||||
} else {
|
||||
settings.set(GLOBAL_FRIENDLY_FIRE, false);
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("global.friendy.fire.is.now.managed.by.each.clan",
|
||||
sender));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%mod %verify")
|
||||
@CommandPermission("simpleclans.mod.verify")
|
||||
@CommandCompletion("@clans:unverified")
|
||||
@Description("{@@command.description.mod.verify}")
|
||||
public void verify(CommandSender sender, @Name("clan") ClanInput clan) {
|
||||
Clan clanInput = clan.getClan();
|
||||
|
||||
if (!clanInput.isVerified()) {
|
||||
clanInput.verifyClan();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@Subcommand("%admin %purge")
|
||||
@CommandPermission("simpleclans.admin.purge")
|
||||
@CommandCompletion("@players")
|
||||
@Description("{@@command.description.purge}")
|
||||
public void purge(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
Player onlinePlayer = player.getClanPlayer().toPlayer();
|
||||
if (onlinePlayer != null && InventoryController.isRegistered(onlinePlayer)) {
|
||||
onlinePlayer.closeInventory();
|
||||
}
|
||||
|
||||
Clan clan = player.getClanPlayer().getClan();
|
||||
if (clan != null && clan.getMembers().size() == 1) {
|
||||
clan.disband(sender, false, false);
|
||||
}
|
||||
cm.deleteClanPlayer(player.getClanPlayer());
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.purged", sender));
|
||||
}
|
||||
|
||||
@Subcommand("%mod %kick")
|
||||
@Description("{@@command.description.mod.kick}")
|
||||
@CommandPermission("simpleclans.mod.kick")
|
||||
@CommandCompletion("@all_non_leaders|@all_leaders")
|
||||
public void kick(CommandSender sender, @Conditions("clan_member") @Name("player") ClanPlayerInput cp) {
|
||||
ClanPlayer clanPlayer = cp.getClanPlayer();
|
||||
Clan clan = Objects.requireNonNull(clanPlayer.getClan());
|
||||
if (clanPlayer.isLeader() && clan.getLeaders().size() == 1) {
|
||||
ChatBlock.sendMessageKey(sender, "cannot.kick.last.leader");
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), lang("has.been.kicked.by", clanPlayer.getName(),
|
||||
sender.getName(), sender));
|
||||
clan.removePlayerFromClan(clanPlayer.getUniqueId());
|
||||
}
|
||||
|
||||
@Subcommand("%mod %disband")
|
||||
@CommandCompletion("@clans")
|
||||
@CommandPermission("simpleclans.mod.disband")
|
||||
@Description("{@@command.description.mod.disband}")
|
||||
public void disband(CommandSender sender, @Name("clan") ClanInput clan) {
|
||||
clan.getClan().disband(sender, true, true);
|
||||
}
|
||||
|
||||
@Subcommand("%admin %promote")
|
||||
@CommandCompletion("@all_non_leaders")
|
||||
@CommandPermission("simpleclans.admin.promote")
|
||||
@Description("{@@command.description.admin.promote}")
|
||||
public void promote(CommandSender sender, @Conditions("online|clan_member") @Name("player") ClanPlayerInput promote) {
|
||||
ClanPlayer clanPlayer = promote.getClanPlayer();
|
||||
Player promotePl = Objects.requireNonNull(clanPlayer.toPlayer());
|
||||
if (!permissions.has(promotePl, "simpleclans.leader.promotable")) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("the.player.does.not.have.the.permissions.to.lead.a.clan",
|
||||
sender));
|
||||
return;
|
||||
}
|
||||
Clan clan = Objects.requireNonNull(clanPlayer.getClan());
|
||||
if (clan.isLeader(promotePl)) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("the.player.is.already.a.leader", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
clan.addBb(sender.getName(), lang("promoted.to.leader", promotePl.getName()));
|
||||
clan.promote(promotePl.getUniqueId());
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.successfully.promoted", sender));
|
||||
}
|
||||
|
||||
@Subcommand("%admin %demote")
|
||||
@CommandCompletion("@all_leaders")
|
||||
@CommandPermission("simpleclans.admin.demote")
|
||||
@Description("{@@command.description.admin.demote}")
|
||||
public void demote(CommandSender sender, @Conditions("clan_member") @Name("leader") ClanPlayerInput other) {
|
||||
ClanPlayer otherCp = other.getClanPlayer();
|
||||
Clan clan = Objects.requireNonNull(otherCp.getClan());
|
||||
|
||||
if (!otherCp.isLeader()) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("player.is.not.a.leader", sender));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getLeaders().size() == 1 && !clan.isPermanent()) {
|
||||
ChatBlock.sendMessage(sender, RED + lang("you.cannot.demote.the.last.leader", sender));
|
||||
return;
|
||||
}
|
||||
clan.demote(otherCp.getUniqueId());
|
||||
clan.addBb(sender.getName(), lang("demoted.back.to.member", otherCp.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("player.successfully.demoted", sender));
|
||||
}
|
||||
|
||||
@Subcommand("%admin %resetkdr %everyone")
|
||||
@CommandPermission("simpleclans.admin.resetkdr")
|
||||
@Description("{@@command.description.resetkdr.everyone}")
|
||||
public void resetKdr(CommandSender sender) {
|
||||
for (ClanPlayer cp : cm.getAllClanPlayers()) {
|
||||
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));
|
||||
}
|
||||
|
||||
@Subcommand("%admin %resetkdr")
|
||||
@CommandCompletion("@players")
|
||||
@CommandPermission("simpleclans.admin.resetkdr")
|
||||
@Description("{@@command.description.resetkdr.player}")
|
||||
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 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"));
|
||||
}
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.conversation;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PreCreateClanEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.conversation.CreateClanTagPrompt.TAG_KEY;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
public class CreateClanNamePrompt extends StringPrompt {
|
||||
public static final String NAME_KEY = "name";
|
||||
|
||||
@Override
|
||||
public @NotNull String getPromptText(@NotNull ConversationContext context) {
|
||||
if (context.getSessionData(NAME_KEY) != null) {
|
||||
return "";
|
||||
}
|
||||
return lang("insert.clan.name", (Player) context.getForWhom());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blocksForInput(@NotNull ConversationContext context) {
|
||||
return context.getSessionData(NAME_KEY) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Prompt acceptInput(@NotNull ConversationContext context, @Nullable String clanName) {
|
||||
SimpleClans plugin = (SimpleClans) context.getPlugin();
|
||||
Player player = (Player) context.getForWhom();
|
||||
clanName = clanName != null ? clanName : (String) context.getSessionData(NAME_KEY);
|
||||
context.setSessionData(NAME_KEY, null);
|
||||
if (plugin == null || clanName == null) return this;
|
||||
|
||||
Prompt errorPrompt = validateName(plugin, player, clanName);
|
||||
if (errorPrompt != null) return errorPrompt;
|
||||
|
||||
String finalClanName = clanName;
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
String tag = (String) context.getSessionData(TAG_KEY);
|
||||
//noinspection ConstantConditions
|
||||
PreCreateClanEvent event = new PreCreateClanEvent(player, tag, finalClanName);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
processClanCreation(plugin, player, tag, finalClanName);
|
||||
}
|
||||
});
|
||||
|
||||
return END_OF_CONVERSATION;
|
||||
}
|
||||
|
||||
private void processClanCreation(@NotNull SimpleClans plugin, @NotNull Player player, @NotNull String tag,
|
||||
@NotNull String name) {
|
||||
if (plugin.getClanManager().purchaseCreation(player)) {
|
||||
plugin.getClanManager().createClan(player, tag, name);
|
||||
|
||||
Clan clan = plugin.getClanManager().getClan(tag);
|
||||
clan.addBb(player.getName(), lang("clan.created", name));
|
||||
plugin.getStorageManager().updateClan(clan);
|
||||
|
||||
if (plugin.getSettingsManager().is(REQUIRE_VERIFICATION)) {
|
||||
boolean verified = !plugin.getSettingsManager().is(REQUIRE_VERIFICATION)
|
||||
|| plugin.getPermissionsManager().has(player, "simpleclans.mod.verify");
|
||||
|
||||
if (!verified) {
|
||||
ChatBlock.sendMessage(player, AQUA +
|
||||
lang("get.your.clan.verified.to.access.advanced.features", player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Prompt validateName(@NotNull SimpleClans plugin, @NotNull Player player, @NotNull String input) {
|
||||
boolean bypass = plugin.getPermissionsManager().has(player, "simpleclans.mod.bypass");
|
||||
if (!bypass) {
|
||||
if (ChatUtils.stripColors(input).length() > plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)) {
|
||||
return new MessagePromptImpl(RED +
|
||||
lang("your.clan.name.cannot.be.longer.than.characters", player,
|
||||
plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)), this);
|
||||
}
|
||||
if (ChatUtils.stripColors(input).length() <= plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)) {
|
||||
return new MessagePromptImpl(RED +
|
||||
lang("your.clan.name.must.be.longer.than.characters", player,
|
||||
plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)), this);
|
||||
}
|
||||
}
|
||||
if (input.contains("&")) {
|
||||
return new MessagePromptImpl(RED +
|
||||
lang("your.clan.name.cannot.contain.color.codes", player), this);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.conversation;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.CreateRankEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.PreCreateRankEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static org.bukkit.ChatColor.AQUA;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
public class CreateRankNamePrompt extends StringPrompt {
|
||||
@Override
|
||||
public @NotNull String getPromptText(@NotNull ConversationContext context) {
|
||||
Player forWhom = (Player) context.getForWhom();
|
||||
return lang("insert.rank.name", forWhom, lang("cancel", forWhom));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input) {
|
||||
SimpleClans plugin = (SimpleClans) context.getPlugin();
|
||||
Player player = (Player) context.getForWhom();
|
||||
Clan clan = (Clan) context.getSessionData("clan");
|
||||
if (clan == null || plugin == null) return END_OF_CONVERSATION;
|
||||
if (input == null) return this;
|
||||
|
||||
String rank = input.toLowerCase().replace(" ", "_");
|
||||
PreCreateRankEvent event = new PreCreateRankEvent(player, clan, rank);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
rank = event.getRankName();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (clan.hasRank(rank)) {
|
||||
return new MessagePromptImpl(RED + lang("rank.already.exists", player), this);
|
||||
}
|
||||
|
||||
clan.createRank(rank);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new CreateRankEvent(player, clan, clan.getRank(rank)));
|
||||
plugin.getStorageManager().updateClan(clan, true);
|
||||
return new MessagePromptImpl(AQUA + lang("rank.created", player));
|
||||
}
|
||||
}
|
||||
Loaded 100 of 502 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user