Compare commits

..
Author SHA1 Message Date
Minat0_ c64715ebaa GITBOOK-76: change codemc url repo to roinuj's one 2024-04-25 17:37:06 +00:00
Minat0_ 1469a899bc GITBOOK-75: remove a notation about missing javadoc in Russian docs 2024-04-06 08:07:35 +00:00
Minat0_ 7ac4f52c4c GitBook: [#74] No subject 2023-01-05 19:15:30 +00:00
Minat0_ a12c804886 GitBook: [#72] [RU] [DiscordSRV] Adds missing command for manually discord creation 2022-09-16 23:15:32 +00:00
Minat0_ 0e18dac7ea GitBook: [#71] Adding geyser player head error loading at known-issues | Russian 2022-08-17 01:11:39 +00:00
Minat0_ af8cd427de GitBook: [#71] Adding geyser player head error loading at known-issues | Russian 2022-07-18 16:18:05 +00:00
Edson Passos ad9bf675ca GitBook: [#70] [Russian] Some modifies around configuration page and permissions page 2022-04-29 20:47:52 +00:00
Minat0_ 4fb647575d GitBook: [#69] [Commands] [Permissions] Adds missing invite-toggle | Russian 2022-01-17 16:16:01 +00:00
Edson Passos 3ed0cbb341 GitBook: [#68] [Clan on Tablist] Updates guide to latest | Russian 2022-01-11 19:56:12 +00:00
Edson Passos 5f8222963f GitBook: [#67] Adds DIscordSRV, Verified, Permanent pages. Emojis on headings. | Russian 2021-12-11 19:16:43 +00:00
Minat0_ 231e4a7d5a GitBook: [russian] one page modified 2021-08-30 17:35:32 +00:00
Minat0_ 88695a1df7 GitBook: [russian] 5 pages modified 2021-08-30 16:59:22 +00:00
Minat0_ 61c3da0544 GitBook: [russian] 14 pages modified 2021-08-30 16:40:01 +00:00
Minat0_ 84301e2636 GitBook: [russian] no pages and one asset modified 2021-08-30 16:20:45 +00:00
Minat0_ ee1fd9c80e GitBook: [russian] 14 pages and one asset modified 2021-08-30 15:45:05 +00:00
Minat0_ f76417c080 GitBook: [russian] one page and 6 assets modified 2021-08-30 15:13:26 +00:00
Minat0_ 7cc585b4ad GitBook: [russian] 3 pages modified 2021-07-06 16:08:25 +00:00
Minat0_ f1fcb0c372 GitBook: [russian] no pages and 2 assets modified 2021-07-06 15:54:38 +00:00
Minat0_ 527bff8d20 GitBook: [russian] one page modified 2021-07-06 15:35:28 +00:00
Minat0_ 5d108caadd GitBook: [russian] 2 pages and 2 assets modified 2021-07-06 15:30:56 +00:00
Minat0_ 5a9e5cb561 GitBook: [russian] one page and 2 assets modified 2021-07-05 10:04:49 +00:00
Minat0_ 9cded638d5 GitBook: [russian] 14 pages modified 2021-07-02 17:06:38 +00:00
mehmet yılmaz 5c7f1d3873 GitBook: [russian] 14 pages modified 2021-06-24 20:47:20 +00:00
mehmet yılmaz f45e4b871c GitBook: [russian] 14 pages modified 2021-06-24 20:18:36 +00:00
mehmet yılmaz 2f2124c7f5 GitBook: [russian] 14 pages modified 2021-06-24 19:54:42 +00:00
mehmet yılmaz 078821a13e GitBook: [russian] 14 pages modified 2021-06-24 19:10:12 +00:00
mehmet yılmaz e900404e17 GitBook: [russian] no pages and one asset modified 2021-06-24 18:59:42 +00:00
Minat0_ d7b9c71ee7 GitBook: [russian] 14 pages modified 2021-05-26 12:39:25 +00:00
Minat0_ f33bf64b50 GitBook: [russian] 14 pages modified 2021-03-26 01:40:42 +00:00
Minat0_ 08f16cac00 GitBook: [russian] 14 pages modified 2021-03-21 17:24:47 +00:00
Minat0_ 4a515453c9 GitBook: [russian] 2 pages modified 2021-03-14 00:51:35 +00:00
Minat0_ e515cad210 GitBook: [russian] one page modified 2021-02-10 03:02:00 +00:00
Minat0_ 4de19f44fa GitBook: [russian] 15 pages modified 2020-12-05 02:13:44 +00:00
Minat0_ 3f4c122f53 GitBook: [russian] 15 pages modified 2020-11-29 17:22:33 +00:00
307 changed files with 10658 additions and 22319 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

+29
View File
@@ -0,0 +1,29 @@
name: Publish to Bintray (Spigot 1.13+)
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: bintray-roinujnosde-bukkit-plugins # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to Bintray
run: mvn -B deploy
env:
MAVEN_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.BINTRAY_TOKEN }}
+19 -25
View File
@@ -1,37 +1,31 @@
# 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
name: Java CI Dev Build
on:
push:
branches: [ master ]
branches: [ dev ]
pull_request:
branches: [ master ]
branches: [ dev ]
jobs:
build:
strategy:
fail-fast: true
max-parallel: 4
matrix:
java-version: [ 8, 11, 16, 17 ]
runs-on: ubuntu-latest
name: Java ${{ matrix.java-version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Set up JDK ${{ matrix.java-version }}"
uses: actions/setup-java@v2
with:
java-version: "${{ matrix.java-version }}"
distribution: 'adopt'
cache: 'maven'
- name: Build with Maven
run: mvn -B -U package --file pom.xml
- name: Upload Build Artifact
if: "${{ matrix.java-version == 8 }}"
uses: actions/upload-artifact@v2
with:
name: SimpleClans
path: target/SimpleClans.jar
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Create Staging
run: mkdir staging && cp target/SimpleClans.jar staging
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: SimpleClans
path: staging
-31
View File
@@ -1,31 +0,0 @@
name: Publish to CurseForge
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 8
cache: 'maven'
distribution: 'adopt'
- name: Build with Maven
run: mvn -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
-31
View File
@@ -1,31 +0,0 @@
name: Publish to Modrinth
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 8
cache: 'maven'
distribution: 'adopt'
- name: Build with Maven
run: mvn -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
-29
View File
@@ -1,29 +0,0 @@
name: Publish to Reposilite
on:
push:
branches:
- master
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 8
server-id: reposilite # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
cache: 'maven'
distribution: 'adopt'
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to Reposilite
run: mvn -B deploy
env:
MAVEN_USERNAME: simpleclans
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_TOKEN }}
-15
View File
@@ -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
-1
View File
@@ -6,4 +6,3 @@
/dependency-reduced-pom.xml
*.jar
.settings
.factorypath
-49
View File
@@ -1,49 +0,0 @@
# Changelog
## [2.18.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.0...v2.18.1) (2022-11-29)
### 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))
-674
View File
@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+9 -11
View File
@@ -1,11 +1,11 @@
[![SimpleClans Logo](https://i.imgur.com/9vgfVdX.png)](https://www.spigotmc.org/resources/simpleclans.71242/)
[![SimpleClans Logo](https://i.imgur.com/Z8XWayV.png)](https://www.spigotmc.org/resources/simpleclans.71242/)
SimpleClans
==========
Full featured clan system for PVP Minecraft Servers!
[![Build Status](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.roinujnosde.me%2Fjob%2FSimpleClans%2F)](https://ci.roinujnosde.me/job/SimpleClans/)
[![Build Status](https://travis-ci.com/RoinujNosde/SimpleClans.svg?branch=master)](https://travis-ci.com/RoinujNosde/SimpleClans)
[![Spiget Downloads](https://img.shields.io/spiget/downloads/71242)](https://www.spigotmc.org/resources/simpleclans.71242/)
[![Issues](https://img.shields.io/github/issues/RoinujNosde/SimpleClans.svg)](https://github.com/RoinujNosde/SimpleClans/issues)
[![Crowdin](https://badges.crowdin.net/simpleclans/localized.svg)](https://crowdin.com/project/simpleclans)
@@ -50,17 +50,15 @@ Including SimpleClans with Maven:
```xml
<repositories>
<repository>
<id>roinujnosde-repo</id>
<url>https://repo.roinujnosde.me/releases/</url>
<id>bintray-roinujnosde-bukkit-plugins</id>
<url>https://dl.bintray.com/roinujnosde/bukkit-plugins</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 -->
<version>2.14.3</version> <!-- You can find the latest version at the bottom -->
<scope>provided</scope>
</dependency>
</dependencies>
@@ -70,16 +68,16 @@ Using Gradle:
```groovy
repositories {
maven {
url "https://repo.roinujnosde.me/releases/"
url "https://dl.bintray.com/roinujnosde/bukkit-plugins"
}
}
dependencies {
compileOnly "net.sacredlabyrinth.phaed.simpleclans:SimpleClans:2.18.1"
compileOnly "net.sacredlabyrinth.phaed.simpleclans:SimpleClans:2.14.3" // You can find the latest version at the bottom
}
```
Feel free to learn our [Javadoc](https://ci.roinujnosde.me/job/SimpleClans/Javadoc/).
##### Latest version:
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.roinujnosde.me%2Freleases%2Fnet%2Fsacredlabyrinth%2Fphaed%2Fsimpleclans%2FSimpleClans%2Fmaven-metadata.xml)](https://repo.roinujnosde.me/#/releases/net/sacredlabyrinth/phaed/simpleclans/SimpleClans)
[![Bintray](https://img.shields.io/bintray/v/roinujnosde/bukkit-plugins/SimpleClans)](https://bintray.com/roinujnosde/bukkit-plugins/SimpleClans/_latestVersion)
##### API Examples
* [Examples of how to use the API](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)
+16 -123
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
@@ -11,135 +11,28 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.13-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.bstats:bstats-base:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.10.9" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:22.0.0" level="project" />
<orderEntry type="library" name="Maven: io.papermc:paperlib:1.0.8-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: co.aikar:acf-paper:0.5.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.cryptomorin:XSeries:9.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.9.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.9.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-bukkit:7.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard.worldguard-libs:core:7.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-default_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.13.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-http:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-spec:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-annotations:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:annotations:3.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-cio:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-io:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-services:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-logging:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-odf:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zipdriver:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bouncycastle:bcprov-jdk15on:1.63" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-tardriver:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-bzip2:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-gzip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-xz:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.tukaani:xz:1.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip-raes:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-base_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access-swing:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-file:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-jar:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-ibm437:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-impl_2.13:0.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-console:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-default:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-swing:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-macosx:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-spec:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-shed:2.5.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mozilla:rhino-runtime:1.7.12" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.7.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TechFortress:GriefPrevention:16.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.discordsrv:discordsrv:1.24.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:4.3.0_349" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.14" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: github.scarsz:configuralize:1.3.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.alexheretic:dynamics:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.alexheretic:fluent:2.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-jdk14:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.vdurmont:emoji-java:5.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.json:json:20170516" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.zafarkhaja:java-semver:0.9.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.kevinsawicki:http-request:6.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-hla:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-dnssec:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-client:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-core:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.minidns:minidns-iterative-resolver:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-expression:5.2.7.RELEASE" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-core:5.2.7.RELEASE" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: dev.vankka:MCDiscordReserializer:4.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: dev.vankka:SimpleAST:2.2.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-api:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-key:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-legacy:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-plain:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-bukkit:4.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-api:4.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-bungeecord:4.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-nbt:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-serializer-gson-legacy-impl:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-facet:4.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-platform-viaversion:4.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.kyori:adventure-text-minimessage:4.1.0-20210316.192746" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-latest:4.351" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-core:4.351" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: biz.princeps:landlord-api:4.351" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.github.bananapuncher714:nbteditor:7.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.eldoria:eldo-util:1.9.1" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.9.1" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:16.0.2" level="project" />
<orderEntry type="library" name="Maven: io.papermc:paperlib:1.0.5" level="project" />
<orderEntry type="library" name="Maven: co.aikar:acf-paper:0.5.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.github.cryptomorin:XSeries:7.2.1" level="project" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.12" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.26.0-GA" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.4.0" level="project" />
</component>
</module>
-7
View File
@@ -1,7 +0,0 @@
pull_request_title: "feat(lang): new crowdin updates"
pull_request_labels: ["l10n"]
commit_message: "feat(lang): new translations for %language%"
append_commit_message: false
files:
- source: src/main/resources/messages.properties
translation: /src/main/resources/%file_name%_%locale_with_underscore%.%file_extension%
+48 -233
View File
@@ -4,8 +4,18 @@
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<name>SimpleClans</name>
<version>2.18.2-SNAPSHOT</version>
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
<version>2.14.3</version>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
<ciManagement>
<system>jenkins</system>
<url>http://104.236.246.108:8080</url>
</ciManagement>
<scm>
<connection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</connection>
<developerConnection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</developerConnection>
<tag>SimpleClans</tag>
<url>http://github.com/marcelo-mason/SimpleClans.git/tree/master/</url>
</scm>
<build>
<resources>
<resource>
@@ -13,7 +23,8 @@
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>plugin.yml</include>
<include>config.yml</include>
<include>*.properties</include>
</includes>
</resource>
@@ -28,6 +39,7 @@
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
@@ -55,7 +67,7 @@
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<pattern>org.bstats.bukkit</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.metrics</shadedPattern>
</relocation>
<relocation>
@@ -75,8 +87,8 @@
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.gson</shadedPattern>
<pattern>org.reflections</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.reflections</shadedPattern>
</relocation>
</relocations>
<artifactSet>
@@ -86,62 +98,6 @@
</artifactSet>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-installed</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<outputDirectory>${env.TEST_SERVER}\plugins</outputDirectory>
<silent>true</silent>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
<configuration>
<source>8</source>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
@@ -157,6 +113,10 @@
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
@@ -165,28 +125,12 @@
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>Scarsz-Nexus</id>
<url>https://nexus.scarsz.me/content/groups/public/</url>
</repository>
<repository>
<id>eldonexus</id>
<url>https://eldonexus.de/repository/maven-public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -197,6 +141,10 @@
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>bungeecord-chat</artifactId>
<groupId>net.md-5</groupId>
@@ -219,6 +167,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
@@ -228,15 +188,19 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<version>16.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<version>5.4.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
<exclusion>
<artifactId>opentest4j</artifactId>
<groupId>org.opentest4j</groupId>
@@ -245,164 +209,15 @@
<artifactId>junit-platform-commons</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>worldedit-bukkit</artifactId>
<groupId>com.sk89q.worldedit</groupId>
</exclusion>
<exclusion>
<artifactId>worldguard-core</artifactId>
<groupId>com.sk89q.worldguard</groupId>
</exclusion>
<exclusion>
<artifactId>commandbook</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>16.17.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.discordsrv</groupId>
<artifactId>discordsrv</artifactId>
<version>1.24.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>JDA</artifactId>
<groupId>net.dv8tion</groupId>
</exclusion>
<exclusion>
<artifactId>nv-websocket-client</artifactId>
<groupId>com.neovisionaries</groupId>
</exclusion>
<exclusion>
<artifactId>trove4j</artifactId>
<groupId>net.sf.trove4j</groupId>
</exclusion>
<exclusion>
<artifactId>configuralize</artifactId>
<groupId>github.scarsz</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-jdk14</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>emoji-java</artifactId>
<groupId>com.vdurmont</groupId>
</exclusion>
<exclusion>
<artifactId>java-semver</artifactId>
<groupId>com.github.zafarkhaja</groupId>
</exclusion>
<exclusion>
<artifactId>http-request</artifactId>
<groupId>com.github.kevinsawicki</groupId>
</exclusion>
<exclusion>
<artifactId>minidns-hla</artifactId>
<groupId>org.minidns</groupId>
</exclusion>
<exclusion>
<artifactId>spring-expression</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>MCDiscordReserializer</artifactId>
<groupId>dev.vankka</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-api</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-text-serializer-legacy</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-text-serializer-gson</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-text-serializer-plain</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-platform-bukkit</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>adventure-text-minimessage</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>biz.princeps</groupId>
<artifactId>landlord-latest</artifactId>
<version>4.351</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>landlord-core</artifactId>
<groupId>biz.princeps</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>reposilite</id>
<url>https://repo.roinujnosde.me/releases/</url>
<id>bintray-roinujnosde-bukkit-plugins</id>
<name>roinujnosde-bukkit-plugins</name>
<url>https://api.bintray.com/maven/roinujnosde/bukkit-plugins/SimpleClans/;publish=1</url>
</repository>
<snapshotRepository>
<id>reposilite</id>
<url>https://repo.roinujnosde.me/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+1 -1
View File
@@ -1,7 +1,7 @@
<root>
<item name='org.bukkit.configuration.MemorySection java.lang.String getString(java.lang.String, java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;_, _ -&gt; !null&quot;"/>
<val val="&quot;_, _, -&gt; !null&quot;"/>
</annotation>
</item>
</root>
+50 -128
View File
@@ -1,10 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.18.2-SNAPSHOT</version>
<version>2.14.4.1</version>
<name>SimpleClans</name>
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
<build>
<finalName>${project.name}</finalName>
@@ -16,7 +17,8 @@
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>plugin.yml</include>
<include>config.yml</include>
<include>*.properties</include>
</includes>
</resource>
@@ -34,6 +36,7 @@
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
@@ -62,7 +65,7 @@
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<pattern>org.bstats.bukkit</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.metrics</shadedPattern>
</relocation>
<relocation>
@@ -82,8 +85,8 @@
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.gson</shadedPattern>
<pattern>org.reflections</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.reflections</shadedPattern>
</relocation>
</relocations>
<artifactSet>
@@ -101,68 +104,6 @@
</execution>
</executions>
</plugin>
<!-- Dependency plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-installed</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<outputDirectory>${env.TEST_SERVER}\plugins</outputDirectory>
<silent>true</silent>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<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.3.2</version>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<source>8</source>
</configuration>
</plugin>
</plugins>
</build>
<!-- Dependencies -->
@@ -170,7 +111,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -179,10 +120,16 @@
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version>
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -194,59 +141,35 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.2.0</version>
<version>7.2.1</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.12</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<version>5.4.0</version>
<scope>test</scope>
</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.17.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>
</dependencies>
<!-- Repositories -->
@@ -263,6 +186,10 @@
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
@@ -271,24 +198,22 @@
<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>
<!-- GitHub/Jenkins -->
<ciManagement>
<system>jenkins</system>
<url>http://104.236.246.108:8080</url>
</ciManagement>
<scm>
<connection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</connection>
<developerConnection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</developerConnection>
<url>http://github.com/marcelo-mason/SimpleClans.git/tree/master/</url>
<tag>SimpleClans</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -297,12 +222,9 @@
<distributionManagement>
<repository>
<id>reposilite</id>
<url>https://repo.roinujnosde.me/releases/</url>
<id>bintray-roinujnosde-bukkit-plugins</id>
<name>roinujnosde-bukkit-plugins</name>
<url>https://api.bintray.com/maven/roinujnosde/bukkit-plugins/SimpleClans/;publish=1</url>
</repository>
<snapshotRepository>
<id>reposilite</id>
<url>https://repo.roinujnosde.me/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>
@@ -1,6 +1,5 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
@@ -10,6 +9,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@@ -25,28 +25,41 @@ public class ChatBlock {
private String color = "";
private boolean cropRight = true;
private boolean padRight = true;
/**
*
*/
public static final Logger LOG = Logger.getLogger("Minecraft");
@Deprecated
public void setCropRight(boolean cropRight) {
this.cropRight = cropRight;
this.cropRight = cropRight;
}
@Deprecated
public void setPadRight(boolean padRight) {
this.padRight = padRight;
this.padRight = padRight;
}
/**
* @param columnAlignment
*/
public void setAlignment(String... columnAlignment) {
columnAlignments.addAll(Arrays.asList(columnAlignment));
}
/**
* @param columnFlex
*/
public void setFlexibility(boolean... columnFlex) {
for (boolean flex : columnFlex) {
columnFlexes.add(flex);
}
}
@Deprecated
/**
* @param columnPercentages
* @param prefix
*/
public void setColumnSizes(String prefix, double... columnPercentages) {
int ll = LINE_LENGTH;
@@ -59,44 +72,73 @@ public class ChatBlock {
}
}
@Deprecated
/**
* @return
*/
public boolean hasContent() {
return !rows.isEmpty();
}
/**
* @param contents
*/
public void addRow(String... contents) {
rows.add(contents);
}
/**
* @return
*/
public int size() {
return rows.size();
}
@Deprecated
/**
* @return
*/
public boolean isEmpty() {
return rows.isEmpty();
}
@Deprecated
/**
*
*/
public void clear() {
rows.clear();
}
@Deprecated
/**
* @param player
* @return
*/
public boolean sendBlock(CommandSender player) {
return sendBlock(player, null, 0);
}
@Deprecated
/**
* @param player
* @param prefix
* @return
*/
public boolean sendBlock(CommandSender player, String prefix) {
return sendBlock(player, prefix, 0);
}
/**
* @param player
* @param amount
* @return
*/
public boolean sendBlock(CommandSender player, int amount) {
return sendBlock(player, null, amount);
}
/**
* @param player
* @param prefix
* @param amount
* @return
*/
boolean sendBlock(CommandSender player, String prefix, int amount) {
if (player == null) {
return false;
@@ -157,27 +199,27 @@ public class ChatBlock {
}
} else if (align.equalsIgnoreCase("l")) {
if (msgLength(section) > colsize) {
if (cropRight) {
col = cropRightToFit(section, colsize);
if (cropRight) {
col = cropRightToFit(section, colsize);
} else {
col = section;
col = section;
}
} else if (msgLength(section) < colsize) {
if (padRight) {
col = paddRightToFit(section, colsize);
} else {
col = section;
}
if (padRight) {
col = paddRightToFit(section, colsize);
} else {
col = section;
}
}
} else if (align.equalsIgnoreCase("c")) {
if (msgLength(section) > colsize) {
if (cropRight) {
col = cropRightToFit(section, colsize);
} else {
col = section;
}
if (cropRight) {
col = cropRightToFit(section, colsize);
} else {
col = section;
}
} else if (msgLength(section) < colsize) {
col = centerInLineOf(section, colsize);
col = centerInLineOf(section, colsize);
}
}
@@ -242,7 +284,7 @@ public class ChatBlock {
// crop and print out
String msg = (prefix_used ? empty_prefix : prefix + " ") + finalString;
if (cropRight) {
msg = cropRightToFit(msg, LINE_LENGTH);
msg = cropRightToFit(msg, LINE_LENGTH);
}
if (color.length() > 0) {
msg = color + msg;
@@ -267,6 +309,10 @@ public class ChatBlock {
return out;
}
/**
* @param col
* @return
*/
int getMaxWidth(int col) {
double maxWidth = 0;
@@ -277,11 +323,19 @@ public class ChatBlock {
return (int) maxWidth;
}
@Deprecated
/**
* @param msg
* @return
*/
public static String centerInLine(String msg) {
return centerInLineOf(msg, LINE_LENGTH);
}
/**
* @param msg
* @param lineLength
* @return
*/
private static String centerInLineOf(String msg, double lineLength) {
double length = msgLength(msg);
double diff = lineLength - length;
@@ -306,6 +360,10 @@ public class ChatBlock {
return msg;
}
/**
* @param str
* @return
*/
public static String makeEmpty(String str) {
if (str == null) {
return "";
@@ -314,6 +372,11 @@ public class ChatBlock {
return paddLeftToFit("", msgLength(str));
}
/**
* @param msg
* @param length
* @return
*/
private static String cropRightToFit(String msg, double length) {
if (msg == null || msg.length() == 0 || length == 0) {
return "";
@@ -326,6 +389,11 @@ public class ChatBlock {
return msg;
}
/**
* @param msg
* @param length
* @return
*/
private static String cropLeftToFit(String msg, double length) {
if (msg == null || msg.length() == 0 || length == 0) {
return "";
@@ -339,11 +407,11 @@ public class ChatBlock {
}
/**
* Pads left til the string is a certain size
* Padds left til the string is a certain size
*
* @param msg the message to pad
* @param length the message length
* @return the padded message
* @param msg
* @param length
* @return
*/
private static String paddLeftToFit(String msg, double length) {
if (msgLength(msg) >= length) {
@@ -358,11 +426,11 @@ public class ChatBlock {
}
/**
* Pads right til the string is a certain size
* Padds right til the string is a certain size
*
* @param msg the message to pad
* @param length the message length
* @return the padded message
* @param msg
* @param length
* @return
*/
private static String paddRightToFit(String msg, double length) {
if (msgLength(msg) >= length) {
@@ -378,6 +446,9 @@ public class ChatBlock {
/**
* Finds the length on the screen of a string. Ignores colors.
*
* @param str
* @return
*/
private static double msgLength(String str) {
double length = 0;
@@ -398,6 +469,9 @@ public class ChatBlock {
/**
* Finds the visual length of the character on the screen.
*
* @param x
* @return
*/
private static int charLength(char x) {
String normalized = StringSimplifier.simplifiedString(x + "");
@@ -423,11 +497,15 @@ public class ChatBlock {
/**
* Cuts the message apart into whole words short enough to fit on one line
*
* @param msg
* @return
*/
private static String[] wordWrap(String msg) {
// Split each word apart
ArrayList<String> split = new ArrayList<>(Arrays.asList(msg.split(" ")));
ArrayList<String> split = new ArrayList<>();
split.addAll(Arrays.asList(msg.split(" ")));
// Create an array list for the output
@@ -467,15 +545,19 @@ public class ChatBlock {
// Merge the words into a sentence (that now fits into a single chat line) and add them to the output array.
String merged = combineSplit(words.toArray(new String[0]));
String merged = combineSplit(words.toArray(new String[words.size()]));
out.add(merged);
}
// Convert to an array and return
return out.toArray(new String[0]);
return out.toArray(new String[out.size()]);
}
/**
* @param string
* @return
*/
private static String combineSplit(String[] string) {
StringBuilder builder = new StringBuilder();
for (String aString : string) {
@@ -489,6 +571,10 @@ public class ChatBlock {
/**
* Cuts apart a word that is too long to fit on one line
*
* @param lengthBefore
* @param str
* @return
*/
private static String[] wordCut(int lengthBefore, String str) {
int length = lengthBefore;
@@ -523,8 +609,8 @@ public class ChatBlock {
/**
* Outputs a single line out, crops overflow
*
* @param receiver the receiver
* @param msg the message
* @param receiver
* @param msg
*/
public static void saySingle(CommandSender receiver, String msg) {
if (receiver == null) {
@@ -537,39 +623,38 @@ public class ChatBlock {
/**
* Outputs a message to a user
*
* @param receiver the receiver
* @param msg the message
* @param receiver
* @param msg
*/
public static void sendMessage(@Nullable CommandSender receiver, @NotNull String msg) {
if (receiver == null) {
return;
}
receiver.sendMessage(ChatUtils.parseColors(msg));
}
String[] message = colorize(wordWrap(msg));
public static void sendMessage(@Nullable ClanPlayer receiver, @NotNull String msg) {
if (receiver == null) {
return;
for (String out : message) {
receiver.sendMessage(out);
}
SimpleClans.getInstance().getProxyManager().sendMessage(receiver.getName(), ChatUtils.parseColors(msg));
}
// ClanCommands#setbanner, LandCommands#Allow/BlockCommand/verify, StaffCommands#kick, etc
public static void sendMessageKey(@Nullable CommandSender receiver, @NotNull String key, @NotNull Object... args) {
sendMessage(receiver, lang(key, receiver, args));
}
@Deprecated
/**
* Send blank lie
*
* @param color
*/
public void startColor(String color) {
this.color = color;
}
/**
* Sends a blank line
* Send blank lie
*
* @param receiver the receiver
* @param receiver
*/
public static void sendBlank(CommandSender receiver) {
if (receiver == null) {
@@ -581,17 +666,22 @@ public class ChatBlock {
/**
* Colors each line
*
* @param message
* @return
*/
@Deprecated
public static String[] say(String message) {
return colorize(wordWrap(message));
}
@Deprecated
public static String[] getColorizedMessage(String msg) {
return colorize(wordWrap(msg));
}
/**
* @param message
* @return
*/
private static String[] colorize(String[] message) {
try {
return colorizeBase(message);
@@ -600,12 +690,21 @@ public class ChatBlock {
}
}
@Deprecated
public static @Nullable String colorize(String message) {
return colorizeBase(new String[]{message})[0];
/**
* @param message
* @return
*/
public static String colorize(String message) {
return colorizeBase(new String[]{
message
})[0];
}
private static @Nullable String[] colorizeBase(String[] message) {
/**
* @param message
* @return
*/
private static String[] colorizeBase(String[] message) {
if (message != null && message[0] != null && !message[0].isEmpty()) {
// Go through each line
@@ -621,8 +720,9 @@ public class ChatBlock {
// advance x to the next character
x += 1;
if (x < msg.length()) {
lastColor = ChatColor.COLOR_CHAR + "" + msg.charAt(x);
try {
lastColor = ChatColor.getByChar(msg.charAt(x)) + "";
} catch (Exception ignored) {
}
}
}
@@ -634,7 +734,6 @@ public class ChatBlock {
}
}
//noinspection ConstantConditions
return message;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,60 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.SimplePluginManager;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Arrays;
public class CommandHelper {
private CommandHelper() {
}
public static void registerCommand(String... aliases) {
if (aliases != null) {
PluginCommand command = getCommand(aliases[0], SimpleClans.getInstance());
if (command != null) {
command.setAliases(Arrays.asList(aliases));
getCommandMap().register(SimpleClans.getInstance().getDescription().getName(), command);
}
}
}
private static PluginCommand getCommand(String name, Plugin plugin) {
PluginCommand command = null;
try {
Constructor<PluginCommand> c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
c.setAccessible(true);
command = c.newInstance(name, plugin);
} catch (Exception e) {
e.printStackTrace();
}
return command;
}
private static CommandMap getCommandMap() {
CommandMap commandMap = null;
try {
if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
Field f = SimplePluginManager.class.getDeclaredField("commandMap");
f.setAccessible(true);
commandMap = (CommandMap) f.get(Bukkit.getPluginManager());
}
} catch (Exception e) {
e.printStackTrace();
}
return commandMap;
}
}
@@ -0,0 +1,65 @@
package net.sacredlabyrinth.phaed.simpleclans;
import java.util.Date;
/**
* @author phaed
*/
public class DamageRecord {
private String victim;
private String attacker;
private Date time;
/**
* @param victim
* @param attacker
*/
public DamageRecord(String victim, String attacker) {
this.victim = victim;
this.attacker = attacker;
this.time = new Date();
}
/**
* @return the victim
*/
public String getVictim() {
return victim;
}
/**
* @param victim the victim to set
*/
public void setVictim(String victim) {
this.victim = victim;
}
/**
* @return the attacker
*/
public String getAttacker() {
return attacker;
}
/**
* @param attacker the attacker to set
*/
public void setAttacker(String attacker) {
this.attacker = attacker;
}
/**
* @return the time
*/
public Date getTime() {
return new Date(time.getTime());
}
/**
* @param time the time to set
*/
public void setTime(Date time) {
this.time = new Date(time.getTime());
}
}
@@ -15,51 +15,111 @@ public class Dates {
private Dates() {
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Timestamp date1, Timestamp date2) {
return differenceInMonths(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Timestamp date1, Timestamp date2) {
return differenceInYears(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Timestamp date1, Timestamp date2) {
return differenceInDays(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Timestamp date1, Timestamp date2) {
return differenceInHours(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Timestamp date1, Timestamp date2) {
return differenceInMinutes(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Timestamp date1, Timestamp date2) {
return differenceInSeconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Date date1, Date date2) {
return differenceInYears(date1, date2) * 12;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Date date1, Date date2) {
double days = differenceInDays(date1, date2);
return days / 365.2425;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Date date1, Date date2) {
return differenceInHours(date1, date2) / 24.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Date date1, Date date2) {
return differenceInMinutes(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Date date1, Date date2) {
return differenceInSeconds(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Date date1, Date date2) {
return differenceInMilliseconds(date1, date2) / 1000.0;
}
@@ -75,12 +135,15 @@ public class Dates {
}
/**
* Returns the string representation of the amount of time labeled as days, hours, minutes, seconds
* @author RoboMWM, LaxWasHere
* @param seconds the time in seconds
* @param depth Max amount of detail (e.g. only display days and hours if set to 1 and seconds {@literal >} 1 day)
* @return the string representation of the amount of time labeled as days, hours, minutes, seconds
* @param depth Max amount of detail (e.g. only display days and hours if set to 1 and seconds > 1 day)
* @return
*/
public static String formatTime(Long seconds, int depth) {
public static String formatTime(Long seconds, int depth)
{
SimpleClans plugin = SimpleClans.getInstance();
if (seconds == null || seconds < 1) {
return lang("bb.moments");
}
@@ -1,5 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
public enum EconomyResponse {
SUCCESS, NEGATIVE_VALUE, NOT_ENOUGH_BALANCE, CANCELLED
}
@@ -1,87 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
public class Flags {
private static final Gson gson = new Gson();
private final JsonObject flags;
public Flags(@Nullable String json) {
if (json != null && !json.isEmpty()) {
flags = gson.fromJson(json, JsonObject.class);
} else {
flags = new JsonObject();
}
}
@NotNull
public List<String> getStringList(@NotNull String key) {
JsonElement object = flags.get(key);
ArrayList<String> list = new ArrayList<>();
if (object != null && object.isJsonArray()) {
for (JsonElement element : object.getAsJsonArray()) {
list.add(element.getAsString());
}
}
return list;
}
@Nullable
public String getString(@NotNull String key) {
JsonElement element = flags.get(key);
if (element == null || element.isJsonNull()) {
return null;
}
return element.getAsString();
}
@NotNull
public String getString(@NotNull String key, @NotNull String def) {
String string = getString(key);
if (string == null) {
return def;
}
return string;
}
@NotNull
public Number getNumber(@NotNull String key) {
JsonElement element = flags.get(key);
if (element == null || element.isJsonNull()) {
return 0;
}
return element.getAsNumber();
}
public boolean getBoolean(@NotNull String key) {
return getBoolean(key, false);
}
public boolean getBoolean(@NotNull String key, boolean def) {
JsonElement element = flags.get(key);
if (element == null || element.isJsonNull()) {
return def;
}
return element.getAsBoolean();
}
public void put(@NotNull String key, @NotNull List<?> value) {
flags.add(key, gson.toJsonTree(value));
}
public void put(@NotNull String key, @NotNull Object object) {
flags.add(key, gson.toJsonTree(object));
}
public String toJSONString() {
return flags.toString();
}
}
@@ -1,49 +1,59 @@
package net.sacredlabyrinth.phaed.simpleclans;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Map.Entry;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.stream.Collectors;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils.stripColors;
/**
* @author phaed
*/
public class Helper {
public final class Helper {
private static final Gson GSON = new Gson();
private static final Type RANKS_TYPE = TypeToken.getParameterized(List.class, Rank.class).getType();
private static final Type RESIGN_TYPE = TypeToken.getParameterized(Map.class, String.class, Long.class).getType();
private Helper() {
}
/**
* Dumps stacktrace to log
*/
@Deprecated
public static void dumpStackTrace() {
for (StackTraceElement el : Thread.currentThread().getStackTrace()) {
SimpleClans.debug(el.toString());
}
}
/**
* @deprecated use {@link KDRFormat}
*/
@Deprecated
public static String formatKDR(float kdr) {
DecimalFormat formatter = new DecimalFormat("#.#");
return formatter.format(kdr);
}
@NotNull
public static Locale forLanguageTag(@Nullable String languageTag) {
Locale defaultLanguage = SimpleClans.getInstance().getSettingsManager().getLanguage();
@@ -52,151 +62,125 @@ public final class Helper {
}
return Locale.forLanguageTag(languageTag);
}
@Contract("null -> null")
@Nullable
public static String toLanguageTag(@Nullable Locale locale) {
return locale != null ? locale.toLanguageTag() : null;
}
public static Set<Path> getPathsIn(String path, Predicate<? super Path> filter) {
Set<Path> files = new LinkedHashSet<>();
String packagePath = path.replace(".", "/");
try {
URI uri = SimpleClans.class.getProtectionDomain().getCodeSource().getLocation().toURI();
FileSystem fileSystem = FileSystems.newFileSystem(URI.create("jar:" + uri), Collections.emptyMap());
files = Files.walk(fileSystem.getPath(packagePath)).
filter(Objects::nonNull).
filter(filter).
collect(Collectors.toSet());
fileSystem.close();
} catch (URISyntaxException | IOException ex) {
SimpleClans.getInstance().getLogger().
log(Level.WARNING, "An error occurred while trying to load files: " + ex.getMessage(), ex);
}
return files;
}
public static Set<Class<?>> getClasses(String packageName) {
Set<Class<?>> classes = new LinkedHashSet<>();
Predicate<? super Path> filter = entry -> {
String path = entry.getFileName().toString();
return !path.contains("$") && path.endsWith(".class");
};
for (Path filesPath : getPathsIn(packageName, filter)) {
// Compatibility with different Java versions
String path = filesPath.toString();
if (path.charAt(0) == '/') {
path = path.substring(1);
}
String fileName = path.replace("/", ".").split(".class")[0];
try {
Class<?> clazz = Class.forName(fileName);
classes.add(clazz);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
return classes;
}
@SuppressWarnings("unchecked")
public static <T> Set<Class<? extends T>> getSubTypesOf(String packageName, Class<?> type) {
return getClasses(packageName).stream().
filter(type::isAssignableFrom).
map(aClass -> ((Class<? extends T>) aClass)).
collect(Collectors.toSet());
}
/**
* Parses a list of ranks from the specified Json String
*
* @param json the Json String
* Gets the Player locale
*
* @param player the player
* @return the locale
*/
@Nullable
public static Locale getLocale(@NotNull Player player) {
ClanPlayer clanPlayer = SimpleClans.getInstance().getClanManager().getAnyClanPlayer(player.getUniqueId());
if (clanPlayer != null) {
return clanPlayer.getLocale();
}
return null;
}
/**
* Converts a JSON String to a list of Ranks
*
* @param json the JSON String
* @return a list of ranks or null if the JSON String is null/empty
*/
public static @Nullable List<Rank> ranksFromJson(@Nullable String json) {
if (json != null && !json.isEmpty()) {
JsonObject object = GSON.fromJson(json, JsonObject.class);
JsonElement ranks = object.get("ranks");
return GSON.fromJson(ranks, RANKS_TYPE);
}
return null;
public static @Nullable List<Rank> ranksFromJson(String json) {
if (json != null && !json.isEmpty()) {
try {
JSONObject jo = (JSONObject) new JSONParser().parse(json);
Object ranks = jo.get("ranks");
if (ranks != null) {
JSONArray array = (JSONArray) ranks;
List<Rank> rankList = new ArrayList<>();
for (Object o : array) {
JSONObject r = (JSONObject) o;
String name = (String) r.get("name");
String displayName = (String) r.get("displayName");
Set<String> permissions = new HashSet<>();
for (Object p : (JSONArray) r.get("permissions")) {
permissions.add((String) p);
}
Rank rank = new Rank(name, displayName, permissions);
rankList.add(rank);
}
return rankList;
}
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
/**
* Parses the default rank from the specified Json String
*
* @param json the Json String
* @return the default rank or null if not found and/or it does not exist
*/
public static @Nullable String defaultRankFromJson(@Nullable String json) {
if (json != null && !json.isEmpty()) {
JsonObject object = GSON.fromJson(json, JsonObject.class);
JsonElement defaultRank = object.get("defaultRank");
if (defaultRank != null && !defaultRank.isJsonNull()) {
return defaultRank.getAsString();
}
}
return null;
}
/**
* Converts a list of ranks and the default rank to a JSON String
*
* @param ranks the ranks
* @param defaultRank the default rank
* Converts a list of Ranks to a JSON String
*
* @param ranks
* @return a JSON String
*/
public static String ranksToJson(List<Rank> ranks, @Nullable String defaultRank) {
if (ranks == null)
ranks = new ArrayList<>();
JsonObject object = new JsonObject();
object.add("ranks", GSON.toJsonTree(ranks));
object.addProperty("defaultRank", defaultRank);
return object.toString();
@SuppressWarnings("unchecked")
public static String ranksToJson(List<Rank> ranks) {
if (ranks == null)
ranks = new ArrayList<Rank>();
JSONArray array = new JSONArray();
for (Rank rank : ranks) {
JSONObject o = new JSONObject();
o.put("name", rank.getName());
o.put("displayName", rank.getDisplayName());
JSONArray permArray = new JSONArray();
for (String p : rank.getPermissions()) {
permArray.add(p);
}
o.put("permissions", permArray);
array.add(o);
}
JSONObject object = new JSONObject();
object.put("ranks", array);
return object.toJSONString();
}
/**
* Converts a resign times map to a JSON String
*
* @param resignTimes the resign times
*
* @param resignTimes
* @return a JSON String
*/
public static String resignTimesToJson(Map<String, Long> resignTimes) {
return GSON.toJson(resignTimes);
return JSONObject.toJSONString(resignTimes);
}
/**
* Converts a JSON String to a resign times map
*
*
* @param json JSON String
* @return a map
*/
public static @Nullable Map<String, Long> resignTimesFromJson(String json) {
if (json != null && !json.isEmpty()) {
return GSON.fromJson(json, RESIGN_TYPE);
}
return null;
@SuppressWarnings("unchecked")
public static Map<String, Long> resignTimesFromJson(String json) {
if (json != null) {
try {
return (Map<String, Long>) new JSONParser().parse(json);
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
/**
* Returns the delay in seconds to the specified hour and minute.
*
* @param hour hour
*
* @param hour hour
* @param minute minute
* @return the delay in seconds
*/
public static long getDelayTo(int hour, int minute) {
if (hour < 0 || hour > 23) hour = 1;
if (minute < 0 || minute > 59) minute = 0;
if (hour < 0 || hour > 23) hour = 1;
if (minute < 0 || minute > 59) minute = 0;
LocalDateTime now = LocalDateTime.now();
LocalDateTime d = LocalDateTime.of(now.toLocalDate(), LocalTime.of(hour, minute));
long delay;
@@ -218,20 +202,194 @@ public final class Helper {
List<Player> players = SimpleClans.getInstance().getServer().matchPlayer(playerName);
if (players.size() == 1) {
PermissionsManager pm = SimpleClans.getInstance().getPermissionsManager();
return pm.getPrefix(players.get(0)) + players.get(0).getName() + pm.getSuffix(players.get(0));
return SimpleClans.getInstance().getPermissionsManager().getPrefix(players.get(0)) + players.get(0).getName() + SimpleClans.getInstance().getPermissionsManager().getSuffix(players.get(0));
}
return playerName;
}
/**
* Converts string array to {@literal ArrayList<String>}, remove empty strings
* Check for integer
*
* @param o
* @return
*/
public static boolean isInteger(Object o) {
return o instanceof java.lang.Integer;
}
/**
* Check for byte
*
* @param input
* @return
*/
public static boolean isByte(String input) {
try {
Byte.parseByte(input);
return true;
} catch (Exception ex) {
return false;
}
}
/**
* Check for short
*
* @param input
* @return
*/
public static boolean isShort(String input) {
try {
Short.parseShort(input);
return true;
} catch (Exception ex) {
return false;
}
}
/**
* Check for integer
*
* @param input
* @return
*/
public static boolean isInteger(String input) {
try {
Integer.parseInt(input);
return true;
} catch (Exception ex) {
return false;
}
}
/**
* Check for float
*
* @param input
* @return
*/
public static boolean isFloat(String input) {
try {
Float.parseFloat(input);
return true;
} catch (Exception ex) {
return false;
}
}
/**
* Check for string
*
* @param o
* @return
*/
public static boolean isString(Object o) {
return o instanceof java.lang.String;
}
/**
* Check for boolean
*
* @param o
* @return
*/
public static boolean isBoolean(Object o) {
return o instanceof java.lang.Boolean;
}
/**
* Remove a character from a string
*
* @param s
* @param c
* @return
*/
public static String removeChar(String s, char c) {
String r = "";
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != c) {
r += s.charAt(i);
}
}
return r;
}
/**
* Remove first character from a string
*
* @param s
* @param c
* @return
*/
public static String removeFirstChar(String s, char c) {
String r = "";
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != c) {
r += s.charAt(i);
break;
}
}
return r;
}
/**
* Capitalize first word of sentence
*
* @param content
* @return
*/
public static String capitalize(String content) {
if (content.length() < 2) {
return content;
}
String first = content.substring(0, 1).toUpperCase();
return first + content.substring(1);
}
/**
* Return plural word if count is bigger than one
*
* @param count
* @param word
* @param ending
* @return
*/
public static String plural(int count, String word, String ending) {
return count == 1 ? word : word + ending;
}
/**
* Hex value to ChatColor
*
* @param hexValue
* @return
*/
@NotNull
public static String toColor(@Nullable String hexValue) {
if (hexValue == null) {
return "";
}
ChatColor color = ChatColor.getByChar(hexValue);
if (color == null) {
return "";
}
return color.toString();
}
/**
* Converts string array to ArrayList<String>, remove empty strings
*
* @param values
* @return
*/
public static List<String> fromArrayToList(String... values) {
public static List<String> fromArray(String... values) {
List<String> results = new ArrayList<>();
Collections.addAll(results, values);
results.remove("");
@@ -239,13 +397,12 @@ public final class Helper {
}
/**
* Converts string array to {@literal HashSet<String>}, remove empty strings
* Converts string array to HashSet<String>, remove empty strings
*
* @param values
* @return
*/
@Deprecated
public static Set<String> fromArrayToSet(String... values) {
public static Set<String> fromArray2(String... values) {
HashSet<String> results = new HashSet<>();
Collections.addAll(results, values);
results.remove("");
@@ -253,27 +410,154 @@ public final class Helper {
}
/**
* Converts {@literal ArrayList<String>} to string array
* Converts a player array to ArrayList<Player>
*
* @param values
* @return
*/
public static List<Player> fromPlayerArray(Player... values) {
List<Player> results = new ArrayList<>();
Collections.addAll(results, values);
return results;
}
/**
* Converts ArrayList<String> to string array
*
* @param list
* @return
*/
public static String[] toArray(List<String> list) {
return list.toArray(new String[0]);
return list.toArray(new String[list.size()]);
}
/**
* Converts the Permission values array to a String array
*
*
* @return
*/
public static String[] fromPermissionArray() {
RankPermission[] permissions = RankPermission.values();
String[] sa = new String[permissions.length];
for (int i = 0; i < permissions.length; i++) {
sa[i] = permissions[i].toString();
RankPermission[] permissions = RankPermission.values();
String[] sa = new String[permissions.length];
for (int i = 0; i < permissions.length; i++) {
sa[i] = permissions[i].toString();
}
return sa;
}
/**
* Removes first item from a string array
*
* @param args
* @return
*/
public static String[] removeFirst(String[] args) {
List<String> out = fromArray(args);
if (!out.isEmpty()) {
out.remove(0);
}
return sa;
return toArray(out);
}
/**
* Converts a string array to a space separated string
*
* @param args
* @return
*/
public static String toMessage(String[] args) {
StringBuilder out = new StringBuilder();
for (String arg : args) {
out.append(arg).append(" ");
}
return out.toString().trim();
}
/**
* Converts a string array to a string with custom separators
*
* @param args
* @param sep
* @return
*/
public static String toMessage(String[] args, String sep) {
String out = "";
for (String arg : args) {
out += arg + ", ";
}
return stripTrailing(out, ", ");
}
/**
* Converts a string array to a string with custom separators
*
* @param args
* @param sep
* @return
*/
public static String toMessage(List<String> args, String sep) {
String out = "";
for (String arg : args) {
out += arg + sep;
}
return stripTrailing(out, sep);
}
/**
* Convert color hex values with ampersand to special character
*
* @param msg
* @return
*/
public static String parseColors(String msg) {
return msg.replace("&", "\u00a7");
}
/**
* Removes color codes from strings
*
* @param msg
* @return
*/
public static String stripColors(String msg) {
String out = msg.replaceAll("[&][0-9a-fk-or]", "");
out = out.replaceAll(String.valueOf((char) 194), "");
return out.replaceAll("[\u00a7][0-9a-fk-or]", "");
}
/*
* Retrieves the last color code @param msg @return
*/
/**
* @param msg
* @return
*/
public static String getLastColorCode(String msg) {
msg = msg.replaceAll(String.valueOf((char) 194), "").trim();
if (msg.length() < 2) {
return "";
}
String one = msg.substring(msg.length() - 2, msg.length() - 1);
String two = msg.substring(msg.length() - 1);
if (one.equals("\u00a7")) {
return one + two;
}
if (one.equals("&")) {
return Helper.toColor(two);
}
return "";
}
/**
@@ -286,6 +570,33 @@ public final class Helper {
return stripColors(tag).toLowerCase();
}
/**
* Removes trailing separators
*
* @param msg
* @param sep
* @return
*/
public static String stripTrailing(String msg, String sep) {
if (msg.length() < sep.length()) {
return msg;
}
String out = msg;
String first = msg.substring(0, sep.length());
String last = msg.substring(msg.length() - sep.length());
if (first.equals(sep)) {
out = msg.substring(sep.length());
}
if (last.equals(sep)) {
out = msg.substring(0, msg.length() - sep.length());
}
return out;
}
/**
* Generates page separator line
*
@@ -301,6 +612,43 @@ public final class Helper {
return out;
}
/**
* Check whether a player is online
*
* @param playerName
* @return
*/
@Deprecated
public static boolean isOnline(String playerName) {
Collection<Player> online = getOnlinePlayers();
for (Player o : online) {
if (o.getName().equalsIgnoreCase(playerName)) {
return true;
}
}
return false;
}
/**
* Check whether a player is online
*
* @param playerUniqueId
* @return
*/
public static boolean isOnline(UUID playerUniqueId) {
Collection<Player> online = getOnlinePlayers();
for (Player o : online) {
if (o.getUniqueId().equals(playerUniqueId)) {
return true;
}
}
return false;
}
/**
* Remove offline players from a ClanPlayer array
*
@@ -319,6 +667,28 @@ public final class Helper {
return out;
}
/**
* Test if a url is valid
*
* @param strUrl
* @return
*/
public static boolean testURL(String strUrl) {
try {
URL url = new URL(strUrl);
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.connect();
if (urlConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
return false;
}
} catch (IOException e) {
return false;
}
return true;
}
/**
* Escapes single quotes
*
@@ -333,7 +703,7 @@ public final class Helper {
}
/**
* Returns a prettier coordinate
* Returns a prettier coordinate, does not include world
*
* @param loc
* @return
@@ -342,6 +712,29 @@ public final class Helper {
return loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + " " + loc.getWorld().getName();
}
/**
* Whether the two locations refer to the same block
*
* @param loc
* @param loc2
* @return
*/
public static boolean isSameBlock(Location loc, Location loc2) {
return loc.getBlockX() == loc2.getBlockX() && loc.getBlockY() == loc2.getBlockY() && loc.getBlockZ() == loc2.getBlockZ();
}
/**
* Whether the two locations refer to the same location, ignoring pitch and
* yaw
*
* @param loc
* @param loc2
* @return
*/
public static boolean isSameLocation(Location loc, Location loc2) {
return loc.getX() == loc2.getX() && loc.getY() == loc2.getY() && loc.getZ() == loc2.getZ();
}
/**
* Sorts a Map by value
*
@@ -360,30 +753,131 @@ public final class Helper {
}
/**
* Formats max inactive days to an infinity symbol if it's negative or 0
*
* @param max inactive days
* @return formatted message
* @deprecated use {@link VanishUtils#isVanished(CommandSender, Player)}
*/
public static String formatMaxInactiveDays(int max) {
if (max <= 0) {
return "∞";
} else {
return String.valueOf(max);
@Deprecated
@Contract("_, null -> false")
public static boolean isVanished(@Nullable CommandSender viewer, @Nullable Player player) {
if (isVanished(player)) {
return true;
}
if (viewer instanceof Player && player != null) {
return !((Player) viewer).canSee(player);
}
return false;
}
@NotNull
public static String getFormattedClanStatus(Clan clan, CommandSender sender) {
ArrayList<String> statuses = new ArrayList<>();
if (clan.isPermanent()) {
statuses.add(lang("permanent", sender));
/**
* @deprecated use {@link VanishUtils#isVanished(Player)}
*/
@Deprecated
@Contract("null -> false")
public static boolean isVanished(@Nullable Player player) {
if (player != null && player.hasMetadata("vanished") && !player.getMetadata("vanished").isEmpty()) {
return player.getMetadata("vanished").get(0).asBoolean();
}
if (clan.isVerified()) {
statuses.add(lang("verified", sender));
return false;
}
@SuppressWarnings("unchecked")
public static Collection<Player> getOnlinePlayers() {
try {
Method method = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
Object players = method.invoke(null);
if (players instanceof Player[]) {
return new ArrayList<>(Arrays.asList((Player[]) players));
} else {
return (Collection<Player>) players;
}
} catch (Exception e) {
e.printStackTrace();
}
return new ArrayList<>();
}
@Deprecated
@Nullable
public static Player getPlayer(String playerName) {
return Bukkit.getPlayerExact(playerName);
}
/**
* Formats the ally chat
*
* @param cp Sender
* @param msg The message
* @param placeholders The placeholders
* @return The formated message
*/
public static String formatAllyChat(ClanPlayer cp, String msg, Map<String, String> placeholders) {
SettingsManager sm = SimpleClans.getInstance().getSettingsManager();
String leaderColor = sm.getAllyChatLeaderColor();
String memberColor = sm.getAllyChatMemberColor();
String rank = cp.getRankId().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRankDisplayName());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getAllyChatRank()).replace("%rank%", rank) : "";
String message = replacePlaceholders(sm.getAllyChatFormat(), cp, leaderColor, memberColor, rankFormat, msg);
if (placeholders != null) {
for (Entry<String, String> e : placeholders.entrySet()) {
message = message.replace("%"+e.getKey()+"%", e.getValue());
}
}
return message;
}
private static String replacePlaceholders(String messageFormat, ClanPlayer cp, String leaderColor, String memberColor, String rankFormat, String msg) {
return ChatColor.translateAlternateColorCodes('&', messageFormat)
.replace("%clan%", Objects.requireNonNull(cp.getClan()).getColorTag())
.replace("%nick-color%", (cp.isLeader() ? leaderColor : memberColor))
.replace("%player%", cp.getName())
.replace("%rank%", rankFormat)
.replace("%message%", msg);
}
/**
* Formats the clan chat
*
* @param cp Sender
* @param msg The message
* @param placeholders The placeholders
* @return The formated message
*/
public static String formatClanChat(ClanPlayer cp, String msg, Map<String, String> placeholders) {
SettingsManager sm = SimpleClans.getInstance().getSettingsManager();
String leaderColor = sm.getClanChatLeaderColor();
String memberColor = sm.getClanChatMemberColor();
String rank = cp.getRankId().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRankDisplayName());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getClanChatRank()).replace("%rank%", rank) : "";
String message = replacePlaceholders(sm.getClanChatFormat(), cp, leaderColor, memberColor, rankFormat, msg);
if (placeholders != null) {
for (Entry<String, String> e : placeholders.entrySet()) {
message = message.replace("%"+e.getKey()+"%", e.getValue());
}
}
return message;
}
/**
* Formats the chat in a way that the Clan Tag is always there, so infractors can be easily identified
*
* @param cp Sender
* @param msg The chat message
* @return The formated message
*/
public static String formatSpyClanChat(ClanPlayer cp, String msg) {
msg = stripColors(msg);
if (msg.contains(stripColors(cp.getClan().getColorTag()))) {
return ChatColor.DARK_GRAY + msg;
} else {
statuses.add(lang("unverified", sender));
return ChatColor.DARK_GRAY + "[" + cp.getTag() + "] " + msg;
}
return String.join(", ", statuses);
}
}
@@ -27,7 +27,7 @@ public class Kill {
}
public enum Type {
CIVILIAN("c"), RIVAL("r"), NEUTRAL("n"), ALLY("a");
CIVILIAN("c"), RIVAL("r"), NEUTRAL("n");
Type(String shortName) {
this.shortName = shortName;
@@ -1,7 +1,5 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.Set;
@@ -17,11 +15,11 @@ public class Rank implements Comparable<Rank> {
public Rank(String name) {
setName(name);
permissions = new HashSet<>();
permissions = new HashSet<String>();
setDisplayName(displayName);
}
public Rank(String name, @Nullable String displayName, Set<String> permissions) {
public Rank(String name, String displayName, Set<String> permissions) {
setName(name);
setDisplayName(displayName);
setPermissions(permissions);
@@ -34,7 +32,7 @@ public class Rank implements Comparable<Rank> {
this.name = name;
}
public void setDisplayName(@Nullable String displayName) {
public void setDisplayName(String displayName) {
if (displayName == null || displayName.isEmpty()) {
displayName = name;
}
@@ -43,7 +41,7 @@ public class Rank implements Comparable<Rank> {
public void setPermissions(Set<String> permissions) {
if (permissions == null) {
permissions = new HashSet<>();
permissions = new HashSet<String>();
}
this.permissions = permissions;
}
@@ -21,7 +21,6 @@ public enum RankPermission {
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),
@@ -6,8 +6,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.REQUEST_MAX;
/**
* @author phaed
*/
@@ -180,6 +178,6 @@ public final class Request {
}
public boolean reachedRequestLimit() {
return askCount > SimpleClans.getInstance().getSettingsManager().getInt(REQUEST_MAX);
return askCount > SimpleClans.getInstance().getSettingsManager().getMaxAsksPerRequest();
}
}
@@ -2,24 +2,17 @@ package net.sacredlabyrinth.phaed.simpleclans;
import co.aikar.commands.BukkitCommandIssuer;
import net.sacredlabyrinth.phaed.simpleclans.commands.SCCommandManager;
import net.sacredlabyrinth.phaed.simpleclans.hooks.papi.SimpleClansExpansion;
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageMigration;
import net.sacredlabyrinth.phaed.simpleclans.language.LanguageResource;
import net.sacredlabyrinth.phaed.simpleclans.listeners.*;
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
import net.sacredlabyrinth.phaed.simpleclans.loggers.CSVBankLogger;
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
import net.sacredlabyrinth.phaed.simpleclans.proxy.BungeeManager;
import net.sacredlabyrinth.phaed.simpleclans.proxy.ProxyManager;
import net.sacredlabyrinth.phaed.simpleclans.tasks.*;
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryController;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatFormatMigration;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
import net.sacredlabyrinth.phaed.simpleclans.utils.UpdateChecker;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bstats.charts.SingleLineChart;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
@@ -35,19 +28,15 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static org.bukkit.Bukkit.getPluginManager;
/**
* @author Phaed
*/
public class SimpleClans extends JavaPlugin {
private final ArrayList<String> messages = new ArrayList<>();
private static SimpleClans instance;
private static LanguageResource languageResource;
private static final Logger logger = Logger.getLogger("SimpleClans");
private static final Logger logger = Logger.getLogger("Minecraft");
private SCCommandManager commandManager;
private ClanManager clanManager;
private RequestManager requestManager;
@@ -55,13 +44,7 @@ public class SimpleClans extends JavaPlugin {
private SettingsManager settingsManager;
private PermissionsManager permissionsManager;
private TeleportManager teleportManager;
private ProtectionManager protectionManager;
private ChatManager chatManager;
private ProxyManager proxyManager;
private boolean hasUUID;
private static final Pattern ACF_PLACEHOLDER_PATTERN = Pattern.compile("\\{(?<key>[a-zA-Z]+?)}");
private BankLogger bankLogger;
/**
* @return the logger
@@ -72,7 +55,7 @@ public class SimpleClans extends JavaPlugin {
}
public static void debug(String msg) {
if (getInstance().getSettingsManager().is(DEBUG)) {
if (getInstance().getSettingsManager().isDebugging()) {
logger.log(Level.INFO, msg);
}
}
@@ -97,24 +80,19 @@ public class SimpleClans extends JavaPlugin {
public void onEnable() {
instance = this;
new LanguageMigration(this).migrate();
settingsManager = new SettingsManager(this);
settingsManager = new SettingsManager();
languageResource = new LanguageResource();
this.hasUUID = UUIDMigration.canReturnUUID();
permissionsManager = new PermissionsManager();
requestManager = new RequestManager();
clanManager = new ClanManager();
proxyManager = new BungeeManager(this);
storageManager = new StorageManager();
teleportManager = new TeleportManager();
protectionManager = new ProtectionManager();
protectionManager.registerListeners();
chatManager = new ChatManager(this);
migrateChatFormat();
registerEvents();
permissionsManager.loadPermissions();
commandManager = new SCCommandManager(this);
bankLogger = new CSVBankLogger(this);
logStatus();
startTasks();
@@ -124,17 +102,16 @@ public class SimpleClans extends JavaPlugin {
}
private void logStatus() {
getLogger().info("Multithreading: " + settingsManager.is(PERFORMANCE_USE_THREADS));
getLogger().info("BungeeCord: " + settingsManager.is(PERFORMANCE_USE_BUNGEECORD));
getLogger().info("HEX support: " + ChatUtils.HEX_COLOR_SUPPORT);
getLogger().info("Multithreading: " + SimpleClans.getInstance().getSettingsManager().getUseThreads());
getLogger().info("BungeeCord: " + SimpleClans.getInstance().getSettingsManager().getUseBungeeCord());
getLogger().info("Help us translate SimpleClans to your language! " +
"Access https://crowdin.com/project/simpleclans/");
}
private void registerEvents() {
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerDeath(this), this);
pm.registerEvents(new SCPlayerListener(this), this);
pm.registerEvents(new PlayerDeath(), this);
pm.registerEvents(new SCPlayerListener(), this);
pm.registerEvents(new InventoryController(), this);
pm.registerEvents(new TamableMobsSharing(this), this);
pm.registerEvents(new PvPOnlyInWar(this), this);
@@ -148,60 +125,60 @@ public class SimpleClans extends JavaPlugin {
}
private void hookIntoPAPI() {
if (getPluginManager().getPlugin("PlaceholderAPI") != null) {
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
getLogger().info("PlaceholderAPI found. Registering hook...");
new SimpleClansExpansion(this).register();
new PlaceholdersManager(this).register();
}
}
private void startMetrics() {
Metrics metrics = new Metrics(this, 7131);
SettingsManager sm = getSettingsManager();
ClanManager cm = getClanManager();
String on = "enabled";
String off = "disabled";
metrics.addCustomChart(new SingleLineChart("clans", () -> cm.getClans().size()));
metrics.addCustomChart(new SingleLineChart("clan_players", () -> cm.getAllClanPlayers().size()));
metrics.addCustomChart(new SimplePie("language", () -> sm.getLanguage().toString()));
metrics.addCustomChart(new SimplePie("machine_language", () -> Locale.getDefault().toString()));
metrics.addCustomChart(new SimplePie("language_chooser", () -> sm.is(LANGUAGE_SELECTOR) ? on : off));
metrics.addCustomChart(new SimplePie("database", () -> sm.is(MYSQL_ENABLE) ? "MySQL" : "SQLite"));
metrics.addCustomChart(new SimplePie("save_periodically", () -> sm.is(PERFORMANCE_SAVE_PERIODICALLY) ? on : off));
metrics.addCustomChart(new SimplePie("save_interval", () -> sm.getString(PERFORMANCE_SAVE_INTERVAL)));
metrics.addCustomChart(new SimplePie("upkeep", () -> sm.is(ECONOMY_UPKEEP_ENABLED) ? on : off));
metrics.addCustomChart(new SimplePie("member_fee", () -> sm.is(ECONOMY_MEMBER_FEE_ENABLED) ? on : off));
metrics.addCustomChart(new SimplePie("rejoin_cooldown", () -> sm.is(ENABLE_REJOIN_COOLDOWN) ? on : off));
metrics.addCustomChart(new SimplePie("clan_verification", () -> sm.is(REQUIRE_VERIFICATION) ? on : off));
metrics.addCustomChart(new SimplePie("money_per_kill", () -> sm.is(ECONOMY_MONEY_PER_KILL) ? on : off));
metrics.addCustomChart(new SimplePie("threads", () -> sm.is(PERFORMANCE_USE_THREADS) ? on : off));
metrics.addCustomChart(new SimplePie("bungeecord", () -> sm.is(PERFORMANCE_USE_BUNGEECORD) ? on : off));
metrics.addCustomChart(new SimplePie("discord_chat", () -> sm.is(DISCORDCHAT_ENABLE) ? on : off));
Metrics metrics = new Metrics(this, 7131);
SettingsManager sm = getSettingsManager();
ClanManager cm = getClanManager();
String on = "enabled";
String off = "disabled";
metrics.addCustomChart(new Metrics.SingleLineChart("clans", () -> cm.getClans().size()));
metrics.addCustomChart(new Metrics.SingleLineChart("clan_players", () -> cm.getAllClanPlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("language", () -> sm.getLanguage().toString()));
metrics.addCustomChart(new Metrics.SimplePie("machine_language", () -> Locale.getDefault().toString()));
metrics.addCustomChart(new Metrics.SimplePie("language_chooser", () -> sm.isLanguagePerPlayer() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("database", () -> sm.isUseMysql() ? "MySQL" : "SQLite"));
metrics.addCustomChart(new Metrics.SimplePie("save_periodically", () -> sm.isSavePeriodically() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("save_interval", () -> String.valueOf(sm.getSaveInterval())));
metrics.addCustomChart(new Metrics.SimplePie("upkeep", () -> sm.isClanUpkeep() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("member_fee", () -> sm.isMemberFee() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("rejoin_cooldown", () -> sm.isRejoinCooldown() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("clan_verification", () -> sm.isRequireVerification() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("money_per_kill", () -> sm.isMoneyPerKill() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("threads", () -> sm.getUseThreads() ? on : off));
metrics.addCustomChart(new Metrics.SimplePie("bungeecord", () -> sm.getUseBungeeCord() ? on : off));
}
private void startTasks() {
if (getSettingsManager().is(PERFORMANCE_SAVE_PERIODICALLY)) {
new SaveDataTask().start();
}
if (getSettingsManager().is(ECONOMY_MEMBER_FEE_ENABLED)) {
if (getSettingsManager().isSavePeriodically()) {
new SaveDataTask().start();
}
if (getSettingsManager().isMemberFee()) {
new CollectFeeTask().start();
}
if (getSettingsManager().is(ECONOMY_UPKEEP_ENABLED)) {
if (getSettingsManager().isClanUpkeep()) {
new CollectUpkeepTask().start();
new UpkeepWarningTask().start();
}
if (getSettingsManager().is(PERFORMANCE_HEAD_CACHING)) {
if (getSettingsManager().isCachePlayerHeads()) {
new PlayerHeadCacheTask(this).start();
}
}
@Override
public void onDisable() {
if (getSettingsManager().is(PERFORMANCE_SAVE_PERIODICALLY)) {
getStorageManager().saveModified();
}
getServer().getScheduler().cancelTasks(this);
if (getSettingsManager().isSavePeriodically()) {
getStorageManager().saveModified();
}
getStorageManager().closeConnection();
getPermissionsManager().savePermissions();
getSettingsManager().loadAndSave();
}
/**
@@ -244,22 +221,6 @@ public class SimpleClans extends JavaPlugin {
return commandManager;
}
public ProtectionManager getProtectionManager() {
return protectionManager;
}
public ChatManager getChatManager() {
return chatManager;
}
public ProxyManager getProxyManager() {
return proxyManager;
}
public BankLogger getBankLogger() {
return bankLogger;
}
/**
* @param key the path within the language file
* @return the lang
@@ -275,43 +236,34 @@ public class SimpleClans extends JavaPlugin {
}
@Nullable
public static String optionalLang(@NotNull String key, @Nullable ClanPlayer clanPlayer, Object... arguments) {
Locale locale = instance.getSettingsManager().getLanguage();
if (clanPlayer != null && clanPlayer.getLocale() != null && instance.getSettingsManager().is(LANGUAGE_SELECTOR)) {
locale = clanPlayer.getLocale();
public static String optionalLang(@NotNull String key, @Nullable Player player, Object... arguments) {
Locale locale = getInstance().getSettingsManager().getLanguage();
if (player != null && instance.getSettingsManager().isLanguagePerPlayer()) {
Locale playerLocale = Helper.getLocale(player);
if (playerLocale != null) {
locale = playerLocale;
}
}
String lang = languageResource.getLang(key, locale);
if (lang == null) {
return null;
}
String message = ChatUtils.parseColors(lang);
String message = ChatColor.translateAlternateColorCodes('&', lang);
// contains acf placeholders like {commandprefix}
if (ACF_PLACEHOLDER_PATTERN.matcher(message).find()) {
if (Pattern.compile("\\{(?<key>[a-zA-Z]+?)}").matcher(message).find()) {
return message;
}
return MessageFormat.format(message, arguments);
}
@Nullable
public static String optionalLang(@NotNull String key, @Nullable Player player, Object... arguments) {
ClanPlayer clanPlayer = null;
if (player != null) {
clanPlayer = instance.getClanManager().getAnyClanPlayer(player.getUniqueId());
}
return optionalLang(key, clanPlayer, arguments);
}
@NotNull
public static String lang(@NotNull String key, @Nullable Player player, Object... arguments) {
String lang = optionalLang(key, player, arguments);
return (lang == null) ? key : lang;
}
@NotNull
public static String lang(@NotNull String key, @Nullable ClanPlayer clanPlayer, Object... arguments) {
String lang = optionalLang(key, clanPlayer, arguments);
return (lang == null) ? key : lang;
if (lang == null) {
return key;
}
return lang;
}
@NotNull
@@ -350,8 +302,7 @@ public class SimpleClans extends JavaPlugin {
return this.hasUUID;
}
@Deprecated
public void setUUID(boolean trueOrFalse) {
this.hasUUID = trueOrFalse;
}
}
}
@@ -1,31 +1,30 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class TeleportState {
private final OfflinePlayer offlinePlayer;
private final Location origin;
private final UUID playerUniqueId;
private final Location playerLocation;
private final Location destination;
private int counter;
private final String clanName;
private boolean processing;
public TeleportState(Player player, Location destination, String clanName, int counter) {
this.offlinePlayer = player;
public TeleportState(Player player, Location destination, String clanName) {
this.destination = destination;
this.origin = player.getLocation();
this.playerLocation = player.getLocation();
this.clanName = clanName;
this.counter = counter;
this.counter = SimpleClans.getInstance().getSettingsManager().getWaitSecs();
this.playerUniqueId = player.getUniqueId();
}
public Location getLocation() {
return this.origin;
return this.playerLocation;
}
public boolean isTeleportTime() {
@@ -43,7 +42,7 @@ public class TeleportState {
* @return the player
*/
public @Nullable Player getPlayer() {
return offlinePlayer.getPlayer();
return SimpleClans.getInstance().getServer().getPlayer(this.playerUniqueId);
}
/**
@@ -75,4 +74,7 @@ public class TeleportState {
this.processing = processing;
}
public UUID getUniqueId() {
return this.playerUniqueId;
}
}
@@ -2,9 +2,12 @@ package net.sacredlabyrinth.phaed.simpleclans;
/**
* Possible vote values
*/
/**
*
* @author cc_madelg
*/
public enum VoteResult {
public enum VoteResult
{
ACCEPT, DENY
}
@@ -1,46 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.jetbrains.annotations.NotNull;
import java.util.*;
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);
}
@@ -1,90 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.chat;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class SCMessage implements Cloneable {
private final Source source;
private final ClanPlayer.Channel channel;
private final ClanPlayer sender;
private List<ClanPlayer> receivers;
private String content;
/**
* Creates a message with initial parameters
*
* @param source The source of message
* @param channel The channel of clan player
* @param sender The clan player sender
* @param content The content of message
* @param receivers The clan players, who will receive the content
*/
public SCMessage(@NotNull Source source, @NotNull ClanPlayer.Channel channel,
@NotNull ClanPlayer sender, String content, @NotNull List<ClanPlayer> receivers) {
this.source = source;
this.channel = channel;
this.sender = sender;
this.content = content;
this.receivers = receivers;
}
/**
* Creates a new SCMessage without receivers
*
* @see SCMessage#SCMessage(Source, ClanPlayer.Channel, ClanPlayer, String, List) instantiate with initial receievers
*/
public SCMessage(@NotNull Source source, @NotNull ClanPlayer.Channel channel, @NotNull ClanPlayer sender, String content) {
this(source, channel, sender, content, new ArrayList<>());
}
public ClanPlayer.Channel getChannel() {
return channel;
}
public ClanPlayer getSender() {
return sender;
}
public String getContent() {
return content;
}
public Source getSource() {
return source;
}
public List<ClanPlayer> getReceivers() {
return receivers;
}
public void setContent(@NotNull String content) {
this.content = content;
}
public void setReceivers(@NotNull List<ClanPlayer> receivers) {
this.receivers = receivers;
}
@Override
public SCMessage clone() {
try {
return (SCMessage) super.clone();
} catch (CloneNotSupportedException e) {
throw new Error(); //never thrown
}
}
/**
* The place where the message came from.
* Used by ChatHandlers to know which SCMessages they can handle.
*
* @see ChatHandler initiate the handler
*/
public enum Source {
SPIGOT, DISCORD, PROXY
}
}
@@ -1,48 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.chat.handlers;
import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel;
import github.scarsz.discordsrv.util.DiscordUtil;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.chat.ChatHandler;
import net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage;
import net.sacredlabyrinth.phaed.simpleclans.hooks.discord.DiscordHook;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
import java.util.Optional;
import static net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.Channel.CLAN;
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source;
import static net.sacredlabyrinth.phaed.simpleclans.chat.SCMessage.Source.SPIGOT;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.DISCORDCHAT_FORMAT_TO;
/**
* Handles delivering messages from {@link Source#SPIGOT} to {@link Source#DISCORD}.
*/
public class DiscordChatHandler implements ChatHandler {
@Override
public void sendMessage(@NotNull SCMessage message) {
if (message.getChannel() != CLAN) {
return;
}
String format = settingsManager.getString(DISCORDCHAT_FORMAT_TO);
String formattedMessage = ChatUtils.stripColors(chatManager.parseChatFormat(format, message));
Clan clan = message.getSender().getClan();
if (clan == null) {
return;
}
DiscordHook discordHook = Objects.requireNonNull(chatManager.getDiscordHook(), "DiscordHook cannot be null");
Optional<TextChannel> channel = discordHook.getCachedChannel(clan.getTag());
channel.ifPresent(textChannel -> DiscordUtil.sendMessage(textChannel, formattedMessage));
}
@Override
public boolean canHandle(SCMessage.Source source) {
return source == SPIGOT && chatManager.isDiscordHookEnabled();
}
}
@@ -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,74 +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.events.ChatEvent;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
import org.bukkit.scheduler.BukkitRunnable;
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;
import static org.bukkit.Bukkit.getPluginManager;
@SuppressWarnings("unused")
public class SpigotChatHandler implements ChatHandler {
@Override
public void sendMessage(SCMessage message) {
/*
TODO: Make it async, change Type to Channel in 3.0
*/
new BukkitRunnable() {
@Override
public void run() {
ChatEvent event = new ChatEvent(message.getContent(), message.getSender(), message.getReceivers(),
ChatEvent.Type.valueOf(message.getChannel().name()));
getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
message.setContent(stripColorsAndFormatsPerPermission(message.getSender(),event.getMessage()));
ConfigField configField = ConfigField.valueOf(String.format("%sCHAT_FORMAT",
message.getSource() == DISCORD ? "DISCORD" : message.getChannel()));
String format = settingsManager.getString(configField);
String formattedMessage = chatManager.parseChatFormat(format, message, event.getPlaceholders());
plugin.getLogger().info(ChatUtils.stripColors(formattedMessage));
for (ClanPlayer cp : message.getReceivers()) {
ChatBlock.sendMessage(cp, formattedMessage);
}
}
}.runTask(plugin);
}
private String stripColorsAndFormatsPerPermission(ClanPlayer sender, String message) {
if (!permissionsManager.has(sender.toPlayer(), "simpleclans.member.chat.color")) {
message = stripColors(message);
}
if (!permissionsManager.has(sender.toPlayer(), "simpleclans.member.chat.format")) {
message = stripFormats(message);
}
return message;
}
private String stripColors(String message) {
return message.replaceAll("[§&][0-9a-fA-FxX]", "");
}
private String stripFormats(String message) {
return message.replaceAll("[§&][k-orK-OR]", "");
}
@Override
public boolean canHandle(SCMessage.Source source) {
return source == SPIGOT || (source == PROXY && settingsManager.is(PERFORMANCE_USE_BUNGEECORD))
|| (source == DISCORD && chatManager.isDiscordHookEnabled());
}
}
@@ -1,54 +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.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 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());
}
}
@@ -6,8 +6,6 @@ import co.aikar.commands.CommandIssuer;
import co.aikar.commands.PaperCommandManager;
import co.aikar.locales.MessageKey;
import co.aikar.locales.MessageKeyProvider;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractAsyncCompletion;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractCompletion;
@@ -24,6 +22,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.reflections.Reflections;
import java.lang.reflect.Modifier;
import java.util.Arrays;
@@ -33,7 +32,6 @@ import java.util.logging.Level;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.optionalLang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
public class SCCommandManager extends PaperCommandManager {
private final SimpleClans plugin;
@@ -46,14 +44,13 @@ public class SCCommandManager extends PaperCommandManager {
}
private void configure() {
enableUnstableAPI("help");
registerDependencies();
enableUnstableAPI("help");
addCommandReplacements();
registerContexts();
registerCommands();
registerConditions();
registerCompletions();
defaultHelpPerPage = plugin.getSettingsManager().getInt(HELP_SIZE);
}
private void registerDependencies() {
@@ -62,14 +59,11 @@ public class SCCommandManager extends PaperCommandManager {
registerDependency(StorageManager.class, plugin.getStorageManager());
registerDependency(PermissionsManager.class, plugin.getPermissionsManager());
registerDependency(RequestManager.class, plugin.getRequestManager());
registerDependency(ProtectionManager.class, plugin.getProtectionManager());
registerDependency(ChatManager.class, plugin.getChatManager());
}
private void registerCompletions() {
Set<Class<? extends AbstractCompletion>> completions =
Helper.getSubTypesOf("net.sacredlabyrinth.phaed.simpleclans.commands.completions",
AbstractCompletion.class);
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.completions");
Set<Class<? extends AbstractCompletion>> completions = reflections.getSubTypesOf(AbstractCompletion.class);
plugin.getLogger().info(String.format("Registering %d command completions...", completions.size()));
for (Class<? extends AbstractCompletion> c : completions) {
if (Modifier.isAbstract(c.getModifiers())) {
@@ -95,9 +89,8 @@ public class SCCommandManager extends PaperCommandManager {
@SuppressWarnings("unchecked")
private void registerConditions() {
Set<Class<? extends AbstractCondition>> conditions =
Helper.getSubTypesOf("net.sacredlabyrinth.phaed.simpleclans.commands.conditions",
AbstractCondition.class);
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.conditions");
Set<Class<? extends AbstractCondition>> conditions = reflections.getSubTypesOf(AbstractCondition.class);
plugin.getLogger().info(String.format("Registering %d command conditions...", conditions.size()));
for (Class<? extends AbstractCondition> c : conditions) {
if (Modifier.isAbstract(c.getModifiers())) {
@@ -122,9 +115,8 @@ public class SCCommandManager extends PaperCommandManager {
@SuppressWarnings({"rawtypes", "unchecked"})
private void registerContexts() {
Set<Class<? extends AbstractContextResolver>> resolvers =
Helper.getSubTypesOf("net.sacredlabyrinth.phaed.simpleclans.commands.contexts",
AbstractContextResolver.class);
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.contexts");
Set<Class<? extends AbstractContextResolver>> resolvers = reflections.getSubTypesOf(AbstractContextResolver.class);
plugin.getLogger().info(String.format("Registering %d command contexts...", resolvers.size()));
for (Class<? extends AbstractContextResolver> cr : resolvers) {
if (Modifier.isAbstract(cr.getModifiers())) {
@@ -145,8 +137,9 @@ public class SCCommandManager extends PaperCommandManager {
}
private void registerCommands() {
boolean forceCommandPriority = plugin.getSettingsManager().is(COMMANDS_FORCE_PRIORITY);
Set<Class<? extends BaseCommand>> commands = Helper.getSubTypesOf("net.sacredlabyrinth.phaed.simpleclans.commands", BaseCommand.class);
boolean forceCommandPriority = plugin.getSettingsManager().isForceCommandPriority();
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands");
Set<Class<? extends BaseCommand>> commands = reflections.getSubTypesOf(BaseCommand.class);
plugin.getLogger().info(String.format("Registering %d base commands...", commands.size()));
for (Class<? extends BaseCommand> c : commands) {
//ACF already registers nested classes
@@ -166,16 +159,16 @@ public class SCCommandManager extends PaperCommandManager {
SettingsManager sm = plugin.getSettingsManager();
getCommandReplacements().addReplacements(
"basic_conditions", "not_blacklisted|not_banned",
"clan", sm.getString(COMMANDS_CLAN),
"deny", sm.getString(COMMANDS_DENY) + "|deny",
"more", sm.getString(COMMANDS_MORE),
"ally_chat", sm.getString(COMMANDS_ALLY),
"accept", sm.getString(COMMANDS_ACCEPT) + "|accept",
"clan_chat", sm.getString(COMMANDS_CLAN_CHAT)
"clan", sm.getCommandClan(),
"deny", sm.getCommandDeny(),
"more", sm.getCommandMore(),
"ally_chat", sm.getCommandAlly(),
"accept", sm.getCommandAccept(),
"clan_chat", sm.getCommandClanChat()
);
SUBCOMMANDS.forEach(s -> {
String command = optionalLang(s + ".command", (ClanPlayer) null);
String command = optionalLang(s + ".command", null);
if (command == null) {
command = s;
}
@@ -212,6 +205,7 @@ public class SCCommandManager extends PaperCommandManager {
};
//this.locales.loadLanguages();
}
return this.locales;
}
@@ -222,8 +216,6 @@ public class SCCommandManager extends PaperCommandManager {
"modtag", "bb", "clear", "rival", "ally", "add", "remove", "stats", "coords", "vitals", "rivalries",
"alliances", "leaderboard", "allow", "block", "auto", "check", "assign", "unassign", "delete", "me",
"setdisplayname", "permissions", "tag", "deposit", "withdraw", "set", "status", "tp", "all", "everyone",
"lookup", "roster", "profile", "list", "create", "description", "start", "end", "admin", "help", "mod",
"setdefault", "removedefault", "land", "break", "interact", "place_block", "damage", "interact_entity",
"container", "permanent", "take", "give", "join", "leave", "mute", "confirm", "balance", "discord");
"lookup", "roster", "profile", "list", "create", "description", "start", "end", "admin", "help");
}
}
@@ -2,67 +2,29 @@ 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.ClanManager;
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;
import org.bukkit.entity.Player;
@CommandAlias("%ally_chat")
@Description("{@@command.description.ally}")
@CommandPermission("simpleclans.member.ally")
@Conditions("%basic_conditions|clan_member|can_chat:type=ALLY|rank:name=ALLY_CHAT")
@Conditions("%basic_conditions|clan_member|rank:name=ALLY_CHAT")
public class AllyChatCommand extends BaseCommand {
@Dependency
private ChatManager chatManager;
private ClanManager clanManager;
@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"));
@CommandCompletion("@chat_subcommands")
public void sendMessage(Player player, @Name("message") String message) {
if (!settingsManager.isAllyChatEnable()) {
return;
}
clanPlayer.setChannel(ALLY);
storageManager.updateClanPlayer(clanPlayer);
ChatBlock.sendMessage(clanPlayer, lang("joined.ally.chat"));
clanManager.processAllyChat(player, message);
}
@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));
}
}
}
@@ -4,18 +4,10 @@ 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 org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.REVERT;
import static net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent.Cause.COMMAND;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@@ -58,31 +50,7 @@ public class BankCommand extends BaseCommand {
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.playerGrantMoney(player, amount)) {
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
clan.addBb(player.getName(), AQUA + lang("bb.clan.withdraw", amount, player.getName()));
} else {
clan.setBalance(operator, REVERT, BankLogger.Operation.WITHDRAW, clan.getBalance() + amount);
}
break;
case NOT_ENOUGH_BALANCE:
player.sendMessage(lang("clan.bank.not.enough.money", player));
break;
}
clan.withdraw(amount, player);
}
@Subcommand("%deposit %all")
@@ -109,33 +77,6 @@ public class BankCommand extends BaseCommand {
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, amount));
return;
}
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
EconomyResponse response = clan.deposit(operator, COMMAND, amount);
if (response == EconomyResponse.SUCCESS) {
if (permissions.playerChargeMoney(player, amount)) {
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
clan.addBb(player.getName(), AQUA + lang("bb.clan.deposit", amount, player.getName()));
} else {
//Reverts the deposit if something went wrong with Vault
clan.setBalance(operator, REVERT, BankLogger.Operation.DEPOSIT, clan.getBalance() - amount);
}
}
clan.deposit(amount, player);
}
}
@@ -2,65 +2,29 @@ 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.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
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;
import org.bukkit.entity.Player;
@CommandAlias("%clan_chat")
@Conditions("%basic_conditions|clan_member|can_chat:type=CLAN")
@Conditions("%basic_conditions|clan_member")
@CommandPermission("simpleclans.member.chat")
@Description("{@@command.description.chat}")
public class ChatCommand extends BaseCommand {
@Dependency
private ChatManager chatManager;
private ClanManager clanManager;
@Dependency
private StorageManager storageManager;
private SettingsManager settingsManager;
@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"));
@CommandCompletion("@chat_subcommands")
public void sendMessage(Player player, ClanPlayer cp, @Name("message") String message) {
if (!settingsManager.getClanChatEnable()) {
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));
}
clanManager.processClanChat(player, cp.getTag(), message);
}
}
@@ -6,11 +6,10 @@ 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.TagValidator;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -18,7 +17,6 @@ import java.util.List;
import java.util.Objects;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@@ -37,29 +35,30 @@ public class ClanCommands extends BaseCommand {
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();
public void startWar(Player player, ClanPlayer cp, Clan issuerClan, @Name("clan") ClanInput other) {
Clan war = other.getClan();
if (!issuerClan.isRival(war.getTag())) {
ChatBlock.sendMessage(player, RED + lang("you.can.only.start.war.with.rivals", player));
return;
}
if (!issuerClan.isWarring(war.getTag())) {
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(issuerClan.getLeaders());
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(requestClan.getLeaders());
if (settings.is(WAR_START_REQUEST_ENABLED)) {
if (!onlineLeaders.isEmpty()) {
requestManager.addWarStartRequest(requester, targetClan, requestClan);
requestManager.addWarStartRequest(cp, war, issuerClan);
ChatBlock.sendMessage(player, AQUA + lang("leaders.have.been.asked.to.accept.the.war.request",
player, targetClan.getName()));
player, war.getName()));
} else {
ChatBlock.sendMessage(player, RED + lang("at.least.one.leader.accept.the.alliance", player));
}
} else {
protectionManager.addWar(requester, requestClan, targetClan);
ChatBlock.sendMessage(player, RED + lang("clans.already.at.war", player));
}
}
@@ -68,13 +67,13 @@ public class ClanCommands extends BaseCommand {
@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) {
public void endWar(Player player, 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()));
ChatBlock.sendMessage(player, AQUA + lang("leaders.asked.to.end.rivalry", player, war.getName()));
} else {
ChatBlock.sendMessage(cp, RED + lang("clans.not.at.war", cp));
ChatBlock.sendMessage(player, RED + lang("clans.not.at.war", player));
}
}
@@ -103,7 +102,7 @@ public class ClanCommands extends BaseCommand {
return;
}
clan.addBb(player.getName(), AQUA + lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
clan.addBb(player.getName(), AQUA + lang("tag.changed.to.0", Helper.parseColors(tag)));
clan.changeClanTag(tag);
cm.updateDisplayName(player);
}
@@ -127,15 +126,11 @@ public class ClanCommands extends BaseCommand {
@Subcommand("%invite")
@CommandPermission("simpleclans.leader.invite")
@CommandCompletion("@non_members:ignore_vanished")
@CommandCompletion("@non_members")
@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;
}
@Conditions("not_banned|not_in_clan|online") @Name("player") ClanPlayerInput invited) {
Player invitedPlayer = invited.getClanPlayer().toPlayer();
if (invitedPlayer == null) return;
if (!permissions.has(invitedPlayer, "simpleclans.member.can-join")) {
@@ -154,7 +149,7 @@ public class ClanCommands extends BaseCommand {
return;
}
if (clan.getSize() >= settings.getInt(CLAN_MAX_MEMBERS) && settings.getInt(CLAN_MAX_MEMBERS) > 0) {
if (clan.getSize() >= settings.getMaxMembers()) {
ChatBlock.sendMessage(sender, RED + lang("the.clan.members.reached.limit", sender));
return;
}
@@ -185,7 +180,7 @@ public class ClanCommands extends BaseCommand {
@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);
double maxFee = settings.getMaxMemberFee();
if (fee > maxFee) {
ChatBlock.sendMessage(player, RED
+ lang("max.fee.allowed.is.0", player, maxFee));
@@ -223,14 +218,14 @@ public class ClanCommands extends BaseCommand {
@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)) {
if (description.length() < settings.getClanMinDescriptionLength()) {
ChatBlock.sendMessage(player, RED + lang("your.clan.description.must.be.longer.than",
player, settings.getInt(CLAN_MIN_DESCRIPTION_LENGTH)));
player, settings.getClanMinDescriptionLength()));
return;
}
if (description.length() > settings.getInt(CLAN_MAX_DESCRIPTION_LENGTH)) {
if (description.length() > settings.getClanMaxDescriptionLength()) {
ChatBlock.sendMessage(player, RED + lang("your.clan.description.cannot.be.longer.than",
player, settings.getInt(CLAN_MAX_DESCRIPTION_LENGTH)));
player, settings.getClanMaxDescriptionLength()));
return;
}
clan.setDescription(description);
@@ -241,7 +236,7 @@ public class ClanCommands extends BaseCommand {
@Subcommand("%rival %add")
@CommandPermission("simpleclans.leader.rival")
@Conditions("verified|rivable|minimum_to_rival|rank:name=RIVAL_ADD")
@CommandCompletion("@clans:hide_own")
@CommandCompletion("@clans")
@Description("{@@command.description.rival.add}")
public void addRival(Player player, Clan issuerClan, @Conditions("verified|different") @Name("clan") ClanInput rival) {
Clan rivalInput = rival.getClan();
@@ -286,7 +281,7 @@ public class ClanCommands extends BaseCommand {
@Subcommand("%ally %add")
@CommandPermission("simpleclans.leader.ally")
@Conditions("verified|rank:name=ALLY_ADD|minimum_to_ally")
@CommandCompletion("@clans:hide_own")
@CommandCompletion("@clans")
@Description("{@@command.description.ally.add}")
public void addAlly(Player player,
ClanPlayer cp,
@@ -297,7 +292,7 @@ public class ClanCommands extends BaseCommand {
ChatBlock.sendMessage(player, RED + lang("your.clans.are.already.allies", player));
return;
}
int maxAlliances = settings.getInt(CLAN_MAX_ALLIANCES);
int maxAlliances = settings.getClanMaxAlliances();
if (maxAlliances != -1) {
if (issuerClan.getAllies().size() >= maxAlliances) {
ChatBlock.sendMessage(player, lang("your.clan.reached.max.alliances", player));
@@ -337,7 +332,7 @@ public class ClanCommands extends BaseCommand {
@Subcommand("%kick")
@CommandPermission("simpleclans.leader.kick")
@CommandCompletion("@clan_members:hide_own")
@CommandCompletion("@clan_members")
@Conditions("rank:name=KICK")
@Description("{@@command.description.kick}")
public void kick(@Conditions("clan_member") Player sender,
@@ -359,31 +354,14 @@ public class ClanCommands extends BaseCommand {
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(), AQUA + 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();
new ConversationFactory(plugin)
.withFirstPrompt(new ResignPrompt())
.withLocalEcho(true)
.withTimeout(10)
.buildConversation(player).begin();
}
}
@@ -4,19 +4,13 @@ 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.managers.*;
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")
@@ -29,8 +23,6 @@ public class HomeCommands extends BaseCommand {
@Dependency
private SettingsManager settings;
@Dependency
private ProtectionManager protection;
@Dependency
private ClanManager cm;
@Subcommand("%regroup %me")
@@ -38,15 +30,15 @@ public class HomeCommands extends BaseCommand {
@Conditions("rank:name=REGROUP_ME")
@Description("{@@command.description.regroup.me}")
public void regroupMe(Player player, ClanPlayer cp, Clan clan) {
if (!settings.is(ALLOW_REGROUP)) {
if (!settings.getAllowReGroupCommand()) {
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
return;
}
processRegroup(player, cp, clan, player.getLocation());
processTeleport(player, cp, clan, player.getLocation());
}
private void processRegroup(Player player, ClanPlayer cp, Clan clan, Location location) {
private void processTeleport(Player player, ClanPlayer cp, Clan clan, Location location) {
HomeRegroupEvent homeRegroupEvent = new HomeRegroupEvent(clan, cp, VanishUtils.getNonVanished(player, clan), location);
plugin.getServer().getPluginManager().callEvent(homeRegroupEvent);
@@ -61,24 +53,34 @@ public class HomeCommands extends BaseCommand {
@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)) {
public void regroupHome(Player player, ClanPlayer cp, Clan clan) {
if (!settings.getAllowReGroupCommand()) {
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
return;
}
Location location = clan.getHomeLocation();
processRegroup(player, cp, clan, location);
if (location == null) {
ChatBlock.sendMessage(player, RED + lang("hombase.not.set", player));
return;
}
processTeleport(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();
public void teleport(Player player, Clan clan, ClanPlayer cp) {
Location loc = clan.getHomeLocation();
if (loc == null) {
ChatBlock.sendMessage(player, RED + lang("hombase.not.set", player));
return;
}
if (cm.purchaseHomeTeleport(player)) {
plugin.getTeleportManager().addPlayer(player, homeLocation, clan.getName());
plugin.getTeleportManager().addPlayer(player, clan.getHomeLocation(), clan.getName());
}
}
@@ -86,19 +88,13 @@ public class HomeCommands extends BaseCommand {
@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 &&
public void clear(Player player, Clan clan) {
if (settings.isHomebaseSetOnce() && 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));
}
@@ -108,17 +104,11 @@ public class HomeCommands extends BaseCommand {
@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 &&
if (settings.isHomebaseSetOnce() && 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);
@@ -1,178 +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.hooks.protection.Land;
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.LAND_EDIT_ALL_LANDS;
@CommandAlias("%clan")
@Subcommand("%land")
@Conditions("%basic_conditions|clan_member|land_sharing|own_land")
@CommandPermission("simpleclans.member.land")
public class LandCommand extends BaseCommand {
@Dependency
private ProtectionManager protection;
@Dependency
private SettingsManager settings;
private Set<Land> getLands(ClanPlayer cp, Location location) {
Player player = Objects.requireNonNull(cp.toPlayer());
if (settings.is(LAND_EDIT_ALL_LANDS)) {
return protection.getLands(player, location);
} else {
return protection.getLandsAt(location).stream().filter(l -> l.getOwners().contains(player.getUniqueId()))
.collect(Collectors.toSet());
}
}
@Subcommand("%allow")
public class AllowCommand extends BaseCommand {
private void allow(ClanPlayer cp, ProtectionManager.Action action, Location location) {
allow(cp, action, location, true);
}
private void allow(ClanPlayer cp, ProtectionManager.Action action, Location location, boolean notify) {
for (Land land : getLands(cp, location)) {
cp.allow(action, land.getId());
}
if (notify) {
ChatBlock.sendMessageKey(cp.toPlayer(), "land.allowed.action");
}
}
@Subcommand("%container")
@Description("{@@command.description.land.allow.container}")
@CommandPermission("simpleclans.member.land.allow.container")
public void container(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.CONTAINER, player.getLocation());
}
@Subcommand("%place")
@Description("{@@command.description.land.allow.place}")
@CommandPermission("simpleclans.member.land.allow.place")
public void place(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.PLACE, player.getLocation());
}
@Subcommand("%damage")
@Description("{@@command.description.land.allow.damage}")
@CommandPermission("simpleclans.member.land.allow.damage")
public void damage(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.DAMAGE, player.getLocation());
}
@Subcommand("%interact_entity")
@Description("{@@command.description.land.allow.interact_entity}")
@CommandPermission("simpleclans.member.land.allow.interact_entity")
public void interactEntity(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.INTERACT_ENTITY, player.getLocation());
}
@Subcommand("%interact")
@Description("{@@command.description.land.allow.interact}")
@CommandPermission("simpleclans.member.land.allow.interact")
public void interact(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.INTERACT, player.getLocation());
}
@Subcommand("%break")
@Description("{@@command.description.land.allow.break}")
@CommandPermission("simpleclans.member.land.allow.break")
public void allowBreak(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.BREAK, player.getLocation());
}
@Subcommand("%all")
@Description("{@@command.description.land.allow.all}")
@CommandPermission("simpleclans.member.land.allow.all")
public void all(Player player, ClanPlayer cp) {
for (ProtectionManager.Action action : ProtectionManager.Action.values()) {
allow(cp, action, player.getLocation(), false);
}
ChatBlock.sendMessageKey(player, "land.allowed.all.actions");
}
}
@Subcommand("%block")
public class BlockCommand extends BaseCommand {
private void block(ClanPlayer cp, ProtectionManager.Action action, Location location) {
block(cp, action, location, true);
}
private void block(ClanPlayer cp, ProtectionManager.Action action, Location location, boolean notify) {
for (Land land : getLands(cp, location)) {
cp.disallow(action, land.getId());
}
if (notify) {
ChatBlock.sendMessageKey(cp.toPlayer(), "land.blocked.action");
}
}
@Subcommand("%container")
@Description("{@@command.description.land.block.container}")
@CommandPermission("simpleclans.member.land.block.container")
public void container(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.CONTAINER, player.getLocation());
}
@Subcommand("%place")
@Description("{@@command.description.land.block.place}")
@CommandPermission("simpleclans.member.land.block.place")
public void place(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.PLACE, player.getLocation());
}
@Subcommand("%damage")
@Description("{@@command.description.land.block.damage}")
@CommandPermission("simpleclans.member.land.block.damage")
public void damage(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.DAMAGE, player.getLocation());
}
@Subcommand("%interact_entity")
@Description("{@@command.description.land.block.interact_entity}")
@CommandPermission("simpleclans.member.land.block.interact_entity")
public void interactEntity(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.INTERACT_ENTITY, player.getLocation());
}
@Subcommand("%interact")
@Description("{@@command.description.land.block.interact}")
@CommandPermission("simpleclans.member.land.block.interact")
public void interact(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.INTERACT, player.getLocation());
}
@Subcommand("%break")
@Description("{@@command.description.land.block.break}")
@CommandPermission("simpleclans.member.land.block.break")
public void blockBreak(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.BREAK, player.getLocation());
}
@Subcommand("%all")
@Description("{@@command.description.land.block.all}")
@CommandPermission("simpleclans.member.land.block.all")
public void all(Player player, ClanPlayer cp) {
protection.getLandsAt(player.getLocation());
for (ProtectionManager.Action action : ProtectionManager.Action.values()) {
block(cp, action, player.getLocation(), false);
}
ChatBlock.sendMessageKey(player, "land.blocked.all.actions");
}
}
}
@@ -5,12 +5,7 @@ import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.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 org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -18,15 +13,13 @@ import org.bukkit.entity.Player;
import java.util.Objects;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static org.bukkit.ChatColor.*;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@CommandAlias("%clan")
@Conditions("%basic_conditions|leader")
public class LeaderCommands extends BaseCommand {
@Dependency
private SimpleClans plugin;
@Dependency
private StorageManager storage;
@Dependency
@@ -37,8 +30,6 @@ public class LeaderCommands extends BaseCommand {
private RequestManager requestManager;
@Dependency
private ClanManager cm;
@Dependency
private ChatManager chatManager;
@Subcommand("%demote")
@CommandCompletion("@clan_leaders")
@@ -57,7 +48,7 @@ public class LeaderCommands extends BaseCommand {
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)) {
if (clan.getLeaders().size() > 2 && settings.isConfirmationForDemote()) {
requestManager.addDemoteRequest(cp, otherCp.getName(), clan);
ChatBlock.sendMessage(player, AQUA + lang("demotion.vote.has.been.requested.from.all.leaders",
player));
@@ -89,7 +80,7 @@ public class LeaderCommands extends BaseCommand {
ChatBlock.sendMessage(player, RED + lang("the.player.is.already.a.leader", player));
return;
}
if (settings.is(CLAN_CONFIRMATION_FOR_PROMOTE) && clan.getLeaders().size() > 1) {
if (settings.isConfirmationForPromote() && clan.getLeaders().size() > 1) {
requestManager.addPromoteRequest(cp, otherPl.getName(), clan);
ChatBlock.sendMessage(player, AQUA + lang("promotion.vote.has.been.requested.from.all.leaders",
player));
@@ -111,7 +102,8 @@ public class LeaderCommands extends BaseCommand {
return;
}
new SCConversation(plugin, player, new DisbandPrompt()).begin();
clan.clanAnnounce(player.getName(), AQUA + lang("clan.has.been.disbanded", clan.getName()));
clan.disband();
}
@Subcommand("%verify")
@@ -122,12 +114,12 @@ public class LeaderCommands extends BaseCommand {
ChatBlock.sendMessageKey(player, "your.clan.already.verified");
return;
}
if (!settings.is(ECONOMY_PURCHASE_CLAN_VERIFY)) {
if (!settings.isePurchaseVerification()) {
ChatBlock.sendMessageKey(player, "staff.member.verify.clan");
return;
}
int minToVerify = settings.getInt(CLAN_MIN_TO_VERIFY);
if (minToVerify > clan.getMembers().size()) {
int minToVerify = settings.getMinToVerify();
if (minToVerify > clan.getAllMembers().size()) {
ChatBlock.sendMessage(player, lang("your.clan.must.have.members.to.verify", player, minToVerify));
return;
}
@@ -186,42 +178,4 @@ public class LeaderCommands extends BaseCommand {
trustedInput.setTrusted(false);
storage.updateClanPlayer(trustedInput);
}
@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, amount));
return;
}
if (!permissions.playerChargeMoney(player, amount)) {
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.playerGrantMoney(player, amount);
}
String messageKey = ex.getMessageKey();
if (messageKey != null) {
ChatBlock.sendMessage(player, RED + lang(messageKey));
}
}
}
}
@@ -5,15 +5,11 @@ 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.conversations.Conversation;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.entity.Player;
import java.util.Comparator;
@@ -40,17 +36,11 @@ public class RankCommand extends BaseCommand {
@CommandPermission("simpleclans.leader.rank.assign")
@CommandCompletion("@clan_members @ranks")
@Description("{@@command.description.rank.assign}")
public void assign(ClanPlayer player,
public void assign(Player 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;
@@ -65,16 +55,10 @@ public class RankCommand extends BaseCommand {
@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);
public void unassign(Player player, @Conditions("same_clan") @Name("member") ClanPlayerInput cp) {
ClanPlayer cpInput = cp.getClanPlayer();
cpInput.setRank(null);
storage.updateClanPlayer(cpInput);
ChatBlock.sendMessage(player, AQUA + lang("player.unassigned.from.rank", player));
}
@@ -82,8 +66,8 @@ public class RankCommand extends BaseCommand {
@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 conversation = new ConversationFactory(plugin).withFirstPrompt(new CreateRankNamePrompt())
.withLocalEcho(true).buildConversation(player);
conversation.getContext().setSessionData("clan", clan);
conversation.begin();
}
@@ -93,14 +77,9 @@ public class RankCommand extends BaseCommand {
@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()));
}
clan.deleteRank(rank.getName());
storage.updateClan(clan, true);
ChatBlock.sendMessage(player, AQUA + lang("rank.0.deleted", player, rank.getDisplayName()));
}
@Subcommand("%list")
@@ -119,7 +98,7 @@ public class RankCommand extends BaseCommand {
int count = 1;
for (Rank rank : ranks) {
ChatBlock.sendMessage(player, AQUA + lang("ranks.list.item", player, count,
ChatUtils.parseColors(rank.getDisplayName()) + AQUA, rank.getName()));
Helper.parseColors(rank.getDisplayName()) + AQUA, rank.getName()));
count++;
}
}
@@ -138,26 +117,9 @@ public class RankCommand extends BaseCommand {
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());
private final String validPermissionsToMessage = Helper.toMessage(Helper.fromPermissionArray(), ",");
@Default
@CommandPermission("simpleclans.leader.rank.permissions.available")
@@ -178,7 +140,7 @@ public class RankCommand extends BaseCommand {
return;
}
ChatBlock.sendMessage(player, AQUA + lang("rank.0.permissions", player, rank.getDisplayName()));
ChatBlock.sendMessage(player, AQUA + String.join(",", permissions));
ChatBlock.sendMessage(player, AQUA + Helper.toMessage(permissions.toArray(new String[0]), ","));
}
@Subcommand("%add")
@@ -16,68 +16,61 @@ import static org.bukkit.ChatColor.AQUA;
@CommandAlias("%clan")
@Subcommand("%toggle")
@Conditions("%basic_conditions")
@Conditions("%basic_conditions|verified")
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("%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);
}
storage.updateClanPlayer(cp);
}
@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);
@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);
storage.updateClanPlayer(cp);
}
@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);
}
private void toggle(CommandSender sender, String onMessageKey, String offMessageKey, boolean status,
@@ -0,0 +1,44 @@
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.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class ChatSubcommandsCompletion extends AbstractSyncCompletion {
public ChatSubcommandsCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public @NotNull String getId() {
return "chat_subcommands";
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
Player player = context.getPlayer();
if (player == null) {
return Collections.emptyList();
}
String leave = lang("leave", player);
List<String> subcommands = new ArrayList<>(Arrays.asList(lang("join", player), leave, lang("mute",
player)));
ClanPlayer cp = clanManager.getAnyClanPlayer(player.getUniqueId());
if (cp != null) {
if (cp.getChannel() == ClanPlayer.Channel.NONE) {
subcommands.remove(leave);
}
}
return subcommands;
}
}
@@ -10,10 +10,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class ClanMembersCompletion extends AbstractSyncCompletion {
public ClanMembersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
@@ -25,11 +23,7 @@ public class ClanMembersCompletion extends AbstractSyncCompletion {
if (player != null) {
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
if (clan != null) {
List<String> list = clan.getMembers().stream().map(ClanPlayer::getName).collect(Collectors.toList());
if (c.hasConfig("hide_own")) {
list.remove(player.getName());
}
return list;
return clan.getAllMembers().stream().map(ClanPlayer::getName).collect(Collectors.toList());
}
}
return Collections.emptyList();
@@ -1,16 +1,14 @@
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;
import java.util.stream.Stream;
public class ClansCompletion extends AbstractSyncCompletion {
public ClansCompletion(@NotNull SimpleClans plugin) {
@@ -19,28 +17,18 @@ public class ClansCompletion extends AbstractSyncCompletion {
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
List<Clan> clans = clanManager.getClans();
Stream<Clan> clans = clanManager.getClans().stream();
if (c.hasConfig("has_home")) {
clans.removeIf(clan -> clan.getHomeLocation() == null);
clans = clans.filter(clan -> clan.getHomeLocation() != null);
}
if (c.hasConfig("unverified")) {
clans.removeIf(Clan::isVerified);
clans = clans.filter(clan -> !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());
return clans.map(Clan::getTag).collect(Collectors.toList());
}
@Override
public @NotNull String getId() {
return "clans";
}
private @Nullable Clan getClan(CommandIssuer issuer) {
return clanManager.getClanByPlayerUniqueId(issuer.getUniqueId());
}
}
@@ -3,13 +3,12 @@ package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class NonMembersCompletion extends AbstractSyncCompletion {
@@ -24,16 +23,10 @@ public class NonMembersCompletion extends AbstractSyncCompletion {
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
Collection<String> onlinePlayers = new ArrayList<>();
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
boolean vanished = VanishUtils.isVanished(c.getSender(), onlinePlayer);
if (clanManager.getClanByPlayerUniqueId(onlinePlayer.getUniqueId()) != null || (c.hasConfig("ignore_vanished") && vanished)) {
continue;
}
onlinePlayers.add(onlinePlayer.getName());
}
return onlinePlayers;
Player player = c.getPlayer();
return Bukkit.getOnlinePlayers().stream()
.filter(p -> clanManager.getClanByPlayerUniqueId(p.getUniqueId()) == null
&& (player == null || player.canSee(p)))
.map(Player::getName).collect(Collectors.toList());
}
}
@@ -1,7 +1,10 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.RequestManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractCondition implements IdentifiableCondition {
@@ -11,7 +14,6 @@ public abstract class AbstractCondition implements IdentifiableCondition {
protected final ClanManager clanManager;
protected final RequestManager requestManager;
protected final SettingsManager settingsManager;
protected final ProtectionManager protectionManager;
public AbstractCondition(@NotNull SimpleClans plugin) {
this.plugin = plugin;
@@ -19,6 +21,5 @@ public abstract class AbstractCondition implements IdentifiableCondition {
clanManager = plugin.getClanManager();
requestManager = plugin.getRequestManager();
settingsManager = plugin.getSettingsManager();
protectionManager = plugin.getProtectionManager();
}
}
@@ -11,7 +11,6 @@ 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 {
@@ -27,7 +26,7 @@ public class CanChangeFeeCondition extends AbstractCommandCondition {
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) {
if (interval <= settingsManager.geteMemberFeeLastMinuteChangeInterval() * HOUR_IN_MINUTES) {
BukkitCommandIssuer issuer = context.getIssuer();
String error = lang("cannot.change.member.fee.now", issuer);
if (interval <= 60) {
@@ -41,8 +40,8 @@ public class CanChangeFeeCondition extends AbstractCommandCondition {
private LocalDateTime getCollectTime() {
LocalDateTime now = LocalDateTime.now();
LocalDateTime collectTime = now.withHour(settingsManager.getInt(TASKS_COLLECT_FEE_HOUR))
.withMinute(settingsManager.getInt(TASKS_COLLECT_FEE_MINUTE));
LocalDateTime collectTime = now.withHour(settingsManager.getTasksCollectFeeHour())
.withMinute(settingsManager.getTasksCollectFeeMinute());
if (collectTime.isBefore(now)) {
collectTime = collectTime.plusDays(1);
}
@@ -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.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField;
public class CanChatCondition extends AbstractCommandCondition {
public CanChatCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
String type = context.getConfigValue("type", (String) null).toUpperCase();
ConfigField chatEnabled = ConfigField.valueOf(type + "CHAT_ENABLE");
if (!settingsManager.is(chatEnabled)) {
throw new ConditionFailedException(lang(type.toLowerCase() + ".chat.disabled", context.getIssuer()));
}
}
@Override
public @NotNull String getId() {
return "can_chat";
}
}
@@ -23,12 +23,12 @@ public class CanVoteCondition extends AbstractCommandCondition {
ClanPlayer cp = clanManager.getCreateClanPlayer(player.getUniqueId());
Clan clan = cp.getClan();
if (clan != null) {
if (!requestManager.hasRequest(clan.getTag())) {
throw new ConditionFailedException(lang("nothing.to.vote", player));
}
if (!clan.isLeader(player)) {
throw new ConditionFailedException(RED + lang("no.leader.permissions", player));
}
if (!requestManager.hasRequest(clan.getTag())) {
throw new ConditionFailedException(lang("nothing.to.vote", player));
}
if (cp.getVote() != null) {
throw new ConditionFailedException(RED + lang("you.have.already.voted", player));
}
@@ -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";
}
}
@@ -24,7 +24,7 @@ public class InputVerifiedCondition extends AbstractParameterCondition<ClanInput
BukkitCommandExecutionContext execContext,
ClanInput value)
throws InvalidCommandArgument {
if (!value.getClan().isVerified() && !context.getIssuer().hasPermission("simpleclans.mod.bypass")) {
if (!value.getClan().isVerified()) {
throw new ConditionFailedException(lang("other.clan.not.verified", execContext.getSender()));
}
}
@@ -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.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.LAND_SHARING;
@SuppressWarnings("unused")
public class LandSharingCondition extends AbstractCommandCondition {
public LandSharingCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
if (!settingsManager.is(LAND_SHARING)) {
throw new ConditionFailedException(lang("land.sharing.disabled", context.getIssuer()));
}
}
@Override
public @NotNull String getId() {
return "land_sharing";
}
}
@@ -9,7 +9,6 @@ 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) {
@@ -18,7 +17,7 @@ public class MemberFeeEnabledCondition extends AbstractCommandCondition {
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
if (!settingsManager.is(ECONOMY_MEMBER_FEE_ENABLED)) {
if (!settingsManager.isMemberFee()) {
throw new ConditionFailedException(ChatColor.RED + lang("disabled.command",
context.getIssuer().getIssuer()));
}
@@ -6,10 +6,10 @@ 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.command.CommandSender;
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")
@@ -21,9 +21,9 @@ public class MinimumToAllyCondition extends AbstractCommandCondition {
@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)) {
if (clan.getSize() < settingsManager.getClanMinSizeToAlly()) {
throw new ConditionFailedException(RED +
lang("minimum.to.make.alliance", context.getIssuer(), settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_ALLY)));
lang("minimum.to.make.alliance", context.getIssuer(), settingsManager.getClanMinSizeToAlly()));
}
}
@@ -9,7 +9,6 @@ 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")
@@ -22,9 +21,9 @@ public class MinimumToRivalCondition extends AbstractCommandCondition {
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)) {
if (clan.getSize() < settingsManager.getClanMinSizeToRival()) {
throw new ConditionFailedException(RED + lang("min.players.rivalries", issuer,
settingsManager.getInt(CLAN_MIN_SIZE_TO_SET_RIVAL)));
settingsManager.getClanMinSizeToRival()));
}
}
@@ -9,8 +9,6 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.BLACKLISTED_WORLDS;
@SuppressWarnings("unused")
public class NotBlacklistedCondition extends AbstractCommandCondition {
@@ -24,7 +22,7 @@ public class NotBlacklistedCondition extends AbstractCommandCondition {
if (player != null) {
World world = player.getLocation().getWorld();
if (world != null) {
if (settingsManager.getStringList(BLACKLISTED_WORLDS).contains(world.getName())) {
if (settingsManager.isBlacklistedWorld(world.getName())) {
throw new ConditionFailedException();
}
}
@@ -1,12 +1,10 @@
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;
@@ -26,9 +24,7 @@ public class NotInClanCondition extends AbstractParameterCondition<ClanPlayerInp
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) {
if (value.getClanPlayer().getClan() != null) {
throw new ConditionFailedException(RED + lang("the.player.is.already.member.of.another.clan",
execContext.getSender()));
}
@@ -1,14 +1,10 @@
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")
@@ -25,18 +21,9 @@ public class OnlineCondition extends AbstractParameterCondition<ClanPlayerInput>
@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;
}
if (value.getClanPlayer().toPlayer() == null) {
throw new ConditionFailedException(lang("other.player.must.be.online", execContext.getSender()));
}
throw new ConditionFailedException(lang("other.player.must.be.online", execContext.getSender()));
}
@Override
@@ -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.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class OwnLandCondition extends AbstractCommandCondition {
public OwnLandCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
Player player = Conditions.assertPlayer(context.getIssuer());
if (protectionManager.getLands(player, player.getLocation()).isEmpty()) {
throw new ConditionFailedException(lang("you.do.not.own.lands", player));
}
}
@Override
public @NotNull String getId() {
return "own_land";
}
}
@@ -8,8 +8,6 @@ import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.debug;
@SuppressWarnings("unused")
public class PlayerClanMemberCondition extends AbstractParameterCondition<Player> {
public PlayerClanMemberCondition(@NotNull SimpleClans plugin) {
@@ -25,7 +23,6 @@ public class PlayerClanMemberCondition extends AbstractParameterCondition<Player
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
Player value) throws InvalidCommandArgument {
debug(String.format("PlayerClanMemberCondition -> %s %s", value.getName(), value.getUniqueId()));
Conditions.assertClanMember(clanManager, context.getIssuer());
}
@@ -1,42 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Flags;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public class TeleportCondition extends AbstractParameterCondition<Clan> {
public TeleportCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<Clan> getType() {
return Clan.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
Clan value) throws InvalidCommandArgument {
Player player = execContext.getPlayer();
if (value.getHomeLocation() == null) {
throw new ConditionFailedException(lang("hombase.not.set", player));
}
Flags flags = new Flags(value.getFlags());
String homeServer = flags.getString("homeServer", "");
if (!homeServer.isEmpty() && !plugin.getProxyManager().getServerName().equals(homeServer)) {
throw new ConditionFailedException(lang("home.set.in.different.server"));
}
}
@Override
public @NotNull String getId() {
return "can_teleport";
}
}
@@ -1,31 +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.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import org.jetbrains.annotations.NotNull;
public class TeleportInputCondition extends AbstractParameterCondition<ClanInput> {
public TeleportInputCondition(@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 {
new TeleportCondition(plugin).validateCondition(context, execContext, value.getClan());
}
@Override
public @NotNull String getId() {
return "can_teleport";
}
}
@@ -2,44 +2,25 @@ package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.MinecraftMessageKeys;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import java.util.regex.Pattern;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.USERNAME_REGEX;
@SuppressWarnings("unused")
public class ClanPlayerInputContextResolver extends AbstractInputOnlyContextResolver<ClanPlayerInput> {
private final Pattern validUsername;
public ClanPlayerInputContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
validUsername = Pattern.compile(plugin.getSettingsManager().getString(USERNAME_REGEX));
}
@Override
public ClanPlayerInput getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
String arg = context.popFirstArg();
if (!validUsername.matcher(arg).matches()) {
throw new InvalidCommandArgument(MinecraftMessageKeys.IS_NOT_A_VALID_NAME, "{name}", arg);
}
ClanPlayer cp = clanManager.getAnyClanPlayer(arg);
if (cp == null) {
Player player = Bukkit.getPlayer(arg);
if (player == null) {
throw new InvalidCommandArgument(lang("user.hasnt.played.before", context.getSender()));
}
cp = clanManager.getCreateClanPlayer(player.getUniqueId());
}
@SuppressWarnings("deprecation")
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(arg);
ClanPlayer cp = clanManager.getCreateClanPlayer(offlinePlayer.getUniqueId());
return new ClanPlayerInput(cp);
}
@@ -48,5 +29,4 @@ public class ClanPlayerInputContextResolver extends AbstractInputOnlyContextReso
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
}
@@ -2,12 +2,12 @@ package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.MessageKeys;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static co.aikar.commands.MessageKeys.*;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public class Contexts {
@@ -30,17 +30,8 @@ public class Contexts {
public static Player assertPlayer(@NotNull BukkitCommandIssuer issuer) {
Player player = issuer.getPlayer();
if (player == null) {
throw new InvalidCommandArgument(NOT_ALLOWED_ON_CONSOLE, false);
throw new InvalidCommandArgument(MessageKeys.NOT_ALLOWED_ON_CONSOLE, false);
}
return player;
}
public static void validateMinMax(Number val, Number minValue, Number maxValue) throws InvalidCommandArgument {
if (maxValue != null && val.doubleValue() > maxValue.doubleValue()) {
throw new InvalidCommandArgument(PLEASE_SPECIFY_AT_MOST, "{max}", String.valueOf(maxValue));
}
if (minValue != null && val.doubleValue() < minValue.doubleValue()) {
throw new InvalidCommandArgument(PLEASE_SPECIFY_AT_LEAST, "{min}", String.valueOf(minValue));
}
}
}
@@ -1,16 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class DoubleContextResolver extends DoublePrimitiveContextResolver {
public DoubleContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<Double> getType() {
return Double.class;
}
}
@@ -1,39 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.MessageKeys;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.commands.contexts.Contexts.validateMinMax;
@SuppressWarnings("unused")
public class DoublePrimitiveContextResolver extends AbstractInputOnlyContextResolver<Double> {
public DoublePrimitiveContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Double getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
String number = context.popFirstArg();
try {
double val = Double.parseDouble(number);
if (!Double.isFinite(val)) {
throw new NumberFormatException();
}
validateMinMax(val, Double.MIN_VALUE, Double.MAX_VALUE);
return val;
} catch (NumberFormatException e) {
throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", number);
}
}
@Override
public Class<Double> getType() {
return double.class;
}
}
@@ -1,16 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class FloatContextResolver extends FloatPrimitiveContextResolver {
public FloatContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<Float> getType() {
return Float.class;
}
}
@@ -1,36 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.MessageKeys;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.commands.contexts.Contexts.validateMinMax;
@SuppressWarnings("unused")
public class FloatPrimitiveContextResolver extends AbstractInputOnlyContextResolver<Float> {
public FloatPrimitiveContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Float getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
String number = context.popFirstArg();
try {
float val = Float.parseFloat(number);
if (!Float.isFinite(val)) {
throw new NumberFormatException();
}
validateMinMax(val, Float.MIN_VALUE, Float.MAX_VALUE);
return val;
} catch (NumberFormatException e) {
throw new InvalidCommandArgument(MessageKeys.MUST_BE_A_NUMBER, "{num}", number);
}
}
@Override
public Class<Float> getType() {
return float.class;
}
}
@@ -10,8 +10,6 @@ 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;
@@ -32,7 +30,7 @@ public class Alliances extends Sendable {
continue;
}
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getAllyString(DARK_GRAY + ", ", sender));
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getAllyString(DARK_GRAY + ", "));
}
sendBlock();
@@ -40,9 +38,9 @@ public class Alliances extends Sendable {
private void sendHeader() {
ChatBlock.sendBlank(sender);
ChatBlock.saySingle(sender, sm.getColored(SERVER_NAME) + subColor + " " +
ChatBlock.saySingle(sender, sm.getServerName() + subColor + " " +
lang("alliances", sender) + " " + headColor +
Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(sender);
chatBlock.setAlignment("l", "l");
@@ -12,7 +12,6 @@ import java.util.Map;
import java.util.TreeMap;
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.WHITE;
@@ -33,8 +32,8 @@ public class ClanCoords extends Sendable {
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 name = (cpm.isLeader() ? sm.getPageLeaderColor() : (cpm.isTrusted() ?
sm.getPageTrustedColor() : sm.getPageUnTrustedColor())) + cpm.getName();
Location loc = p.getLocation();
int distance = (int) Math.ceil(loc.toVector().distance(player.getLocation().toVector()));
String coords = loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ();
@@ -58,8 +57,8 @@ public class ClanCoords extends Sendable {
chatBlock.setAlignment("l", "c", "c", "c");
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, sm.getColored(PAGE_CLAN_NAME_COLOR) + clan.getName() + subColor + " " +
lang("coords", player) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
ChatBlock.saySingle(player, sm.getPageClanNameColor() + clan.getName() + subColor + " " +
lang("coords", player) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(player);
chatBlock.addRow(" " + headColor + lang("name", player), lang("distance", player),
@@ -14,7 +14,6 @@ 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.*;
@@ -53,7 +52,7 @@ public class ClanList extends Sendable {
@Nullable String order) {
boolean ascending = order == null || lang("list.order.asc").equalsIgnoreCase(order);
if (type == null) {
type = sm.getString(LIST_DEFAULT_ORDER_BY);
type = sm.getListDefaultOrderBy();
}
if (type.equalsIgnoreCase(lang("list.type.size"))) {
return new RankingNumberResolver<>(clans, Clan::getSize, order != null && ascending, ORDINAL);
@@ -74,15 +73,15 @@ public class ClanList extends Sendable {
@NotNull
private List<Clan> getListableClans() {
List<Clan> clans = plugin.getClanManager().getClans();
clans = clans.stream().filter(clan -> clan.isVerified() || sm.is(SHOW_UNVERIFIED_ON_LIST))
clans = clans.stream().filter(clan -> clan.isVerified() || sm.isShowUnverifiedOnList())
.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.saySingle(sender, sm.getServerName() + subColor + " " + lang("clans.lower", sender)
+ " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(sender);
ChatBlock.sendMessage(sender, headColor + lang("total.clans", sender) + " " + subColor + clans.size());
ChatBlock.sendBlank(sender);
@@ -92,11 +91,12 @@ public class ClanList extends Sendable {
lang("kdr", sender), lang("members", sender));
}
@SuppressWarnings("deprecation")
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 tag = sm.getClanChatBracketColor() + sm.getClanChatTagBracketLeft()
+ sm.getTagDefaultColor() + clan.getColorTag() + sm.getClanChatBracketColor()
+ sm.getClanChatTagBracketRight();
String name = (clan.isVerified() ? sm.getPageClanNameColor() : GRAY) + clan.getName();
String fullname = tag + " " + name;
String size = WHITE + "" + clan.getSize();
String kdr = clan.isVerified() ? YELLOW + "" + KDRFormat.format(clan.getTotalKDR()) : "";
@@ -1,7 +1,6 @@
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;
@@ -9,7 +8,6 @@ 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 {
@@ -25,31 +23,42 @@ public class ClanProfile extends Sendable {
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_verified%", getVerifiedStatus())
.replace("%clan_leaders%", clan.getLeadersString(sm.getPageLeaderColor(), 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_allies%", clan.getAllyString(subColor + ", "))
.replace("%clan_rivals%", clan.getRivalString(subColor + ", "))
.replace("%clan_founded%", clan.getFoundedString())
.replace("%clan_inactive_days%", String.valueOf(clan.getInactiveDays()))
.replace("%clan_max_inactive_days%", Helper.formatMaxInactiveDays(clan.getMaxInactiveDays()));
.replace("%clan_max_inactive_days%", getMaxInactiveDays());
sender.sendMessage(message);
}
@NotNull
private String getMaxInactiveDays() {
return String.valueOf(clan.isVerified() ?
sm.getPurgeClan() : sm.getPurgeUnverified());
}
@NotNull
private String getFeeEnabled() {
return clan.isMemberFeeEnabled() ? lang("fee.enabled", sender) : lang("fee.disabled", sender);
}
@NotNull
private String getVerifiedStatus() {
return clan.isVerified() ? sm.getPageTrustedColor() + lang("verified", sender) :
sm.getPageUnTrustedColor() + lang("unverified", sender);
}
@NotNull
private String getDescription() {
return clan.getDescription() != null && !clan.getDescription().isEmpty() ? clan.getDescription() :
@@ -1,15 +1,13 @@
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.bukkit.entity.Player;
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 {
@@ -34,10 +32,12 @@ public class ClanRoster extends Sendable {
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);
Player p = cp.toPlayer();
chatBlock.addRow(" " + name, YELLOW + ChatUtils.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
String name = (cp.isTrusted() ? sm.getPageTrustedColor() : sm.getPageUnTrustedColor()) + cp.getName();
String lastSeen = p != null && p.isOnline() && !Helper.isVanished(sender, p) ? GREEN + lang("online", sender) : WHITE + cp.getLastSeenDaysString(sender);
chatBlock.addRow(" " + name, YELLOW + Helper.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
}
}
@@ -45,22 +45,24 @@ public class ClanRoster extends Sendable {
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);
Player p = cp.toPlayer();
chatBlock.addRow(" " + name, YELLOW + ChatUtils.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
String name = sm.getPageLeaderColor() + cp.getName();
String lastSeen = p != null && p.isOnline() && !Helper.isVanished(sender, p) ? GREEN + lang("online", sender)
: WHITE + cp.getLastSeenDaysString(sender);
chatBlock.addRow(" " + name, YELLOW + Helper.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.saySingle(sender, sm.getPageClanNameColor() + clan.getName() + subColor + " " +
lang("roster", sender) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
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.sendMessage(sender, headColor + lang("legend", sender) + " " + sm.getPageLeaderColor() +
lang("leader", sender) + headColor + ", " + sm.getPageTrustedColor() + lang("trusted", sender) +
headColor + ", " + sm.getPageUnTrustedColor() + lang("untrusted", sender));
ChatBlock.sendBlank(sender);
chatBlock.setFlexibility(false, true, false, true);
@@ -9,7 +9,6 @@ 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 {
@@ -37,15 +36,15 @@ public class ClanStats extends Sendable {
}
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.saySingle(sender, sm.getPageClanNameColor() + clan.getName() + subColor + " " +
lang("stats", sender) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
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));
+ ": " + subColor + sm.getKwRival() + headColor + " " + lang("neutral", sender) + ": " + subColor +
sm.getKwNeutral() + headColor + " " + lang("civilian", sender) + ": " + subColor +
sm.getKwCivilian());
ChatBlock.sendBlank(sender);
chatBlock.setFlexibility(true, false, false, false, false, false, false);
@@ -57,8 +56,8 @@ public class ClanStats extends Sendable {
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 name = (cpm.isLeader() ? sm.getPageLeaderColor() : (cpm.isTrusted() ? sm.getPageTrustedColor() :
sm.getPageUnTrustedColor())) + cpm.getName();
String rival = NumberFormat.getInstance().format(cpm.getRivalKills());
String neutral = NumberFormat.getInstance().format(cpm.getNeutralKills());
String civilian = NumberFormat.getInstance().format(cpm.getCivilianKills());
@@ -11,8 +11,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.Map;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PAGE_CLAN_NAME_COLOR;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.PAGE_SEPARATOR;
public class Kills extends Sendable {
@@ -55,9 +53,9 @@ public class Kills extends Sendable {
chatBlock.setFlexibility(true, false);
chatBlock.setAlignment("l", "c");
chatBlock.addRow(" " + headColor + lang("victim", player), lang("killcount", player));
ChatBlock.saySingle(player, sm.getColored(PAGE_CLAN_NAME_COLOR) + polled + subColor
ChatBlock.saySingle(player, sm.getPageClanNameColor() + polled + subColor
+ " " + lang("kills", player) + " " + headColor +
Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(player);
}
}
@@ -6,7 +6,6 @@ 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;
@@ -14,7 +13,6 @@ 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 {
@@ -38,10 +36,10 @@ public class Leaderboard extends Sendable {
private void addLines() {
for (ClanPlayer cp : clanPlayers) {
boolean online = !VanishUtils.isVanished(cp);
boolean online = cp.toPlayer() != null;
String name = (cp.isLeader() ? sm.getColored(PAGE_LEADER_COLOR) : (cp.isTrusted() ? sm.getColored(PAGE_TRUSTED_COLOR) :
sm.getColored(PAGE_UNTRUSTED_COLOR))) + cp.getName();
String name = (cp.isLeader() ? sm.getPageLeaderColor() : (cp.isTrusted() ? sm.getPageTrustedColor() :
sm.getPageUnTrustedColor())) + cp.getName();
String lastSeen = online ? GREEN + lang("online", sender) : WHITE + cp.getLastSeenDaysString(sender);
String clanTag = WHITE + lang("free.agent", sender);
@@ -57,8 +55,8 @@ public class Leaderboard extends Sendable {
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.saySingle(sender, sm.getServerName() + subColor + " " + lang("leaderboard.command", sender)
+ " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(sender);
ChatBlock.sendMessage(sender, headColor + lang("total.clan.players.0", sender, subColor +
clanPlayers.size()));
@@ -1,7 +1,6 @@
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.KDRFormat;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -11,7 +10,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.UUID;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static org.bukkit.ChatColor.*;
public class Lookup extends Sendable {
@@ -40,19 +38,18 @@ public class Lookup extends Sendable {
String lookup = lang("player.lookup", sender)
.replace("%player_name%", target.getName())
.replace("%clan_name%", getClanName())
.replace("%player_rank%", ChatUtils.parseColors(target.getRankDisplayName()))
.replace("%player_rank%", Helper.parseColors(target.getRankDisplayName()))
.replace("%player_status%", getPlayerStatus())
.replace("%player_kdr%", KDRFormat.format(target.getKDR()))
.replace("%player_rival_kills%", String.valueOf(target.getRivalKills()))
.replace("%player_neutral_kills%", String.valueOf(target.getNeutralKills()))
.replace("%player_civilian_kills%", String.valueOf(target.getCivilianKills()))
.replace("%player_ally_kills%", String.valueOf(target.getAllyKills()))
.replace("%player_deaths%", String.valueOf(target.getDeaths()))
.replace("%player_join_date%", target.getJoinDateString())
.replace("%player_last_seen%", target.getLastSeenString(sender))
.replace("%player_past_clans%", target.getPastClansString(headColor + ", "))
.replace("%player_inactive_days%", String.valueOf(target.getInactiveDays()))
.replace("%player_max_inactive_days%", Helper.formatMaxInactiveDays(sm.getInt(PURGE_INACTIVE_PLAYER_DAYS)))
.replace("%player_max_inactive_days%", String.valueOf(sm.getPurgePlayers()))
.replace("%kill_type_line%", getKillTypeLine());
sender.sendMessage(lookup);
} else {
@@ -78,19 +75,10 @@ public class Lookup extends Sendable {
@NotNull
private String getPlayerStatus() {
if (target == null || targetClan == null) {
return lang("free.agent", sender);
}
if (target.isLeader()) {
return sm.getColored(PAGE_LEADER_COLOR) + lang("leader", sender);
}
if (target.isTrusted()) {
return sm.getColored(PAGE_TRUSTED_COLOR) + lang("trusted", sender);
}
if (!target.getRankId().isEmpty()) {
return sm.getColored(PAGE_TRUSTED_COLOR) + lang("in.rank", sender);
}
return sm.getColored(PAGE_UNTRUSTED_COLOR) + lang("untrusted", sender);
return target == null || targetClan == null ? lang("free.agent", sender) : (target.isLeader() ?
sm.getPageLeaderColor() + lang("leader", sender) : (target.isTrusted() ?
sm.getPageTrustedColor() + lang("trusted", sender) : sm.getPageUnTrustedColor() +
lang("untrusted", sender)));
}
@NotNull
@@ -101,13 +89,8 @@ public class Lookup extends Sendable {
if (targetClan == null) {
killType = DARK_GRAY + lang("civilian", sender);
} else if (senderClan != null) {
if (senderClan.isRival(targetClan.getTag())) {
killType = WHITE + lang("rival", sender);
}
if (senderClan.equals(targetClan) || senderClan.isAlly(targetClan.getTag())) {
killType = RED + lang("ally", sender);
}
} else if (senderClan != null && senderClan.isRival(targetClan.getTag())) {
killType = WHITE + lang("rival", sender);
}
killTypeLine = lang("player.lookup.killtype", sender).replace("%player_kill_type%", killType);
@@ -10,8 +10,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.Map;
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 MostKilled extends Sendable {
@@ -66,8 +64,8 @@ public class MostKilled extends Sendable {
chatBlock.addRow(" " + headColor + lang("victim", player), headColor +
lang("killcount", player), headColor + lang("attacker", player));
ChatBlock.saySingle(player, sm.getColored(SERVER_NAME) + subColor + " " + lang("mostkilled",
player) + " " + headColor + Helper.generatePageSeparator(sm.getString(PAGE_SEPARATOR)));
ChatBlock.saySingle(player, sm.getServerName() + subColor + " " + lang("mostkilled",
player) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(player);
}
}
@@ -10,8 +10,6 @@ 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 {
@@ -31,7 +29,7 @@ public class Rivalries extends Sendable {
continue;
}
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getRivalString(DARK_GRAY + ", ", sender));
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getRivalString(DARK_GRAY + ", "));
}
sendBlock();
@@ -39,8 +37,8 @@ public class Rivalries extends Sendable {
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.saySingle(sender, sm.getServerName() + subColor + " " +
lang("rivalries", sender) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(sender);
ChatBlock.sendMessage(sender, headColor + lang("legend", sender) + DARK_RED + " [" +
lang("war", sender) + "]");
@@ -8,7 +8,6 @@ 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.*;
public abstract class Sendable {
@@ -26,19 +25,19 @@ public abstract class Sendable {
sm = plugin.getSettingsManager();
cm = plugin.getClanManager();
this.sender = sender;
headColor = sm.getColored(PAGE_HEADINGS_COLOR);
subColor = sm.getColored(PAGE_SUBTITLE_COLOR);
headColor = sm.getPageHeadingsColor();
subColor = sm.getPageSubTitleColor();
}
protected void sendBlock() {
SettingsManager sm = plugin.getSettingsManager();
boolean more = chatBlock.sendBlock(sender, sm.getInt(PAGE_SIZE));
boolean more = chatBlock.sendBlock(sender, sm.getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(sender, chatBlock);
ChatBlock.sendBlank(sender);
ChatBlock.sendMessage(sender, sm.getColored(PAGE_HEADINGS_COLOR) + lang("view.next.page", sender,
sm.getString(COMMANDS_MORE)));
ChatBlock.sendMessage(sender, sm.getPageHeadingsColor() + lang("view.next.page", sender,
sm.getCommandMore()));
}
ChatBlock.sendBlank(sender);
}
@@ -9,7 +9,6 @@ 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 {
@@ -39,8 +38,8 @@ public class Vitals extends Sendable {
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.saySingle(sender, sm.getPageClanNameColor() + clan.getName() + subColor + " " +
lang("vitals", sender) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
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));
@@ -64,10 +63,10 @@ public class Vitals extends Sendable {
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 name = (cpm.isLeader() ? sm.getPageLeaderColor() : (cpm.isTrusted() ? sm.getPageTrustedColor()
: sm.getPageUnTrustedColor())) + cpm.getName();
String health = cm.getHealthString(p.getHealth());
String hunger = cm.getHungerString(p.getFoodLevel());
String armor = cm.getArmorString(p.getInventory());
String weapons = cm.getWeaponString(p.getInventory());
String food = cm.getFoodString(p.getInventory());
@@ -13,26 +13,23 @@ 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.SCConversation;
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.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationFactory;
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")
@@ -52,9 +49,10 @@ public class GeneralCommands extends BaseCommand {
@Default
@Description("{@@command.description.clan}")
@CommandAlias("%clan")
@HelpSearchTags("menu gui interface ui")
public void main(CommandSender sender) {
if (sender instanceof Player && settings.is(ENABLE_GUI)) {
if (sender instanceof Player && settings.isEnableGUI()) {
InventoryDrawer.open(new MainFrame((Player) sender));
} else {
help(sender, new CommandHelp(getCurrentCommandManager(),
@@ -76,8 +74,8 @@ public class GeneralCommands extends BaseCommand {
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 conversation = new ConversationFactory(plugin).withFirstPrompt(new CreateClanTagPrompt())
.withLocalEcho(true).withInitialSessionData(initialData).buildConversation(player);
conversation.begin();
}
@@ -93,8 +91,8 @@ public class GeneralCommands extends BaseCommand {
@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());
public void lookup(CommandSender sender, @Name("player") OfflinePlayer player) {
Lookup l = new Lookup(plugin, sender, player.getUniqueId());
l.send();
}
@@ -122,7 +120,7 @@ public class GeneralCommands extends BaseCommand {
@Subcommand("%profile")
@CommandPermission("simpleclans.anyone.profile")
@CommandCompletion("@clans:hide_own")
@CommandCompletion("@clans")
@Description("{@@command.description.profile.other}")
public void profile(CommandSender sender, @Conditions("verified") @Name("clan") ClanInput clan) {
ClanProfile p = new ClanProfile(plugin, sender, clan.getClan());
@@ -130,7 +128,7 @@ public class GeneralCommands extends BaseCommand {
}
@Subcommand("%roster")
@CommandCompletion("@clans:hide_own")
@CommandCompletion("@clans")
@CommandPermission("simpleclans.anyone.roster")
@Description("{@@command.description.roster.other}")
public void roster(CommandSender sender, @Conditions("verified") @Name("clan") ClanInput clan) {
@@ -160,7 +158,7 @@ public class GeneralCommands extends BaseCommand {
@CommandPermission("simpleclans.vip.resetkdr")
@Description("{@@command.description.resetkdr}")
public void resetKdr(Player player, ClanPlayer cp) {
if (!settings.is(ALLOW_RESET_KDR)) {
if (!settings.isAllowResetKdr()) {
ChatBlock.sendMessage(player, RED + lang("disabled.command", player));
return;
}
@@ -202,12 +200,12 @@ public class GeneralCommands extends BaseCommand {
return;
}
chatBlock.sendBlock(player, settings.getInt(PAGE_SIZE));
chatBlock.sendBlock(player, settings.getPageSize());
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.sendMessage(player, settings.getPageHeadingsColor() + lang("view.next.page", player,
settings.getCommandMore()));
}
ChatBlock.sendBlank(player);
}
@@ -236,31 +234,6 @@ public class GeneralCommands extends BaseCommand {
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.getBalance());
sender.sendMessage(line);
}
}
@Subcommand("%list")
@CommandPermission("simpleclans.anyone.list")
@Description("{@@command.description.list}")
@@ -1,89 +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 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.getBalance()));
}
@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, amount, clan.getName()));
clan.addBb(sender.getName(), AQUA + lang("bb.clan.take", sender, amount, sender.getName()));
break;
case NOT_ENOUGH_BALANCE:
sender.sendMessage(RED + lang("clan.admin.bank.not.enough.money", sender, clan.getName()));
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, amount, clan.getName()));
clan.addBb(sender.getName(), AQUA + lang("bb.clan.give", sender, 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(), amount));
clan.addBb(sender.getName(), AQUA + lang("bb.clan.set", sender, amount, sender.getName()));
}
}
}
Loaded 100 of 307 files, more files were not shown because too many files have changed in this diff. Show more