Compare commits

...
419 Commits
Author SHA1 Message Date
NotAlexNoyle 07c630deaf Point submodules at canonical Gitea repositories 2026-11-01 12:54:06 -05:00
NotAlexNoyle 88ff9fe559 Update canonical Gitea links 2026-10-31 11:39:48 -04:00
NotAlexNoyle a0b4b2ffa0 Update canonical Gitea links 2026-10-31 11:39:48 -04:00
NotAlexNoyle 541b3c1c72 Update canonical Gitea links 2026-10-31 11:39:48 -04:00
NotAlexNoyle 56dfe76ffa Update canonical Gitea links 2026-10-31 11:39:48 -04:00
NotAlexNoyle 42a07a697b Exclude CODEOWNERS from language statistics 2026-10-31 09:54:56 -04:00
NotAlexNoyle 78a41622f4 Add CODEOWNERS (one staff approval) 2026-10-31 09:54:56 -04:00
NotAlexNoyle 59bd8d87ab universal pvp toggle 2026-09-14 11:16:20 -04:00
NotAlexNoyle 46e776cdc5 Update Utilities-OG 2026-09-14 02:01:11 -04:00
NotAlexNoyle a3993384d9 Fix same case rename 2026-08-20 11:33:28 -04:00
NotAlexNoyle 00c08e6eb5 v2.5.1 update 2026-08-15 10:12:50 -04:00
NotAlexNoyle ace6904cf6 v2.5 Release 2026-08-13 16:25:17 -04:00
NotAlexNoyle e2d3ebfe70 Update commands 2026-08-12 12:11:15 -04:00
NotAlexNoyle a61ae9894f v2.4 Release 2026-08-10 11:10:11 -04:00
NotAlexNoyle 0d6f429e1e Update tag format 2026-08-09 12:02:30 -04:00
NotAlexNoyle a02ef45497 Change home timer to 5s 2026-08-09 11:09:38 -04:00
NotAlexNoyle 6650799f71 Remove union verification 2026-08-08 15:31:26 -04:00
NotAlexNoyle 449c0b3961 No more untrust 2026-08-08 11:25:43 -04:00
NotAlexNoyle 6d5e6f38e6 Remove update checker 2026-07-29 17:14:08 -04:00
NotAlexNoyle 035f4dcba6 Update DiamondBank-OG API 2026-07-29 12:19:03 -04:00
NotAlexNoyle cf583f481e Old database migration 2026-07-29 12:18:58 -04:00
NotAlexNoyle 7091da2d3d Update DiamondBank-OG 2026-07-27 07:57:56 -04:00
NotAlexNoyle 358bb00180 Spotless formatting 2026-07-24 12:47:36 -04:00
NotAlexNoyle a9e6f3fa4d Merge pull request #2 from true-og/agent/reorder-main-gui-union-banking
Reorder main GUI and add Union Banking preview
2026-07-24 12:36:52 -04:00
NotAlexNoyle bb4cd6fc1b Reorder main GUI and add Union Banking preview 2026-07-24 12:33:15 -04:00
NotAlexNoyle 2a0a181399 Update DiamondBank-OG 2026-07-22 07:09:20 -04:00
NotAlexNoyle 32e90b1c80 Vault -> DiamondBank 2026-07-20 14:47:04 -04:00
NotAlexNoyle 3f13f63c18 Make union chat /u 2026-07-20 10:18:35 -04:00
NotAlexNoyle 240a1fc42d Update Utilities-OG API 2026-07-20 00:49:08 -04:00
NotAlexNoyle e85a4007eb Disable bulliten board at startup 2026-06-24 11:40:00 -04:00
NotAlexNoyle 870bff28c8 Remove Template-OG artifact 2026-06-21 21:08:24 -04:00
NotAlexNoyle 76c728688e Update Utilities-OG 2026-05-20 11:10:47 -04:00
NotAlexNoyle 245fa36e1d Update Utilities-OG 2026-05-11 00:44:01 -04:00
NotAlexNoyle f437980d8e Prevent calling Unions None 2026-05-06 14:46:43 -04:00
NotAlexNoyle f1cceaca0c Add MiniPlaceholder support via UtilitiesOG 2026-05-05 23:56:07 -04:00
NotAlexNoyle 3b152d6578 Disable clan verification, update case sensitivity 2026-05-04 17:06:10 -04:00
NotAlexNoyle 0782fd753d Add default placeholder 2026-04-24 11:56:37 -04:00
NotAlexNoyle 941cd4c20d Add /union color command 2026-04-22 15:06:19 -04:00
NotAlexNoyle 9ce6641489 Add /union command 2026-04-22 14:28:39 -04:00
NotAlexNoyle 3886c87637 Release Unions-OG 2026-04-22 13:07:12 -04:00
NotAlexNoyle 1e70ade03e Fix tests 2026-03-30 04:52:40 -04:00
NotAlexNoyle 700e29ce97 Use WorldEdit/WorldGuard 7 API instead of legacy WE6 reflection 2026-03-30 04:25:04 -04:00
NotAlexNoyle 3de15c9adb Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	src/main/java/net/sacredlabyrinth/phaed/simpleclans/managers/StorageManager.java
2026-03-30 04:13:12 -04:00
Edson Passos 0406c61b0f fix: kills table prefix
closes #470
2026-01-08 23:33:54 -03:00
NotAlexNoyle 3969d52184 Fix jar 2025-12-08 22:43:59 -05:00
NotAlexNoyle f4d413e0b3 Update shadow to 8.3.8 2025-09-24 17:28:32 -04:00
NotAlexNoyle 28e545a4ff Add gradle wrapper 2025-09-02 13:08:07 -04:00
NotAlexNoyle 9c921be01a Maven -> Gradle 8.14.3 2025-09-02 12:52:41 -04:00
Edson Passos a2e59c9401 fix: return null when username is not found - UUIDFetcher (#466) 2025-07-17 20:46:05 -03:00
Edson Passos b1b5fef7bf feat(lang): new crowdin updates (#439) 2025-07-14 19:44:41 -03:00
Edson Passos 2bdd6bc3bf fix: check bungee channel version and ownership (#460) 2025-03-18 11:33:56 -03:00
Edson Passos f7081499b2 fix: placeholders being parsed in clan chat 2025-03-08 21:30:35 -03:00
Edson Passos 0f50d498cb build: downgraded to JDK 8 (#459)
Removed built-in support for WorldGuard7 (https://github.com/RoinujNosde/SimpleClans-WorldGuard7)
2025-03-08 21:09:33 -03:00
Edson PassosandTomut0 da8d343897 feat: only send bungee messages to allowed servers (#455)
Co-authored-by: Tomut0 <minat0_@outlook.com>
2025-03-06 20:09:33 -03:00
Minat0_ ee1feb4276 fix: created_at migration should use prefixed table (#456) 2025-03-06 20:07:11 -03:00
Edson Passos 24af2c03d0 fix: missing import for charset 2025-03-05 20:07:50 -03:00
Edson PassosandTomut0 6b2a3f85ac feat: adds completions to clan create command (#452)
Co-authored-by: Tomut0 <minat0_@outlook.com>
2025-03-05 19:54:32 -03:00
Edson PassosandTomut0 57076fb033 fix: uuid bulk fetching over Mojang and minetools APIs (#451)
Co-authored-by: Tomut0 <minat0_@outlook.com>
2025-03-05 19:45:36 -03:00
RoinujNosde 52ff77e6c1 fix: no need to create ClanPlayer on placeholder request 2025-02-17 20:04:30 -03:00
Tomut0 146713fd48 fix: player can change locale even if selector is disabled 2025-02-08 20:40:50 -03:00
RoinujNosde c8e67cfd4f fix: Bukkit#getOfflinePlayers causing the server to hang 2025-02-08 20:31:08 -03:00
Tomut0 f4f47b2060 fix: clan disband should require a confirmation in gui 2025-01-30 21:12:59 -03:00
Minat0_ 13cf348084 feat: compile under Java 21 LTS (#446) 2025-01-19 19:07:44 -03:00
RoinujNosde b37512be7d fix: RequestManager requesting data from Mojang servers 2024-12-26 19:19:35 -03:00
RoinujNosde 9097fa02fa fix: getAnyClanPlayer(String) requesting data from Mojang servers 2024-12-21 20:34:17 -03:00
Minat0_ a759884b8d fix(discord): use fresh reference for guild and role objects and non-cached channels (#438) 2024-11-11 16:26:40 -03:00
Minat0_ f5e1387246 feat(db): add datetime column to sc_kills (#432)
Co-authored-by: Minat0_ <minat0_@outlook.com>
2024-11-08 22:53:24 -03:00
Edson PassosandMinat0_ cddde547b1 fix: missed name in /clan stats command
Co-authored-by: Minat0_ <minat0_@outlook.com>
2024-11-08 17:29:14 -03:00
Lucas f466a86309 feat: added reload event for better plugin integration (#441) 2024-09-24 19:02:20 -03:00
Edson Passos 9f4f39a420 feat(lang): new crowdin updates (#332) 2024-08-18 22:52:11 -03:00
Edson Passos 46702f90ab feat: added config for the db table prefix (#408) 2024-08-15 07:46:27 -03:00
Minat0_ 5a490b11a3 fix(discord): more debug messages for DiscordHook (#437) 2024-08-08 18:36:57 +03:00
Edson Passos 3b51299dd6 docs: added mikasa's banner 2024-06-12 16:08:19 -03:00
Edson Passos 5212296d62 fix: NPE while setting owner of skull 2024-05-12 12:35:27 -03:00
Edson Passos 67d3e70f58 fix: fire FrameOpenEvent sync 2024-04-25 16:25:14 -03:00
Edson Passos 8cd0b2e454 fix: order of FrameOpenEvent 2024-04-25 16:17:31 -03:00
RoinujNosde da9ec6c917 fix: players not getting removed from clans on purge 2024-04-19 20:17:25 -03:00
Nishikiyama cb314dbe7b feat: limit unverified clan members (#422) 2024-03-19 17:55:33 +03:00
ThiagoROX 01c79862b9 feat: add %simpleclans_is_invite_enabled% placeholder (#424) 2024-03-07 15:03:11 -03:00
Nishikiyama c9df6acb13 feat: possibility to set a default rank for new clans (#418) 2024-02-01 17:12:57 +03:00
Minat0_ ad910e9c30 fix(discord): bump DiscordSRV to 1.27.0 (#414)
Possibly fixes IncompatibleClassChangeError for newest DiscordSRV version.
2024-01-09 20:29:25 +03:00
Minat0_ d4d144fe36 fix: update the Mojang API endpoint (#413)
As of 23w42a, the "Usernames to UUIDs" endpoint moved to:
POST https://api.minecraftservices.com/minecraft/profile/lookup/bulk/byname
2024-01-08 15:27:08 +03:00
Minat0_ 1375679df8 fix(discord): revoke discord leader role on events (#411) 2024-01-06 14:49:02 +03:00
ThiagoROXandRoinujNosde b2c7d12b60 feat: added price and date formatters (#401)
Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2023-11-13 10:39:26 -03:00
Edson Passos b363efe530 fix: more fixes for RequestManager (#405) 2023-10-25 10:29:19 -03:00
RoinujNosde 876b5ac50e fix: rename command not checking length 2023-10-22 19:17:32 -03:00
Edson Passos d2825df01b fix: wrong request key in requestAllLeaders 2023-10-04 07:13:36 -03:00
RoinujNosde bc85864134 fix: players not able to vote on some requests
PROMOTE, RENAME and DISBAND

Also fixed the requester's name placeholder
2023-10-03 19:23:21 -03:00
WolfBot 4808addaa5 chore(master): release 2.19.3-SNAPSHOT (#399) 2023-08-03 19:38:27 -03:00
WolfBot 05e7abccbd chore(master): release 2.19.2 (#398) 2023-08-03 19:30:23 -03:00
WolfBot cfd1ff851d chore(master): release 2.19.2-SNAPSHOT (#395) 2023-08-03 19:24:05 -03:00
Minat0_ f29bc746af fix: cause check should return true on granting (#397) 2023-08-03 19:21:35 -03:00
WolfBot e12ee8aaed chore(master): release 2.19.1 (#393) 2023-08-03 13:22:44 -03:00
Edson Passos fe60b25f61 fix: charge money on deposit (#394) 2023-08-03 13:12:07 -03:00
Minat0_ 503d67903e fix: consider uppercase when checking for disallowed colors (#391) 2023-08-02 09:03:59 -03:00
Minat0_ e1625d38c8 ci: ensure running on maven 3.9.3 (#390)
* ci: Upgrade JDK to 16 at modrinth workflow

* ci: Upgrade JDK to 16 at curseforge workflow

* ci: ensure running on maven 3.9.3

* ci: ensure running on maven 3.9.3 (#389)

* Set executable permission for mvnw

* using newer release option for compiler plugin
2023-07-27 19:58:04 -03:00
WolfBot 4fa1aeaccc chore(master): release 2.19.1-SNAPSHOT (#387) 2023-07-27 16:55:43 -03:00
WolfBot 1b44edeec5 chore(master): release 2.19.0 (#340) 2023-07-27 16:54:35 -03:00
d21dc02dff feat: EconomyTransactionEvent creation (#384)
Co-authored-by: Anony <contacto@anderhurtado.com>
Co-authored-by: Tomut0 <minat0_@outlook.com>
2023-07-27 16:53:11 -03:00
Minat0_ ad6bb7b13b feat: hide reset kdr in main frame if perm denied (#385) 2023-07-23 20:56:42 +03:00
Minat0_ 8269d80831 fix: resets error message when validating a clan tag (#383) 2023-06-23 19:44:32 +03:00
Minat0_ 57b9987e9b fix: tnt explosion doesn't count a kill (#381) 2023-06-20 00:02:47 +03:00
ThiagoROX f8ce0f415f feat: add %simpleclans_has_rank% placeholder (#379) 2023-06-20 00:01:04 +03:00
3ef3169942 feat: validating tag by regex (#363)
* Special Characters

* Changed default value from True to False

* Apparently useless in the PR

* Changed cleanTag.toLowerCase() to cleanTag
replaced string cleanTag = ChatUtils.stripColors(this.tag) with string cleanTag = Helper.cleanTag(tag);

* added simpleclans.iml back to fix any errors

* Added SimpleClans.iml to .gitignore; correct me if i'm wrong, but I believe this is for the better.

* Added 'SimpleClans.iml' to .gitignore :)

~ Side note: Shoot me a message if this should be undone.

* Added original SimpleClans.iml

I have no idea what went wrong last time.

* fix: bb migration settings save

* feat: tag regex implement

* refactor tag length set

* delete auto-generated files from git

* optimize imports

* speed up tag validation process by creating one TagValidator per plugin reload

rollback accept-other-alphabets-letters-on-tag

* we don't need to save config twice on bb migration

* don't create new instance of tagValidator on plugin reload

* fix even if regex matches it checks the alphabet

---------

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: Tomut0 <minat0_@outlook.com>
2023-06-17 18:52:55 +03:00
Minat0_ 5cf64a672d feat: add a command to set player's locale (#378) 2023-06-17 00:28:22 +03:00
Minat0_ c49b2d9dc2 Merge pull request #375 from Tomut0/dev 2023-05-12 17:53:59 +03:00
Tomut0 8801e8e855 build: add surface plugin, upgrade tests to JUnit 5 2023-05-12 17:41:07 +03:00
Tomut0 bc4775c293 build: upgrade javadoc plugin, suppress warnings on build 2023-05-12 17:40:32 +03:00
Tomut0 74e39c2666 I don't think we need META-INF file anymore
It's a maven task to create it, I believe
2023-05-12 17:40:32 +03:00
Tomut0 f73e798e65 ci: upload artifact with jdk 16 2023-05-12 17:40:32 +03:00
Tomut0 f101ea4768 build: delete dependency-reduced-pom.xml from git 2023-05-12 17:40:32 +03:00
Tomut0 f5d547ab27 docs: author tag isn't available at methods 2023-05-12 17:40:31 +03:00
Minat0_ 7fcb964f41 fix: prevent clan name renaming with colors (#374) 2023-05-12 16:15:08 +03:00
ThiagoROX d4f1a74dee feat: add confirmation before reset kdr (#371) 2023-05-10 21:03:29 +03:00
Edson Passos 3e192a70da build: update junit 2023-05-09 19:55:18 -03:00
Edson Passos 103f1e56c7 ci: update Reposilite workflow 2023-05-07 18:06:14 -03:00
Edson Passos 103b4055f3 ci: update CI workflow 2023-05-07 17:52:28 -03:00
RoinujNosde c91442cd1e Merge remote-tracking branch 'origin/master' 2023-05-07 17:47:49 -03:00
RoinujNosde e368ead04a fix: bump JDK to 16 2023-05-07 17:47:23 -03:00
ThiagoROX d68ec28f8e feat: add PlayerResetKdrEvent (#370) 2023-05-03 12:16:22 +03:00
RoinujNosde 2f4ad00f1c fix: migrates land permissions on GP claim resize 2023-04-30 18:40:23 -03:00
RoinujNosde 524e407620 fix: NPE on EntityDamageByEntityEvent listener (LandProtection) 2023-04-30 18:14:21 -03:00
ThiagoROX 992166de66 ci: update checkout and setup-java actions (#369) 2023-04-28 00:18:07 +03:00
ThiagoROX 0b74355467 fix: display hex message on bulletin board (#365) 2023-04-26 20:30:53 +03:00
ThiagoROX 105a8cad51 feat: add subcommand /clan mod bb display (#367) 2023-04-26 19:26:15 +03:00
Minat0_ 0f693329ca feat: adds the possibility to rename a clan (#360) 2023-03-26 18:45:29 -03:00
Minat0_ 263d129325 feat: bb message language key (#358) 2023-03-21 22:37:24 -03:00
ThiagoROX 442096e9da fix: added clan suggestion in staff bb commands (#359) 2023-03-19 21:32:59 -03:00
Minat0_ 36084dbfa3 perf(discord): remove discord channels from creation (#353) 2023-02-13 08:53:31 -03:00
RoinujNosde 8a05dbbf00 fix: possibly fixes CME on SpyChatHandler 2023-01-31 18:47:08 -03:00
Minat0_ 8a3529377f fix(discord): permission overrides reset only existing members (#349) 2023-01-28 21:26:28 -03:00
Minat0_ 5f519c477a fix: remove abandoned channels before validating (#348) 2023-01-27 23:30:32 -03:00
Minat0_ 7eb748bb9a fix: async permission reset & category deletion (#347) 2023-01-27 20:46:12 -03:00
Minat0_ 18507016a8 fix: view permission applies only to cached channels (#346) 2023-01-20 16:53:02 -03:00
Edson Passos ed243f72ec fix(bungee): updates kills count immediately 2023-01-08 20:42:29 -03:00
RoinujNosde 5021b8ad7b fix: players not able to strip logs/fertilize blocks 2023-01-03 19:37:17 -03:00
Edson Passos f98868c776 fix: invalid colors being used in tags, pt. 2
* Added test for another invalid variant
* Updated patterns
2023-01-03 16:29:48 -03:00
RoinujNosde 2850e59d37 fix: invalid colors being used in tags 2023-01-02 19:35:42 -03:00
RoinujNosde 86d4fac938 fix: players not able to break vehicles/exit horses 2022-12-28 20:12:00 -03:00
Edson Passos 0258a75c81 fix(bungee): removes players from clan on delete 2022-12-27 09:56:34 -03:00
RoinujNosde 61dcb3d440 fix: players unable to interact with armor stands, paintings, etc 2022-12-24 17:26:50 -03:00
RoinujNosde bf1033af76 fix: default username-regex 2022-12-23 20:28:04 -03:00
RoinujNosde 807d39afeb fix: players not able to use water buckets (WorldGuard) 2022-12-23 20:27:37 -03:00
RoinujNosde bc046d4b2a refactor: code cleanup on LandProtection 2022-12-22 22:20:18 -03:00
RoinujNosde 545dd1652f Merge remote-tracking branch 'origin/master' 2022-12-21 21:29:57 -03:00
RoinujNosde e9ec283ace fix: players not able to sleep on beds (WorldGuard) 2022-12-21 21:29:19 -03:00
Minat0_ 718868b2d9 docs: updated version in README (#343) 2022-12-08 08:41:10 -03:00
Edson Passos 2a139aba03 feat(chat): adds permissions to use colors and formats (#341) 2022-12-04 13:06:15 -03:00
RoinujNosde 046aa1d96d fix: sets duplicate names to something unique 2022-11-30 20:01:40 -03:00
WolfBot e44775e994 chore(master): release 2.18.2-SNAPSHOT (#339) 2022-11-29 19:54:00 -03:00
WolfBot 43da5bd1f1 chore(master): release 2.18.1 (#335) 2022-11-29 19:53:16 -03:00
Minat0_ 8fa465da38 fix: missing getHandlerList on HomeRegroupEvent (#338) 2022-11-29 14:48:31 -03:00
RoinujNosde 56c7908c33 fix(bungee): error deserializing clan banners 2022-11-23 20:14:14 -03:00
RoinujNosde fc81e76521 fix: added check for clan_member on land commands 2022-11-18 19:21:01 -03:00
RoinujNosde f7fe5c4ad4 refactor: ignore unknown subchannels 2022-11-08 20:19:57 -03:00
RoinujNosde 8f4f763c37 refactor: added debug messages to BungeeManager 2022-11-04 23:15:09 -03:00
RoinujNosde 7a37382264 fix: default ranks were getting re-added on config load 2022-11-03 20:37:29 -03:00
RoinujNosde 7f9d133051 fix: channel auto creation setting not respected on join/link 2022-11-02 14:55:00 -03:00
RoinujNosde 26ba9f7329 fix: attempt at fixing NPE on getAllClanPlayers 2022-11-01 21:43:31 -03:00
Minat0_ d8cb61b0fc fix: money was not given back when channel creation failed (#336) 2022-10-31 18:39:26 -03:00
Minat0_ 3f1b06dcf9 fix: wrong path of discord economy section (#334) 2022-10-31 17:14:10 -03:00
WolfBot b043eb0742 chore(master): release 2.18.1-SNAPSHOT (#331) 2022-10-14 18:15:11 -03:00
github-actions[bot]andWolfBot 7691a4b719 chore(master): release 2.18.0 (#318)
Co-authored-by: WolfBot <112733600+bot-wolf@users.noreply.github.com>
2022-10-14 18:13:47 -03:00
Edson Passos 87ece22036 feat(lang): new crowdin updates (#319) 2022-10-14 18:10:47 -03:00
RoinujNosde f7e7ec6624 fix: removes duplicate /clan from help 2022-10-03 19:59:02 -03:00
RoinujNosde 25197cdd72 feat: add help-size config 2022-09-30 18:43:00 -03:00
Edson Passos 30a501c063 fix: ConfigurationSerializableAdapter NPE 2022-09-27 10:22:47 -03:00
RoinujNosde f14c425488 fix: NPE while purging data 2022-09-24 19:43:14 -03:00
Edson Passos cc2e32984d ci: added modrinth action 2022-09-20 20:07:56 -03:00
Edson Passos 2c9b0f98fe feat: Improves Bungee support (#327) 2022-09-17 11:22:11 -03:00
Edson Passos f484bc16c6 fix: set useSSL to false 2022-08-30 08:30:42 -03:00
RoinujNosde 37f0ecff50 fix: supports '.' and '*' as username prefix by default 2022-08-28 12:33:01 -03:00
Minat0_ c8969f2196 chore: update dependency version at README.md (#329) 2022-08-28 12:03:20 -03:00
Edson Passos b9c3cfd640 ci: adds name to job 2022-08-24 22:02:56 -03:00
RoinujNosde a440834347 feat: adds starter-ranks
A list of ranks, defined in the config, which are added to new clans
2022-08-16 19:09:10 -03:00
RoinujNosde 1adec0b89d fix: changes size of some frames for better visualization on Bedrock 2022-08-15 20:27:53 -03:00
RoinujNosde d56a0a979a feat: adds permission to bypass the teleport delay
Node: simpleclans.vip.teleport-delay
2022-08-15 20:18:53 -03:00
RoinujNosde af07988103 fix: getPastClans() preserves the insertion order 2022-08-15 19:37:17 -03:00
Edson Passos 96a13d8d6c fix: updates join date when joining a clan (#326) 2022-08-15 11:33:14 -03:00
Edson Passos 2a1ad5b5c8 fix: removes rank and join date on disband 2022-08-15 10:28:50 -03:00
RoinujNosde 1311423a17 refactor: changed members list to <ClanPlayer> 2022-08-01 19:38:50 -03:00
RoinujNosde 59e9c4caed refactor: changed clanPlayers map to <UUID, ClanPlayer> 2022-08-01 19:17:00 -03:00
RoinujNosde 4ab53d1613 perf: improved UUID lookup performance 2022-07-11 22:55:13 -03:00
RoinujNosde 2ea744443f feat: added method for registering protection providers 2022-06-27 18:58:05 -03:00
Edson Passos 8bd8bb6466 ci: disable fork on release-please 2022-06-24 19:29:58 -03:00
Minat0_ e7f756f306 fix: NPE while sending a message to spies (#322) 2022-06-24 19:27:34 -03:00
Edson Passos b7961acd5c ci: use fork on release-please 2022-06-12 15:12:43 -03:00
RoinujNosde c47289c5bf fix: NPE while collecting fees
ClanPlayer#toPlayer() returns null when the player is not connected
2022-06-12 15:10:32 -03:00
Edson Passos 7769060f4d ci: updated release-please token
This fixes actions listening to "release" not running
2022-06-10 19:35:52 -03:00
RoinujNosde a859928622 fix: NoClassDefFoundError in WorldGuard6Provider 2022-06-09 23:38:55 -03:00
RoinujNosde becb88b763 feat: adds PlayerHomeClearEvent
and fires PlayerHomeSetEvent when the mod command is used
2022-06-09 14:15:14 -03:00
RoinujNosde 711f81f3da ci: update java version
here we go again
2022-06-08 21:41:15 -03:00
RoinujNosde 7fae6f8b8a ci: added missing required input 2022-06-08 21:36:57 -03:00
RoinujNosde 62a8d304f4 ci: adds snapshots repository and udpated setup-jdk 2022-06-08 21:32:22 -03:00
Edson Passos fe8668abb0 Merge pull request #317 from RoinujNosde/release-please--branches--master
chore(master): release 2.17.1-SNAPSHOT
2022-06-08 21:04:55 -03:00
github-actions[bot] 36f5739f06 chore(master): release 2.17.1-SNAPSHOT 2022-06-09 00:01:26 +00:00
RoinujNosde f7465941b2 ci: updated crowdin.yml and publish actions 2022-06-08 21:00:08 -03:00
Edson Passos 2aa5b9aad3 bump version... 2022-06-08 20:20:55 -03:00
Edson Passos 51f82ba988 New Crowdin updates (#316) 2022-06-08 19:57:45 -03:00
Edson Passos 327bcf3980 v2.17.0 2022-06-08 19:45:19 -03:00
Edson Passos 5c3bb558cf feat(lang): new Crowdin updates (#295) 2022-06-08 19:27:22 -03:00
RoinujNosde c726e2bb3c feature: adds coordinates to Land 2022-06-07 14:27:17 -03:00
Edson Passos af6c72eda9 fix: war end via request 2022-06-05 12:53:56 -03:00
RoinujNosde d48c17f1f9 feature: adds permission FEE_BYPASS to ranks
removes simpleclans.member.bypass-fee
2022-05-31 19:14:00 -03:00
RoinujNosde 93eef5c727 fix: catches exceptions when creating Discord channels 2022-05-22 22:01:01 -03:00
RoinujNosde 714aa10701 fix: adds groups (Vault) to the global storage, instead of per world 2022-05-20 19:53:50 -03:00
Minat0_ b2d271b23b fix: don't confuse auto-group-groupname and auto-groups 2022-05-18 17:54:57 +03:00
RoinujNosde 7dad746269 fix: possibly improves performance of ClanPlayer lookup 2022-05-17 20:28:30 -03:00
RoinujNosde 37399cd50b fix: refactored ConfirmationPrompts 2022-05-10 20:03:09 -03:00
RoinujNosde 132eac98e2 fix: doesn't try saving Players with duplicate names 2022-05-09 20:21:15 -03:00
RoinujNosde ba68e8f70a fix: doesn't try saving Players with null names 2022-05-08 18:48:25 -03:00
RoinujNosde 0d3542b4aa Merge remote-tracking branch 'origin/dev' into dev 2022-05-08 17:40:28 -03:00
RoinujNosde 94eed8710c fix!: removed PlotSquared3Provider
Maven repo is down
2022-05-08 17:40:06 -03:00
RoinujNosde 0d3d4981c0 fix: removed PlotSquared3Provider
Maven repo is down
2022-05-08 17:35:56 -03:00
Minat0_ 73fa75fccc fix!: Log "API" when player is offline (#310) 2022-05-08 16:44:17 -03:00
RoinujNosde a855b51617 fix: pending invites could bypass the max members limit 2022-05-03 20:32:39 -03:00
RoinujNosde 83e7ad4ae1 fix: duplicate usernames logic 2022-05-02 21:24:18 -03:00
RoinujNosde 05cddb7e7f feature: adds ClanPlayerTeleportEvent 2022-04-08 14:23:05 -03:00
RoinujNosde 8d1ed8cf41 fix: refactored DBCore, added caller's stack trace to db exceptions 2022-04-05 20:00:33 -03:00
RoinujNosde f8862299f2 fix: optimizes player lookup by using Bukkit#getOfflinePlayers #306 2022-04-02 20:35:09 -03:00
RoinujNosde 1de339addc fix: parsing placeholders that return new placeholders 2022-03-30 19:23:39 -03:00
RoinujNosde e929b58cd7 fix: player not removed from Discord channel on kick #305 2022-03-17 18:55:42 -03:00
RoinujNosde 237755b5d5 fix: remove colors from logged chat messages 2022-03-13 20:02:47 -03:00
RoinujNosde c648343cdc fix: stop setting player locale on insert
The player has not set a language yet
2022-03-13 00:02:19 -03:00
RoinujNosde f34b9273cc fix: setting server's default language as the player's 2022-03-12 23:44:00 -03:00
Minat0_andRoinujNosde d07bc160e6 fix: Strips only Spy and Discord chats (#304)
Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2022-03-12 23:24:31 -03:00
RoinujNosde 6f1f919977 fix: NoSuchFieldException on PlayerHeadCacheTask 2022-03-11 18:13:11 -03:00
Edson Passos 12a5aa92bb fix: disallows 'k' format in tags by default 2022-03-08 12:11:28 -03:00
RoinujNosde 5d7ad0808d fix: checks for valid alphabet even for players with bypass permission 2022-03-06 10:58:02 -03:00
RoinujNosde ac0e2f2116 fix: checks for spaces in tag when ACCEPT_OTHER_ALPHABETS_LETTERS is enabled 2022-03-06 10:57:10 -03:00
Edson Passos 2d553234a3 Update maven.yml 2022-03-06 01:03:38 -03:00
RoinujNosde e4588fe1ef fix: error parsing username regex 2022-03-05 22:29:09 -03:00
RoinujNosde 4221cc2fa1 fix: teleporting to highest block if home is set on a slab #301 2022-03-05 22:18:49 -03:00
RoinujNosde 5db69775a3 feature: adds username regex to config 2022-03-04 20:40:40 -03:00
Minat0_ 88f61a150f Lack of permissions when auto-create is false (#300)
* fix: Lack of permissions when auto-create is false
2022-03-03 20:06:23 -03:00
Edson Passos f0df4435be Bump version 2022-03-02 15:09:53 -03:00
Minat0_andEdson Passos 05c0f734b5 Disband command requires confirmation (#299)
* build: Add maven dependency plugin

* feature: Disband command requires confirmation

* fix: Don't create clans (event) if auto-creation is false

* Updates env variable for testing purpose

* Makes confirm and decline methods abstract

* Testing dependency plugin config

Co-authored-by: Edson Passos <edsonpassosjr@outlook.com>
2022-03-02 17:03:49 +03:00
Edson Passos 4f0b721d49 Updates SCMessage with ChatEvent changes #298 2022-03-02 07:57:11 -03:00
RoinujNosde 3ebb041a3f Merge remote-tracking branch 'origin/dev' into dev 2022-02-26 22:13:47 -03:00
RoinujNosde 3b8dc4992d fix: first time players marked as "not played before" 2022-02-26 22:13:28 -03:00
Edson Passos 16be0c12a0 Fixes line breaks in changelog 2022-02-24 22:36:27 -03:00
Edson Passos 18c7c41ac4 Updated badges and repo info 2022-02-24 22:26:21 -03:00
Edson Passos cb201eb4b8 Update publish_reposilite.yml 2022-02-24 22:01:47 -03:00
Edson Passos 7a8ac9509b Bump version 2022-02-24 21:45:33 -03:00
Edson Passos 587bd9b445 Merge pull request #296 from RoinujNosde/dev
2.16.2
2022-02-24 21:42:42 -03:00
Edson Passos 6419e16eb0 Merge branch 'master' into dev 2022-02-24 21:38:59 -03:00
RoinujNosde 59d2bfc5f8 fix: middle-click actions stopped working on 1.18 #294 2022-02-24 20:37:52 -03:00
Edson Passos e452441380 Adds 1.18 to curseforge supported versions 2022-02-24 19:00:52 -03:00
Edson Passos 4d8fc0f0e5 Updates distributionManagement 2022-02-24 16:01:42 -03:00
Edson Passos 6bbb12e901 Create publish_reposilite.yml 2022-02-24 13:07:10 -03:00
RoinujNosde 002939f2df fix: bad usage of > in javadocs 2022-02-20 15:53:02 -03:00
RoinujNosde 6f27da4bdb fix: bad usage of > in javadocs 2022-02-20 15:48:58 -03:00
RoinujNosde 268f4752d6 feature: adds javadoc plugin 2022-02-20 15:32:15 -03:00
RoinujNosde 204858dee7 fix: uses - instead of space as commit hash separator 2022-02-20 14:18:27 -03:00
RoinujNosde a0ced58a02 feature: adds commit hash to version 2022-02-20 14:15:08 -03:00
RoinujNosde b8cbf831b3 fix: sc_players.name unique constraint not being respected in some cases 2022-02-19 22:59:45 -03:00
RoinujNosde d6ec0c3a3d fix: removes duplicate methods getHealthString and getHungerString 2022-02-19 22:10:51 -03:00
RoinujNosde bf3fc03f93 fix: checks if player name is null before processing death 2022-02-19 21:58:54 -03:00
Edson Passos 52348096a0 Merge pull request #293 from RoinujNosde/l10n_dev
New Crowdin updates
2022-02-18 11:06:29 -03:00
Edson Passos 00a48b24dd New translations messages.properties (Lithuanian) 2022-02-18 11:04:44 -03:00
Edson Passos c9aae0d781 Adds Lithuanian translation (#292)
* New translations messages.properties (Russian)

* New translations messages.properties (Norwegian)

* New translations messages.properties (Lithuanian)
2022-02-18 09:35:12 -03:00
Edson Passos d0bba163a0 New Crowdin updates (#284) 2022-02-18 09:31:32 -03:00
Edson Passos cd0e75483a Merge pull request #290 from Tomut0/dev
Some fixes on messages.properties
2022-02-16 09:40:08 -03:00
Edson Passos 2c365c5d54 Updates insufficient balance message 2022-02-16 09:38:53 -03:00
Minat0_ 9704562353 fix: Fixes "your.clan.doesnt.have.minimum.linked.player" message key 2022-02-16 11:51:43 +03:00
Minat0_ 836fc9d6a0 fix: Returns needed money as argument of "not.sufficient.money" key 2022-02-15 19:54:43 +03:00
Minat0_ cd01b0cd47 fix: Added missing message when player creates a discord channel 2022-02-15 19:54:43 +03:00
Minat0_ d797ab0908 feature: Leaders can create discord channel (#288)
* fix: CNFE on ChatManager#getDiscordHook

* Makes possible to turn off automatic discord channels creation
2022-02-14 22:32:42 -03:00
RoinujNosde fd58f4abda feature: chat listener priority can be changed via config #286 2022-02-03 18:52:34 -03:00
RoinujNosde 6653c6f8c0 feature: staffers can bypass the teleport timer 2022-02-02 19:09:45 -03:00
RoinujNosde 4dee178403 fix: removed PlotSquared5Provider 2022-02-02 18:55:01 -03:00
RoinujNosde 908451c65c feature: %rel_simpleclans_color% is configurable 2022-01-31 19:08:17 -03:00
RoinujNosde d468bd0df2 fix: temporarily removed PlotSquared5Provider as its maven repo is unavailable 2022-01-30 15:26:07 -03:00
RoinujNosde 3779585645 fix: incompatibility with UltimateChat's latest version
Added missing enum ConfigField.TAG_SEPARATOR_char (deprecated)
2022-01-30 14:36:15 -03:00
RoinujNosde c346fdf967 fix: removes player's own name from kick completion #263 2022-01-29 22:36:18 -03:00
Minat0_ 240a782774 Fixes missing clanTag argument at exception 2022-01-30 02:02:47 +03:00
Edson PassosandMinat0_ dce26a784f 2.16.1 (#283)
Adds Landlord 4 support
Fixes bug on create land event
Fixes a bug where JDA was loaded earlier than SC's DiscordHook
Fixes resetKdr not resetting ally kills
LanguageChooser now uses _ instead of -
Adds %clean-tag% placeholder for chat messages
Fixes bb settings
Fixes Vault groups getting removed only on join
Probably adds support for older GriefPrevention versions
Possibly fixes bug on home item on ClanDetailsFrame (staff)
Fixes unban command not saving changes
Strips colors from chat messages
Adds missing language keys
Fixes disallowed tags setting
Adds feature to limit past clans
Hides the player's own clan from some completions
Adds placeholder for bank bb messages
Adds bb commands for staff
Fixes player' permission was not deleted after kicking from the clan
Place command now supports offline players
Fixes not kicking a member if there is at least one leader
Adds sender to DisbandClanEvent
Fixes opening double chests - war and land sharing
Adds method to validate min, max on values
HEX support message on server startup
Bumps discordsrv to 1.24.1-SNAPSHOT
DiscordHook improvements and bug fixes
Messages updated
Removes floody debugs from ProtectionManager

Co-authored-by: Minat0_ <42711312+Tomut0@users.noreply.github.com>
2022-01-23 17:25:06 -03:00
RoinujNosde 3cac8067a6 Removes floody debugs from ProtectionManager 2022-01-23 17:04:08 -03:00
Edson Passos 993578f13e New Crowdin updates (#266) 2022-01-23 16:49:15 -03:00
Minat0_ 96da1b3936 DiscordHook improvement and fixing (#281)
Removes invalid channels on startup
Updates role after channel creation
Creating a channel on player' linking, joining
New setting - min-linked-players-to-create
Throws new exception ChannelExistsException
Makes DiscordHook#deleteChannel return boolean
2022-01-23 14:43:32 -03:00
RoinujNosde 2fc8a1aa1b Bumps discordsrv to 1.24.1-SNAPSHOT 2022-01-16 22:44:32 -03:00
Edson Passos b4cf94dab2 Merge pull request #279 from Tomut0/fix-discord-clan-creation
Fixes skipping channel creation conditions
2022-01-16 18:19:15 -03:00
Minat0_ a793e933ae Checking resolved 2022-01-17 00:07:10 +03:00
Minat0_ a0ec61cec7 Fixes skipping channel creation conditions, part 3
Capitalizes TAG_SEPARATOR_CHAR
2022-01-16 18:56:14 +03:00
Edson Passos 10b24b99a2 Testing cache setting 2022-01-13 23:43:32 -03:00
RoinujNosde 4ed174970e Merge remote-tracking branch 'origin/dev' into dev 2022-01-13 23:33:36 -03:00
RoinujNosde f7b4f5dfd9 Bumps discordsrv to 1.24.0 2022-01-13 23:33:21 -03:00
Edson Passos 8b7d8e4a72 Merge pull request #280 from Tomut0/dev
HEX support message on server startup
2022-01-12 20:11:17 -03:00
Minat0_ 8ab89cd03f HEX support message on server startup 2022-01-13 01:25:29 +03:00
RoinujNosde 47a5948157 Merge remote-tracking branch 'origin/dev' into dev 2022-01-11 19:38:53 -03:00
RoinujNosde 48e3da9716 Adds method to validate min, max on values
Overrides context resolvers from ACF to check for finite numbers (float and double)
2022-01-11 19:38:16 -03:00
Minat0_ 05ec2241f0 Revert "Replaces deprecated getItemInHand"
This reverts commit 71ad4ce160.
2022-01-10 18:25:16 +03:00
Minat0_ 4c881f4601 Fixes skipping channel creation conditions, part 2 2022-01-10 18:18:13 +03:00
Minat0_ 71ad4ce160 Replaces deprecated getItemInHand 2022-01-10 18:08:52 +03:00
Minat0_ 3c2d5c9b81 Fixes skipping channel creation conditions
Updates PaperLib to the latest
2022-01-10 17:26:27 +03:00
Edson Passos b0a0f951fa Merge pull request #278 from RoinujNosde/fix-leader-role
Fixes adding the leader role to anyone
2022-01-09 16:50:23 -03:00
Minat0_ 408647161e Fixes adding the leader role to anyone 2022-01-09 22:34:12 +03:00
RoinujNosde 55f95b405e Possibly fixes opening double chests - war and land sharing 2022-01-04 19:03:18 -03:00
RoinujNosde 0aeb153293 Adds sender to DisbandClanEvent #271 2021-12-10 19:02:02 -03:00
Edson Passos cdc185c8e7 Merge pull request #272 from RoinujNosde/Tomut0-patch-1
Fixes not kicking a member if there is at least one leader
2021-12-09 13:34:41 -03:00
Minat0_ 1f128e8368 Fixes not kicking a member if there is at least one leader
### Example:
Clan 1:
* Minat0_ (Leader)
* RoinujNosde (Member)

Following the current code logic: let's kick RoinujNosde (Member) -> check if clan leaders size == 1 (true) -> send message, return.
The solution is to *check* if this player is a leader and clan leaders size. ☕
2021-12-09 11:53:42 +03:00
RoinujNosde 2e68e7fe2f Place command now supports offline players 2021-11-29 18:16:47 -03:00
Minat0_ 388d17fe99 Fixes player' permission was not deleted after kicking from the clan (#269) 2021-11-19 15:58:38 -03:00
RoinujNosde 89d59a39d9 Adds bb commands for staff #265 2021-11-07 12:15:40 -03:00
Edson Passos d88c14359a New Crowdin updates (#261) 2021-11-07 11:45:53 -03:00
RoinujNosde ae40b35325 Adds placeholder for bank bb messages #246 2021-11-07 11:44:37 -03:00
RoinujNosde 6a410354e5 Hides the player's own clan from some completions
#263
2021-11-07 11:29:52 -03:00
Minat0_ 96c2b8c718 Adds feature to limit past clans (#264)
* Adds a view limit of past clans

* Removes Helper#toMessage

* Removes Helper#stripTrailing
2021-11-02 13:07:36 -03:00
RoinujNosde 4bf0e69734 Fixes disallowed tags setting #262 2021-10-18 21:24:43 -03:00
RoinujNosde 6803b001ce Adds missing language keys 2021-10-12 18:21:14 -03:00
Edson Passos 366863b63e New Crowdin updates (#254) 2021-10-12 18:02:53 -03:00
RoinujNosde 5c391e33c4 Strips colors from chat messages 2021-10-10 19:38:49 -03:00
RoinujNosde 448cc6093e Fixes unban command not saving changes 2021-10-08 23:33:40 -03:00
RoinujNosde 9d910759cb Possibly fixes bug on home item on ClanDetailsFrame (staff) 2021-10-06 13:42:45 -03:00
RoinujNosde cdc1808078 Fixes NoClassDefFoundError on older GriefPrevention versions 2021-09-29 21:38:06 -03:00
RoinujNosde 87541f9742 Probably adds support for older GriefPrevention versions #258 2021-09-28 23:43:44 -03:00
RoinujNosde 54f3f4ba40 Fixes Vault groups getting removed only on join #259 2021-09-28 23:34:22 -03:00
Edson Passos 4e8850e734 Fixes bb settings 2021-09-25 16:27:20 -03:00
RoinujNosde 9e55a00d68 Adds %clean-tag% placeholder for chat messages 2021-09-19 18:05:10 -03:00
Edson Passos f898631ace Merge pull request #256 from mehmet-27/patch-1
Update LanguageSelectorFrame.java
2021-09-19 16:29:36 -03:00
Mehmet f71a84a70e Update LanguageSelectorFrame.java
underscores should be used in languages shown as desired in the config
2021-09-19 22:15:22 +03:00
RoinujNosde b51f27e68b Merge remote-tracking branch 'origin/dev' into dev 2021-09-18 18:27:23 -03:00
RoinujNosde ad38548440 Fixes resetKdr not resetting ally kills 2021-09-18 18:26:28 -03:00
Edson Passos f69207f0d4 Probably fixes a bug, where JDA was loaded earlier than SC's DiscordHook. (#255) 2021-09-17 18:11:59 -03:00
Minat0_ 9fb42b7093 Probably fixes a bug, where JDA was loaded earlier than SC's DiscordHook. 2021-09-17 23:21:52 +03:00
RoinujNosde bf0670cb88 Fixes bug on create land event 2021-09-17 14:19:30 -03:00
RoinujNosde d4507f41fa Adds Landlord 4 support 2021-09-16 19:36:00 -03:00
Edson Passos 41a978a278 Added 1.17 to curseforge workflow 2021-09-13 20:54:29 -03:00
Edson Passos 6ad79b6879 Merge pull request #253 from RoinujNosde/dev
2.16.0
2021-09-13 20:28:55 -03:00
Edson Passos 30cc1759e9 Merge branch 'master' into dev 2021-09-13 20:24:30 -03:00
Edson Passos 3bae27db2d New Crowdin updates (#252) 2021-09-13 20:11:38 -03:00
RoinujNosde 33ea872e4d Bump version 2021-09-13 20:10:38 -03:00
RoinujNosde 558f13dccb Merge remote-tracking branch 'origin/dev' into dev 2021-09-12 10:27:40 -03:00
RoinujNosde 08aae94637 Changes tasks to be sync 2021-09-12 10:27:18 -03:00
Thiago GebrimandEdson Passos c25bd8206c Adição do R antes do $ para ficar: "R$" (#250)
* Adição do R antes do $ para ficar: "R$", pois PT-BR fica mais certo, e tradução de algumas mensagens.

* Changed currency symbol position

Co-authored-by: Edson Passos <edsonpassosjr@outlook.com>
2021-09-09 19:59:10 -03:00
Edson Passos da397676f6 New Crowdin updates (#245) 2021-09-09 19:38:41 -03:00
RoinujNosde 4a56f9e87a Merge remote-tracking branch 'origin/dev' into dev 2021-09-07 19:22:32 -03:00
RoinujNosde 51241b3ae5 Adds /clan list balance command
Permission: simpleclans.anyone.list.balance - default false
2021-09-07 19:22:23 -03:00
Minat0_ e66e187566 Running checks on different Java versions (#248) 2021-09-04 23:59:02 -03:00
RoinujNosde 031227ddaf Merge remote-tracking branch 'origin/dev' into dev 2021-09-04 21:27:51 -03:00
RoinujNosde c3b9c68d45 Creates a ClanPlayer object on placeholder request 2021-09-04 21:27:41 -03:00
Minat0_ 37ffb93808 Adds new metrics for discord chat feature (#247)
* Adds new metrics for discord chat feature
Marks CommandHelper as deprecated

* Deletes CommandHelper.java && DamageRecord.java because of non-usage
2021-09-04 18:51:29 +03:00
RoinujNosde 84dd6a4cbd Adds command /clan resign confirm #163
This will bypass the conversation to confirm the resign
2021-09-03 23:55:14 -03:00
RoinujNosde 8eaa86ae45 Marks annoying provider messages as debug
Logs when a provider is registered
Adds debug messages for ProtectionManager#can()
Checks if getPlot exists on PlotSquared5Provider
2021-09-03 20:13:49 -03:00
Mehmet 55e82dab5f Toggle Clan Invitation (#244)
#57
2021-08-30 18:57:58 -03:00
Edson Passos 0f1e016483 New Crowdin updates (#239) 2021-08-30 18:43:31 -03:00
Minat0_ 3a8a316f3d GitBook: [master] 15 pages modified 2021-08-30 16:40:00 +00:00
Minat0_ f350025796 GitBook: [master] no pages and one asset modified 2021-08-30 16:20:46 +00:00
Minat0_ 36bbb91b61 GitBook: [master] 15 pages and one asset modified 2021-08-30 15:45:02 +00:00
Minat0_ f468a28476 GitBook: [master] no pages and 6 assets modified 2021-08-30 15:13:28 +00:00
RoinujNosde 115e1c5083 Checks if user has already played in the server before saving to db 2021-08-28 20:40:46 -03:00
RoinujNosde 420d8fae8e Added debug messages to some conditions 2021-08-28 19:20:20 -03:00
RoinujNosde fef3763039 Fixes empty tag brackets 2021-08-28 19:11:53 -03:00
RoinujNosde ebe79fe340 Fixes casting exception on config default values 2021-08-28 13:50:41 -03:00
Edson Passos 4a40e4c03d Merge pull request #242 from Tomut0/abandon-conversation
Returns message after conversation expiring
2021-08-27 23:45:50 -03:00
Minat0_ 47d4a215fb Returns message after conversation expiring
Fixes getting null of all players on PlayerListFrame
Updates JavaDoc
Updates messages.properties
2021-08-28 04:50:53 +03:00
Minat0_ ad22a4c75c ChatManager implementation | Refactoring (#215)
Adds integration with Discord
Removes deprecated methods in Helper.java
New config value: settings.global-friendly-fire
Using ACF commands for ally/clan chat
ClanPlayer#setMuted and ClanPlayer#setMutedAlly was moved to ClanPlayer#mute
You may use HEX colors at chat format. 😎
This PR also solves Spy: ally chat has the same format as clan chat #160 and adds spy chat for DiscordChat.
Updates maven dependencies: bStats, JetBrain Annotations and JUnit.
Adds a message, if player tries to join to the same chat (ally/clan)
Adds a message, if chat is disabled (ally/clan)
Adds a message, if player tries to leave the chat, in which it is not located
Adds a message, if staff sends message trough discord to minecraft and he is not located in current clan.
Adds a message, if admin player tries to demote someone, who is not a leader.
2021-08-26 23:26:25 -03:00
RoinujNosde 9811e2e1db Implements relational placeholder color
%rel_simpleclans_color%
This returns GREEN when both players are in the same clan, RED for rivals, AQUA for allies
2021-08-19 13:52:02 -03:00
Edson Passos f81318d458 Merge pull request #236 from RoinujNosde/l10n_dev
New Crowdin updates
2021-08-06 10:56:57 -03:00
RoinujNosde 4d0c39c0dc Suppresses exceptions on GriefPreventionProvider #237 2021-08-03 18:43:26 -03:00
Edson Passos 74752b4341 New translations messages.properties (Spanish) 2021-08-02 01:14:01 -03:00
RoinujNosde 099cf2e8d1 Merge remote-tracking branch 'origin/dev' into dev 2021-07-26 19:52:42 -03:00
RoinujNosde b4447054fb Replaces Threads with BukkitTasks on MySQLCore 2021-07-26 19:52:29 -03:00
Edson Passos 387ea7fb7b New translations messages.properties (Vietnamese) 2021-07-22 16:33:18 -03:00
Edson Passos 5a2efab233 New translations messages.properties (Vietnamese) 2021-07-21 16:37:44 -03:00
Edson Passos 7b415e883f New translations messages.properties (Hungarian) 2021-07-15 16:21:28 -03:00
Edson Passos 339bacf6d4 New translations messages.properties (Portuguese) 2021-07-14 16:19:02 -03:00
Edson Passos 650d8d4d50 New translations messages.properties (Swedish) 2021-07-13 15:57:06 -03:00
Edson Passos c1a3a5a5fe New translations messages.properties (Chinese Simplified) 2021-07-12 10:37:40 -03:00
Edson Passos ca550c13c4 Merge pull request #235 from Tomut0/dev
Fixes StaffCommands#demote for permanent feature
2021-07-11 17:30:52 -03:00
Minat0_ 4738fcae97 Fixes StaffCommands#demote for permanent feature 2021-07-11 23:22:43 +03:00
RoinujNosde e6a4d94ea7 Updated intellij module 2021-07-11 10:49:04 -03:00
RoinujNosde c4baa6b7f8 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	SimpleClans.iml
2021-07-11 10:44:26 -03:00
RoinujNosde 2eba58cd1c Bumped version
Changed url on pom
Removed Minecraft facet from module
2021-07-11 10:43:19 -03:00
Edson Passos bc4c1280b0 Merge pull request #234 from RoinujNosde/dev
v2.15.3
2021-07-11 10:39:23 -03:00
Edson Passos 0881f69900 New Crowdin updates (#228)
* New translations messages.properties (Russian)

* New translations messages.properties (Russian)

* New translations messages.properties (Russian)

* New translations messages.properties (Greek)

* New translations messages.properties (Greek)
2021-07-11 10:27:40 -03:00
RoinujNosde e3d6fdfe4a Makes registerProvider public 2021-07-09 18:39:28 -03:00
RoinujNosde 935c86c43d Revert "Adds support for PlotSquared 6"
This reverts commit ae1f8460
2021-07-08 21:09:06 -03:00
RoinujNosde ae1f846077 Adds support for PlotSquared 6 2021-07-08 20:54:49 -03:00
Minat0_ ddbd56e447 GitBook: [master] no pages and 2 assets modified 2021-07-06 15:54:40 +00:00
Minat0_ 35cba37cbe GitBook: [master] no pages and 2 assets modified 2021-07-06 15:30:57 +00:00
Minat0_ 1bd9191267 GitBook: [master] no pages and 2 assets modified 2021-07-05 10:04:51 +00:00
Minat0_ b8b1c6a02e GitBook: [master] 15 pages modified 2021-07-02 17:06:40 +00:00
RoinujNosde 001382558b Optimizes lookup command to not use OfflinePlayer 2021-07-02 13:27:26 -03:00
RoinujNosde eaf9cf6e19 Blocks clicking multiple times on the same button while it's loading 2021-07-01 18:16:13 -03:00
RoinujNosde 5297739002 Merge remote-tracking branch 'origin/dev' into dev 2021-06-28 18:52:59 -03:00
RoinujNosde c826db3549 Fixes max-kills-per-victim
Enabled bank-logger by default
2021-06-28 18:52:45 -03:00
Edson Passos 6b4e18338b New translations messages.properties (Dutch) (#227) 2021-06-28 08:49:16 -03:00
Edson Passos 44f1e6014f New Crowdin updates (#225)
* New translations messages.properties (German)

* New translations messages.properties (German)
2021-06-27 20:03:32 -03:00
Minat0_ c05e978faf SettingsManager cleanup (#226) 2021-06-27 20:02:53 -03:00
mehmet yılmaz 90f66681d0 GitBook: [master] 15 pages modified 2021-06-24 20:47:18 +00:00
mehmet yılmaz 536c18744a GitBook: [master] 15 pages modified 2021-06-24 20:18:37 +00:00
mehmet yılmaz ee00ffbf58 GitBook: [master] 15 pages modified 2021-06-24 19:54:41 +00:00
mehmet yılmaz 8b2cf58f9f GitBook: [master] 15 pages modified 2021-06-24 19:43:37 +00:00
mehmet yılmaz 194ed5cae8 GitBook: [master] 15 pages modified 2021-06-24 19:10:15 +00:00
mehmet yılmaz 747683aa99 GitBook: [master] 7 pages and one asset modified 2021-06-24 18:59:39 +00:00
RoinujNosde 2f6afdb6e0 Fixes regex for hex colors 2021-06-22 18:58:38 -03:00
Edson Passos 4aae97b033 New Crowdin updates (#213)
* New translations messages.properties (Spanish)

* New translations messages.properties (Turkish)

* New translations messages.properties (German)

* New translations messages.properties (French)

* New translations messages.properties (Hungarian)

* New translations messages.properties (Polish)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Russian)

* New translations messages.properties (Portuguese, Brazilian)

* New translations messages.properties (Russian)

* New translations messages.properties (Polish)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Finnish)

* New translations messages.properties (Spanish)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Polish)

* New translations messages.properties (Spanish)

* New translations messages.properties (Russian)

* New translations messages.properties (Arabic)

* New translations messages.properties (Vietnamese)

* New translations messages.properties (Russian)

* New translations messages.properties (Turkish)

* New translations messages.properties (Spanish)

* New translations messages.properties (Portuguese, Brazilian)
2021-06-21 15:59:18 -03:00
Edson Passos 51a88d0e5b Merge pull request #222 from Tomut0/patch-1
Removes unnecessary task canceling
2021-06-20 20:49:17 -03:00
Minat0_ d2a15f84f9 Removes unnecessary task canceling 2021-06-21 02:46:31 +03:00
Minat0_ d5e456a4b6 Fixes possibility to have multiple conversations (#220)
* Fixes possibility to have multiple conversation
* Fixes the missing resign message
2021-06-16 15:54:35 -03:00
RoinujNosde d2530ebc72 Merge remote-tracking branch 'origin/dev' into dev 2021-06-14 19:52:55 -03:00
RoinujNosde 1670c2da54 Added ignored list for BREAK 2021-06-14 19:52:37 -03:00
RoinujNosde eda29fbfad Adds debug messages for getLandsAt 2021-05-27 18:59:47 -03:00
RoinujNosde daff6952e5 Merge remote-tracking branch 'origin/dev' into dev 2021-05-26 19:42:39 -03:00
RoinujNosde be12935e2f Fixes GUI not respecting show-unverified-on-list
#212
2021-05-26 19:42:22 -03:00
RoinujNosde d17be1d834 Fixes wording on max members message
The max members can now be disabled by setting it to < 0
2021-05-26 19:39:27 -03:00
Edson Passos 38e6d6853f New Crowdin updates (#191)
* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Italian)

* New translations messages.properties (Italian)

* New translations messages.properties (Polish)

* New translations messages.properties (Hungarian)

* New translations messages.properties (Hungarian)
2021-05-26 19:36:34 -03:00
Minat0_ 5e1791d953 A little cleanup (#211)
* Adds javadocs to BankLog, CSVBankLogger

* Marks unused methods as deprecated in ChatBlock

* Removes useless mChatIntegration in SettingsManager

* Removes useless mChatIntegration in SettingsManager

* A little cleanup

* Changes javadocs description
2021-05-26 13:22:31 -03:00
Minat0_ f4f592da92 Fixes "Trusted color is ignored on clan/ally chat #186" (#202) 2021-05-21 19:44:20 -03:00
RoinujNosde aa130710ee Relocates javassist to prevent classloader problems 2021-05-18 20:12:18 -03:00
Edson Passos 0a664543a7 New Crowdin updates (#189)
* New translations messages.properties (Arabic)

* New translations messages.properties (Chinese Simplified)

* New translations messages.properties (Czech)

* New translations messages.properties (Spanish)

* New translations messages.properties (Russian)
2021-05-13 10:56:15 -03:00
Minat0_ 8338dc2ac7 Let's log bank transactions! 😃 (#190) 2021-05-12 13:03:49 -03:00
Edson Passos c621823d46 New Crowdin updates (#187)
* New translations messages.properties (Russian)

* New translations messages.properties (German)

* New translations messages.properties (Portuguese, Brazilian)
2021-05-05 09:26:03 -03:00
Edson Passos 612d923b12 New Crowdin updates (#182) 2021-05-04 20:03:34 -03:00
Minat0_ 7c0834845b Colored "none" message (#185)
#19
2021-05-04 09:11:49 -03:00
RoinujNosde 29f85228e8 Fixes clan-less leaders not being purged 2021-05-03 18:44:57 -03:00
Minat0_ c0741a3554 Cancel clan/rank creation (#184) 2021-05-02 14:19:47 -03:00
RoinujNosde 6e6503d480 getAnyClanPlayer(String) searches by name first 2021-05-01 18:54:01 -03:00
526 changed files with 49830 additions and 27998 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
.gitea/CODEOWNERS linguist-detectable=false
-5
View File
@@ -1,5 +0,0 @@
root: ./wiki
structure:
readme: README.md
summary: SUMMARY.md
+3
View File
@@ -0,0 +1,3 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
-30
View File
@@ -1,30 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run the command '...'
2. Click on a mob '....'
3. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Software (please complete the following information):**
- Server: [e.g. Spigot 1.12]
- Plugin version [e.g. 2.12.1]
**Additional context**
Add any other context about the problem here.
-20
View File
@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
-29
View File
@@ -1,29 +0,0 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI Dev Build
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
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
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: SimpleClans
path: target/SimpleClans.jar
-29
View File
@@ -1,29 +0,0 @@
name: Publish to CurseForge
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
- 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 }}
display_name: ${{ github.event.release.tag_name }}
game_versions: 7915,7667,7330,7105,6588,630,591,585,531
release_type: release
relations: vault:optionalDependency,worldguard:optionalDependency,grief-prevention:optionalDependency
+8 -6
View File
@@ -1,9 +1,11 @@
/target/
/.idea/
/bin/
/.classpath
/.project
/dependency-reduced-pom.xml
.idea/
bin/
.classpath
.project
*.jar
build/
.gradle/
.settings
.factorypath
SimpleClans.iml
/unions.txt
+6
View File
@@ -0,0 +1,6 @@
[submodule "libs/Utilities-OG"]
path = libs/Utilities-OG
url = https://git.trueog.net/trueog/Utilities-OG
[submodule "libs/DiamondBank-OG"]
path = libs/DiamondBank-OG
url = https://git.trueog.net/trueog/DiamondBank-OG
-22
View File
@@ -1,22 +0,0 @@
# Use https://travis-ci.org/ for automatic testing
# This is a java project
language: java
script: mvn install
jdk: [openjdk8]
# if one build failed, exit testing
matrix:
fast_finish: true
addons:
artifacts: true
# Disable caching in order to get notified if there are some repo/dependency issues
## Cache maven dependencies
#sudo: false
#cache:
# directories:
# - '$HOME/.m2/repository'
+126
View File
@@ -0,0 +1,126 @@
# Unions-OG Changelog
This changelog records only changes made by the Unions-OG soft fork relative
to upstream [SimpleClans](https://github.com/RoinujNosde/SimpleClans). Changes
inherited unchanged from SimpleClans are intentionally omitted.
## [2.5.1] - 2026-08-15
- Inactivity purges removed. Unions and player data are no longer deleted on startup.
## [2.5] - 2026-08-13
### Added
- Clickable chat buttons for request responses. Accept and deny regroup requests
now display green `[ACCEPT]` and red `[DENY]` buttons in chat that players can
click instead of typing commands. Hover text explains each button's action.
Command-based responses still work for full backward compatibility.
- Adventure/MiniMessage dependency for rich text rendering and interactive chat
components.
- Fix union commands and help menu
## [2.4] - 2026-08-10
### Added
- Unions decide by member vote. `disband`, `home set` and `war start` now open
a proposal that passes when half the members are in favour, is rejected once
half becomes unreachable, and expires after 7 days. Votes are stored in the
database, so members can vote when they next log in.
- `/union vote` shows the open proposal and its tally; `/union vote yes|no`
casts a vote. A vote screen in the GUI does the same, and is shown once on
login to members who have not voted.
- Disbanding a union splits its bank evenly between all members. Inert until
union bank accounts are enabled.
- `/clan`, `/clans`, `/factions`, `/guilds`, `/party`, `/tribe`, `/nation`,
`/crew`, `/squad` and `/gang` tell the player to use `/union` instead.
`/f`, `/faction` and `/guild` are left to Utilities-OG.
### Changed
- Unions are flat. Every union command is member-level, and the three actions
above are the only ones needing more than one member's say-so.
- Folded `unionsog.leader.*` into `unionsog.member.*`, which is granted by
default. Union ally management is `unionsog.member.ally-set` and union
friendly fire is `unionsog.member.union-ff`, to avoid clashing with the
existing ally-chat and personal-friendly-fire nodes.
- Renamed clan to union across the API, config sections and message keys:
`Clan` is `Union`, `clan:` is `union:`, `clanchat:` is `unionchat:`.
Database identifiers and PlaceholderAPI placeholder names deliberately keep
their `clan` spelling.
- Renamed `/union clanff` to `/union unionff`.
- Chat and display formats accept `{union}`; `{clan}` still works.
- A union now ends with its last member.
- `/union war start` no longer asks the target union, so the member-count
guard always applies. Removed `war-and-protection.war-start.request-enabled`.
- Inter-union requests are answered by the first member of the asked union
rather than by its leaders.
- Set the union GUI title to "Union Management".
### Removed
- Ranks, promotion and demotion, with their commands, settings, events and GUI
screens.
- The leader role: no leader flag, leader-only command, tag colour, Discord
role or `sc_leader` LuckPerms group. The `sc_players.leader` column is kept
and always written `0` for data compatibility.
- The leaders-only land creation option.
- The in-game Crowdin translation prompts.
### Fixed
- `/union lookup` and `/union profile` no longer print a literal
`%player_rank%` or `%clan_leaders%`.
- Removed a stale `%rank%` token from the default chat formats.
- `/union unionff block` now requires union membership, matching
`/union unionff allow`.
- The legacy database importer no longer reads or writes leader relationships.
## [2.3] - Initial release
### Added
- `/union` and `/unions` as primary command aliases, keeping `/clan` and
`/clans`.
- `/u [message]` for union chat. Running `/u` alone toggles the channel.
- `/union color <color>` with named, legacy and hex color support.
- `simpleunions` PlaceholderAPI aliases alongside the legacy `simpleclans`
identifier, plus MiniPlaceholders support through Utilities-OG.
- A Union Banking preview in the main GUI.
- A configuration-gated legacy database migration from `unions_parties` and
`unions_players`. It never touches the source tables, requires empty
transactional destinations, is idempotent, and aborts startup on failure so
the server cannot run on partially migrated data.
### Changed
- Renamed the plugin and artifact to Unions-OG, moved the namespace to
`net.trueog.unionsog` and permission nodes to `unionsog.*`.
- Replaced Vault with DiamondBank-OG and its shard-based balances. Legacy
Vault-denominated union balances are zeroed once. Union-bank commands are
disabled until DiamondBank-OG provides union-owned accounts.
- Unions are treated as verified without the upstream verification workflow.
- Reserved `None` as a union name or tag, and made the no-union color-tag
placeholder return a stable `&8None`.
- Bulletin-board messages no longer show on login by default.
- Reordered the main GUI around the union overview, banking preview, lists,
leaderboards and administrative tools.
- Replaced the WorldGuard 6 reflection provider with the WorldEdit and
WorldGuard 7 APIs.
- Updated MySQL driver loading for Connector/J 8, MariaDB and JDBC service
discovery.
- Migrated the build from Maven to Gradle with a Java 17 toolchain,
reproducible shaded jars, and the Utilities-OG and DiamondBank-OG submodules.
### Removed
- The Vault dependency, along with the member-fee and upkeep tasks it backed.
- The legacy WorldGuard 6 provider.
- bStats telemetry.
## Fork baseline
The fork last merged upstream SimpleClans history through commit `0406c61b`
on 2026-03-30. Earlier SimpleClans release history belongs to the upstream
project.
+125 -69
View File
@@ -1,84 +1,140 @@
[![SimpleClans Logo](https://i.imgur.com/9vgfVdX.png)](https://www.spigotmc.org/resources/simpleclans.71242/)
![Unions-OG Logo](https://i.imgur.com/9vgfVdX.png)
SimpleClans
==========
# Unions-OG
Full featured clan system for PVP Minecraft Servers!
A full-featured union system for PvP Minecraft servers.
[![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)
[![Discord](https://img.shields.io/discord/719557355917934613?label=discord&logo=discord)](https://discord.gg/CkNwgdE)
[![bStats Servers](https://img.shields.io/bstats/servers/7131)](https://bstats.org/plugin/bukkit/SimpleClans/7131)
[![bStats Players](https://img.shields.io/bstats/players/7131)](https://bstats.org/plugin/bukkit/SimpleClans/7131)
> [!IMPORTANT]
> Unions-OG is an unofficial soft fork of
> [SimpleClans](https://github.com/RoinujNosde/SimpleClans), maintained for the
> TrueOG Network. Upstream behavior is retained where practical, while
> branding, integrations, and selected gameplay behavior intentionally differ.
Current fork version: **2.4**
#### Download Link
- [Fork-only changelog](CHANGELOG.md)
- [PlaceholderAPI and MiniPlaceholders reference](placeholder-info.txt)
- [Upstream SimpleClans project](https://github.com/RoinujNosde/SimpleClans)
* [Download from Spigot](https://www.spigotmc.org/resources/simpleclans.71242/)
## Main fork differences
#### Documentation
### Flat unions
* [Documentation](https://simpleclans.gitbook.io/simpleclans/)
* Commands & Permissions
* [Permissions](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/permissions)
* [Commands](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/commands)
* [Clan Alliances and Rivalries](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/aliances-and-rivalries)
* [Clan Ranks with Permissions](https://simpleclans.gitbook.io/simpleclans/commands-and-permissions/ranks-with-permissions)
* How to Setup
* [Configuration](https://simpleclans.gitbook.io/simpleclans/how-to-setup/configuration)
* [Translation](https://simpleclans.gitbook.io/simpleclans/how-to-setup/translation)
* [Clan Member Fee](https://simpleclans.gitbook.io/simpleclans/how-to-setup/member-fee)
* [Clan Upkeep](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-upkeep)
* [Clan name above players head](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-below-players-name)
* [Clan name on Tablist](https://simpleclans.gitbook.io/simpleclans/how-to-setup/clan-on-tablist)
* Plugins & Development
* [SimpleClans API Example](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)
* [PlaceholderAPI Placeholders](https://simpleclans.gitbook.io/simpleclans/other/placeholderapi-support)
* [Land Protection Plugins](https://simpleclans.gitbook.io/simpleclans/other/land-claims)
#### Support & Suggestions
Unions have no internal hierarchy. Ranks, promotion, demotion and the leader
role itself were removed, so every member holds the same powers.
* [Discord Support](https://discord.gg/CkNwgdE)
* [Bugs and Suggestions](https://github.com/RoinujNosde/SimpleClans/issues)
- Every union command is member-level. There is no leader flag, no rank
system, and no way to grant one member authority over another.
- A union ends with its last member: resigning, or being kicked or moved out
as the only member, disbands it.
### Decisions by member consensus
#### Developers
Three actions need a vote of the union's own members instead of a leader's
say-so: **disband**, **home set**, and **war start**.
Including SimpleClans with Maven:
```xml
<repositories>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
</repositories>
```
```xml
<dependencies>
<dependency>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.15.0</version> <!-- You can find the latest version at the bottom -->
<scope>provided</scope>
</dependency>
</dependencies>
- A proposal passes as soon as half the members (rounded up) vote in favour,
and is rejected as soon as enough vote against that half can no longer be
reached.
- Votes are stored in the database, so a member who is offline when a
proposal opens can still vote the next time they log in. Proposals expire
after 7 days.
- A union can only have one proposal open at a time.
- Members vote with `/union vote yes|no`, or by clicking the vote buttons in
the union GUI. The GUI is presented once on login to members who have not
voted yet.
- `/union vote` on its own shows the open proposal and the running tally.
### Other differences
- Uses Unions-OG branding and union terminology throughout, including config
sections (`union:`, `unionchat:`) and message keys.
- Provides `/union` and `/unions`. Other group words — `/clan`, `/clans`,
`/factions`, `/guilds`, `/party`, `/tribe`, `/nation`, `/crew`, `/squad` and
`/gang` — are registered as signposts that tell the player to run the same command with
`/union` instead. `/f`, `/faction` and `/guild` belong to Utilities-OG,
which already redirects them.
- Uses `/u` for union chat; a bare `/u` toggles the union-chat channel.
- Adds `/union rename <name>` and `/union color <color>`, both open to any
member.
- Union-wide friendly fire is `/union unionff allow|block`, aliased as
`/union pvp on|off`. The per-player friendly fire opt-in (`/union ff`)
is removed, so friendly fire is decided only by the union setting or the
staff-wide `globalff` override.
- Supports both `simpleclans` and `simpleunions` placeholder identifiers in
PlaceholderAPI and MiniPlaceholders.
- Uses DiamondBank-OG instead of Vault for player economy access. Union-owned
bank accounts remain under development, so their commands are currently
disabled. Once enabled, disbanding a union splits its bank evenly between
all members.
- Treats unions as verified without requiring the upstream verification
workflow.
- Includes a configuration-gated, transactional importer for the legacy
unions database.
See the [changelog](CHANGELOG.md) for the complete list of changes maintained
by this fork. Upstream SimpleClans changes are intentionally not repeated
there.
## Documentation
The [Unions-OG wiki](wiki/) documents this fork, and is the reference to use.
- [Commands](wiki/commands-and-permissions/commands.md)
- [Permissions](wiki/commands-and-permissions/permissions.md)
- [Proposals and Voting](wiki/commands-and-permissions/proposals-and-voting.md)
- [Union Alliances and Rivalries](wiki/commands-and-permissions/alliances-and-rivalries.md)
- [Configuration](wiki/how-to-setup/configuration.md)
- [PlaceholderAPI Support](wiki/other/placeholderapi-support.md)
- [API example](wiki/other/unions-og-api.md)
> [!WARNING]
> The [upstream SimpleClans documentation](https://simpleclans.gitbook.io/simpleclans/)
> no longer describes this fork. Its pages on leaders, ranks, promotion,
> demotion, member fees and upkeep do **not** apply, and its command,
> permission and configuration names have all been renamed here.
For the unmodified upstream plugin and its public releases, use the
[SimpleClans Spigot page](https://www.spigotmc.org/resources/simpleclans.71242/).
That download is not an Unions-OG build.
## Building
The build requires Java 17. Clone with submodules, then run:
```bash
git submodule update --init --recursive
./gradlew build
```
Using Gradle:
```groovy
repositories {
maven {
url "https://repo.codemc.org/repository/maven-public"
}
}
dependencies {
compileOnly "net.sacredlabyrinth.phaed.simpleclans:SimpleClans:2.15.0"
}
```
The shaded plugin is produced under `build/libs/` with the
`Unions-OG-2.4.jar` name.
##### Latest version:
[![](https://jitpack.io/v/roinujnosde/simpleclans.svg?label=Maven)]()
##### API Examples
* [Examples of how to use the API](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)
## Developer compatibility
- Java and Gradle namespace: `net.trueog.unionsog`
- Bukkit main class: `net.trueog.unionsog.UnionsOG`
- API types use union naming: `Union`, `UnionPlayer`, `UnionManager`,
`Proposal`, `DisbandUnionEvent`
- Permission prefix: `unionsog.*`. Union actions all live under
`unionsog.member.*`, which is granted by default; there is no
`unionsog.leader.*` tree
- Command aliases: `union` and `unions`. Other group words are redirect-only
signposts, not aliases, and never execute a union command
- Placeholder identifiers: `simpleunions` and the retained `simpleclans`
compatibility identifier. Placeholder **names** deliberately keep their
upstream `clan` spelling (`%simpleunions_clan_name%`) so existing setups
keep resolving
- Database identifiers are unchanged for live-data compatibility: the table
prefix stays `sc_`, and the `clans` table and `leader` column are retained
even though the leader column is no longer used
- Chat and display formats accept `{union}`; the legacy `{clan}` token still
works
The old SimpleClans Maven coordinates and Java packages do not describe this
fork and should not be used as Unions-OG API coordinates.
## Credits and license
Unions-OG is derived from SimpleClans by its original and upstream
contributors. This fork remains licensed under the [GNU GPL v3](LICENSE).
-109
View File
@@ -1,109 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.16-R0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.26" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.MilkBowl:VaultAPI:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit: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: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" />
<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: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.28" 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: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.26" 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.plotsquared:PlotSquared-Core:5.13.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.plotsquared:PlotSquared-Bukkit:5.13.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.plotsquared:plotsquared-api:3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.plotsquared:plotsquared-bukkitapi:3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.7" level="project" />
</component>
</module>
File diff suppressed because it is too large. Load diff
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/bash
# Fetch all submodule content.
git submodule update --force --recursive --init
+181
View File
@@ -0,0 +1,181 @@
import org.gradle.kotlin.dsl.provideDelegate
/* ------------------------------ Plugins ------------------------------ */
plugins {
id("java") // Import Java plugin.
id("java-library") // Import Java Library plugin.
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
id("checkstyle") // Import Checkstyle plugin.
eclipse // Import Eclipse plugin.
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
}
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
/* --------------------------- JDK / Kotlin ---------------------------- */
java {
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
toolchain { // Select Java toolchain.
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
}
}
kotlin { jvmToolchain(17) }
/* ----------------------------- Metadata ------------------------------ */
group = "net.trueog.unionsog" // Declare bundle identifier.
version = "2.5.1" // Declare plugin version (will be in .jar).
val apiVersion = "1.19" // Declare minecraft server target version.
/* ----------------------------- Resources ----------------------------- */
tasks.named<ProcessResources>("processResources") {
val props = mapOf("version" to version, "apiVersion" to apiVersion)
inputs.properties(props) // Indicates to rerun if version changes.
filesMatching("plugin.yml") { expand(props) }
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
}
/* ---------------------------- Repos ---------------------------------- */
repositories {
mavenCentral() // Import the Maven Central Maven Repository.
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") }
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
maven { url = uri("https://repo.aikar.co/content/groups/aikar/") }
maven { url = uri("https://maven.enginehub.org/repo/") }
maven { url = uri("https://nexus.scarsz.me/content/groups/public/") }
maven { url = uri("https://eldonexus.de/repository/maven-public") }
maven { url = uri("https://jitpack.io") }
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let {
val dir = file(it)
if (dir.isDirectory) {
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
maven { url = uri("file://${dir.absolutePath}") }
} else {
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
mavenLocal()
}
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
}
/* ---------------------- Java project deps ---------------------------- */
dependencies {
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("net.luckperms:api:5.5") // Import LuckPerms API.
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
compileOnlyApi(project(":libs:DiamondBank-OG")) {
attributes { attribute(kotlinAttribute, true) }
} // Import TrueOG network DiamondBank-OG Kotlin API (from source).
compileOnly("me.clip:placeholderapi:2.11.3")
compileOnly("org.jetbrains:annotations:24.0.1")
implementation("io.papermc:paperlib:1.0.8-SNAPSHOT")
implementation("net.kyori:adventure-api:4.14.0")
implementation("net.kyori:adventure-text-minimessage:4.14.0")
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
implementation("co.aikar:acf-paper:0.5.1-SNAPSHOT")
implementation("com.github.cryptomorin:XSeries:11.2.0.1")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT") { isTransitive = false }
compileOnly("com.sk89q.worldedit:worldedit-core:7.3.0-SNAPSHOT") { isTransitive = false }
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.8") { isTransitive = false }
compileOnly("com.sk89q.worldguard:worldguard-core:7.0.8") { isTransitive = false }
compileOnly("com.github.TechFortress:GriefPrevention:17.0.0")
compileOnly("com.discordsrv:discordsrv:1.28.0")
implementation("com.google.code.gson:gson:2.10.1")
testImplementation("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.3")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.11.3")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.3")
testImplementation("org.mockito:mockito-core:5.14.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
testImplementation("com.h2database:h2:2.3.232")
}
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
/* ---------------------- Reproducible jars ---------------------------- */
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
/* ----------------------------- Shadow -------------------------------- */
tasks.shadowJar {
relocate("io.papermc.lib", "net.trueog.unionsog.paperlib")
relocate("co.aikar.commands", "net.trueog.unionsog.acf")
relocate("co.aikar.locales", "net.trueog.unionsog.locales")
relocate("com.cryptomorin.xseries", "net.trueog.unionsog.xseries")
relocate("com.google.gson", "net.trueog.unionsog.gson")
dependencies { exclude(dependency("org.jetbrains:annotations:.*")) }
archiveBaseName.set("Unions-OG")
archiveClassifier.set("")
}
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar, tasks.javadoc) } // Build depends on spotless and shadow.
/* --------------------------- Javac opts ------------------------------- */
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters") // Enable reflection for java code.
options.isFork = true // Run javac in its own process.
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
options.encoding = "UTF-8" // Use UTF-8 file encoding.
}
tasks.test { useJUnitPlatform() }
/* ----------------------------- Auto Formatting ------------------------ */
spotless {
java {
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
removeUnusedImports() // Remove imports that aren't being called.
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
}
}
checkstyle {
toolVersion = "10.18.1" // Declare checkstyle version to use.
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
}
tasks.named("compileJava") {
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
}
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}
/* ------------------------------ Eclipse SHIM ------------------------- */
// This can't be put in eclipse.gradle.kts because Gradle is weird.
subprojects {
apply(plugin = "java-library")
apply(plugin = "eclipse")
eclipse.project.name = "${project.name}-${rootProject.name}"
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
}
tasks.register<Copy>("copyToTestServer") {
val out = System.getenv("TEST_SERVER")?.let { file("$it/plugins") }
onlyIf { out != null }
dependsOn(tasks.shadowJar)
from(tasks.shadowJar)
into(out ?: layout.buildDirectory.dir("noop").get().asFile)
}
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
<property name="severity" value="error"/>
</module>
<module name="TreeWalker">
<module name="FinalLocalVariable"/>
<module name="AvoidStarImport"/>
<module name="Indentation">
<property name="severity" value="ignore"/>
</module>
</module>
<module name="RegexpSingleline">
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="ignoreCase" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="(?&lt;!\w)fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="severity" value="warning"/>
</module>
</module>
+404
View File
@@ -0,0 +1,404 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="23">
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
</profiles>
+4
View File
@@ -1,3 +1,7 @@
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%
-327
View File
@@ -1,327 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<name>SimpleClans</name>
<version>2.15.1</version>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
<include>*.properties</include>
</includes>
</resource>
</resources>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats.bukkit</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.metrics</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.paperlib</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.locales</shadedPattern>
</relocation>
<relocation>
<pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>org.reflections</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.reflections</shadedPattern>
</relocation>
</relocations>
<artifactSet>
<excludes>
<exclude>org.jetbrains:annotations</exclude>
</excludes>
</artifactSet>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>placeholderapi-repo</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>IntellectualSites</id>
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
</repository>
<repository>
<id>plotsquared</id>
<url>https://plotsquared.com/mvn/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>bungeecord-chat</artifactId>
<groupId>net.md-5</groupId>
</exclusion>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
<groupId>org.bukkit</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>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>
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>16.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<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>
</exclusion>
<exclusion>
<artifactId>junit-platform-commons</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>worldedit-bukkit</artifactId>
<groupId>com.sk89q.worldedit</groupId>
</exclusion>
<exclusion>
<artifactId>worldguard-core</artifactId>
<groupId>com.sk89q.worldguard</groupId>
</exclusion>
<exclusion>
<artifactId>commandbook</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>16.17.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>PlotSquared-Core</artifactId>
<version>5.13.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>PlotSquared-Bukkit</artifactId>
<version>5.13.3</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>PlotSquared-Core</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-api</artifactId>
<version>3.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>com.sk89q.worldedit</groupId>
</exclusion>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-bukkitapi</artifactId>
<version>3.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>com.sk89q.worldedit</groupId>
</exclusion>
<exclusion>
<artifactId>Core</artifactId>
<groupId>PlotSquared</groupId>
</exclusion>
<exclusion>
<artifactId>VaultAPI</artifactId>
<groupId>net.milkbowl.vault</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
+151
View File
@@ -0,0 +1,151 @@
/* This is free and unencumbered software released into the public domain */
import org.gradle.plugins.ide.eclipse.model.EclipseModel
import java.nio.file.Files
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.OutputKeys
import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
val kotlinPluginProjects = configurations
.getByName("compileClasspath")
.allDependencies
.filterIsInstance<ProjectDependency>()
.filter { it -> it.attributes.getAttribute(kotlinAttribute) != null }
.map { it.path }
kotlinPluginProjects.forEach { evaluationDependsOn(it) }
val ideLibs: Configuration by
configurations.creating {
isCanBeResolved = true
isCanBeConsumed = false
}
configure<EclipseModel> {
project {
name = "Template-OG-Plugin"
}
classpath {
plusConfigurations.add(ideLibs)
}
}
val ideLibDir = layout.buildDirectory.dir("ide-libs")
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
val copyTasks = mutableListOf<TaskProvider<Copy>>()
kotlinPluginProjects.forEach { path ->
val sub = project(path)
val shadowJarProv = sub.tasks.named("shadowJar")
val copyTask =
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
dependsOn(shadowJarProv)
from(shadowJarProv)
into(ideLibDir)
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
}
copyTasks += copyTask
}
/* Ensure the jars exist before .classpath is generated */
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
/* Supply those jars to the ideLibs configuration (after evaluation) */
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
val injectIdeLibs =
tasks.register("injectIdeLibs") {
dependsOn("eclipse") // run after all eclipse files are generated
doLast {
val cpFile = file(".classpath")
if (!cpFile.exists()) return@doLast
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
if (jars.isEmpty()) return@doLast
// Parse DOM
val dbf = DocumentBuilderFactory.newInstance()
val doc = dbf.newDocumentBuilder().parse(cpFile)
val root = doc.documentElement
// Helper to see if an entry already exists
fun exists(path: String): Boolean =
root.getElementsByTagName("classpathentry").let { list ->
(0 until list.length).any { i ->
val n = list.item(i)
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
val p = n.attributes?.getNamedItem("path")?.nodeValue
kind == "lib" && p == path
}
}
// Remove any entry that points to ide-libs dir (folder or jars) to avoid dupes
val toRemove = mutableListOf<org.w3c.dom.Node>()
val list = root.getElementsByTagName("classpathentry")
val dirPath = ideLibDir.get().asFile.absolutePath
for (i in 0 until list.length) {
val n = list.item(i)
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
if (kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))) {
toRemove += n
}
}
toRemove.forEach { root.removeChild(it) }
// Append our jar entries LAST
jars.forEach { f ->
val abs = f.absolutePath
if (!exists(abs)) {
val entry = doc.createElement("classpathentry")
entry.setAttribute("kind", "lib")
entry.setAttribute("path", abs)
root.appendChild(entry)
}
}
// Write back pretty
val tf =
TransformerFactory.newInstance().newTransformer().apply {
setOutputProperty(OutputKeys.INDENT, "yes")
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
}
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
}
}
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
val eclipseModel = extensions.getByType<EclipseModel>()
fun Project.addResolvableEclipseConfigs() {
val jarAttr =
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
val compileOnlyRes =
configurations.create("eclipseCompileOnly") {
extendsFrom(configurations.getByName("compileOnly"))
isCanBeResolved = true
isCanBeConsumed = false
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
}
val compileOnlyApiRes =
configurations.create("eclipseCompileOnlyApi") {
extendsFrom(configurations.getByName("compileOnlyApi"))
isCanBeResolved = true
isCanBeConsumed = false
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
}
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
}
addResolvableEclipseConfigs()
+2
View File
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1024m -Dfile.encoding=UTF-8
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Submodule libs/DiamondBank-OG added at 39d5a2b936.
+1
Submodule libs/Utilities-OG added at 8b5c86cc9c.
+194
View File
@@ -0,0 +1,194 @@
Unions-OG Placeholder Reference
===============================
Unions-OG registers legacy PlaceholderAPI placeholders when PlaceholderAPI is installed.
It also registers MiniPlaceholders through the Utilities-OG API when Utilities-OG is installed.
Identifiers
-----------
All placeholders use both identifiers:
- simpleclans
- simpleunions
In the syntax patterns below, replace {id} with either identifier.
Legacy PlaceholderAPI syntax:
- Player placeholder: %{id}_{player-placeholder}%
- Union placeholder: %{id}_clan_{union-placeholder}%
- Union compatibility alias: %{id}_union_{union-placeholder}%
- Relational color placeholder: %rel_{id}_color%
MiniPlaceholders syntax:
- Player placeholder: <{id}_{player-placeholder}>
- Union placeholder: <{id}_clan_{union-placeholder}>
- Union compatibility alias: <{id}_union_{union-placeholder}>
- Relational color placeholder: <{id}_rel_color>
MiniPlaceholders are audience placeholders unless marked relational. They require a player audience.
Relational MiniPlaceholders require a relational MiniPlaceholders context.
Boolean output follows PlaceholderAPI's boolean.true and boolean.false config values when PlaceholderAPI is loaded.
Without PlaceholderAPI, boolean placeholders return yes or no.
Player Placeholders
-------------------
These resolve against the requested player:
- name
- clean_name
- lastseendays
- total_kills
- rival_kills
- civilian_kills
- neutral_kills
- ally_kills
- is_friendlyfire_on
- deaths
- weighted_kills
- kdr
- topplayers_position
- join_date
- lastseen
- inactive_days
- in_clan
- tag
- tag_label
- is_trusted
- is_member
- clanchat_player_color
- allychat_player_color
- is_bb_enabled
- is_invite_enabled
- is_tag_enabled
- is_muted
- is_mutedally
Player compatibility aliases:
- in_union maps to in_clan
- unionchat_player_color maps to clanchat_player_color
Examples:
- %simpleclans_name%
- %simpleunions_in_union%
- <simpleclans_name>
- <simpleunions_in_union>
Union Placeholders
------------------
These resolve against the requested player's union:
- name
- balance
- balance_formatted
- tag
- color
- inactivedays
- friendly_fire
- allies_count
- founded
- color_tag
- size
- rivals_count
- is_permanent
- onlinemembers_count
- total_kdr
- topclans_position
- total_deaths
- average_wk
- total_kills
- total_rival
- total_neutral
- total_civilian
- total_ally
- is_anyonline
- is_unrivable
- allow_withdraw
- allow_deposit
Union compatibility aliases:
- Use union_ instead of clan_ for any union placeholder.
- topunions_position maps to topclans_position.
Examples:
- %simpleclans_clan_name%
- %simpleclans_union_name%
- %simpleunions_clan_color_tag%
- %simpleunions_union_topunions_position%
- <simpleclans_clan_name>
- <simpleclans_union_name>
- <simpleunions_clan_color_tag>
- <simpleunions_union_topunions_position>
Top Player Placeholders
-----------------------
Legacy PlaceholderAPI syntax:
- %{id}_topplayers_{position}_{player-placeholder}%
MiniPlaceholders syntax:
- <{id}_topplayers_{player-placeholder}:{position}>
The {position} value is 1-based. The {player-placeholder} value can be any player placeholder or player compatibility alias listed above.
Examples:
- %simpleclans_topplayers_1_name%
- %simpleunions_topplayers_3_kdr%
- <simpleclans_topplayers_name:1>
- <simpleunions_topplayers_kdr:3>
Top Union Placeholders
----------------------
Legacy PlaceholderAPI syntax:
- %{id}_topclans_{position}_clan_{union-placeholder}%
- %{id}_topunions_{position}_union_{union-placeholder}%
MiniPlaceholders syntax:
- <{id}_topclans_clan_{union-placeholder}:{position}>
- <{id}_topunions_union_{union-placeholder}:{position}>
The {position} value is 1-based. The {union-placeholder} value can be any union placeholder or union compatibility alias listed above.
Examples:
- %simpleclans_topclans_1_clan_name%
- %simpleclans_topunions_1_union_name%
- %simpleunions_topclans_5_clan_total_kdr%
- <simpleclans_topclans_clan_name:1>
- <simpleclans_topunions_union_name:1>
- <simpleunions_topclans_clan_total_kdr:5>
Relational Color Placeholder
----------------------------
The relational color placeholder returns a color code based on the relationship between two players:
- same union: &a
- ally: &b
- rival: &c
- unrelated: empty string
Legacy PlaceholderAPI syntax:
- %rel_simpleclans_color%
- %rel_simpleunions_color%
MiniPlaceholders syntax:
- <simpleclans_rel_color>
- <simpleunions_rel_color>
-289
View File
@@ -1,289 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.15.2</version>
<name>SimpleClans</name>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
<build>
<finalName>${project.name}</finalName>
<!-- Resources -->
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
<include>*.properties</include>
</includes>
</resource>
</resources>
<!-- Plugins -->
<plugins>
<!-- Compilation plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<!-- JAR creation plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<!-- Release plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<!-- Shade plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<relocations>
<relocation>
<pattern>org.bstats.bukkit</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.metrics</shadedPattern>
</relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.paperlib</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.acf</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.locales</shadedPattern>
</relocation>
<relocation>
<pattern>com.cryptomorin.xseries</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.xseries</shadedPattern>
</relocation>
<relocation>
<pattern>org.reflections</pattern>
<shadedPattern>net.sacredlabyrinth.phaed.simpleclans.reflections</shadedPattern>
</relocation>
</relocations>
<artifactSet>
<excludes>
<exclude>org.jetbrains:annotations</exclude>
</excludes>
</artifactSet>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Dependencies -->
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</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>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
<version>0.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<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.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.plotsquared</groupId>
<artifactId>PlotSquared-Core</artifactId>
<version>5.13.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>PlotSquared-Bukkit</artifactId>
<version>5.13.3</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>PlotSquared-Core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-api</artifactId>
<version>3.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-bukkitapi</artifactId>
<version>3.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>PlotSquared</groupId>
<artifactId>Core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!-- Repositories -->
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>placeholderapi-repo</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>IntellectualSites</id>
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
</repository>
<repository>
<id>plotsquared</id>
<url>https://plotsquared.com/mvn/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Upstream Distribution -->
<distributionManagement>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
+13
View File
@@ -0,0 +1,13 @@
rootProject.name = "Unions-OG"
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
}
file("libs")
.listFiles()
?.filter { it.isDirectory && !it.name.startsWith(".") }
?.forEach { dir ->
include(":libs:${dir.name}")
project(":libs:${dir.name}").projectDir = dir
}
-3
View File
@@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: net.sacredlabyrinth.phaed.simpleclans.SimpleClans
File diff suppressed because it is too large. Load diff
@@ -1,10 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
/**
* Clan Requests
* @author phaed
*/
public enum ClanRequest
{
DEMOTE, PROMOTE, DISBAND, INVITE, CREATE_ALLY, BREAK_RIVALRY, START_WAR, END_WAR
}
@@ -1,60 +0,0 @@
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;
}
}
@@ -1,65 +0,0 @@
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());
}
}
@@ -1,961 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
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.Material;
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 static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import java.io.IOException;
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.stream.Collectors;
/**
* @author phaed
*/
public class Helper {
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();
if (languageTag == null) {
return defaultLanguage;
}
return Locale.forLanguageTag(languageTag);
}
/**
* 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;
}
public static @Nullable JSONObject parseJson(String json) {
if (json != null && !json.isEmpty()) {
try {
return (JSONObject) new JSONParser().parse(json);
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
/**
* Parses a list of ranks from the specified JSONObject
*
* @param jo the JSON Object
* @return a list of ranks or null if the JSON String is null/empty
*/
public static @Nullable List<Rank> ranksFromJson(@Nullable JSONObject jo) {
if (jo != null && !jo.isEmpty()) {
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;
}
}
return null;
}
/**
* Parses the default rank from the specified JSONObject
*
* @param jo the JSON object
* @return the default rank or null if not found and/or it does not exist
*/
public static @Nullable String defaultRankFromJson(@Nullable JSONObject jo) {
if (jo != null && !jo.isEmpty()) {
if (!jo.containsKey("defaultRank")) {
return null;
} else {
return (String) jo.get("defaultRank");
}
}
return null;
}
/**
* Converts a list of ranks and the default rank to a JSON String
*
* @param ranks the ranks
* @param defaultRank the default rank
* @return a JSON String
*/
@SuppressWarnings("unchecked")
public static String ranksToJson(List<Rank> ranks, @Nullable String defaultRank) {
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);
object.put("defaultRank", defaultRank);
return object.toJSONString();
}
/**
* Converts a resign times map to a JSON String
*
* @param resignTimes
* @return a JSON String
*/
public static String resignTimesToJson(Map<String, Long> resignTimes) {
return JSONObject.toJSONString(resignTimes);
}
/**
* Converts a JSON String to a resign times map
*
* @param json JSON String
* @return a map
*/
@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 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;
LocalDateTime now = LocalDateTime.now();
LocalDateTime d = LocalDateTime.of(now.toLocalDate(), LocalTime.of(hour, minute));
long delay;
if (now.isAfter(d)) {
delay = now.until(d.plusDays(1), ChronoUnit.SECONDS);
} else {
delay = now.until(d, ChronoUnit.SECONDS);
}
return delay;
}
/**
* Get a players full color name if he is online
*
* @param playerName
* @return
*/
public static String getColorName(String playerName) {
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 playerName;
}
/**
* 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 "";
}
if (hexValue.startsWith("&#")) {
return ChatUtils.parseColors(hexValue);
}
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> fromArray(String... values) {
List<String> results = new ArrayList<>();
Collections.addAll(results, values);
results.remove("");
return results;
}
/**
* Converts string array to HashSet<String>, remove empty strings
*
* @param values
* @return
*/
public static Set<String> fromArray2(String... values) {
HashSet<String> results = new HashSet<>();
Collections.addAll(results, values);
results.remove("");
return results;
}
/**
* 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[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();
}
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 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);
}
/**
* @deprecated use {@link ChatUtils#parseColors(String)}
*/
@Deprecated
public static String parseColors(String msg) {
return ChatUtils.parseColors(msg);
}
/**
* Removes color codes from strings
*
* @deprecated use {@link ChatUtils#stripColors(String)}
*/
@Deprecated
public static String stripColors(String msg) {
return ChatUtils.stripColors(msg);
}
/*
* 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 "";
}
/**
* Cleans up the tag from color codes and makes it lowercase
*
* @param tag
* @return
*/
public static String cleanTag(String tag) {
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
*
* @param sep
* @return
*/
public static String generatePageSeparator(String sep) {
String out = "";
for (int i = 0; i < 320; i++) {
out += sep;
}
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
*
* @param in
* @return
*/
public static List<ClanPlayer> stripOffLinePlayers(List<ClanPlayer> in) {
List<ClanPlayer> out = new ArrayList<>();
for (ClanPlayer cp : in) {
if (cp.toPlayer() != null) {
out.add(cp);
}
}
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
*
* @param str
* @return
*/
public static String escapeQuotes(@Nullable String str) {
if (str == null) {
return "";
}
return str.replace("'", "''");
}
/**
* Returns a prettier coordinate, does not include world
*
* @param loc
* @return
*/
public static String toLocationString(Location loc) {
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
*
* @param map the Map to sort
* @return the Map sorted
*/
public static <K, V extends Comparable<V>> Map<K, V> sortByValue(Map<K, V> map) {
LinkedList<Map.Entry<K, V>> entryList = new LinkedList<>(map.entrySet());
entryList.sort(Entry.comparingByValue());
Map<K, V> result = new LinkedHashMap<>();
for (Entry<K, V> entry : entryList) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
/**
* @deprecated use {@link VanishUtils#isVanished(CommandSender, Player)}
*/
@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;
}
/**
* @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();
}
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 : ChatUtils.parseColors(cp.getRankDisplayName());
String rankFormat = rank != null ? ChatUtils.parseColors(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 ChatUtils.parseColors(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 : ChatUtils.parseColors(cp.getRankDisplayName());
String rankFormat = rank != null ? ChatUtils.parseColors(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 formatted 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 {
return ChatColor.DARK_GRAY + "[" + cp.getTag() + "] " + msg;
}
}
/**
* Formats max inactive days to an infinity symbol if it's negative or 0
*
* @param max inactive days
* @return formatted message
*/
public static String formatMaxInactiveDays(int max) {
if (max <= 0) {
return "∞";
} else {
return String.valueOf(max);
}
}
@NotNull
public static String getFormattedClanStatus(Clan clan, CommandSender sender) {
ArrayList<String> statuses = new ArrayList<>();
if (clan.isPermanent()) {
statuses.add(lang("permanent", sender));
}
if (clan.isVerified()) {
statuses.add(lang("verified", sender));
} else {
statuses.add(lang("unverified", sender));
}
return String.join(", ", statuses);
}
/**
* Checks if all passed materials are some kind of AIR
*
* @param materials materials to test
* @return true if all materials are AIR
*/
public static boolean isAir(@NotNull Material... materials) {
for (Material m : materials) {
if (!m.name().contains("AIR")) {
return false;
}
}
return true;
}
}
@@ -1,42 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import java.time.LocalDateTime;
public class Kill {
private final ClanPlayer killer;
private final ClanPlayer victim;
private final LocalDateTime time;
public Kill(ClanPlayer killer, ClanPlayer victim, LocalDateTime time) {
this.killer = killer;
this.victim = victim;
this.time = time;
}
public ClanPlayer getKiller() {
return killer;
}
public ClanPlayer getVictim() {
return victim;
}
public LocalDateTime getTime() {
return time;
}
public enum Type {
CIVILIAN("c"), RIVAL("r"), NEUTRAL("n"), ALLY("a");
Type(String shortName) {
this.shortName = shortName;
}
private final String shortName;
public String getShortname() {
return shortName;
}
}
}
@@ -1,5 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
public enum PermissionLevel {
LEADER, TRUSTED
}
@@ -1,105 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author RoinujNosde
*/
public class Rank implements Comparable<Rank> {
private String name;
private String displayName;
private Set<String> permissions;
public Rank(String name) {
setName(name);
permissions = new HashSet<String>();
setDisplayName(displayName);
}
public Rank(String name, String displayName, Set<String> permissions) {
setName(name);
setDisplayName(displayName);
setPermissions(permissions);
}
public void setName(String name) {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("name cannot be null or empty");
}
this.name = name;
}
public void setDisplayName(String displayName) {
if (displayName == null || displayName.isEmpty()) {
displayName = name;
}
this.displayName = displayName;
}
public void setPermissions(Set<String> permissions) {
if (permissions == null) {
permissions = new HashSet<String>();
}
this.permissions = permissions;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Rank other = (Rank) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
/**
* Returns the rank's permissions
*
* @return
*/
public Set<String> getPermissions() {
return permissions;
}
/**
* Returns the rank's display name
*
* @return
*/
public String getDisplayName() {
return displayName;
}
/**
* Returns the rank's name
*
* @return
*/
public String getName() {
return name;
}
@Override
public int compareTo(Rank other) {
return Integer.compare(permissions.size(), other.permissions.size());
}
}
@@ -1,89 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.Nullable;
/**
*
* @author RoinujNosde
*
*/
public enum RankPermission {
ALLY_ADD("simpleclans.leader.ally", PermissionLevel.LEADER),
ALLY_CHAT("simpleclans.member.ally", PermissionLevel.TRUSTED),
ALLY_REMOVE("simpleclans.leader.ally", PermissionLevel.LEADER),
BANK_BALANCE("simpleclans.member.bank", PermissionLevel.TRUSTED),
BANK_DEPOSIT("simpleclans.member.bank", PermissionLevel.LEADER),
BANK_WITHDRAW("simpleclans.member.bank", PermissionLevel.LEADER),
BB_ADD("simpleclans.member.bb-add", PermissionLevel.TRUSTED),
BB_CLEAR("simpleclans.leader.bb-clear", PermissionLevel.LEADER),
COORDS("simpleclans.member.coords", PermissionLevel.TRUSTED),
FEE_ENABLE("simpleclans.leader.fee", PermissionLevel.LEADER),
FEE_SET("simpleclans.leader.fee", PermissionLevel.LEADER),
REGROUP_HOME("simpleclans.leader.regroup.home", PermissionLevel.LEADER),
REGROUP_ME("simpleclans.leader.regroup.me", PermissionLevel.LEADER),
HOME_SET("simpleclans.leader.home-set", PermissionLevel.LEADER),
HOME_TP("simpleclans.member.home", PermissionLevel.TRUSTED),
INVITE("simpleclans.leader.invite", PermissionLevel.LEADER),
KICK("simpleclans.leader.kick", PermissionLevel.LEADER),
MODTAG("simpleclans.leader.modtag", PermissionLevel.LEADER),
RANK_DISPLAYNAME("simpleclans.leader.rank.setdisplayname", PermissionLevel.LEADER),
RANK_LIST("simpleclans.leader.rank.list", PermissionLevel.LEADER),
RIVAL_ADD("simpleclans.leader.rival", PermissionLevel.LEADER),
RIVAL_REMOVE("simpleclans.leader.rival", PermissionLevel.LEADER),
WAR_END("simpleclans.leader.war", PermissionLevel.LEADER),
WAR_START("simpleclans.leader.war", PermissionLevel.LEADER),
STATS("simpleclans.member.stats", PermissionLevel.TRUSTED),
VITALS("simpleclans.member.vitals", PermissionLevel.TRUSTED),
KILLS("simpleclans.member.kills", PermissionLevel.TRUSTED),
DESCRIPTION("simpleclans.leader.description", PermissionLevel.LEADER),
MOSTKILLED("simpleclans.mod.mostkilled", PermissionLevel.TRUSTED),
FRIENDLYFIRE("simpleclans.leader.ff", PermissionLevel.LEADER),
SETBANNER("simpleclans.leader.setbanner", PermissionLevel.LEADER);
private final String bukkitPermission;
private final PermissionLevel permissionLevel;
RankPermission(String bukkitPermission, PermissionLevel permissionLevel) {
this.bukkitPermission = bukkitPermission;
this.permissionLevel = permissionLevel;
}
/**
*
* @return the Bukkit equivalent to this rank permission
*/
public String getBukkitPermission() {
return bukkitPermission;
}
/**
*
* @return the PermissionLevel
*
*/
public PermissionLevel getPermissionLevel() {
return permissionLevel;
}
@Override
public String toString() {
return super.toString().replace("_", ".").toLowerCase();
}
/**
*
* @param permission the permission
* @return true if this is a valid rank permission
*/
@Contract("null -> false")
public static boolean isValid(@Nullable String permission) {
for (RankPermission p : values()) {
if (p.toString().equalsIgnoreCase(permission)) {
return true;
}
}
return false;
}
}
@@ -1,317 +0,0 @@
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.managers.*;
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.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
/**
* @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 SCCommandManager commandManager;
private ClanManager clanManager;
private RequestManager requestManager;
private StorageManager storageManager;
private SettingsManager settingsManager;
private PermissionsManager permissionsManager;
private TeleportManager teleportManager;
private ProtectionManager protectionManager;
private boolean hasUUID;
private static final Pattern ACF_PLACEHOLDER_PATTERN = Pattern.compile("\\{(?<key>[a-zA-Z]+?)}");
/**
* @return the logger
*/
@Deprecated
public static Logger getLog() {
return logger;
}
public static void debug(String msg) {
if (getInstance().getSettingsManager().isDebugging()) {
logger.log(Level.INFO, msg);
}
}
/**
* @return the instance
*/
public static SimpleClans getInstance() {
return instance;
}
@Deprecated
public static void log(String msg, Object... arg) {
if (arg == null || arg.length == 0) {
logger.log(Level.INFO, msg);
} else {
logger.log(Level.INFO, MessageFormat.format(msg, arg));
}
}
@Override
public void onEnable() {
instance = this;
new LanguageMigration(this).migrate();
settingsManager = new SettingsManager();
languageResource = new LanguageResource();
this.hasUUID = UUIDMigration.canReturnUUID();
permissionsManager = new PermissionsManager();
requestManager = new RequestManager();
clanManager = new ClanManager();
storageManager = new StorageManager();
teleportManager = new TeleportManager();
protectionManager = new ProtectionManager();
protectionManager.registerListeners();
migrateChatFormat();
registerEvents();
permissionsManager.loadPermissions();
commandManager = new SCCommandManager(this);
logStatus();
startTasks();
startMetrics();
hookIntoPAPI();
new UpdateChecker(this).check();
}
private void logStatus() {
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);
pm.registerEvents(new SCPlayerListener(), this);
pm.registerEvents(new InventoryController(), this);
pm.registerEvents(new TamableMobsSharing(this), this);
pm.registerEvents(new PvPOnlyInWar(this), this);
pm.registerEvents(new FriendlyFire(this), this);
}
private void migrateChatFormat() {
ChatFormatMigration chatFormatMigration = new ChatFormatMigration();
chatFormatMigration.migrateAllyChat();
chatFormatMigration.migrateClanChat();
}
private void hookIntoPAPI() {
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
getLogger().info("PlaceholderAPI found. Registering hook...");
new SimpleClansExpansion(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 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().isSavePeriodically()) {
new SaveDataTask().start();
}
if (getSettingsManager().isMemberFee()) {
new CollectFeeTask().start();
}
if (getSettingsManager().isClanUpkeep()) {
new CollectUpkeepTask().start();
new UpkeepWarningTask().start();
}
if (getSettingsManager().isCachePlayerHeads()) {
new PlayerHeadCacheTask(this).start();
}
}
@Override
public void onDisable() {
getServer().getScheduler().cancelTasks(this);
if (getSettingsManager().isSavePeriodically()) {
getStorageManager().saveModified();
}
getStorageManager().closeConnection();
getPermissionsManager().savePermissions();
}
/**
* @return the clanManager
*/
public ClanManager getClanManager() {
return clanManager;
}
/**
* @return the requestManager
*/
public RequestManager getRequestManager() {
return requestManager;
}
/**
* @return the storageManager
*/
public StorageManager getStorageManager() {
return storageManager;
}
/**
* @return the settingsManager
*/
public SettingsManager getSettingsManager() {
return settingsManager;
}
/**
* @return the permissionsManager
*/
@NotNull
public PermissionsManager getPermissionsManager() {
return permissionsManager;
}
public SCCommandManager getCommandManager() {
return commandManager;
}
public ProtectionManager getProtectionManager() {
return protectionManager;
}
/**
* @param key the path within the language file
* @return the lang
*/
@Deprecated
public String getLang(@NotNull String key) {
return getLang(key, null);
}
@Deprecated
public String getLang(@NotNull String key, @Nullable Player player) {
return lang(key, player);
}
@Nullable
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);
// contains acf placeholders like {commandprefix}
if (ACF_PLACEHOLDER_PATTERN.matcher(message).find()) {
return message;
}
return MessageFormat.format(message, arguments);
}
@NotNull
public static String lang(@NotNull String key, @Nullable Player player, Object... arguments) {
String lang = optionalLang(key, player, arguments);
if (lang == null) {
return key;
}
return lang;
}
@NotNull
public static String lang(@NotNull String key, @Nullable CommandSender sender, Object... arguments) {
if (sender instanceof Player) {
return lang(key, (Player) sender, arguments);
} else {
return lang(key, (Player) null, arguments);
}
}
@NotNull
public static String lang(@NotNull String key, @Nullable BukkitCommandIssuer issuer, Object... arguments) {
if (issuer != null) {
return lang(key, issuer.getIssuer(), arguments);
}
return lang(key, arguments);
}
@NotNull
public static String lang(@NotNull String key, Object... arguments) {
return lang(key, (Player) null, arguments);
}
public TeleportManager getTeleportManager() {
return teleportManager;
}
@Deprecated
public List<String> getMessages() {
return messages;
}
@Deprecated
public boolean hasUUID() {
return this.hasUUID;
}
public void setUUID(boolean trueOrFalse) {
this.hasUUID = trueOrFalse;
}
}
@@ -1,13 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
/**
* Possible vote values
*/
/**
*
* @author cc_madelg
*/
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,32 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class ClanInput {
private final Clan clan;
public ClanInput(@NotNull Clan clan) {
this.clan = clan;
}
public Clan getClan() {
return clan;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClanInput clanInput = (ClanInput) o;
return clan.equals(clanInput.clan);
}
@Override
public int hashCode() {
return Objects.hash(clan);
}
}
@@ -1,32 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class ClanPlayerInput {
private final ClanPlayer clanPlayer;
public ClanPlayerInput(@NotNull ClanPlayer clanPlayer) {
this.clanPlayer = clanPlayer;
}
public ClanPlayer getClanPlayer() {
return clanPlayer;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClanPlayerInput that = (ClanPlayerInput) o;
return clanPlayer.equals(that.clanPlayer);
}
@Override
public int hashCode() {
return Objects.hash(clanPlayer);
}
}
@@ -1,30 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.entity.Player;
@CommandAlias("%ally_chat")
@Description("{@@command.description.ally}")
@CommandPermission("simpleclans.member.ally")
@Conditions("%basic_conditions|clan_member|rank:name=ALLY_CHAT")
public class AllyChatCommand extends BaseCommand {
@Dependency
private ClanManager clanManager;
@Dependency
private SettingsManager settingsManager;
@Default
@HelpSearchTags("chat")
@CommandCompletion("@chat_subcommands")
public void sendMessage(Player player, @Name("message") String message) {
if (!settingsManager.isAllyChatEnable()) {
return;
}
clanManager.processAllyChat(player, message);
}
}
@@ -1,126 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.EconomyResponse;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.events.BankDepositEvent;
import net.sacredlabyrinth.phaed.simpleclans.events.BankWithdrawEvent;
import net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent;
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 org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@CommandAlias("%clan")
@Subcommand("%bank")
@Conditions("%basic_conditions|economy|verified")
public class BankCommand extends BaseCommand {
@Dependency
private PermissionsManager permissions;
@Subcommand("%status")
@CommandPermission("simpleclans.member.bank")
@Conditions("rank:name=BANK_BALANCE")
@Description("{@@command.description.bank.status}")
public void bankStatus(Player player, Clan clan) {
player.sendMessage(AQUA + lang("clan.balance", player, clan.getBalance()));
}
@Subcommand("%withdraw %all")
@CommandPermission("simpleclans.member.bank")
@Conditions("rank:name=BANK_WITHDRAW")
@Description("{@@command.description.bank.withdraw.all}")
public void bankWithdraw(Player player, Clan clan) {
processWithdraw(player, clan, clan.getBalance());
}
@Subcommand("%withdraw")
@CommandPermission("simpleclans.member.bank")
@Conditions("rank:name=BANK_WITHDRAW")
@Description("{@@command.description.bank.withdraw.amount}")
public void bankWithdraw(Player player, Clan clan, double amount) {
processWithdraw(player, clan, amount);
}
@SuppressWarnings("deprecation")
private void processWithdraw(Player player, Clan clan, double amount) {
if (!clan.isAllowWithdraw()) {
String message = getCurrentCommandManager().getCommandReplacements()
.replace(lang("withdraw.not.allowed", player));
ChatBlock.sendMessage(player, RED + message);
return;
}
amount = Math.abs(amount);
BankWithdrawEvent event = new BankWithdrawEvent(player, clan, amount);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
switch (clan.withdraw(player, ClanBalanceUpdateEvent.Cause.COMMAND, amount)) {
case SUCCESS:
if (SimpleClans.getInstance().getPermissionsManager().playerGrantMoney(player, amount)) {
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
clan.addBb(player.getName(), AQUA + lang("bb.clan.withdraw", amount));
} else {
clan.setBalance(player, ClanBalanceUpdateEvent.Cause.REVERT, clan.getBalance() + amount);
}
break;
case NOT_ENOUGH_BALANCE:
player.sendMessage(lang("clan.bank.not.enough.money", player));
break;
}
}
@Subcommand("%deposit %all")
@CommandPermission("simpleclans.member.bank")
@Conditions("rank:name=BANK_DEPOSIT")
@Description("{@@command.description.bank.deposit.all}")
public void bankDeposit(Player player, Clan clan) {
processDeposit(player, clan, permissions.playerGetMoney(player));
}
@Subcommand("%deposit")
@CommandPermission("simpleclans.member.bank")
@Conditions("rank:name=BANK_DEPOSIT")
@Description("{@@command.description.bank.deposit.amount}")
public void bankDeposit(Player player, Clan clan, double amount) {
processDeposit(player, clan, amount);
}
@SuppressWarnings("deprecation")
private void processDeposit(Player player, Clan clan, double amount) {
if (!clan.isAllowDeposit()) {
String message = getCurrentCommandManager().getCommandReplacements()
.replace(lang("deposit.not.allowed", player));
ChatBlock.sendMessage(player, RED + message);
return;
}
amount = Math.abs(amount);
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));
return;
}
EconomyResponse response = clan.deposit(player, ClanBalanceUpdateEvent.Cause.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));
} else {
//Reverts the deposit if something went wrong with Vault
clan.setBalance(player, ClanBalanceUpdateEvent.Cause.REVERT, clan.getBalance() - amount);
}
}
}
}
@@ -1,52 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
import org.bukkit.entity.Player;
import java.util.Objects;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
@CommandAlias("%clan")
@Conditions("%basic_conditions|verified")
public class BbCommand extends BaseCommand {
@Dependency
private ClanManager cm;
@Dependency
private StorageManager storage;
@Subcommand("%bb")
@CommandPermission("simpleclans.member.bb")
@Description("{@@command.description.bb.display}")
public void display(Player sender) {
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(sender.getUniqueId()));
clan.displayBb(sender);
}
@Subcommand("%bb %clear")
@CommandPermission("simpleclans.leader.bb-clear")
@Conditions("rank:name=BB_CLEAR")
@Description("{@@command.description.bb.clear}")
public void clear(Player player) {
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(player.getUniqueId()));
clan.clearBb();
ChatBlock.sendMessage(player, RED + lang("cleared.bb", player));
}
@Subcommand("%bb %add")
@CommandPermission("simpleclans.member.bb-add")
@Conditions("rank:name=BB_ADD")
@Description("{@@command.description.bb.post}")
public void postMessage(Player player, @Name("message") String msg) {
Clan clan = Objects.requireNonNull(cm.getClanByPlayerUniqueId(player.getUniqueId()));
clan.addBb(player.getName(), AQUA + player.getName() + ": " + WHITE + msg);
storage.updateClan(clan);
}
}
@@ -1,30 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.entity.Player;
@CommandAlias("%clan_chat")
@Conditions("%basic_conditions|clan_member")
@CommandPermission("simpleclans.member.chat")
@Description("{@@command.description.chat}")
public class ChatCommand extends BaseCommand {
@Dependency
private ClanManager clanManager;
@Dependency
private SettingsManager settingsManager;
@Default
@HelpSearchTags("chat")
@CommandCompletion("@chat_subcommands")
public void sendMessage(Player player, ClanPlayer cp, @Name("message") String message) {
if (!settingsManager.getClanChatEnable()) {
return;
}
clanManager.processClanChat(player, cp.getTag(), message);
}
}
@@ -1,367 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import net.sacredlabyrinth.phaed.simpleclans.conversation.ResignPrompt;
import net.sacredlabyrinth.phaed.simpleclans.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;
import java.util.List;
import java.util.Objects;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@CommandAlias("%clan")
@Conditions("%basic_conditions")
public class ClanCommands extends BaseCommand {
@Dependency
private SimpleClans plugin;
@Dependency
private SettingsManager settings;
@Dependency
private ClanManager cm;
@Dependency
private StorageManager storage;
@Dependency
private PermissionsManager permissions;
@Dependency
private RequestManager requestManager;
@Dependency
private ProtectionManager protectionManager;
@Subcommand("%war %start")
@CommandPermission("simpleclans.leader.war")
@Conditions("verified|rank:name=WAR_START")
@Description("{@@command.description.war.start}")
@CommandCompletion("@rivals")
public void startWar(Player player, ClanPlayer requester, Clan requestClan, @Conditions("can_war_target") @Name("clan") ClanInput targetClanInput) {
Clan targetClan = targetClanInput.getClan();
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(requestClan.getLeaders());
if (settings.isWarRequestEnabled()) {
if (!onlineLeaders.isEmpty()) {
requestManager.addWarStartRequest(requester, targetClan, requestClan);
ChatBlock.sendMessage(player, AQUA + lang("leaders.have.been.asked.to.accept.the.war.request",
player, targetClan.getName()));
} else {
ChatBlock.sendMessage(player, RED + lang("at.least.one.leader.accept.the.alliance", player));
}
} else {
protectionManager.addWar(requester, requestClan, targetClan);
}
}
@Subcommand("%war %end")
@CommandPermission("simpleclans.leader.war")
@Conditions("verified|rank:name=WAR_END")
@Description("{@@command.description.war.end}")
@CommandCompletion("@warring_clans")
public void endWar(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(player, AQUA + lang("leaders.asked.to.end.rivalry", player, war.getName()));
} else {
ChatBlock.sendMessage(player, RED + lang("clans.not.at.war", player));
}
}
@Subcommand("%modtag")
@CommandPermission("simpleclans.leader.modtag")
@Conditions("verified|rank:name=MODTAG")
@Description("{@@command.description.modtag}")
public void modtag(Player player, Clan clan, @Single @Name("tag") String tag) {
TagChangeEvent event = new TagChangeEvent(player, clan, tag);
plugin.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
tag = event.getNewTag();
String cleanTag = Helper.cleanTag(tag);
TagValidator validator = new TagValidator(plugin, player, tag);
if (validator.getErrorMessage() != null) {
ChatBlock.sendMessage(player, validator.getErrorMessage());
return;
}
if (!cleanTag.equals(clan.getTag())) {
ChatBlock.sendMessage(player, RED + lang("you.can.only.modify.the.color.and.case.of.the.tag",
player));
return;
}
clan.addBb(player.getName(), AQUA + lang("tag.changed.to.0", ChatUtils.parseColors(tag)));
clan.changeClanTag(tag);
cm.updateDisplayName(player);
}
@Subcommand("%setbanner")
@CommandPermission("simpleclans.leader.setbanner")
@Conditions("verified|rank:name=SETBANNER")
@Description("{@@command.description.setbanner}")
public void setbanner(Player player, Clan clan) {
@SuppressWarnings("deprecation")
ItemStack hand = player.getItemInHand();
if (!hand.getType().toString().contains("BANNER")) {
ChatBlock.sendMessageKey(player, "you.must.hold.a.banner");
return;
}
clan.setBanner(hand);
storage.updateClan(clan);
ChatBlock.sendMessageKey(player, "you.changed.clan.banner");
}
@Subcommand("%invite")
@CommandPermission("simpleclans.leader.invite")
@CommandCompletion("@non_members:ignore_vanished")
@Conditions("rank:name=INVITE")
@Description("{@@command.description.invite}")
public void invite(Player sender, ClanPlayer cp, Clan clan,
@Conditions("not_banned|not_in_clan|online:ignore_vanished") @Name("player") ClanPlayerInput invited) {
Player invitedPlayer = invited.getClanPlayer().toPlayer();
if (invitedPlayer == null) return;
if (!permissions.has(invitedPlayer, "simpleclans.member.can-join")) {
ChatBlock.sendMessage(sender, RED +
lang("the.player.doesn.t.not.have.the.permissions.to.join.clans", sender));
return;
}
if (invitedPlayer.getUniqueId().equals(sender.getUniqueId())) {
ChatBlock.sendMessage(sender, RED + lang("you.cannot.invite.yourself", sender));
return;
}
long minutesBeforeRejoin = cm.getMinutesBeforeRejoin(invited.getClanPlayer(), clan);
if (minutesBeforeRejoin != 0) {
ChatBlock.sendMessage(sender, RED +
lang("the.player.must.wait.0.before.joining.your.clan.again", sender, minutesBeforeRejoin));
return;
}
if (clan.getSize() >= settings.getMaxMembers()) {
ChatBlock.sendMessage(sender, RED + lang("the.clan.members.reached.limit", sender));
return;
}
if (!cm.purchaseInvite(sender)) {
return;
}
requestManager.addInviteRequest(cp, invitedPlayer.getName(), clan);
ChatBlock.sendMessage(sender, AQUA + lang("has.been.asked.to.join",
sender, invitedPlayer.getName(), clan.getName()));
}
@Subcommand("%fee %check")
@Conditions("member_fee_enabled|verified")
@CommandPermission("simpleclans.member.fee-check")
@Description("{@@command.description.fee.check}")
public void checkFee(Player player, Clan clan) {
ChatBlock.sendMessage(player, AQUA
+ lang("the.fee.is.0.and.its.current.value.is.1", player, clan.isMemberFeeEnabled() ?
lang("fee.enabled", player) : lang("fee.disabled", player),
clan.getMemberFee()
));
}
@Subcommand("%fee %set")
@CommandPermission("simpleclans.leader.fee")
@Conditions("rank:name=FEE_SET|change_fee")
@Description("{@@command.description.fee.set}")
public void setFee(Player player, Clan clan, @Name("fee") double fee) {
fee = Math.abs(fee);
double maxFee = settings.getMaxMemberFee();
if (fee > maxFee) {
ChatBlock.sendMessage(player, RED
+ lang("max.fee.allowed.is.0", player, maxFee));
return;
}
if (cm.purchaseMemberFeeSet(player)) {
clan.setMemberFee(fee);
clan.addBb(player.getName(), AQUA + lang("bb.fee.set", fee));
ChatBlock.sendMessage(player, AQUA + lang("fee.set", player));
storage.updateClan(clan);
}
}
@Subcommand("%clanff %allow")
@CommandPermission("simpleclans.leader.ff")
@Conditions("rank:name=FRIENDLYFIRE")
@Description("{@@command.description.clanff.allow}")
public void allowClanFf(Player player, Clan clan) {
clan.addBb(player.getName(), AQUA + lang("clan.wide.friendly.fire.is.allowed"));
clan.setFriendlyFire(true);
storage.updateClan(clan);
}
@Subcommand("%clanff %block")
@CommandPermission("simpleclans.leader.ff")
@Description("{@@command.description.clanff.block}")
public void blockClanFf(Player player, Clan clan) {
clan.addBb(player.getName(), AQUA + lang("clan.wide.friendly.fire.blocked"));
clan.setFriendlyFire(false);
storage.updateClan(clan);
}
@Subcommand("%description")
@CommandPermission("simpleclans.leader.description")
@Conditions("verified|rank:name=DESCRIPTION")
@Description("{@@command.description.description}")
public void setDescription(Player player, Clan clan, @Name("description") String description) {
if (description.length() < settings.getClanMinDescriptionLength()) {
ChatBlock.sendMessage(player, RED + lang("your.clan.description.must.be.longer.than",
player, settings.getClanMinDescriptionLength()));
return;
}
if (description.length() > settings.getClanMaxDescriptionLength()) {
ChatBlock.sendMessage(player, RED + lang("your.clan.description.cannot.be.longer.than",
player, settings.getClanMaxDescriptionLength()));
return;
}
clan.setDescription(description);
ChatBlock.sendMessage(player, AQUA + lang("description.changed", player));
storage.updateClan(clan);
}
@Subcommand("%rival %add")
@CommandPermission("simpleclans.leader.rival")
@Conditions("verified|rivable|minimum_to_rival|rank:name=RIVAL_ADD")
@CommandCompletion("@clans")
@Description("{@@command.description.rival.add}")
public void addRival(Player player, Clan issuerClan, @Conditions("verified|different") @Name("clan") ClanInput rival) {
Clan rivalInput = rival.getClan();
if (settings.isUnrivable(rivalInput.getTag())) {
ChatBlock.sendMessage(player, RED + lang("the.clan.cannot.be.rivaled", player));
return;
}
if (!issuerClan.reachedRivalLimit()) {
if (!issuerClan.isRival(rivalInput.getTag())) {
issuerClan.addRival(rivalInput);
rivalInput.addBb(player.getName(), AQUA + lang("has.initiated.a.rivalry", issuerClan.getName(),
rivalInput.getName()), false);
issuerClan.addBb(player.getName(), AQUA + lang("has.initiated.a.rivalry", player.getName(),
rivalInput.getName()));
} else {
ChatBlock.sendMessage(player, RED + lang("your.clans.are.already.rivals", player));
}
} else {
ChatBlock.sendMessage(player, RED + lang("rival.limit.reached", player));
}
}
@Subcommand("%rival %remove")
@CommandPermission("simpleclans.leader.rival")
@Conditions("verified|rank:name=RIVAL_REMOVE")
@CommandCompletion("@rivals")
@Description("{@@command.description.rival.remove}")
public void removeRival(Player player,
ClanPlayer cp,
Clan issuerClan,
@Conditions("different") @Name("clan") ClanInput rival) {
Clan rivalInput = rival.getClan();
if (issuerClan.isRival(rivalInput.getTag())) {
requestManager.addRivalryBreakRequest(cp, rivalInput, issuerClan);
ChatBlock.sendMessage(player, AQUA + lang("leaders.asked.to.end.rivalry", player,
rivalInput.getName()));
} else {
ChatBlock.sendMessage(player, RED + lang("your.clans.are.not.rivals", player));
}
}
@Subcommand("%ally %add")
@CommandPermission("simpleclans.leader.ally")
@Conditions("verified|rank:name=ALLY_ADD|minimum_to_ally")
@CommandCompletion("@clans")
@Description("{@@command.description.ally.add}")
public void addAlly(Player player,
ClanPlayer cp,
Clan issuerClan,
@Conditions("verified|different") @Name("clan") ClanInput other) {
Clan input = other.getClan();
if (issuerClan.isAlly(input.getTag())) {
ChatBlock.sendMessage(player, RED + lang("your.clans.are.already.allies", player));
return;
}
int maxAlliances = settings.getClanMaxAlliances();
if (maxAlliances != -1) {
if (issuerClan.getAllies().size() >= maxAlliances) {
ChatBlock.sendMessage(player, lang("your.clan.reached.max.alliances", player));
return;
}
if (input.getAllies().size() >= maxAlliances) {
ChatBlock.sendMessage(player, lang("other.clan.reached.max.alliances", player));
return;
}
}
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(issuerClan.getLeaders());
if (onlineLeaders.isEmpty()) {
ChatBlock.sendMessage(player, RED + lang("at.least.one.leader.accept.the.alliance",
player));
return;
}
requestManager.addAllyRequest(cp, input, issuerClan);
ChatBlock.sendMessage(player, AQUA + lang("leaders.have.been.asked.for.an.alliance",
player, input.getName()));
}
@Subcommand("%ally %remove")
@Conditions("verified|rank:name=ALLY_REMOVE")
@CommandPermission("simpleclans.leader.ally")
@Description("{@@command.description.ally.remove}")
@CommandCompletion("@allied_clans")
public void removeAlly(Player player, Clan issuerClan, @Conditions("different|allied_clan") @Name("clan") ClanInput ally) {
Clan allyInput = ally.getClan();
issuerClan.removeAlly(allyInput);
allyInput.addBb(player.getName(), AQUA + lang("has.broken.the.alliance", issuerClan.getName(),
allyInput.getName()), false);
issuerClan.addBb(player.getName(), AQUA + lang("has.broken.the.alliance", player.getName(),
allyInput.getName()));
}
@Subcommand("%kick")
@CommandPermission("simpleclans.leader.kick")
@CommandCompletion("@clan_members")
@Conditions("rank:name=KICK")
@Description("{@@command.description.kick}")
public void kick(@Conditions("clan_member") Player sender,
@Conditions("same_clan") @Name("member") ClanPlayerInput other) {
ClanPlayer clanPlayer = other.getClanPlayer();
if (sender.getUniqueId().equals(clanPlayer.getUniqueId())) {
ChatBlock.sendMessage(sender, RED + lang("you.cannot.kick.yourself", sender));
return;
}
Clan clan = cm.getClanByPlayerUniqueId(sender.getUniqueId());
if (Objects.requireNonNull(clan).isLeader(clanPlayer.getUniqueId())) {
ChatBlock.sendMessage(sender, RED + lang("you.cannot.kick.another.leader", sender));
return;
}
clan.addBb(sender.getName(), AQUA + lang("has.been.kicked.by", clanPlayer.getName(),
sender.getName(), sender));
clan.removePlayerFromClan(clanPlayer.getUniqueId());
}
@Subcommand("%resign")
@CommandPermission("simpleclans.member.resign")
@Description("{@@command.description.resign}")
public void resign(@Conditions("clan_member") Player player) {
new ConversationFactory(plugin)
.withFirstPrompt(new ResignPrompt())
.withLocalEcho(true)
.withTimeout(10)
.buildConversation(player).begin();
}
}
@@ -1,69 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.data.*;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@CommandAlias("%clan")
@Conditions("%basic_conditions|verified")
public class DataCommands extends BaseCommand {
@Dependency
private SimpleClans plugin;
@Subcommand("%vitals")
@CommandPermission("simpleclans.member.vitals")
@Conditions("rank:name=VITALS")
@Description("{@@command.description.vitals}")
public void vitals(CommandSender sender, Clan clan) {
Vitals vitals = new Vitals(plugin, sender, clan);
vitals.send();
}
@Subcommand("%stats")
@CommandPermission("simpleclans.member.stats")
@Conditions("rank:name=STATS")
@Description("{@@command.description.stats}")
public void stats(Player player, Clan clan) {
ClanStats stats = new ClanStats(plugin, player, clan);
stats.send();
}
@Subcommand("%profile")
@CommandPermission("simpleclans.member.profile")
@Description("{@@command.description.profile}")
public void profile(CommandSender sender, Clan clan) {
ClanProfile p = new ClanProfile(plugin, sender, clan);
p.send();
}
@Subcommand("%roster")
@CommandPermission("simpleclans.member.roster")
@Description("{@@command.description.roster}")
public void roster(Player player, Clan clan) {
ClanRoster r = new ClanRoster(plugin, player, clan);
r.send();
}
@Subcommand("%coords")
@CommandPermission("simpleclans.member.coords")
@Conditions("rank:name=COORDS")
@HelpSearchTags("local location")
@Description("{@@command.description.coords}")
public void coords(Player player, Clan clan) {
if (VanishUtils.getNonVanished(player, clan).size() == 1) {
ChatBlock.sendMessage(player, RED + lang("you.are.the.only.member.online", player));
return;
}
ClanCoords c = new ClanCoords(plugin, player, clan);
c.send();
}
}
@@ -1,134 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.events.HomeRegroupEvent;
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerHomeSetEvent;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
@CommandAlias("%clan")
@Conditions("%basic_conditions|verified")
public class HomeCommands extends BaseCommand {
@Dependency
private SimpleClans plugin;
@Dependency
private PermissionsManager permissions;
@Dependency
private SettingsManager settings;
@Dependency
private ProtectionManager protection;
@Dependency
private ClanManager cm;
@Subcommand("%regroup %me")
@CommandPermission("simpleclans.leader.regroup.me")
@Conditions("rank:name=REGROUP_ME")
@Description("{@@command.description.regroup.me}")
public void regroupMe(Player player, ClanPlayer cp, Clan clan) {
if (!settings.getAllowReGroupCommand()) {
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
return;
}
processRegroup(player, cp, clan, player.getLocation());
}
private void processRegroup(Player player, ClanPlayer cp, Clan clan, Location location) {
HomeRegroupEvent homeRegroupEvent = new HomeRegroupEvent(clan, cp, VanishUtils.getNonVanished(player, clan), location);
plugin.getServer().getPluginManager().callEvent(homeRegroupEvent);
if (homeRegroupEvent.isCancelled() || !cm.purchaseHomeRegroup(player)) {
return;
}
plugin.getTeleportManager().teleport(player, clan, location);
}
@Subcommand("%regroup %home")
@CommandPermission("simpleclans.leader.regroup.home")
@Conditions("rank:name=REGROUP_HOME")
@Description("{@@command.description.regroup.home}")
public void regroupHome(Player player, ClanPlayer cp, Clan clan) {
if (!settings.getAllowReGroupCommand()) {
ChatBlock.sendMessage(player, RED + lang("insufficient.permissions", player));
return;
}
Location location = clan.getHomeLocation();
if (location == null) {
ChatBlock.sendMessage(player, RED + lang("hombase.not.set", player));
return;
}
processRegroup(player, cp, clan, location);
}
@Subcommand("%home")
@CommandPermission("simpleclans.member.home")
@Conditions("rank:name=HOME_TP")
@Description("{@@command.description.home.tp}")
public void teleport(Player player, 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, clan.getHomeLocation(), clan.getName());
}
}
@Subcommand("%home %clear")
@CommandPermission("simpleclans.leader.home-set")
@Conditions("rank:name=HOME_SET")
@Description("{@@command.description.home.clear}")
public void clear(Player player, 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;
}
clan.setHomeLocation(null);
ChatBlock.sendMessage(player, AQUA + lang("hombase.cleared", player));
}
@Subcommand("%home %set")
@Conditions("rank:name=HOME_SET")
@CommandPermission("simpleclans.leader.home-set")
@Description("{@@command.description.home.set}")
public void set(Player player, ClanPlayer cp, Clan clan) {
if (settings.isHomebaseSetOnce() && clan.getHomeLocation() != null &&
!permissions.has(player, "simpleclans.mod.home")) {
ChatBlock.sendMessage(player, RED + lang("home.base.only.once", player));
return;
}
if (settings.isSetBaseOnlyInLand()) {
if (!protection.isOwner(player, player.getLocation())) {
ChatBlock.sendMessageKey(player, "you.can.only.set.base.in.your.land");
return;
}
}
PlayerHomeSetEvent homeSetEvent = new PlayerHomeSetEvent(clan, cp, player.getLocation());
plugin.getServer().getPluginManager().callEvent(homeSetEvent);
if (homeSetEvent.isCancelled() || !cm.purchaseHomeTeleportSet(player)) {
return;
}
clan.setHomeLocation(player.getLocation());
ChatBlock.sendMessage(player, AQUA + lang("hombase.set", player, YELLOW +
Helper.toLocationString(player.getLocation())));
}
}
@@ -1,180 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.Objects;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
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 StorageManager storage;
@Dependency
private PermissionsManager permissions;
@Dependency
private SettingsManager settings;
@Dependency
private RequestManager requestManager;
@Dependency
private ClanManager cm;
@Subcommand("%demote")
@CommandCompletion("@clan_leaders")
@CommandPermission("simpleclans.leader.demote")
@Description("{@@command.description.demote}")
public void demote(Player player,
ClanPlayer cp,
Clan clan,
@Conditions("same_clan") @Name("leader") ClanPlayerInput other) {
ClanPlayer otherCp = other.getClanPlayer();
if (!clan.enoughLeadersOnlineToDemote(otherCp)) {
ChatBlock.sendMessage(player, RED + lang("not.enough.leaders.online.to.vote.on.demotion", player));
return;
}
if (!clan.isLeader(otherCp.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("player.is.not.a.leader.of.your.clan", player));
return;
}
if (clan.getLeaders().size() > 2 && settings.isConfirmationForDemote()) {
requestManager.addDemoteRequest(cp, otherCp.getName(), clan);
ChatBlock.sendMessage(player, AQUA + lang("demotion.vote.has.been.requested.from.all.leaders",
player));
return;
}
clan.addBb(player.getName(), AQUA + lang("demoted.back.to.member", otherCp.getName()));
clan.demote(otherCp.getUniqueId());
}
@Subcommand("%promote")
@CommandPermission("simpleclans.leader.promote")
@CommandCompletion("@clan_non_leaders")
@Description("{@@command.description.promote}")
public void promote(Player player,
Clan clan,
ClanPlayer cp,
@Conditions("online|same_clan") @Name("member") ClanPlayerInput other) {
Player otherPl = Objects.requireNonNull(other.getClanPlayer().toPlayer());
if (!permissions.has(otherPl, "simpleclans.leader.promotable")) {
ChatBlock.sendMessage(player, RED + lang("the.player.does.not.have.the.permissions.to.lead.a.clan",
player));
return;
}
if (otherPl.getUniqueId().equals(player.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("you.cannot.promote.yourself", player));
return;
}
if (clan.isLeader(otherPl.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("the.player.is.already.a.leader", player));
return;
}
if (settings.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));
return;
}
clan.addBb(player.getName(), AQUA + lang("promoted.to.leader", otherPl.getName()));
clan.promote(otherPl.getUniqueId());
}
@Subcommand("%disband")
@CommandPermission("simpleclans.leader.disband")
@Description("{@@command.description.disband}")
public void disband(Player player, ClanPlayer cp, Clan clan) {
if (clan.getLeaders().size() != 1) {
requestManager.addDisbandRequest(cp, clan);
ChatBlock.sendMessage(player, AQUA +
lang("clan.disband.vote.has.been.requested.from.all.leaders", player));
return;
}
clan.disband(player, true, false);
}
@Subcommand("%verify")
@CommandPermission("simpleclans.leader.verify")
@Description("{@@command.description.verify}")
public void verify(Player player, Clan clan) {
if (clan.isVerified()) {
ChatBlock.sendMessageKey(player, "your.clan.already.verified");
return;
}
if (!settings.isePurchaseVerification()) {
ChatBlock.sendMessageKey(player, "staff.member.verify.clan");
return;
}
int minToVerify = settings.getMinToVerify();
if (minToVerify > clan.getAllMembers().size()) {
ChatBlock.sendMessage(player, lang("your.clan.must.have.members.to.verify", player, minToVerify));
return;
}
if (cm.purchaseVerification(player)) {
clan.verifyClan();
clan.addBb(player.getName(), AQUA + lang("clan.0.has.been.verified", clan.getName()));
ChatBlock.sendMessage(player, AQUA + lang("the.clan.has.been.verified", player));
}
}
@Subcommand("%trust")
@CommandPermission("simpleclans.leader.settrust")
@CommandCompletion("@clan_members")
@Description("{@@command.description.trust}")
public void trust(Player player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput trusted) {
ClanPlayer trustedInput = trusted.getClanPlayer();
if (player.getUniqueId().equals(trustedInput.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("you.cannot.trust.yourself", player));
return;
}
if (clan.isLeader(trustedInput.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("leaders.are.already.trusted", player));
return;
}
if (trustedInput.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + lang("this.player.is.already.trusted", player));
return;
}
clan.addBb(player.getName(), AQUA + lang("has.been.given.trusted.status.by", trustedInput.getName(),
player.getName()));
trustedInput.setTrusted(true);
storage.updateClanPlayer(trustedInput);
}
@Subcommand("%untrust")
@CommandPermission("simpleclans.leader.settrust")
@CommandCompletion("@clan_members")
@Description("{@@command.description.untrust}")
public void untrust(Player player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput trusted) {
ClanPlayer trustedInput = trusted.getClanPlayer();
if (trustedInput.getUniqueId().equals(player.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("you.cannot.untrust.yourself", player));
return;
}
if (clan.isLeader(trustedInput.getUniqueId())) {
ChatBlock.sendMessage(player, RED + lang("leaders.cannot.be.untrusted", player));
return;
}
if (!trustedInput.isTrusted()) {
ChatBlock.sendMessage(player, RED + lang("this.player.is.already.untrusted", player));
return;
}
clan.addBb(player.getName(), AQUA + lang("has.been.given.untrusted.status.by", trustedInput.getName(),
player.getName()));
trustedInput.setTrusted(false);
storage.updateClanPlayer(trustedInput);
}
}
@@ -1,214 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import net.sacredlabyrinth.phaed.simpleclans.conversation.CreateRankNamePrompt;
import net.sacredlabyrinth.phaed.simpleclans.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;
import java.util.List;
import java.util.Set;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.RED;
@CommandAlias("%clan")
@Subcommand("%rank")
@Conditions("%basic_conditions|verified|leader")
public class RankCommand extends BaseCommand {
@Dependency
private SimpleClans plugin;
@Dependency
private StorageManager storage;
@Dependency
private PermissionsManager permissions;
@Subcommand("%assign")
@CommandPermission("simpleclans.leader.rank.assign")
@CommandCompletion("@clan_members @ranks")
@Description("{@@command.description.rank.assign}")
public void assign(ClanPlayer player,
Clan clan,
@Name("member") @Conditions("same_clan") ClanPlayerInput member,
@Name("rank") Rank rank) {
ClanPlayer memberInput = member.getClanPlayer();
PlayerRankUpdateEvent event = new PlayerRankUpdateEvent(player, memberInput, clan, clan.getRank(memberInput.getRankId()), rank);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return;
if (memberInput.getRankId().equals(rank.getName())) {
ChatBlock.sendMessage(player, lang("player.already.has.that.rank", player));
return;
}
memberInput.setRank(rank.getName());
storage.updateClanPlayer(memberInput);
ChatBlock.sendMessage(player, AQUA + lang("player.rank.changed", player));
}
@Subcommand("%unassign")
@CommandPermission("simpleclans.leader.rank.unassign")
@CommandCompletion("@clan_members")
@Description("{@@command.description.rank.unassign}")
public void unassign(ClanPlayer player, Clan clan, @Conditions("same_clan") @Name("member") ClanPlayerInput cp) {
ClanPlayer memberInput = cp.getClanPlayer();
PlayerRankUpdateEvent event = new PlayerRankUpdateEvent(player, memberInput, clan, clan.getRank(memberInput.getRankId()), null);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return;
memberInput.setRank(null);
storage.updateClanPlayer(memberInput);
ChatBlock.sendMessage(player, AQUA + lang("player.unassigned.from.rank", player));
}
@Subcommand("%create")
@CommandPermission("simpleclans.leader.rank.create")
@Description("{@@command.description.rank.create}")
public void create(Player player, Clan clan) {
Conversation conversation = new ConversationFactory(plugin).withFirstPrompt(new CreateRankNamePrompt())
.withLocalEcho(true).withTimeout(60).buildConversation(player);
conversation.getContext().setSessionData("clan", clan);
conversation.begin();
}
@Subcommand("%delete")
@CommandPermission("simpleclans.leader.rank.delete")
@CommandCompletion("@ranks")
@Description("{@@command.description.rank.delete}")
public void delete(Player player, Clan clan, @Name("rank") Rank rank) {
DeleteRankEvent event = new DeleteRankEvent(player, clan, rank);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
clan.deleteRank(rank.getName());
storage.updateClan(clan, true);
ChatBlock.sendMessage(player, AQUA + lang("rank.0.deleted", player, rank.getDisplayName()));
}
}
@Subcommand("%list")
@CommandPermission("simpleclans.leader.rank.list")
@Description("{@@command.description.rank.list}")
public void list(Player player, Clan clan) {
List<Rank> ranks = clan.getRanks();
if (ranks.isEmpty()) {
ChatBlock.sendMessage(player, RED + lang("no.ranks", player));
return;
}
ranks.sort(Comparator.reverseOrder());
ChatBlock.sendMessage(player, AQUA + lang("clans.ranks", player));
int count = 1;
for (Rank rank : ranks) {
ChatBlock.sendMessage(player, AQUA + lang("ranks.list.item", player, count,
ChatUtils.parseColors(rank.getDisplayName()) + AQUA, rank.getName()));
count++;
}
}
@Subcommand("%setdisplayname")
@CommandPermission("simpleclans.leader.rank.setdisplayname")
@CommandCompletion("@ranks @nothing")
@Description("{@@command.description.rank.setdisplayname}")
public void setDisplayName(Player player, Clan clan, @Name("rank") Rank rank, @Name("displayname") String displayName) {
if (displayName.contains("&") && !permissions.has(player, "simpleclans.leader.coloredrank")) {
ChatBlock.sendMessage(player, RED + lang("you.cannot.set.colored.ranks", player));
return;
}
rank.setDisplayName(displayName);
storage.updateClan(clan, true);
ChatBlock.sendMessage(player, ChatColor.AQUA + lang("rank.displayname.updated", player));
}
@Subcommand("%setdefault")
@CommandPermission("simpleclans.leader.rank.setdefault")
@CommandCompletion("@ranks")
@Description("{@@command.description.rank.setdefault}")
public void setDefault(Player player, Clan clan, @Name("rank") Rank rank) {
clan.setDefaultRank(rank.getName());
ChatBlock.sendMessage(player, AQUA + lang("rank.setdefault", player, rank.getDisplayName()));
}
@Subcommand("%removedefault")
@CommandPermission("simpleclans.leader.rank.removedefault")
@Description("{@@command.description.rank.removedefault}")
public void removeDefault(Player player, Clan clan) {
clan.setDefaultRank(null);
ChatBlock.sendMessage(player, AQUA + lang("rank.removedefault", player));
}
@Subcommand("%permissions")
public class PermissionsCommand extends BaseCommand {
private final String validPermissionsToMessage = Helper.toMessage(Helper.fromPermissionArray(), ",");
@Default
@CommandPermission("simpleclans.leader.rank.permissions.available")
@Description("{@@command.description.rank.permissions.available}")
public void availablePermissions(Player player) {
ChatBlock.sendMessage(player, AQUA + lang("available.rank.permissions", player));
ChatBlock.sendMessage(player, AQUA + validPermissionsToMessage);
}
@Default
@CommandPermission("simpleclans.leader.rank.permissions.list")
@CommandCompletion("@ranks")
@Description("{@@command.description.rank.permissions.rank}")
public void list(Player player, @Name("rank") Rank rank) {
Set<String> permissions = rank.getPermissions();
if (permissions.isEmpty()) {
ChatBlock.sendMessage(player, RED + lang("rank.no.permissions", player));
return;
}
ChatBlock.sendMessage(player, AQUA + lang("rank.0.permissions", player, rank.getDisplayName()));
ChatBlock.sendMessage(player, AQUA + Helper.toMessage(permissions.toArray(new String[0]), ","));
}
@Subcommand("%add")
@CommandPermission("simpleclans.leader.rank.permissions.add")
@CommandCompletion("@ranks @rank_permissions")
@Description("{@@command.description.rank.permissions.add}")
public void add(Player player,
Clan clan,
@Name("rank") Rank rank,
@Values("@rank_permissions") @Name("permission") String permission) {
Set<String> permissions = rank.getPermissions();
permissions.add(permission);
ChatBlock.sendMessage(player, AQUA + lang("permission.0.added.to.rank.1", player, permission,
rank.getDisplayName()));
storage.updateClan(clan, true);
}
@Subcommand("%remove")
@CommandCompletion("@ranks @rank_permissions")
@CommandPermission("simpleclans.leader.rank.permissions.remove")
@Description("{@@command.description.rank.permissions.remove}")
public void remove(Player player,
Clan clan,
@Name("rank") Rank rank,
@Values("@rank_permissions") @Name("permission") String permission) {
Set<String> permissions = rank.getPermissions();
permissions.remove(permission);
ChatBlock.sendMessage(player, AQUA + lang("permission.0.removed.from.rank.1", player,
permission, rank.getDisplayName()));
storage.updateClan(clan, true);
}
}
}
@@ -1,84 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.function.Consumer;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.AQUA;
@CommandAlias("%clan")
@Subcommand("%toggle")
@Conditions("%basic_conditions|verified")
public class ToggleCommand extends BaseCommand {
@Dependency
private StorageManager storage;
@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);
storage.updateClanPlayer(cp);
}
@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,
Consumer<Boolean> consumer) {
String messageOn = AQUA + lang(onMessageKey, sender);
String messageOff = AQUA + lang(offMessageKey, sender);
ChatBlock.sendMessage(sender, status ? messageOff : messageOn);
consumer.accept(!status);
}
}
@@ -1,16 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractCompletion implements IdentifiableCompletion {
protected final SimpleClans plugin;
protected final ClanManager clanManager;
public AbstractCompletion(@NotNull SimpleClans plugin) {
this.plugin = plugin;
this.clanManager = plugin.getClanManager();
}
}
@@ -1,29 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class AllNonLeadersCompletion extends AbstractSyncCompletion {
public AllNonLeadersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
return clanManager
.getAllClanPlayers().stream().filter(cp -> !cp.isLeader() && cp.getClan() != null)
.map(ClanPlayer::getName).collect(Collectors.toList());
}
@Override
public @NotNull String getId() {
return "all_non_leaders";
}
}
@@ -1,44 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.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;
}
}
@@ -1,36 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
public class ClanLeadersCompletion extends AbstractSyncCompletion {
public ClanLeadersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
Player player = c.getPlayer();
if (player != null) {
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
if (clan != null) {
return clan.getLeaders().stream().map(ClanPlayer::getName).collect(Collectors.toList());
}
}
return Collections.emptyList();
}
@Override
public @NotNull String getId() {
return "clan_leaders";
}
}
@@ -1,36 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
public class ClanMembersCompletion extends AbstractSyncCompletion {
public ClanMembersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
Player player = c.getPlayer();
if (player != null) {
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
if (clan != null) {
return clan.getAllMembers().stream().map(ClanPlayer::getName).collect(Collectors.toList());
}
}
return Collections.emptyList();
}
@Override
public @NotNull String getId() {
return "clan_members";
}
}
@@ -1,36 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class ClanNonLeadersCompletion extends AbstractSyncCompletion {
public ClanNonLeadersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
Player player = c.getPlayer();
if (player != null) {
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
if (clan != null) {
return clan.getNonLeaders().stream().map(ClanPlayer::getName).collect(Collectors.toList());
}
}
return Collections.emptyList(); }
@Override
public @NotNull String getId() {
return "clan_non_leaders";
}
}
@@ -1,34 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ClansCompletion extends AbstractSyncCompletion {
public ClansCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext c) throws InvalidCommandArgument {
Stream<Clan> clans = clanManager.getClans().stream();
if (c.hasConfig("has_home")) {
clans = clans.filter(clan -> clan.getHomeLocation() != null);
}
if (c.hasConfig("unverified")) {
clans = clans.filter(clan -> !clan.isVerified());
}
return clans.map(Clan::getTag).collect(Collectors.toList());
}
@Override
public @NotNull String getId() {
return "clans";
}
}
@@ -1,25 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
@SuppressWarnings("unused")
public class RankPermissionsCompletion extends AbstractStaticCompletion {
public RankPermissionsCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public @NotNull Collection<String> getCompletions() {
return Arrays.asList(Helper.fromPermissionArray());
}
@Override
public @NotNull String getId() {
return "rank_permissions";
}
}
@@ -1,35 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Rank;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
public class RanksCompletion extends AbstractSyncCompletion {
public RanksCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
Player player = context.getPlayer();
if (player != null) {
Clan clan = clanManager.getClanByPlayerUniqueId(player.getUniqueId());
if (clan != null) {
return clan.getRanks().stream().map(Rank::getName).collect(Collectors.toList());
}
}
return Collections.emptyList(); }
@Override
public @NotNull String getId() {
return "ranks";
}
}
@@ -1,12 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.CommandConditions;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractCommandCondition extends AbstractCondition implements CommandConditions.Condition<BukkitCommandIssuer> {
public AbstractCommandCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
}
@@ -1,38 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class AlliedClanCondition extends AbstractParameterCondition<ClanInput> {
public AlliedClanCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanInput> getType() {
return ClanInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
ClanInput value) throws InvalidCommandArgument {
BukkitCommandIssuer issuer = context.getIssuer();
Clan clan = Conditions.assertClanMember(clanManager, issuer);
if (!clan.isAlly(value.getClan().getTag())) {
throw new ConditionFailedException(RED + lang("your.clans.are.not.allies", issuer));
}
}
@Override
public @NotNull String getId() {
return "allied_clan";
}
}
@@ -1,55 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import java.time.LocalDateTime;
import static java.time.temporal.ChronoUnit.MINUTES;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class CanChangeFeeCondition extends AbstractCommandCondition {
private static final float HOUR_IN_MINUTES = 60;
public CanChangeFeeCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
LocalDateTime now = LocalDateTime.now();
LocalDateTime collectTime = getCollectTime();
long interval = now.until(collectTime, MINUTES);
if (interval <= settingsManager.geteMemberFeeLastMinuteChangeInterval() * HOUR_IN_MINUTES) {
BukkitCommandIssuer issuer = context.getIssuer();
String error = lang("cannot.change.member.fee.now", issuer);
if (interval <= 60) {
error += lang("cannot.change.member.fee.minutes", issuer, interval);
} else {
error += lang("cannot.change.member.fee.hours", issuer, Math.ceil(interval / HOUR_IN_MINUTES));
}
throw new ConditionFailedException(error);
}
}
private LocalDateTime getCollectTime() {
LocalDateTime now = LocalDateTime.now();
LocalDateTime collectTime = now.withHour(settingsManager.getTasksCollectFeeHour())
.withMinute(settingsManager.getTasksCollectFeeMinute());
if (collectTime.isBefore(now)) {
collectTime = collectTime.plusDays(1);
}
return collectTime;
}
@Override
public @NotNull String getId() {
return "change_fee";
}
}
@@ -1,49 +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;
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.isWarRequestEnabled();
int maxDifference = settingsManager.getMembersOnlineMaxDifference();
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";
}
}
@@ -1,33 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class ClanMemberCondition extends AbstractParameterCondition<ClanPlayer> {
public ClanMemberCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayer> getType() {
return ClanPlayer.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext, ClanPlayer value)
throws InvalidCommandArgument {
Conditions.assertClanMember(clanManager, context.getIssuer());
}
@Override
public @NotNull String getId() {
return "clan_member";
}
}
@@ -1,43 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class DifferentClanCondition extends AbstractParameterCondition<ClanInput> {
public DifferentClanCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanInput> getType() {
return ClanInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
ClanInput value) throws InvalidCommandArgument {
if (execContext.getIssuer().isPlayer()) {
Player player = execContext.getPlayer();
ClanPlayer cp = clanManager.getAnyClanPlayer(player.getUniqueId());
if (cp != null && cp.getClan() != null) {
if (value.getClan().equals(cp.getClan())) {
throw new ConditionFailedException(lang("cannot.be.same.clan", player));
}
}
}
}
@Override
public @NotNull String getId() {
return "different";
}
}
@@ -1,35 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
public class InputClanMemberCondition extends AbstractParameterCondition<ClanPlayerInput> {
public InputClanMemberCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
throws InvalidCommandArgument {
if (value.getClanPlayer().getClan() == null) {
throw new ConditionFailedException(RED + lang("player.not.a.member.of.any.clan",
execContext.getSender()));
}
}
@Override
public @NotNull String getId() {
return "clan_member";
}
}
@@ -1,36 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class InputVerifiedCondition extends AbstractParameterCondition<ClanInput> {
public InputVerifiedCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanInput> getType() {
return ClanInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
ClanInput value)
throws InvalidCommandArgument {
if (!value.getClan().isVerified() && !context.getIssuer().hasPermission("simpleclans.mod.bypass")) {
throw new ConditionFailedException(lang("other.clan.not.verified", execContext.getSender()));
}
}
@Override
public @NotNull String getId() {
return "verified";
}
}
@@ -1,27 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@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.isLandSharing()) {
throw new ConditionFailedException(lang("land.sharing.disabled", context.getIssuer()));
}
}
@Override
public @NotNull String getId() {
return "land_sharing";
}
}
@@ -1,34 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class LeaderCondition extends AbstractCommandCondition {
public LeaderCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
Player player = Conditions.assertPlayer(context.getIssuer());
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
if (!clan.isLeader(player)) {
throw new ConditionFailedException(ChatColor.RED + lang("no.leader.permissions", player));
}
}
@Override
public @NotNull String getId() {
return "leader";
}
}
@@ -1,30 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public class MemberFeeEnabledCondition extends AbstractCommandCondition {
public MemberFeeEnabledCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
if (!settingsManager.isMemberFee()) {
throw new ConditionFailedException(ChatColor.RED + lang("disabled.command",
context.getIssuer().getIssuer()));
}
}
@Override
public @NotNull String getId() {
return "member_fee_enabled";
}
}
@@ -1,34 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class MinimumToAllyCondition extends AbstractCommandCondition {
public MinimumToAllyCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
if (clan.getSize() < settingsManager.getClanMinSizeToAlly()) {
throw new ConditionFailedException(RED +
lang("minimum.to.make.alliance", context.getIssuer(), settingsManager.getClanMinSizeToAlly()));
}
}
@Override
public @NotNull String getId() {
return "minimum_to_ally";
}
}
@@ -1,40 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class NotBannedInputCondition extends AbstractParameterCondition<ClanPlayerInput> {
public NotBannedInputCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
throws InvalidCommandArgument {
UUID uniqueId = value.getClanPlayer().getUniqueId();
if (settingsManager.isBanned(uniqueId)) {
throw new ConditionFailedException(RED + lang("this.player.is.banned.from.using.clan.commands",
execContext.getSender()));
}
}
@Override
public @NotNull String getId() {
return "not_banned";
}
}
@@ -1,37 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class NotInClanCondition extends AbstractParameterCondition<ClanPlayerInput> {
public NotInClanCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext, ClanPlayerInput value)
throws InvalidCommandArgument {
if (value.getClanPlayer().getClan() != null) {
throw new ConditionFailedException(RED + lang("the.player.is.already.member.of.another.clan",
execContext.getSender()));
}
}
@Override
public @NotNull String getId() {
return "not_in_clan";
}
}
@@ -1,43 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class OnlineCondition extends AbstractParameterCondition<ClanPlayerInput> {
public OnlineCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context, BukkitCommandExecutionContext execContext, ClanPlayerInput value) throws InvalidCommandArgument {
Player player = value.getClanPlayer().toPlayer();
if (player != null) {
boolean isVanished = VanishUtils.isVanished(execContext.getSender(), player);
if (!isVanished || !context.hasConfig("ignore_vanished")) {
return;
}
}
throw new ConditionFailedException(lang("other.player.must.be.online", execContext.getSender()));
}
@Override
@NotNull
public String getId() {
return "online";
}
}
@@ -1,33 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class PlayerClanMemberCondition extends AbstractParameterCondition<Player> {
public PlayerClanMemberCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<Player> getType() {
return Player.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
Player value) throws InvalidCommandArgument {
Conditions.assertClanMember(clanManager, context.getIssuer());
}
@Override
public @NotNull String getId() {
return "clan_member";
}
}
@@ -1,37 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.RankPermission;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class RankPermissionCondition extends AbstractCommandCondition {
public RankPermissionCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
String name = context.getConfigValue("name", (String) null);
Player player = context.getIssuer().getPlayer();
if (player == null || name == null) {
return;
}
RankPermission rankPermission = net.sacredlabyrinth.phaed.simpleclans.RankPermission.valueOf(name);
if (!permissionsManager.has(player, rankPermission, true)) {
throw new ConditionFailedException();
}
}
@Override
public @NotNull String getId() {
return "rank";
}
}
@@ -1,38 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.*;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class SameClanCondition extends AbstractParameterCondition<ClanPlayerInput> {
public SameClanCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext execContext,
ClanPlayerInput value) throws InvalidCommandArgument {
BukkitCommandIssuer issuer = context.getIssuer();
Clan clan = Conditions.assertClanMember(clanManager, issuer);
if (value == null || value.getClanPlayer().getClan() == null ||
!value.getClanPlayer().getClan().equals(clan)) {
throw new ConditionFailedException(lang("the.player.is.not.a.member.of.your.clan", issuer));
}
}
@Override
public @NotNull String getId() {
return "same_clan";
}
}
@@ -1,33 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.conditions;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.ConditionContext;
import co.aikar.commands.ConditionFailedException;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class VerifiedCondition extends AbstractCommandCondition {
public VerifiedCondition(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public void validateCondition(ConditionContext<BukkitCommandIssuer> context) throws InvalidCommandArgument {
Clan clan = Conditions.assertClanMember(clanManager, context.getIssuer());
if (!clan.isVerified()) {
throw new ConditionFailedException(lang("clan.is.not.verified",
context.getIssuer()));
}
}
@Override
public @NotNull String getId() {
return "verified";
}
}
@@ -1,18 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractContextResolver<T> {
protected final @NotNull SimpleClans plugin;
protected final @NotNull ClanManager clanManager;
public AbstractContextResolver(@NotNull SimpleClans plugin) {
this.plugin = plugin;
clanManager = plugin.getClanManager();
}
public abstract Class<T> getType();
}
@@ -1,24 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class ClanContextResolver extends AbstractIssuerOnlyContextResolver<Clan> {
public ClanContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Clan getContext(BukkitCommandExecutionContext c) throws InvalidCommandArgument {
return Contexts.assertClanMember(clanManager, c.getIssuer());
}
@Override
public Class<Clan> getType() {
return Clan.class;
}
}
@@ -1,34 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanInput;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class ClanInputContextResolver extends AbstractInputOnlyContextResolver<ClanInput> {
public ClanInputContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public ClanInput getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
String arg = context.popFirstArg();
Clan clan = clanManager.getClan(arg);
if (clan == null) {
throw new InvalidCommandArgument(RED + lang("the.clan.does.not.exist", context.getSender()),
false);
}
return new ClanInput(clan);
}
@Override
public Class<ClanInput> getType() {
return ClanInput.class;
}
}
@@ -1,26 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class ClanPlayerContextResolver extends AbstractIssuerOnlyContextResolver<ClanPlayer> {
public ClanPlayerContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public ClanPlayer getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
Player player = Contexts.assertPlayer(context.getIssuer());
return clanManager.getCreateClanPlayer(player.getUniqueId());
}
@Override
public Class<ClanPlayer> getType() {
return ClanPlayer.class;
}
}
@@ -1,35 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.ClanPlayerInput;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("unused")
public class ClanPlayerInputContextResolver extends AbstractInputOnlyContextResolver<ClanPlayerInput> {
public ClanPlayerInputContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public ClanPlayerInput getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
String arg = context.popFirstArg();
ClanPlayer cp = clanManager.getAnyClanPlayer(arg);
if (cp == null) {
@SuppressWarnings("deprecation")
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(arg);
cp = clanManager.getCreateClanPlayer(offlinePlayer.getUniqueId());
}
return new ClanPlayerInput(cp);
}
@Override
public Class<ClanPlayerInput> getType() {
return ClanPlayerInput.class;
}
}
@@ -1,37 +0,0 @@
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 net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public class Contexts {
private Contexts() {
}
@NotNull
public static Clan assertClanMember(@NotNull ClanManager clanManager,
@NotNull BukkitCommandIssuer issuer) {
assertPlayer(issuer);
Clan clan = clanManager.getClanByPlayerUniqueId(issuer.getUniqueId());
if (clan == null) {
throw new InvalidCommandArgument(lang("not.a.member.of.any.clan", issuer), false);
}
return clan;
}
@NotNull
public static Player assertPlayer(@NotNull BukkitCommandIssuer issuer) {
Player player = issuer.getPlayer();
if (player == null) {
throw new InvalidCommandArgument(MessageKeys.NOT_ALLOWED_ON_CONSOLE, false);
}
return player;
}
}
@@ -1,35 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.contexts;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Rank;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.RED;
@SuppressWarnings("unused")
public class RankContextResolver extends AbstractInputOnlyContextResolver<Rank> {
public RankContextResolver(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Rank getContext(BukkitCommandExecutionContext context) throws InvalidCommandArgument {
Clan clan = Contexts.assertClanMember(clanManager, context.getIssuer());
String rankName = context.isLastArg() ? context.joinArgs() : context.popFirstArg();
Rank rank = clan.getRank(rankName);
if (rank == null) {
throw new InvalidCommandArgument(RED + lang("rank.0.does.not.exist", context.getIssuer(), rankName),
false);
}
return rank;
}
@Override
public Class<Rank> getType() {
return Rank.class;
}
}
@@ -1,49 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.AQUA;
import static org.bukkit.ChatColor.DARK_GRAY;
public class Alliances extends Sendable {
public Alliances(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
super(plugin, sender);
}
@Override
public void send() {
List<Clan> clans = cm.getClans();
cm.sortClansByKDR(clans);
sendHeader();
for (Clan clan : clans) {
if (!clan.isVerified()) {
continue;
}
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getAllyString(DARK_GRAY + ", "));
}
sendBlock();
}
private void sendHeader() {
ChatBlock.sendBlank(sender);
ChatBlock.saySingle(sender, sm.getServerName() + subColor + " " +
lang("alliances", sender) + " " + headColor +
Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(sender);
chatBlock.setAlignment("l", "l");
chatBlock.addRow(" " + headColor + lang("clan", sender), lang("allies", sender));
}
}
@@ -1,106 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
import net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.stream.Collectors;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver.RankingType.ORDINAL;
import static org.bukkit.ChatColor.*;
public class ClanList extends Sendable {
private final @Nullable String type;
private final @Nullable String order;
public ClanList(@NotNull SimpleClans plugin,
@NotNull CommandSender sender,
@Nullable String type,
@Nullable String order) {
super(plugin, sender);
this.type = type;
this.order = order;
}
@Override
public void send() {
List<Clan> clans = getListableClans();
if (clans.isEmpty()) {
ChatBlock.sendMessage(sender, RED + lang("no.clans.have.been.created", sender));
return;
}
RankingNumberResolver<Clan, ? extends Comparable<?>> ranking = getRankingResolver(clans, type, order);
sendHeader(clans);
for (Clan clan : clans) {
addLine(ranking, clan);
}
sendBlock();
}
private RankingNumberResolver<Clan, ? extends Comparable<?>> getRankingResolver(List<Clan> clans,
@Nullable String type,
@Nullable String order) {
boolean ascending = order == null || lang("list.order.asc").equalsIgnoreCase(order);
if (type == null) {
type = sm.getListDefaultOrderBy();
}
if (type.equalsIgnoreCase(lang("list.type.size"))) {
return new RankingNumberResolver<>(clans, Clan::getSize, order != null && ascending, ORDINAL);
}
if (type.equalsIgnoreCase(lang("list.type.active"))) {
return new RankingNumberResolver<>(clans, Clan::getLastUsed, order != null && ascending, ORDINAL);
}
if (type.equalsIgnoreCase(lang("list.type.founded"))) {
return new RankingNumberResolver<>(clans, Clan::getFounded, ascending, ORDINAL);
}
if (type.equalsIgnoreCase(lang("list.type.name"))) {
return new RankingNumberResolver<>(clans, Clan::getName, ascending, ORDINAL);
}
return new RankingNumberResolver<>(clans, clan -> KDRFormat.toBigDecimal(clan.getTotalKDR()),
order != null && ascending, sm.getRankingType());
}
@NotNull
private List<Clan> getListableClans() {
List<Clan> clans = plugin.getClanManager().getClans();
clans = clans.stream().filter(clan -> clan.isVerified() || sm.isShowUnverifiedOnList())
.collect(Collectors.toList());
return clans;
}
private void sendHeader(List<Clan> clans) {
ChatBlock.sendBlank(sender);
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);
chatBlock.setAlignment("c", "l", "c", "c");
chatBlock.setFlexibility(false, true, false, false);
chatBlock.addRow(" " + headColor + lang("rank", sender), lang("name", sender),
lang("kdr", sender), lang("members", sender));
}
@SuppressWarnings("deprecation")
private void addLine(RankingNumberResolver<Clan, ? extends Comparable<?>> ranking, Clan clan) {
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()) : "";
chatBlock.addRow(" " + ranking.getRankingNumber(clan), fullname, kdr, size);
}
}
@@ -1,57 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public class ClanProfile extends Sendable {
private final Clan clan;
public ClanProfile(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
super(plugin, sender);
this.clan = clan;
}
@Override
public void send() {
String message = lang("clan.profile").replace("%clan_name%", clan.getName())
.replace("%clan_color_tag%", clan.getColorTag())
.replace("%clan_description%", getDescription())
.replace("%clan_status%", Helper.getFormattedClanStatus(clan, sender))
.replace("%clan_leaders%", clan.getLeadersString(sm.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 + ", "))
.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()));
sender.sendMessage(message);
}
@NotNull
private String getFeeEnabled() {
return clan.isMemberFeeEnabled() ? lang("fee.enabled", sender) : lang("fee.disabled", sender);
}
@NotNull
private String getDescription() {
return clan.getDescription() != null && !clan.getDescription().isEmpty() ? clan.getDescription() :
lang("no.description", sender);
}
}
@@ -1,74 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.*;
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 org.bukkit.ChatColor.*;
public class ClanRoster extends Sendable {
private final Clan clan;
public ClanRoster(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
super(plugin, sender);
this.clan = clan;
}
@Override
public void send() {
configureAndSendHeader();
addLeaders();
addMembers();
sendBlock();
}
private void addMembers() {
List<ClanPlayer> members = clan.getNonLeaders();
plugin.getClanManager().sortClanPlayersByLastSeen(members);
for (ClanPlayer cp : members) {
Player p = cp.toPlayer();
String name = (cp.isTrusted() ? sm.getPageTrustedColor() : sm.getPageUnTrustedColor()) + cp.getName();
String lastSeen = p != null && p.isOnline() && !VanishUtils.isVanished(sender, p) ? GREEN + lang("online", sender) : WHITE + cp.getLastSeenDaysString(sender);
chatBlock.addRow(" " + name, YELLOW + Helper.parseColors(cp.getRankDisplayName()) + RESET, lastSeen);
}
}
private void addLeaders() {
List<ClanPlayer> leaders = clan.getLeaders();
plugin.getClanManager().sortClanPlayersByLastSeen(leaders);
for (ClanPlayer cp : leaders) {
Player p = cp.toPlayer();
String name = sm.getPageLeaderColor() + cp.getName();
String lastSeen = p != null && p.isOnline() && !VanishUtils.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.getPageClanNameColor() + clan.getName() + subColor + " " +
lang("roster", sender) + " " + headColor + Helper.generatePageSeparator(sm.getPageSep()));
ChatBlock.sendBlank(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);
chatBlock.addRow(" " + headColor + lang("player", sender), lang("rank", sender),
lang("seen", sender));
}
}
@@ -1,71 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.text.NumberFormat;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
public class ClanStats extends Sendable {
private final Clan clan;
public ClanStats(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
super(plugin, sender);
this.clan = clan;
}
@Override
public void send() {
configureAndSendHeader();
List<ClanPlayer> leaders = clan.getLeaders();
cm.sortClanPlayersByKDR(leaders);
addRows(leaders);
List<ClanPlayer> members = clan.getNonLeaders();
cm.sortClanPlayersByKDR(members);
addRows(members);
sendBlock();
}
private void configureAndSendHeader() {
ChatBlock.saySingle(sender, sm.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.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);
chatBlock.setAlignment("l", "c", "c", "c", "c", "c", "c");
chatBlock.addRow(" " + headColor + lang("name", sender), lang("kdr", sender),
lang("rival", sender), lang("neutral", sender), lang("civilian.abbreviation", sender),
lang("deaths", sender));
}
private void addRows(List<ClanPlayer> clanPlayers) {
for (ClanPlayer cpm : clanPlayers) {
String name = (cpm.isLeader() ? sm.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());
String deaths = NumberFormat.getInstance().format(cpm.getDeaths());
String kdr = KDRFormat.format(cpm.getKDR());
chatBlock.addRow(" " + name, YELLOW + kdr, WHITE + rival, GRAY + neutral, DARK_GRAY + civilian,
DARK_RED + deaths);
}
}
}
@@ -1,69 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
import net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
public class Leaderboard extends Sendable {
private final RankingNumberResolver<ClanPlayer, BigDecimal> rankingResolver;
private final List<ClanPlayer> clanPlayers;
public Leaderboard(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
super(plugin, sender);
clanPlayers = cm.getAllClanPlayers();
rankingResolver = new RankingNumberResolver<>(clanPlayers,
c -> KDRFormat.toBigDecimal(c.getKDR()), false, sm.getRankingType());
}
@Override
public void send() {
configureAndSendHeader();
addLines();
sendBlock();
}
private void addLines() {
for (ClanPlayer cp : clanPlayers) {
boolean online = cp.toPlayer() != null;
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);
if (cp.getClan() != null) {
clanTag = cp.getClan().getColorTag();
}
chatBlock.addRow(" " + rankingResolver.getRankingNumber(cp),
name, YELLOW + "" + KDRFormat.format(cp.getKDR()), WHITE + clanTag, lastSeen);
}
}
private void configureAndSendHeader() {
ChatBlock.sendBlank(sender);
ChatBlock.saySingle(sender, sm.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()));
ChatBlock.sendBlank(sender);
chatBlock.setAlignment("c", "l", "c", "c", "c", "c");
chatBlock.addRow(" " + headColor + lang("rank", sender), lang("player", sender),
lang("kdr", sender), lang("clan", sender), lang("seen", sender));
}
}
@@ -1,50 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
public class Rivalries extends Sendable {
public Rivalries(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
super(plugin, sender);
}
@Override
public void send() {
List<Clan> clans = cm.getClans();
cm.sortClansByKDR(clans);
sendHeader();
for (Clan clan : clans) {
if (!clan.isVerified()) {
continue;
}
chatBlock.addRow(" " + AQUA + clan.getName(), clan.getRivalString(DARK_GRAY + ", "));
}
sendBlock();
}
private void sendHeader() {
ChatBlock.sendBlank(sender);
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) + "]");
ChatBlock.sendBlank(sender);
chatBlock.setAlignment("l", "l");
chatBlock.addRow(lang("clan", sender), lang("rivals", sender));
}
}
@@ -1,46 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
public abstract class Sendable {
protected final SimpleClans plugin;
protected final SettingsManager sm;
protected final ClanManager cm;
protected final CommandSender sender;
protected final ChatBlock chatBlock = new ChatBlock();
protected final String headColor;
protected final String subColor;
public Sendable(@NotNull SimpleClans plugin, @NotNull CommandSender sender) {
this.plugin = plugin;
sm = plugin.getSettingsManager();
cm = plugin.getClanManager();
this.sender = sender;
headColor = sm.getPageHeadingsColor();
subColor = sm.getPageSubTitleColor();
}
protected void sendBlock() {
SettingsManager sm = plugin.getSettingsManager();
boolean more = chatBlock.sendBlock(sender, sm.getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(sender, chatBlock);
ChatBlock.sendBlank(sender);
ChatBlock.sendMessage(sender, sm.getPageHeadingsColor() + lang("view.next.page", sender,
sm.getCommandMore()));
}
ChatBlock.sendBlank(sender);
}
public abstract void send();
}
@@ -1,78 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.data;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.List;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static org.bukkit.ChatColor.*;
public class Vitals extends Sendable {
private final Clan clan;
public Vitals(@NotNull SimpleClans plugin, @NotNull CommandSender sender, @NotNull Clan clan) {
super(plugin, sender);
this.clan = clan;
}
@Override
public void send() {
configureAndSendHeader();
List<ClanPlayer> members = Helper.stripOffLinePlayers(clan.getLeaders());
members.addAll(Helper.stripOffLinePlayers(clan.getNonLeaders()));
addRows(members);
chatBlock.addRow(" -- Allies -- ", "", "", "", "", "");
addRows(clan.getAllAllyMembers());
sendBlock();
}
private void configureAndSendHeader() {
ChatBlock.sendBlank(sender);
ChatBlock.saySingle(sender, sm.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));
ChatBlock.sendMessage(sender, headColor + lang("materials", sender) + ": " + AQUA +
lang("diamond", sender) + DARK_GRAY + ", " + YELLOW + lang("gold", sender) + DARK_GRAY + ", "
+ GRAY + lang("stone", sender) + DARK_GRAY + ", " + WHITE + lang("iron", sender) + DARK_GRAY +
", " + GOLD + lang("wood", sender));
ChatBlock.sendBlank(sender);
chatBlock.setFlexibility(true, false, false, false, false, false);
chatBlock.setAlignment("l", "l", "l", "c", "c", "c");
chatBlock.addRow(" " + headColor + lang("name", sender), lang("health", sender),
lang("hunger", sender), lang("food", sender), lang("armor", sender),
lang("weapons", sender));
}
private void addRows(Collection<ClanPlayer> players){
for (ClanPlayer cpm : players) {
Player p = cpm.toPlayer();
if (p != null) {
String name = (cpm.isLeader() ? sm.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());
chatBlock.addRow(" " + name, RED + health, hunger, WHITE + food, armor, weapons);
}
}
}
}
Loaded 100 of 526 files, more files were not shown because too many files have changed in this diff. Show more