Compare commits

...
252 Commits
Author SHA1 Message Date
Minat0_ fce8399840 GitBook: [#66] [DiscordSRV] Updated to relevant | English 2022-08-17 01:12:37 +00:00
Minat0_ cc2fc201fe GitBook: [tuerkce] 15 pages modified 2021-08-30 16:39:59 +00:00
Minat0_ 373f41f9ee GitBook: [tuerkce] no pages and one asset modified 2021-08-30 16:20:48 +00:00
Minat0_ f1e4bbf043 GitBook: [tuerkce] 15 pages and one asset modified 2021-08-30 15:45:06 +00:00
Minat0_ b902f5f71d GitBook: [tuerkce] no pages and 6 assets modified 2021-08-30 15:13:27 +00:00
Minat0_ 6461b5bc8c GitBook: [tuerkce] no pages and 2 assets modified 2021-07-06 15:54:35 +00:00
Minat0_ 169ebe543e GitBook: [tuerkce] no pages and 2 assets modified 2021-07-06 15:30:59 +00:00
Minat0_ 6018c793d4 GitBook: [tuerkce] no pages and 2 assets modified 2021-07-05 10:04:52 +00:00
Minat0_ ded9077dda GitBook: [tuerkce] 15 pages modified 2021-07-02 17:06:41 +00:00
mehmet yılmaz 0dd519dabd GitBook: [tuerkce] 16 pages modified 2021-06-24 20:47:17 +00:00
mehmet yılmaz 9563fc383c GitBook: [tuerkce] one page modified 2021-06-24 20:24:32 +00:00
mehmet yılmaz 846574e613 GitBook: [tuerkce] one page modified 2021-06-24 20:24:15 +00:00
mehmet yılmaz cd40fdc704 GitBook: [tuerkce] 16 pages modified 2021-06-24 20:18:35 +00:00
mehmet yılmaz 7f01696a56 GitBook: [tuerkce] 15 pages modified 2021-06-24 19:54:39 +00:00
mehmet yılmaz 52da3def88 GitBook: [tuerkce] 16 pages modified 2021-06-24 19:43:35 +00:00
mehmet yılmaz baea60473a GitBook: [tuerkce] 15 pages modified 2021-06-24 19:10:13 +00:00
mehmet yılmaz 4d6d2b550a GitBook: [tuerkce] 2 pages and one asset modified 2021-06-24 18:59:38 +00:00
mehmet yılmaz ae99204f58 GitBook: [tuerkce] one page modified 2021-06-24 18:41:02 +00:00
mehmet yılmaz 03e95cfa23 GitBook: [tuerkce] one page modified 2021-06-24 18:35:56 +00:00
mehmet yılmaz 25f854b155 GitBook: [tuerkce] one page modified 2021-06-24 18:34:21 +00:00
mehmet yılmaz a32c751aaa GitBook: [tuerkce] one page modified 2021-06-24 18:31:58 +00:00
mehmet yılmaz e212e17bef GitBook: [tuerkce] one page modified 2021-06-24 18:26:26 +00:00
mehmet yılmaz 4a7036cd82 GitBook: [tuerkce] 7 pages modified 2021-06-24 18:15:07 +00:00
mehmet yılmaz d7d7620c24 GitBook: [tuerkce] 4 pages modified 2021-06-24 17:55:35 +00:00
mehmet yılmaz 3d545acda5 GitBook: [tuerkce] 2 pages modified 2021-06-24 17:54:20 +00:00
Edson Passos 1d5a8beb3d Merge pull request #181 from RoinujNosde/dev
v2.15.2
2021-04-30 19:37:51 -03:00
RoinujNosde 82a14a8f24 Probably fixes kick command #180 2021-04-30 19:25:44 -03:00
RoinujNosde d07ff8aa17 Bump version 2021-04-30 19:18:28 -03:00
RoinujNosde 855927e1cd Fixes merge problem 2021-04-30 19:17:39 -03:00
RoinujNosde a67beb0fda Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	src/main/java/net/sacredlabyrinth/phaed/simpleclans/Clan.java
#	src/main/java/net/sacredlabyrinth/phaed/simpleclans/commands/SCCommandManager.java
#	src/main/java/net/sacredlabyrinth/phaed/simpleclans/events/DeleteRankEvent.java
#	src/main/resources/messages.properties
#	src/main/resources/messages_af_ZA.properties
#	src/main/resources/messages_ar_SA.properties
#	src/main/resources/messages_ca_ES.properties
#	src/main/resources/messages_cs_CZ.properties
#	src/main/resources/messages_da_DK.properties
#	src/main/resources/messages_de_DE.properties
#	src/main/resources/messages_el_GR.properties
#	src/main/resources/messages_es_ES.properties
#	src/main/resources/messages_fi_FI.properties
#	src/main/resources/messages_fr_FR.properties
#	src/main/resources/messages_he_IL.properties
#	src/main/resources/messages_hu_HU.properties
#	src/main/resources/messages_it_IT.properties
#	src/main/resources/messages_ja_JP.properties
#	src/main/resources/messages_ko_KR.properties
#	src/main/resources/messages_nl_NL.properties
#	src/main/resources/messages_no_NO.properties
#	src/main/resources/messages_pl_PL.properties
#	src/main/resources/messages_pt_BR.properties
#	src/main/resources/messages_pt_PT.properties
#	src/main/resources/messages_ro_RO.properties
#	src/main/resources/messages_ru_RU.properties
#	src/main/resources/messages_sr_SP.properties
#	src/main/resources/messages_sv_SE.properties
#	src/main/resources/messages_tr_TR.properties
#	src/main/resources/messages_uk_UA.properties
#	src/main/resources/messages_vi_VN.properties
#	src/main/resources/messages_zh_CN.properties
#	src/main/resources/messages_zh_TW.properties
2021-04-30 19:13:40 -03:00
Edson Passos b3e2720bc9 New translations messages.properties (Russian) (#179) 2021-04-30 19:07:33 -03:00
Minat0_ 99cb9e332a Show bank balance on staff GUI #89 (#178) 2021-04-29 22:23:55 -03:00
RoinujNosde 541e775fdb Merge remote-tracking branch 'origin/dev' into dev 2021-04-29 18:51:11 -03:00
RoinujNosde 0c220c79f2 Adds ignore-list for block place listeners 2021-04-29 18:50:59 -03:00
Edson Passos abc0bfe3ae New Crowdin updates (#177) 2021-04-28 21:02:44 -03:00
Edson Passos ff28d67e4b New Crowdin updates (#168) 2021-04-28 18:47:13 -03:00
RoinujNosde a723e8acff Only saves to db if set balance cause is not LOADING 2021-04-28 18:36:09 -03:00
RoinujNosde 9c20ef0575 Actually fixes spaces in BB 2021-04-27 22:51:15 -03:00
RoinujNosde 00b19d8c99 Fixes spaces in BB #172 2021-04-27 22:38:51 -03:00
Minat0_andRoinujNosde 8bcb1f2177 Bank commands for admins #88 (#174)
Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2021-04-27 22:04:14 -03:00
Edson Passos 37be7fbfc7 Checks if the Connection is valid before returning 2021-04-27 20:12:45 -03:00
RoinujNosde 29ef92e3b8 Refactored Clan and ClanPlayer update statements 2021-04-25 21:42:00 -03:00
RoinujNosde accddf319d Fixes negative KDR 2021-04-24 22:09:33 -03:00
RoinujNosde dafae75b21 Adds ALLY as kill type #99 2021-04-20 18:59:01 -03:00
RoinujNosde 6e477ec091 Adds name and clean name placeholders 2021-04-15 21:04:42 -03:00
RoinujNosde 8ae504024e Merge remote-tracking branch 'origin/dev' into dev 2021-04-11 10:20:44 -03:00
RoinujNosde 665ac47150 Sets PlotSquared as provided 2021-04-11 10:20:24 -03:00
Minat0_ f6d1356873 Hide vanished players from the invite command #128 (#167) 2021-04-07 22:15:21 -03:00
Edson Passos 40a749b304 New Crowdin updates (#150) 2021-04-07 19:46:13 -03:00
Minat0_ 628b26543f Disabling war requests, PlayerRankUpdateEvent (#166) 2021-04-06 12:33:57 -03:00
RoinujNosde c25c982264 Suppresses stacktrace from ProtectionProvider#setup
Adds support for PlotSquared 3 (untested)
2021-04-03 22:15:18 -03:00
RoinujNosde 32e21dbf50 Fixes clan home teleporting to surface if set in cave 2021-04-02 21:12:25 -03:00
RoinujNosde 7653b494fe Adds support for PlotSquared 5 (untested)
Attempts to add compatibility with CMI chat
2021-04-02 15:00:09 -03:00
RoinujNosde d20def4647 Adds support for WorldGuard 6 2021-03-29 23:44:26 -03:00
RoinujNosde 759796402e Fixes exception when using WG <7 2021-03-29 22:38:06 -03:00
RoinujNosde 13281ebff9 Fixes javadoc 2021-03-27 11:17:21 -03:00
Minat0_andRoinujNosde 2d52da106b Permanent clans (#157)
* Added permanent command
* Permanent clans are not purged
* Shows permanent status on profile
* Shows infinity symbol if a clan is permanent or purging is disabled

Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2021-03-26 16:01:52 -03:00
RoinujNosde 587f74e6aa Fixes NPE on ProtectionManager 2021-03-26 13:47:50 -03:00
RoinujNosde 74ba2ff568 Adds KDR resolver for placeholders
Changes KDR format to #.## in placeholders

Adds getClan() to PreCreateRankEvent
2021-03-20 22:05:31 -03:00
Minat0_andRoinujNosde 7e658c08b6 Rank events (PreCreateRankEvent, CreateRankEvent, DeleteRankEvent) (#151)
Adds events PreCreateRankEvent, CreateRankEvent, DeleteRankEvent

Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2021-03-20 13:32:08 -03:00
RoinujNosde cdda69d8b6 Adds option to edit all lands or only one 2021-03-19 22:37:47 -03:00
RoinujNosde 41721b02a7 Fixes ally invite still sent after disband #143 2021-03-19 22:20:46 -03:00
RoinujNosde 6bb3afb707 Revert "Adds compatibility with mute plugins"
This reverts commit 1f0b2518
2021-03-19 21:19:43 -03:00
RoinujNosde 3550d3909e Merge remote-tracking branch 'origin/dev' into dev 2021-03-18 21:46:06 -03:00
RoinujNosde 1f0b251885 Adds compatibility with mute plugins 2021-03-18 21:45:53 -03:00
Edson Passos 701d70681f Merge pull request #146 from RoinujNosde/l10n_dev
New Crowdin updates
2021-03-18 12:28:50 -03:00
Edson Passos 9f312800e1 New translations messages.properties (German) 2021-03-17 19:26:15 -03:00
Edson Passos d892b03142 Bump version 2021-03-16 19:44:31 -03:00
Edson PassosandMinat0_ 105ed018b1 v2.15.1 (#145)
Updated messages
Add event for deleting a rank
Fixes InventoryOpenEvent on older versions
Fixed players without rank unable to send chat messages

Co-authored-by: Minat0_ <42711312+Tomut0@users.noreply.github.com>
2021-03-16 19:39:00 -03:00
Edson Passos 7d872f1a4b New Crowdin updates (#142) 2021-03-16 19:31:38 -03:00
Minat0_ 5a1173f257 Add event for deleting a rank (#144) 2021-03-15 21:40:02 -03:00
Edson Passos 567e64462b New translations messages.properties (Russian) (#139) 2021-03-11 09:56:58 -03:00
RoinujNosde 95c5b11352 Merge remote-tracking branch 'origin/dev' into dev 2021-03-10 13:24:17 -03:00
RoinujNosde 26ceb59564 Fixes InventoryOpenEvent on older versions 2021-03-10 13:23:36 -03:00
Edson Passos ddf11b732f New Crowdin updates (#137)
* Update source file messages.properties
* New translations messages.properties (Polish)
* New translations messages.properties (Portuguese, Brazilian)
2021-03-07 14:29:22 -03:00
Edson Passos d35007b369 Updated messages 2021-03-06 15:01:16 -03:00
RoinujNosde aa011357bc Fixed players without rank unable to send chat messages 2021-03-06 13:59:27 -03:00
Edson Passos 53296485e8 Update Crowdin configuration file 2021-03-06 00:07:26 -03:00
Edson Passos 3f4fe0429f Update Crowdin configuration file 2021-03-06 00:00:16 -03:00
Edson Passos 31389485fd Deleted test action 2021-03-05 23:23:34 -03:00
Edson Passos c84f88b607 Fixed wrong path in publish action 2021-03-05 23:20:53 -03:00
Edson Passos a3cee92371 Update test_curseforge.yml 2021-03-05 22:54:52 -03:00
Edson Passos 8ae79e6b3d Testing curse forge action 2021-03-05 22:42:39 -03:00
Edson Passos 93fb4eafd4 Attemps to fix publish_curseforge action 2021-03-05 22:39:22 -03:00
RoinujNosde 5f2c20fe13 Deleted bintray action
Updated readme with new repo
2021-03-05 22:16:09 -03:00
Edson Passos 27b81f00d1 v2.15.0 (#132)
Added War and protection
Added clan color placeholder (#130)
Refactored flags
Fixed invitation message being sent even after invited created clan
Probably fixed exception thrown when two players modify the same part of the Clan via GUI
Fixed inverted bypass permission
Fixed allowDeposit and allowWithdraw not saving to db #125
2021-03-05 21:31:19 -03:00
RoinujNosde 0d0ad0a73f Changes maven repo to CodeMC 2021-03-05 20:50:40 -03:00
Edson Passos 7f20cd47f2 Renamed bintray action 2021-02-16 20:22:00 -03:00
Edson Passos ddabe9f86e Creates action to publish to CurseForge 2021-02-16 20:19:27 -03:00
Edson Passos 22cee2c494 Create LICENSE 2021-02-15 18:55:45 -03:00
Edson Passos 4f74885e8f v2.14.7 (#122)
Fixes wrapping long colored strings/words
Fixes kicking players via GUI
Probably fixes purge message
Fixes clickable accept and deny not working on translated configs
Refactored PAPI Expansion
Fixes RGB colors on BB
Fixes next button on some frames
Probably fixes placeholder not found warning
Ignore comments when loading translation status
Stores clan home location x, y and z as double
Stops wrapping messages to fit in one line
Players with bypass permission can view the profile/roster of non-verified clans
Adds kick command for moderators
Allows the removal of lines from lore
Adds debug messages to permission checks and deaths
Added topplayers placeholder
2021-02-08 20:46:35 -03:00
Edson Passos c4a253efb7 v2.14.6 (#115)
Adds delay for PvP denied messages #106
Adds 60 seconds timeout for conversations
Adds message for admin promote success
Adds Default Ranks #110
Adds warning about LuckPerms and auto-group-groupname
Warns when moving the last leader from a clan #94
PlayerDetailsFrame now gets the nickname from ClanPlayer to avoid rare cases where the player data file was deleted
Updated StaffFrame to reflect command changes #114
Fixes parsing large colored strings on wordWrap
Fixes clickable messages on <=1.12
Updated language files
2021-01-03 12:31:44 -03:00
Edson Passos f34b947e59 v2.14.5 (#108)
Adds clickable messages (accept and deny)
Added support to RGB colors
Added modtag for staff
Request messages are now 100% customizable
Moved mod commands to subcommand "mod"
Clan home now saves yaw and pitch
Fixed {clan} showing on chat when not in clan
Shows status "in rank" for untrusted players
Increased color_tag column size to 255
2020-12-17 20:19:11 -03:00
Edson Passos 5c98c1ecda GitBook: [master] 2 pages modified 2020-11-27 22:16:03 +00:00
Edson Passos 61b37d0907 GitBook: [master] 2 pages modified 2020-11-27 21:34:55 +00:00
Edson Passos e974af3c0e GitBook: [master] one page modified 2020-11-27 17:38:12 +00:00
Edson Passos 182e6e15c8 v2.14.4.1 (#93)
Fixed VanishUtils
2020-11-23 00:07:59 -03:00
Edson Passos c11a0e326c v2.14.4 (#92)
Re-added API methods that use player names instead of UUID to regain compatibility with old plugins (those names are converted to UUID)
Added PreCreateClanEvent #87
Added BankDepositEvent and BankWithdrawEvent #51
Added check for last minute changes of the member fee #75
Added suggestions for chat subcommands
Create clan command now accepts tag and name (optional arguments) #76 
Removed unused PlayerNameTabCompleter
Removed chat subcommands on and off
Fixed vanished players showing in online count #83
Fixes SQLite drop index syntax #52
Fixed saved banner not loading #90
Before caching the player head, the plugin now checks if the task was cancelled (on disable) #49
Fixed chat NPE and messages not being sent
Shaded Reflections lib to fix compatibility issues with other plugins
Changed priorities of some listeners
Updated language files
2020-11-22 17:37:18 -03:00
Edson Passos 1087235ecb GitBook: [master] 16 pages modified 2020-11-22 15:01:00 +00:00
Edson Passos cf45e73448 Added latest version badge 2020-11-18 19:19:06 -03:00
Edson Passos 6cf8517606 Added bStats badges 2020-11-16 20:29:47 -03:00
Tom Lewis f73ac56bde Added quick links to all doc (#85)
* Added quick links to all doc
* Warning for auto giving super permissions
* Added missing permissions
2020-11-09 11:09:36 -03:00
Edson Passosandxtomyserrax be5dc77e24 v2.14.3 (#84)
Changes disabled resetkdr message Closes #77
Fixes set fee allowing negative values Closes #74
Fixes exception on interacting with a wolf whose owner is offline Closes #73
Extracted events related to the TamableMobsSharing feature to their own class
Adds confirmation messages for accepting/denying invitations. Closes #44
The plugin now sends messages when attacks are cancelled. Closes #71
Refactored listeners related to the FriendlyFire and PvPOnlyInWar features
Refactored the PlayerDeathEvent listener
Fixed not being able to post more than one word to the bb
Plugin now gets ACF messages from ENGLISH when missing
Changed main GUI title to "{server name} - clan menu" Closes #63
Added staff lore message Closes #32
Removes spaces from subcommands
Fixes mute clan chat command
Updated language files

Co-authored-by: xtomyserrax <xtomyserrax@users.noreply.github.com>
2020-11-08 21:39:04 -03:00
Edson Passos db17074ac0 GitBook: [master] 2 pages modified 2020-11-06 17:26:10 +00:00
Tom Lewis 40d506c389 Adds doc link with commands & permissions links (#72) 2020-10-25 13:00:03 -03:00
Edson Passos d9f87420e1 2.14.2 (#69)
Fixed ally chat command not changing
Help command is now translatable
Added missing clan_member condition to chat commands
Updated language files
Fixes teleport blocks not respecting config
Adds a different way to check for vanished players
Fixes Lookup showing vanished players as online
Basic permissions are now default true
2020-10-23 20:13:00 -03:00
RoinujNosde bfa50407a7 Probably fixes #55 2020-10-19 19:52:48 -03:00
RoinujNosde 238ee17de8 Fixes ACF Name Annotation bug
Fixes InviteFrame's next page button. Closes #61
Added TagChangeEvent. Closes #58
2020-10-19 19:44:56 -03:00
Edson Passos 1b8a3fee6e Implemented ACF 2020-10-18 22:40:42 -03:00
RoinujNosde 69f75af088 Merge remote-tracking branch 'origin/master' 2020-08-22 20:29:16 -03:00
RoinujNosde 895ff3a44c Added lore length to the config 2020-08-22 19:54:04 -03:00
RoinujNosde 22d961b663 Bump version 2020-08-21 20:15:54 -03:00
RoinujNosde c006de7c08 Implemented lore length limiter Closes #36
Showing clan tag instead of name on alliances/rivalries Closes #40
Renaming old language files to messages_en Closes #42
Hid the head cache setting Closes #39
2020-08-21 20:09:37 -03:00
RoinujNosde c0ba056e54 New events and some fixes
Fixed roster not switching pages #39
Moved min-to-verify setting
Added task for caching player heads #39
Added FrameOpenEvent and ComponentClickEvent Closes #35
Added ability to hit oneself Closes #38
Added missing has.been.purged message Closes #37
2020-08-18 20:48:38 -03:00
Armageddon 2c7a594c56 GitBook: [master] 14 pages and 2 assets modified 2020-08-11 15:04:43 +00:00
srbedrock 29db5da1dc Merge branch 'master' into master 2020-08-11 10:34:58 -03:00
srbedrock 1d3ebafd6c Update maven.yml 2020-08-11 10:32:46 -03:00
RoinujNosde 07be81b456 Merge branch 'dev'
# Conflicts:
#	.github/workflows/bintray-publish.yml
#	.github/workflows/brintray-publish-1.8.yml
#	pom.xml
2020-08-09 20:12:29 -03:00
RoinujNosde e7b088d833 Bump version 2020-08-09 20:04:18 -03:00
RoinujNosde 9ad41ee3d6 Added translations
Added setbanner to help command
Added German translation
Added Turkish translation
Added Dutch translation
2020-08-09 19:30:41 -03:00
RoinujNosde a053911f00 Added banner for clans
Added command to set banners
Fixed insufficient permissions message
2020-08-09 14:39:44 -03:00
Edson Passos 1a2cf1d3b9 GitBook: [master] 10 pages modified 2020-08-09 17:28:54 +00:00
srbedrock cc3d7f9502 Wiki 2 (#30) 2020-08-07 08:59:03 -03:00
Thiago Kenis 98c69ed9e9 Update Clan Upkeep and Land Claims Plugins 2020-08-07 08:55:30 -03:00
Thiago Kenis f2bc1f12bd Update Configuration.md 2020-08-07 08:51:45 -03:00
Thiago Kenis 04a2fd603f Add Member Fee and Placeholder API Support 2020-08-07 08:47:27 -03:00
srbedrock 4e0c123879 Merge branch 'master' into master 2020-08-07 08:31:22 -03:00
Edson Passos 3bf8e77133 GitBook: [master] 27 pages and 2 assets modified 2020-08-06 21:23:53 +00:00
srbedrock 11e0344181 Wiki (#1) 2020-08-06 15:33:33 -03:00
srbedrock 34d4590d7e Commit Inicial mudança da Wiki (#29) 2020-08-06 15:00:37 -03:00
Edson Passos d1c98f802c Added Bintray Publish Action (#28) 2020-08-06 14:24:08 -03:00
Lucas 8f4dbc9f28 PAPI hook improved (#23) 2020-08-06 14:05:07 -03:00
srbedrock a5510b98ad Update and rename maven-master.yml to maven.yml 2020-08-06 11:43:18 -03:00
srbedrock a7d11f763c Update and rename maven.yml to maven-master.yml 2020-08-06 11:35:15 -03:00
srbedrock c50f6dc931 Create maven.yml 2020-08-06 10:56:56 -03:00
xtomyserrax 2b4e335b14 Fixes issue with item-list for dropping when teleporting home (#22) 2020-08-05 20:23:53 -03:00
RoinujNosde 34b0f32f1b Added DENSE ranking type
Fixed demote command
Changed kdr-exempt permission from default false to op to try to prevent a bug where everyone has it
2020-08-05 20:02:11 -03:00
Edson Passos 9ebe483850 Create .gitbook.yaml 2020-08-05 19:52:30 -03:00
RoinujNosde 7757f712cd Added StaffFrame
Added ClanDetailsFrame (staff)
Added PlayerDetailsFrame (staff)
Added PlayerListFrame (staff)
Added ClanListFrame (staff)
Fixed some messages not using the player's locale

marcelo-mason/SimpleClans#600
marcelo-mason/SimpleClans#614
2020-07-31 18:28:37 -03:00
RoinujNosde 2b562ac466 Added ConfirmationFrame
marcelo-mason/SimpleClans#616
2020-07-29 20:37:05 -03:00
Edson Passos 9038f97403 Merge pull request #21 from SrBedrock/patch-1
Update README.md
2020-07-29 07:53:30 -03:00
srbedrock 0892545252 Update README.md 2020-07-29 02:10:15 -03:00
Edson Passos 554e5f25bb Experimenting with Travis 2020-07-28 19:59:10 -03:00
RoinujNosde a0114a517d Implemented async teleport #3 2020-07-28 19:43:15 -03:00
RoinujNosde 960e40b387 Changed separator in auto groups to underscore
Fixes incompatibility issues with storing groups in YAML config files
2020-07-28 18:58:59 -03:00
RoinujNosde 0ca66fb6a4 Fixed placeholder registration
Added metric for language_chooser

marcelo-mason/SimpleClans#639
2020-07-26 13:40:38 -03:00
RoinujNosde e2a083f09a Added minimum members to verify 2020-07-26 10:35:59 -03:00
RoinujNosde c825fdd7ab Finished the language update
Removed usage of deprecated getLang
Added translation status for every language
Added link to the crowdin project and for every language
2020-07-26 01:05:06 -03:00
RoinujNosde 7e12fa6d01 Merge xtomyserrax's master into dev 2020-07-21 20:43:33 -03:00
RoinujNosde 113ef19966 Removed wrong import 2020-07-20 21:11:33 -03:00
RoinujNosde 93cb11532a Created LanguageSelectorFrame frame 2020-07-20 21:08:04 -03:00
Edson Passos 7d5699d75e Update README.md
Updated badges
Added maven repo info
Added API examples
2020-07-05 15:03:54 -03:00
RoinujNosde ae09353ab4 Fixes Exception on ChatEvent
getHandlerList() was missing

marcelo-mason/SimpleClans#634
2020-07-03 18:42:53 -03:00
RoinujNosde 33f9ee7adc Fixes NPE thrown if a color in the config is empty or doesn't exist 2020-07-02 22:16:37 -03:00
Edson Passos 2ba027f89a Delete bintray-publish.yml 2020-07-02 20:23:31 -03:00
Edson Passos d2ed8ac366 Delete bintray-publish-mc-1.8.yml 2020-07-02 20:23:21 -03:00
RoinujNosde 5e03bf53e7 Added support for different alphabets on tags
marcelo-mason/SimpleClans#618
2020-07-02 19:49:29 -03:00
RoinujNosde 01dc9d2304 Implemented rank creation via Conversation
marcelo-mason/SimpleClans#606
2020-07-01 19:47:05 -03:00
RoinujNosde 4eafe9afa8 Implemented clan creation via Conversation
Changed the command to /clan create (no args)
Created TagValidator class to have tag validation logic in one place
2020-07-01 18:42:43 -03:00
Edson Passos f2ba4b8a5c Added issue templates 2020-07-01 10:47:13 -03:00
RoinujNosde 7ba439eafc Added support for line breaks in an item's lore marcelo-mason/SimpleClans#611 2020-06-28 19:26:02 -03:00
RoinujNosde 5781f64796 Implemented disable-messages settings marcelo-mason/SimpleClans#597
If enabled, server announcements will not be sent
2020-06-28 18:56:32 -03:00
RoinujNosde 4d634901b0 GUI items now show their prices marcelo-mason/SimpleClans#620 2020-06-28 13:16:47 -03:00
RoinujNosde c1c4a35b82 Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	.github/workflows/maven-publish-mc-1.8.yml
#	.github/workflows/maven-publish.yml
2020-06-28 11:39:37 -03:00
RoinujNosde fd0954b510 Added promote command for admins marcelo-mason/SimpleClans#628 2020-06-28 11:38:51 -03:00
Edson Passos 2e1339e08e Delete bintray-publish.yml 2020-06-27 18:51:20 -03:00
Edson Passos cec163add9 Delete bintray-publish-mc-1.8.yml 2020-06-27 18:51:09 -03:00
Edson Passos 43e21924ee Renaming workflows again... 2020-06-27 18:48:00 -03:00
RoinujNosde 2bfc37d780 Merge remote-tracking branch 'origin/master' 2020-06-27 18:24:46 -03:00
RoinujNosde 3e4a744fc3 Renaming the workflows 2020-06-27 18:24:30 -03:00
Edson Passos f203554a64 Renamed workflows 2020-06-26 21:25:41 -03:00
RoinujNosde 116e99104c Merge branch 'master' into dev 2020-06-26 21:02:10 -03:00
RoinujNosde b5f81ccf79 Merge remote-tracking branch 'origin/master' 2020-06-26 20:57:26 -03:00
RoinujNosde 1ee1c288bd Changed distributionManagement 2020-06-26 20:56:58 -03:00
Edson Passos 03b95bbedf Updated issues link 2020-06-26 18:40:23 -03:00
rafael59r2 37ea6fe665 Added AddKillEvent (#631) 2020-06-25 19:55:41 -03:00
RoinujNosde 23832888e0 Fixes NPE on killing a NPC #630 2020-06-25 19:28:04 -03:00
RoinujNosde 50666a222a Added Friendly Fire permission to ranks
#625
2020-06-22 19:39:07 -03:00
RoinujNosde 0c63974180 Add info about clan/ally on MenuCommand
Added usage of the clan/ally chat commands to the MenuCommand and to the Chat Button
#582
2020-06-21 13:18:59 -03:00
RoinujNosde aa95ce09a4 Fixed too long colored tag on ModTag #598 2020-06-20 18:50:02 -03:00
RoinujNosde 960200a45f Added limit to the number of alliances
-1 disables it
#609
2020-06-19 21:54:09 -03:00
RoinujNosde 6c7bfa1752 Fixes NPE on a PlayerDeathEvent fired by PvPManager
#623
2020-06-19 21:27:26 -03:00
RoinujNosde 6554a91800 Forgot to replace other uses of Arrow #619 2020-06-14 16:23:47 -03:00
RoinujNosde 73616ddef9 ResetKDR price is displayed on the button and changed its permission #616 2020-06-14 16:13:40 -03:00
RoinujNosde ef894a36df Fixed place command and EntityListener
Fixed place command Closes #621
Fixed friendly fire not blocked if using tridents Closes #619
Added authors to plugin.yml
2020-06-14 15:54:16 -03:00
Edson Passos 598e420fa6 Added link to Discord server 2020-06-09 18:30:33 -03:00
RoinujNosde 68065a3b79 Fixed massive lag when opening the Leaderboard Frame
Closes #617
Added loading message to the buttons lore
Previous and Next page buttons now hide if they have no use
2020-06-06 19:00:38 -03:00
RoinujNosde 6e255fc7cb Added top clans placeholders
%simpleclans_topclans_POSITION_color_tag%
%simpleclans_topclans_POSITION_kdr%
%simpleclans_topclans_POSITION_total_kills%
Closes #610
2020-06-02 20:44:20 -03:00
Edson Passos 36a3d3732a Fixed maven build action
Ref was in the wrong action
2020-05-31 23:30:21 -03:00
RoinujNosde 934263063e Added a workflow for 1.8 2020-05-31 22:59:57 -03:00
RoinujNosde af9e9539f9 Fixed lpp on bb messages 2020-05-30 21:00:52 -03:00
RoinujNosde 14be85a84c Added getLocale check for older MC versions 2020-05-29 23:54:23 -03:00
RoinujNosde 3a789adf61 Implemented lpp on RequestManager 2020-05-29 23:47:58 -03:00
RoinujNosde 2c39603da9 Merge remote-tracking branch 'origin/master' 2020-05-28 21:00:24 -03:00
RoinujNosde 6dddc64a95 Fixed clan command not working on older Minecraft versions
Added messages for join/leave/mute/unmute chat Closes #603
Fixed clan tag min length Closes #608
Added a check for too long colored tag Closes #598
2020-05-28 20:59:42 -03:00
RoinujNosde 82f94d1149 Fixed clan command not working on older Minecraft versions
Added messages for join/leave/mute/unmute chat Closes #603
Fixed clan tag min length Closes #608
Added a check for too long colored tag Closes #598
2020-05-28 20:55:39 -03:00
RoinujNosde edd19a42d6 Implemented lpp on TabCompleter and ResignPrompt 2020-05-28 19:39:48 -03:00
RoinujNosde 26d41c2d98 Implemented language per player on ClanPlayer and Dates 2020-05-27 20:47:25 -03:00
RoinujNosde d928cf8e39 Merge branch 'master' of https://github.com/xtomyserrax/SimpleClans into lang-pp 2020-05-27 20:12:50 -03:00
xtomyserrax 4e1d538ef2 Added support for per player language. 2020-05-26 00:11:21 -03:00
Edson Passos b4fbcdd0de Added resource page 2020-05-25 20:47:03 -03:00
xtomyserrax 0ead15ff25 Update .gitignore 2020-05-25 20:43:28 -03:00
Edson Passos 3db5a71bbe Added maven package badge
Change links
2020-05-25 20:32:46 -03:00
RoinujNosde ae86f5b68f Updated language files 2020-05-25 19:17:48 -03:00
Edson Passos 1ca26319db Added a GUI
The plugin accepts & as an alternative color code
Fixed PurgeCommand not purging players without clan
2020-05-25 19:02:24 -03:00
Edson Passos 0bb9fd5b53 Removed old repo 2020-05-24 15:50:38 -03:00
Edson Passos c548f7749e Added Maven Package workflow 2020-05-24 15:41:58 -03:00
Edson Passos 888366ce27 Added new distribution repo and changed vault repo 2020-05-24 15:40:50 -03:00
RoinujNosde dc7d414393 Fixed globalff usage
Fixed Russian translation for the ff commands ("allow", "block" and
"auto")
Closes #594
2020-05-13 20:38:26 -03:00
RoinujNosde f5c0920cc9 Fixed rank command and added new languages 2020-05-13 20:14:49 -03:00
RoinujNosde fe866d959a Now saving periodically to db
Added update checker
Removed usage of SimpleClans#getLog()
2020-05-08 18:31:06 -03:00
LucasandRoinujNosde 6083766a12 Added PlaceholderAPI support (#587)
Added PlaceholderAPI support
Refactored PlaceholderHook

Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
2020-05-01 14:54:28 -03:00
14b663801d Added spanish translation
Removed the usage of Helper.capitalize()
Fixed some messages in English
Converted spanish file to properties

Co-authored-by: RoinujNosde <edsonpassosjr@outlook.com>
Co-authored-by: CrazyDev <hugosilvaf2@gmail.com>
2020-04-27 22:45:22 -03:00
RoinujNosde b331e2c236 Merge branch 'master' of https://github.com/marcelo-mason/SimpleClans.git 2020-04-27 20:18:18 -03:00
RoinujNosde b3d5be1ec0 Updated language system Closes #573
The language file format is now .properties
If a message is not present in the messages file in the plugin's folder,
the plugin will search inside the jar
You can switch languages in the config
Fixed the vote system
Added message "resign request cancelled" Closes #580
Chat command is on the Menu command
2020-04-27 20:17:33 -03:00
Edson Passos b6d9c3a605 Removed disclaimer 2020-04-27 11:32:22 -03:00
Edson Passos e2c7b109d9 Added translation badge 2020-04-27 07:32:52 -03:00
CrazyDev 6bb370facd Fix command /clan home regroup (#584)
Fix loc null in /clan home regroup
2020-04-23 11:05:42 -03:00
RoinujNosde b3c8131c96 Fixed confirmation for promote Closes #581
Refactored the code to process votes
2020-04-22 21:32:02 -03:00
RoinujNosde d4c9537296 Fixed KDR not recording
Changed the kdr-exempt permission to simpleclans.other.kdr-exempt Closes
#579
2020-04-21 19:32:56 -03:00
RoinujNosde f89d446ac0 Fixed confirmation for demote/promote still asking after voting
Closes #482
2020-04-21 19:29:19 -03:00
RoinujNosde 009564f732 Fixed leaders online to demote
Closes #575
2020-04-18 19:15:55 -03:00
RoinujNosde a6e10da510 Checking if connection is null or closed
Closes #572
2020-04-18 19:11:34 -03:00
RoinujNosde a9fe589794 Forgot to update table 2020-04-16 07:02:51 -03:00
RoinujNosde 2d0b524557 Removed forRemoval from @Deprecated 2020-04-15 21:43:19 -03:00
RoinujNosde ba66f16f54 Fixed last seen and menu command messages
Fixed last seen not updating Closes #566
Fixed weird space in Menu command Closes #483
Fixed Menu command messages getting cropped Closes #392
Fixed Mojang URL
Removed deprecated code
2020-04-15 21:32:57 -03:00
RoinujNosde 4d6a489b43 SQLite queries use threads if enabled
Fixes #568
2020-04-13 20:22:45 -03:00
xtomyserrax 92da40ca76 Small fixes on commands
Fixes a small issue when ally wasn't verified, it was sending a message but not returning the code.
Fixes NPE on Ban command.
ChatEvent is ignored if cancelled.
Menu command will show /clan fee only if member fee is enabled
Added disabled message to Fee command
2020-04-10 13:35:44 -03:00
Edson Passos f1d0741ac8 Corrected version number 2020-04-10 11:28:24 -03:00
RoinujNosde 03b2f73e74 Rank name is lowercase 2020-04-10 10:35:54 -03:00
Edson Passos 2a65295e8b Finalized ranks with permissions
Closes #544

Fixed config resetting. Closes #564
2020-04-10 01:37:07 -03:00
Edson Passos a7cb9ed171 Update pom.xml 2020-04-03 19:13:10 -03:00
RoinujNosde ac0a387198 Removed kdr-exempt from anyone.*
Closes #561
2020-04-02 07:35:59 -03:00
Edson Passos e3cd7d37a8 Merge pull request #559 from xtomyserrax/patch-1
Added check for null home on regroup
2020-03-31 07:58:22 -03:00
Edson Passos 63595258f4 Removed wrong message 2020-03-31 07:48:21 -03:00
xtomyserrax 0c866044df /clan home command fixes
- Fixes this error when there is no home set for the clan (I just copied and pasted the loc == null statement): https://pastebin.com/jiXneTvK

Also can you please fix this placeholder? I dont want to touch anything there as maybe it breaks some stuff or it meant to be something: https://imgur.com/a/KWPDTk7
It says: "Clan home-base set to: {0}" + Location. I guess the 0 meant to be the location? Maybe adding a replace would fix it, unless the idea was to make something else.

Thanks for the awesome plugin and sorry for making another merge for the same, I just noticed it! 

Also another idea, what if instead of saying Insufficient Permission when you write a command wrongly it sends a usage message? For example, if I type /clan home tp, I get a no permission message, if I write /clan home tp test, then I go to the home of test clan. 

Thanks!
2020-03-30 22:45:34 -03:00
Edson Passos 2217efa8a7 Merge pull request #558 from xtomyserrax/patch-1
Fix bypassing /clan home regroup
2020-03-30 21:22:49 -03:00
xtomyserrax df97e43c4d Fix bypassing /clan home regroup
Clan members can use /clan home regroup without being leaders and also without having the permission simpleclans.leader.home-regroup

Just added a return statement to both conditionals.
2020-03-30 21:05:03 -03:00
RoinujNosde 169b44e793 Added permission for using colors/formats on setrank
Closes #548
2020-03-26 20:19:45 -03:00
RoinujNosde f2303c5336 Allow server owners to edit the time to collect member fee and upkeep
Closes #543
2020-03-25 20:13:35 -03:00
RoinujNosde af8cd133c2 Added permission to prevent the player's kdr from being affected
Closes #549
2020-03-21 23:48:52 -03:00
RoinujNosde fa66424402 Prevents code &k to transform the spaces between columns on clan roster
Closes #554
2020-03-21 23:31:12 -03:00
RoinujNosde 2727203bed Fixed spy chat and banned list
- The remaining chat codes (k, m, n, o, r) are now stripped from the Spy
Chat messages. Closes #550
- The banned players list is now saved to the config. Closes #546
2020-02-07 19:48:26 -03:00
RoinujNosde eedc743d5b Created a full PT-BR language file 2019-09-20 22:07:49 -03:00
RoinujNosde 4e12e4d6f5 KDR grinding prevention
Added two ways to prevent players from grinding KDR. Closes #276
When a player joins a clan, they automatically receive the
"group.tagname permission". Closes #541
Removed the usage of SimpleClans#hasUUID()
2019-09-20 20:40:11 -03:00
RoinujNosde 32855c2611 Fixed database not being loaded #542 2019-09-10 21:34:08 -03:00
RoboMWM d7118aea82 Updated Bukkit dependency to 1.13
Now the plugin supports 1.13 and 1.14
2019-09-08 09:41:16 -03:00
RoinujNosde f472432eb6 Rejoin, clan list and member fee improved
- Cooldown on rejoining clans added. Closes #280
- You can now sort the clan list by name, size, etc. Closes #530
- Added a permission to bypass the member fee. Closes #540
2019-09-06 20:15:59 -03:00
RoinujNosde e07c8a9343 Updating download link 2019-08-26 22:02:05 -03:00
RoinujNosde b84e46d156 Clans can now have a description
It can be changed using the /clan description command
Its max and min length can be set in the config

Closes #537
2019-08-26 21:55:02 -03:00
RoinujNosde daba767a5a Charge upkeep if member fee is enabled
Closes #539
2019-08-26 19:27:25 -03:00
RoinujNosde e59a760776 Upkeep system implemented
Closes #524
2019-08-25 17:14:39 -03:00
349 changed files with 29270 additions and 10465 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
root: ./wiki
structure:
readme: README.md
summary: SUMMARY.md
+30
View File
@@ -0,0 +1,30 @@
---
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
@@ -0,0 +1,20 @@
---
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
@@ -0,0 +1,29 @@
# 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
@@ -0,0 +1,29 @@
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
+7 -1
View File
@@ -1,3 +1,9 @@
/target/
/.idea/
SimpleClans.iml
/bin/
/.classpath
/.project
/dependency-reduced-pom.xml
*.jar
.settings
.factorypath
+3
View File
@@ -10,6 +10,9 @@ 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
+674
View File
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+84 -15
View File
@@ -1,15 +1,84 @@
SimpleClans
==========
Full featured clan system for PVP Minecraft Servers
[![Build Status](https://travis-ci.org/marcelo-mason/SimpleClans.svg)](https://travis-ci.org/marcelo-mason/SimpleClans)
[![Download](https://img.shields.io/badge/snapshot-download-blue.svg)](https://github.com/marcelo-mason/SimpleClans/releases/latest)
[![Issues](https://img.shields.io/github/issues/marcelo-mason/SimpleClans.svg)](https://github.com/marcelo-mason/SimpleClans/issues)
[![ghit.me](https://ghit.me/badge.svg?repo=marcelo-mason/SimpleClans)](https://ghit.me/repo/marcelo-mason/SimpleClans)
## Disclaimer:
Active development for this plugin has stopped. It is in maintenance mode and will continue to be kept up to date as-is with any new Minecraft version indefinitely.
Pull-requests for bug fixes or new features are welcomed and will be merged in if they do not break existing functionalities.
[![SimpleClans Logo](https://i.imgur.com/9vgfVdX.png)](https://www.spigotmc.org/resources/simpleclans.71242/)
SimpleClans
==========
Full featured clan 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)
#### Download Link
* [Download from Spigot](https://www.spigotmc.org/resources/simpleclans.71242/)
#### Documentation
* [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
* [Discord Support](https://discord.gg/CkNwgdE)
* [Bugs and Suggestions](https://github.com/RoinujNosde/SimpleClans/issues)
#### Developers
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>
```
Using Gradle:
```groovy
repositories {
maven {
url "https://repo.codemc.org/repository/maven-public"
}
}
dependencies {
compileOnly "net.sacredlabyrinth.phaed.simpleclans:SimpleClans:2.15.0"
}
```
##### 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)
+93 -12
View File
@@ -1,28 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<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.bukkit:bukkit:1.9-R0.1-SNAPSHOT" level="project" />
<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" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.15" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.milkbowl.vault:VaultAPI:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.nijikokun.bukkit:Permissions:2.7.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sacredlabyrinth.Phaed:PreciousStones:9.7.0" level="project" />
<orderEntry type="library" name="Maven: org.getspout:spoutplugin:dev-SNAPSHOT" 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>
+11
View File
@@ -0,0 +1,11 @@
<root>
<item name='co.aikar.commands.BukkitCommandCompletionContext org.bukkit.entity.Player getPlayer()'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='co.aikar.commands.BukkitCommandExecutionContext org.bukkit.entity.Player getPlayer()'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='co.aikar.commands.BukkitCommandIssuer org.bukkit.entity.Player getPlayer()'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
</root>
+3
View File
@@ -0,0 +1,3 @@
files:
- source: src/main/resources/messages.properties
translation: /src/main/resources/%file_name%_%locale_with_underscore%.%file_extension%
+327
View File
@@ -0,0 +1,327 @@
<?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>
+7
View File
@@ -0,0 +1,7 @@
<root>
<item name='org.bukkit.configuration.MemorySection java.lang.String getString(java.lang.String, java.lang.String)'>
<annotation name='org.jetbrains.annotations.Contract'>
<val val="&quot;_, _ -&gt; !null&quot;"/>
</annotation>
</item>
</root>
+197 -42
View File
@@ -1,8 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.7.20</version>
<version>2.15.2</version>
<name>SimpleClans</name>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
@@ -18,9 +19,7 @@
<includes>
<include>plugin.yml</include>
<include>config.yml</include>
<include>language.yml</include>
<include>language-br.yml</include>
<include>language-zh.yml</include>
<include>*.properties</include>
</includes>
</resource>
</resources>
@@ -38,6 +37,9 @@
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
@@ -54,65 +56,220 @@
<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>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.6</version>
<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>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>paper-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
<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>
<!-- GitHub/Jenkins -->
<ciManagement>
<system>jenkins</system>
<url>http://104.236.246.108:8080</url>
</ciManagement>
<scm>
<connection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</connection>
<developerConnection>scm:git:git:@github.com:marcelo-mason/SimpleClans.git</developerConnection>
<url>http://github.com/marcelo-mason/SimpleClans.git/tree/master/</url>
<tag>SimpleClans</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -121,14 +278,12 @@
<distributionManagement>
<repository>
<id>SacredCoding</id>
<name>SacredCoding-releases</name>
<url>http://104.236.246.108:8081/artifactory/plugins-release-local</url>
<id>codemc-releases</id>
<url>https://repo.codemc.io/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>SacredCoding</id>
<name>SacredCoding-snapshots</name>
<url>http://104.236.246.108:8081/artifactory/plugins-release-local</url>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
@@ -1,13 +1,18 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
/**
* @author phaed
@@ -19,31 +24,27 @@ public class ChatBlock {
private final ArrayList<String> columnAlignments = new ArrayList<>();
private final LinkedList<String[]> rows = new LinkedList<>();
private String color = "";
/**
*
*/
public static final Logger LOG = Logger.getLogger("Minecraft");
private boolean cropRight = true;
private boolean padRight = true;
public void setCropRight(boolean cropRight) {
this.cropRight = cropRight;
}
public void setPadRight(boolean padRight) {
this.padRight = padRight;
}
/**
* @param columnAlignment
*/
public void setAlignment(String... columnAlignment) {
columnAlignments.addAll(Arrays.asList(columnAlignment));
}
/**
* @param columnFlex
*/
public void setFlexibility(boolean... columnFlex) {
for (boolean flex : columnFlex) {
columnFlexes.add(flex);
}
}
/**
* @param columnPercentages
* @param prefix
*/
public void setColumnSizes(String prefix, double... columnPercentages) {
int ll = LINE_LENGTH;
@@ -56,73 +57,38 @@ public class ChatBlock {
}
}
/**
* @return
*/
public boolean hasContent() {
return !rows.isEmpty();
}
/**
* @param contents
*/
public void addRow(String... contents) {
rows.add(contents);
}
/**
* @return
*/
public int size() {
return rows.size();
}
/**
* @return
*/
public boolean isEmpty() {
return rows.isEmpty();
}
/**
*
*/
public void clear() {
rows.clear();
}
/**
* @param player
* @return
*/
public boolean sendBlock(CommandSender player) {
return sendBlock(player, null, 0);
}
/**
* @param player
* @param prefix
* @return
*/
public boolean sendBlock(CommandSender player, String prefix) {
return sendBlock(player, prefix, 0);
}
/**
* @param player
* @param amount
* @return
*/
public boolean sendBlock(CommandSender player, int amount) {
return sendBlock(player, null, amount);
}
/**
* @param player
* @param prefix
* @param amount
* @return
*/
boolean sendBlock(CommandSender player, String prefix, int amount) {
if (player == null) {
return false;
@@ -158,6 +124,7 @@ public class ChatBlock {
}
List<String> messages = new ArrayList<>();
// size up all sections
for (int i = 0; i < amount; i++) {
@@ -182,13 +149,25 @@ public class ChatBlock {
}
} else if (align.equalsIgnoreCase("l")) {
if (msgLength(section) > colsize) {
col = cropRightToFit(section, colsize);
if (cropRight) {
col = cropRightToFit(section, colsize);
} else {
col = section;
}
} else if (msgLength(section) < colsize) {
col = paddRightToFit(section, colsize);
if (padRight) {
col = paddRightToFit(section, colsize);
} else {
col = section;
}
}
} else if (align.equalsIgnoreCase("c")) {
if (msgLength(section) > colsize) {
col = cropRightToFit(section, colsize);
if (cropRight) {
col = cropRightToFit(section, colsize);
} else {
col = section;
}
} else if (msgLength(section) < colsize) {
col = centerInLineOf(section, colsize);
}
@@ -253,18 +232,20 @@ public class ChatBlock {
}
// crop and print out
String msg = cropRightToFit((prefix_used ? empty_prefix : prefix + " ") + finalString, LINE_LENGTH);
String msg = (prefix_used ? empty_prefix : prefix + " ") + finalString;
if (cropRight) {
msg = cropRightToFit(msg, LINE_LENGTH);
}
if (color.length() > 0) {
msg = color + msg;
}
player.sendMessage(msg);
messages.add(msg);
prefix_used = true;
}
player.sendMessage(messages.toArray(new String[0]));
return !rows.isEmpty();
}
@@ -278,10 +259,6 @@ public class ChatBlock {
return out;
}
/**
* @param col
* @return
*/
int getMaxWidth(int col) {
double maxWidth = 0;
@@ -292,19 +269,10 @@ public class ChatBlock {
return (int) maxWidth;
}
/**
* @param msg
* @return
*/
public static String centerInLine(String msg) {
return centerInLineOf(msg, LINE_LENGTH);
}
/**
* @param msg
* @param lineLength
* @return
*/
private static String centerInLineOf(String msg, double lineLength) {
double length = msgLength(msg);
double diff = lineLength - length;
@@ -329,10 +297,6 @@ public class ChatBlock {
return msg;
}
/**
* @param str
* @return
*/
public static String makeEmpty(String str) {
if (str == null) {
return "";
@@ -341,11 +305,6 @@ public class ChatBlock {
return paddLeftToFit("", msgLength(str));
}
/**
* @param msg
* @param length
* @return
*/
private static String cropRightToFit(String msg, double length) {
if (msg == null || msg.length() == 0 || length == 0) {
return "";
@@ -358,11 +317,6 @@ public class ChatBlock {
return msg;
}
/**
* @param msg
* @param length
* @return
*/
private static String cropLeftToFit(String msg, double length) {
if (msg == null || msg.length() == 0 || length == 0) {
return "";
@@ -376,11 +330,11 @@ public class ChatBlock {
}
/**
* Padds left til the string is a certain size
* Pads left til the string is a certain size
*
* @param msg
* @param length
* @return
* @param msg the message to pad
* @param length the message length
* @return the padded message
*/
private static String paddLeftToFit(String msg, double length) {
if (msgLength(msg) >= length) {
@@ -395,11 +349,11 @@ public class ChatBlock {
}
/**
* Padds right til the string is a certain size
* Pads right til the string is a certain size
*
* @param msg
* @param length
* @return
* @param msg the message to pad
* @param length the message length
* @return the padded message
*/
private static String paddRightToFit(String msg, double length) {
if (msgLength(msg) >= length) {
@@ -415,9 +369,6 @@ public class ChatBlock {
/**
* Finds the length on the screen of a string. Ignores colors.
*
* @param str
* @return
*/
private static double msgLength(String str) {
double length = 0;
@@ -438,9 +389,6 @@ public class ChatBlock {
/**
* Finds the visual length of the character on the screen.
*
* @param x
* @return
*/
private static int charLength(char x) {
String normalized = StringSimplifier.simplifiedString(x + "");
@@ -466,15 +414,11 @@ public class ChatBlock {
/**
* Cuts the message apart into whole words short enough to fit on one line
*
* @param msg
* @return
*/
private static String[] wordWrap(String msg) {
// Split each word apart
ArrayList<String> split = new ArrayList<>();
split.addAll(Arrays.asList(msg.split(" ")));
ArrayList<String> split = new ArrayList<>(Arrays.asList(msg.split(" ")));
// Create an array list for the output
@@ -514,19 +458,15 @@ public class ChatBlock {
// Merge the words into a sentence (that now fits into a single chat line) and add them to the output array.
String merged = combineSplit(words.toArray(new String[words.size()]));
String merged = combineSplit(words.toArray(new String[0]));
out.add(merged);
}
// Convert to an array and return
return out.toArray(new String[out.size()]);
return out.toArray(new String[0]);
}
/**
* @param string
* @return
*/
private static String combineSplit(String[] string) {
StringBuilder builder = new StringBuilder();
for (String aString : string) {
@@ -540,10 +480,6 @@ public class ChatBlock {
/**
* Cuts apart a word that is too long to fit on one line
*
* @param lengthBefore
* @param str
* @return
*/
private static String[] wordCut(int lengthBefore, String str) {
int length = lengthBefore;
@@ -577,9 +513,6 @@ public class ChatBlock {
/**
* Outputs a single line out, crops overflow
*
* @param receiver
* @param msg
*/
public static void saySingle(CommandSender receiver, String msg) {
if (receiver == null) {
@@ -591,35 +524,43 @@ public class ChatBlock {
/**
* Outputs a message to a user
*
* @param receiver
* @param msg
*/
public static void sendMessage(CommandSender receiver, String msg) {
public static void sendMessage(@Nullable CommandSender receiver, @NotNull String msg) {
if (receiver == null) {
return;
}
String[] message = colorize(wordWrap(msg));
for (String out : message) {
receiver.sendMessage(out);
}
receiver.sendMessage(ChatUtils.parseColors(msg));
// String[] message = colorize(wordWrap(msg));
//
// for (String out : message) {
// receiver.sendMessage(out);
// }
}
public static void sendMessage(@Nullable ClanPlayer receiver, @NotNull String msg) {
if (receiver == null) {
return;
}
Player player = receiver.toPlayer();
if (player == null) {
return;
}
player.sendMessage(ChatUtils.parseColors(msg));
}
public static void sendMessageKey(@Nullable CommandSender receiver, @NotNull String key, @NotNull Object... args) {
sendMessage(receiver, lang(key, receiver, args));
}
/**
* Send blank lie
*
* @param color
*/
public void startColor(String color) {
this.color = color;
}
/**
* Send blank lie
*
* @param receiver
* Send blank line
*/
public static void sendBlank(CommandSender receiver) {
if (receiver == null) {
@@ -631,22 +572,15 @@ public class ChatBlock {
/**
* Colors each line
*
* @param message
* @return
*/
public static String[] say(String message) {
return colorize(wordWrap(message));
}
public static String[] getColorizedMessage(String msg) {
return colorize(wordWrap(msg));
}
/**
* @param message
* @return
*/
private static String[] colorize(String[] message) {
try {
return colorizeBase(message);
@@ -655,21 +589,12 @@ public class ChatBlock {
}
}
/**
* @param message
* @return
*/
public static String colorize(String message) {
return colorizeBase(new String[]{
message
})[0];
public static @Nullable String colorize(String message) {
return colorizeBase(new String[]{message})[0];
}
/**
* @param message
* @return
*/
private static String[] colorizeBase(String[] message) {
private static @Nullable String[] colorizeBase(String[] message) {
if (message != null && message[0] != null && !message[0].isEmpty()) {
// Go through each line
@@ -685,9 +610,8 @@ public class ChatBlock {
// advance x to the next character
x += 1;
try {
lastColor = ChatColor.getByChar(msg.charAt(x)) + "";
} catch (Exception ignored) {
if (x < msg.length()) {
lastColor = ChatColor.COLOR_CHAR + "" + msg.charAt(x);
}
}
}
@@ -699,6 +623,7 @@ public class ChatBlock {
}
}
//noinspection ConstantConditions
return message;
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -4,6 +4,8 @@ import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
/**
* @author phaed
*/
@@ -13,115 +15,51 @@ public class Dates {
private Dates() {
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Timestamp date1, Timestamp date2) {
return differenceInMonths(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Timestamp date1, Timestamp date2) {
return differenceInYears(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Timestamp date1, Timestamp date2) {
return differenceInDays(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Timestamp date1, Timestamp date2) {
return differenceInHours(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Timestamp date1, Timestamp date2) {
return differenceInMinutes(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Timestamp date1, Timestamp date2) {
return differenceInSeconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
private static double differenceInMilliseconds(Timestamp date1, Timestamp date2) {
return differenceInMilliseconds(new Date(date1.getTime()), new Date(date2.getTime()));
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMonths(Date date1, Date date2) {
return differenceInYears(date1, date2) * 12;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInYears(Date date1, Date date2) {
double days = differenceInDays(date1, date2);
return days / 365.2425;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInDays(Date date1, Date date2) {
return differenceInHours(date1, date2) / 24.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInHours(Date date1, Date date2) {
return differenceInMinutes(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInMinutes(Date date1, Date date2) {
return differenceInSeconds(date1, date2) / 60.0;
}
/**
* @param date1
* @param date2
* @return
*/
public static double differenceInSeconds(Date date1, Date date2) {
return differenceInMilliseconds(date1, date2) / 1000.0;
}
@@ -137,56 +75,53 @@ public class Dates {
}
/**
* Returns the string representation of the amount of time labeled as days, hours, minutes, seconds
* @author RoboMWM, LaxWasHere
* @param seconds the time in seconds
* @param depth Max amount of detail (e.g. only display days and hours if set to 1 and seconds > 1 day)
* @return
* @return the string representation of the amount of time labeled as days, hours, minutes, seconds
*/
public static String formatTime(Long seconds, int depth)
{
SimpleClans plugin = SimpleClans.getInstance();
public static String formatTime(Long seconds, int depth) {
if (seconds == null || seconds < 1) {
return plugin.getLang("bb.moments");
return lang("bb.moments");
}
if (seconds < 60) {
return seconds + plugin.getLang("bb.seconds");
return seconds + lang("bb.seconds");
}
if (seconds < 3600) {
Long count = (long) Math.ceil(seconds / 60);
long count = (long) Math.ceil(seconds / 60f);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.minutes");
res = count + lang("bb.minutes");
} else {
res = plugin.getLang("bb.one.minute");
res = lang("bb.one.minute");
}
Long remaining = seconds % 60;
long remaining = seconds % 60;
if (depth > 0 && remaining >= 5) {
return res + ", " + formatTime(remaining, --depth);
}
return res;
}
if (seconds < 86400) {
Long count = (long) Math.ceil(seconds / 3600);
long count = (long) Math.ceil(seconds / 3600f);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.hours");
res = count + lang("bb.hours");
} else {
res = plugin.getLang("bb.one.hour");
res = lang("bb.one.hour");
}
if (depth > 0) {
return res + ", " + formatTime(seconds % 3600, --depth);
}
return res;
}
Long count = (long) Math.ceil(seconds / 86400);
long count = (long) Math.ceil(seconds / 86400f);
String res;
if (count > 1) {
res = count + plugin.getLang("bb.days");
res = count + lang("bb.days");
} else {
res = plugin.getLang("bb.one.day");
res = lang("bb.one.day");
}
if (depth > 0) {
return res + ", " + formatTime(seconds % 86400, --depth);
@@ -0,0 +1,5 @@
package net.sacredlabyrinth.phaed.simpleclans;
public enum EconomyResponse {
SUCCESS, NEGATIVE_VALUE, NOT_ENOUGH_BALANCE, CANCELLED
}
@@ -0,0 +1,93 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import java.util.ArrayList;
import java.util.List;
public class Flags {
private final JSONObject flags;
public Flags(@Nullable String json) {
JSONObject flags = null;
if (json != null && !json.isEmpty()) {
flags = (JSONObject) JSONValue.parse(json);
}
if (flags == null) {
flags = new JSONObject();
}
this.flags = flags;
}
@NotNull
public List<String> getStringList(@NotNull String key) {
Object object = flags.get(key);
ArrayList<String> list = new ArrayList<>();
if (object instanceof JSONArray) {
for (Object o : ((JSONArray) object)) {
list.add(String.valueOf(o));
}
}
return list;
}
@Nullable
public String getString(@NotNull String key) {
Object object = flags.get(key);
if (object == null) {
return null;
}
return String.valueOf(object);
}
@NotNull
public String getString(@NotNull String key, @NotNull String def) {
String string = getString(key);
if (string == null) {
return def;
}
return string;
}
@NotNull
public Number getNumber(@NotNull String key) {
Object object = flags.get(key);
if (object instanceof Number) {
return (Number) object;
}
return 0;
}
public boolean getBoolean(@NotNull String key) {
return getBoolean(key, false);
}
public boolean getBoolean(@NotNull String key, boolean def) {
Object object = flags.get(key);
if (object instanceof Boolean) {
return (Boolean) object;
}
return def;
}
@SuppressWarnings("unchecked")
public void put(@NotNull String key, @NotNull List<?> value) {
JSONArray array = new JSONArray();
array.addAll(value);
flags.put(key, array);
}
@SuppressWarnings("unchecked")
public void put(@NotNull String key, @NotNull Object object) {
flags.put(key, object);
}
public String toJSONString() {
return flags.toJSONString();
}
}
@@ -1,19 +1,37 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
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.regex.Matcher;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import java.util.stream.Collectors;
/**
* @author phaed
@@ -26,12 +44,184 @@ public class 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
*
@@ -42,7 +232,8 @@ public class Helper {
List<Player> players = SimpleClans.getInstance().getServer().matchPlayer(playerName);
if (players.size() == 1) {
return SimpleClans.getInstance().getPermissionsManager().getPrefix(players.get(0)) + players.get(0).getName() + SimpleClans.getInstance().getPermissionsManager().getSuffix(players.get(0));
PermissionsManager pm = SimpleClans.getInstance().getPermissionsManager();
return pm.getPrefix(players.get(0)) + players.get(0).getName() + pm.getSuffix(players.get(0));
}
return playerName;
@@ -210,12 +401,20 @@ public class Helper {
* @param hexValue
* @return
*/
public static String toColor(String hexValue) {
@NotNull
public static String toColor(@Nullable String hexValue) {
if (hexValue == null) {
return "";
}
if (hexValue.startsWith("&#")) {
return ChatUtils.parseColors(hexValue);
}
return ChatColor.getByChar(hexValue).toString();
ChatColor color = ChatColor.getByChar(hexValue);
if (color == null) {
return "";
}
return color.toString();
}
/**
@@ -265,6 +464,20 @@ public class Helper {
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
@@ -288,13 +501,13 @@ public class Helper {
* @return
*/
public static String toMessage(String[] args) {
String out = "";
StringBuilder out = new StringBuilder();
for (String arg : args) {
out += arg + " ";
out.append(arg).append(" ");
}
return out.trim();
return out.toString().trim();
}
/**
@@ -332,25 +545,21 @@ public class Helper {
}
/**
* Convert color hex values with ampersand to special character
*
* @param msg
* @return
* @deprecated use {@link ChatUtils#parseColors(String)}
*/
@Deprecated
public static String parseColors(String msg) {
return msg.replace("&", "\u00a7");
return ChatUtils.parseColors(msg);
}
/**
* Removes color codes from strings
*
* @param msg
* @return
* @deprecated use {@link ChatUtils#stripColors(String)}
*/
@Deprecated
public static String stripColors(String msg) {
String out = msg.replaceAll("[&][0-9a-f]", "");
out = out.replaceAll(String.valueOf((char) 194), "");
return out.replaceAll("[\u00a7][0-9a-f]", "");
return ChatUtils.stripColors(msg);
}
/*
@@ -405,7 +614,7 @@ public class Helper {
String out = msg;
String first = msg.substring(0, sep.length());
String last = msg.substring(msg.length() - sep.length(), msg.length());
String last = msg.substring(msg.length() - sep.length());
if (first.equals(sep)) {
out = msg.substring(sep.length());
@@ -516,7 +725,7 @@ public class Helper {
* @param str
* @return
*/
public static String escapeQuotes(String str) {
public static String escapeQuotes(@Nullable String str) {
if (str == null) {
return "";
}
@@ -557,37 +766,52 @@ public class Helper {
}
/**
* Sort hashmap by value
* Sorts a Map by value
*
* @param map
* @return Map
* @param map the Map to sort
* @return the Map sorted
*/
public static Map sortByValue(Map map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
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());
@Override
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.Entry) (o2)).getValue()).compareTo(((Map.Entry) (o1)).getValue());
}
});
Map result = new LinkedHashMap();
for (Iterator it = list.iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
Map<K, V> result = new LinkedHashMap<>();
for (Entry<K, V> entry : entryList) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
public static boolean isVanished(Player player) {
/**
* @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;
}
public static Collection<Player> getOnlinePlayers() {
@SuppressWarnings("unchecked")
public static Collection<Player> getOnlinePlayers() {
try {
Method method = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
Object players = method.invoke(null);
@@ -604,12 +828,10 @@ public class Helper {
return new ArrayList<>();
}
@Deprecated
@Nullable
public static Player getPlayer(String playerName) {
if (SimpleClans.getInstance().hasUUID()) {
return SimpleClans.getInstance().getServer().getPlayer(UUIDMigration.getForcedPlayerUUID(playerName));
}
return SimpleClans.getInstance().getServer().getPlayer(playerName);
return Bukkit.getPlayerExact(playerName);
}
/**
@@ -625,8 +847,8 @@ public class Helper {
String leaderColor = sm.getAllyChatLeaderColor();
String memberColor = sm.getAllyChatMemberColor();
String rank = cp.getRank().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRank());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getAllyChatRank()).replace("%rank%", rank) : "";
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) {
@@ -637,14 +859,18 @@ public class Helper {
return message;
}
private static String replacePlaceholders(String messageFormat, ClanPlayer cp, String leaderColor, String memberColor, String rankFormat, String msg) {
String message = ChatColor.translateAlternateColorCodes('&', messageFormat)
.replace("%clan%", cp.getClan().getColorTag())
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);
return message;
}
/**
@@ -660,8 +886,8 @@ public class Helper {
String leaderColor = sm.getClanChatLeaderColor();
String memberColor = sm.getClanChatMemberColor();
String rank = cp.getRank().isEmpty() ? null : ChatColor.translateAlternateColorCodes('&', cp.getRank());
String rankFormat = rank != null ? ChatColor.translateAlternateColorCodes('&', sm.getClanChatRank()).replace("%rank%", rank) : "";
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);
@@ -678,7 +904,7 @@ public class Helper {
*
* @param cp Sender
* @param msg The chat message
* @return The formated message
* @return The formatted message
*/
public static String formatSpyClanChat(ClanPlayer cp, String msg) {
msg = stripColors(msg);
@@ -689,4 +915,47 @@ public class Helper {
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;
}
}
@@ -0,0 +1,42 @@
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;
}
}
}
@@ -0,0 +1,5 @@
package net.sacredlabyrinth.phaed.simpleclans;
public enum PermissionLevel {
LEADER, TRUSTED
}
@@ -1,54 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class PlayerNameTabCompleter implements TabCompleter {
private SimpleClans plugin;
public PlayerNameTabCompleter() {
plugin = SimpleClans.getInstance();
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
if (command.getName().equalsIgnoreCase(plugin.getSettingsManager().getCommandClan())) {
if (strings.length < 2) {
return null;
}
if (strings[0].equalsIgnoreCase(plugin.getLang("lookup.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("ban.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("unban.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("kick.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("trust.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("untrust.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("promote.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("demote.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("setrank.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("place.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("invite.command")) ||
strings[0].equalsIgnoreCase(plugin.getLang("kills.command"))) {
List<String> list = new ArrayList<>();
for (OfflinePlayer player : plugin.getServer().getOnlinePlayers()) {
if (player.getName().startsWith(strings[1])) {
list.add(player.getName());
}
}
Collections.sort(list);
return list;
}
}
return null;
}
}
@@ -0,0 +1,105 @@
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());
}
}
@@ -0,0 +1,89 @@
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,5 +1,7 @@
package net.sacredlabyrinth.phaed.simpleclans;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -16,16 +18,13 @@ public final class Request {
private ClanPlayer requester;
private int askCount;
/**
* @param plugin
* @param type
* @param acceptors
* @param msg
* @param requester
* @param clan
* @param target
*/
public Request(SimpleClans plugin, ClanRequest type, List<ClanPlayer> acceptors, ClanPlayer requester, String target, Clan clan, String msg) {
public Request(SimpleClans plugin,
ClanRequest type,
@Nullable List<ClanPlayer> acceptors,
ClanPlayer requester,
String target,
Clan clan,
String msg) {
this.type = type;
this.target = target;
this.clan = clan;
@@ -108,25 +107,15 @@ public final class Request {
this.target = target;
}
/**
* Used for leader voting
*
* @param playerNAme
* @param vote
*/
public void vote(String playerNAme, VoteResult vote) {
public void vote(String playerName, VoteResult vote) {
for (ClanPlayer cp : acceptors) {
if (cp.getName().equalsIgnoreCase(playerNAme)) {
if (cp.getName().equalsIgnoreCase(playerName)) {
cp.setVote(vote);
}
}
}
/**
* Check whether all leaders have voted
*
* @return
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean votingFinished() {
for (ClanPlayer cp : acceptors) {
if (cp.getVote() == null) {
@@ -137,11 +126,6 @@ public final class Request {
return true;
}
/**
* Returns the players who have denied the request
*
* @return
*/
public List<String> getDenies() {
List<String> out = new ArrayList<>();
@@ -154,11 +138,6 @@ public final class Request {
return out;
}
/**
* Returns the players who have denied the request
*
* @return
*/
public List<String> getAccepts() {
List<String> out = new ArrayList<>();
@@ -1,191 +1,317 @@
package net.sacredlabyrinth.phaed.simpleclans;
import net.sacredlabyrinth.phaed.simpleclans.executors.*;
import net.sacredlabyrinth.phaed.simpleclans.listeners.SCEntityListener;
import net.sacredlabyrinth.phaed.simpleclans.listeners.SCPlayerListener;
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.plugin.java.JavaPlugin;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sacredlabyrinth.phaed.simpleclans.tasks.CollectFeeTask;
/**
* @author Phaed
*/
public class SimpleClans extends JavaPlugin {
private ArrayList<String> messages = new ArrayList<>();
private static SimpleClans instance;
private static final Logger logger = Logger.getLogger("Minecraft");
private ClanManager clanManager;
private RequestManager requestManager;
private StorageManager storageManager;
private SettingsManager settingsManager;
private PermissionsManager permissionsManager;
private TeleportManager teleportManager;
private LanguageManager languageManager;
private ChatFormatMigration chatFormatMigration;
private boolean hasUUID;
/**
* @return the logger
*/
public static Logger getLog() {
return logger;
}
/**
* @param msg
*/
public static void debug(String msg) {
if (getInstance().getSettingsManager().isDebugging()) {
logger.log(Level.INFO, msg);
}
}
/**
* @return the instance
*/
public static SimpleClans getInstance() {
return instance;
}
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;
settingsManager = new SettingsManager();
this.hasUUID = UUIDMigration.canReturnUUID();
languageManager = new LanguageManager();
permissionsManager = new PermissionsManager();
requestManager = new RequestManager();
clanManager = new ClanManager();
storageManager = new StorageManager();
teleportManager = new TeleportManager();
chatFormatMigration = new ChatFormatMigration();
chatFormatMigration.migrateAllyChat();
chatFormatMigration.migrateClanChat();
logger.info(MessageFormat.format(getLang("version.loaded"), getDescription().getName(), getDescription().getVersion()));
getServer().getPluginManager().registerEvents(new SCEntityListener(), this);
getServer().getPluginManager().registerEvents(new SCPlayerListener(), this);
permissionsManager.loadPermissions();
CommandHelper.registerCommand(getSettingsManager().getCommandClan());
CommandHelper.registerCommand(getSettingsManager().getCommandAccept());
CommandHelper.registerCommand(getSettingsManager().getCommandDeny());
CommandHelper.registerCommand(getSettingsManager().getCommandMore());
CommandHelper.registerCommand(getSettingsManager().getCommandAlly());
CommandHelper.registerCommand(getSettingsManager().getCommandGlobal());
getCommand(getSettingsManager().getCommandClan()).setExecutor(new ClanCommandExecutor());
getCommand(getSettingsManager().getCommandAccept()).setExecutor(new AcceptCommandExecutor());
getCommand(getSettingsManager().getCommandDeny()).setExecutor(new DenyCommandExecutor());
getCommand(getSettingsManager().getCommandMore()).setExecutor(new MoreCommandExecutor());
getCommand(getSettingsManager().getCommandAlly()).setExecutor(new AllyCommandExecutor());
getCommand(getSettingsManager().getCommandGlobal()).setExecutor(new GlobalCommandExecutor());
getCommand(getSettingsManager().getCommandClan()).setTabCompleter(new PlayerNameTabCompleter());
logger.info("[SimpleClans] Online Mode: " + hasUUID); //TODO: Is this necessary?
logger.info("[SimpleClans] Modo Multithreading: " + SimpleClans.getInstance().getSettingsManager().getUseThreads());
logger.info("[SimpleClans] Modo BungeeCord: " + SimpleClans.getInstance().getSettingsManager().getUseBungeeCord());
if (getSettingsManager().isMemberFee()) {
new CollectFeeTask().start();
}
}
@Override
public void onDisable() {
getServer().getScheduler().cancelTasks(this);
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
*/
public PermissionsManager getPermissionsManager() {
return permissionsManager;
}
/**
* @param msg the path within the language file
* @return the lang
*/
public String getLang(String msg) {
return languageManager.get(msg);
}
public TeleportManager getTeleportManager() {
return teleportManager;
}
public List<String> getMessages() {
return messages;
}
/**
* @return the hasUUID
*/
public boolean hasUUID() {
return this.hasUUID;
}
/**
* @param trueOrFalse
*/
public void setUUID(boolean trueOrFalse) {
this.hasUUID = trueOrFalse;
}
public LanguageManager getLanguageManager() {
return languageManager;
}
}
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;
}
}
@@ -2,39 +2,31 @@ package net.sacredlabyrinth.phaed.simpleclans;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class TeleportState {
private UUID playerUniqueId;
private String playerName;
private Location playerLocation;
private Location destination;
private final UUID playerUniqueId;
private final Location playerLocation;
private final Location destination;
private int counter;
private String clanName;
private final String clanName;
private boolean processing;
public TeleportState(Player player, Location dest, String clanName) {
this.destination = dest;
public TeleportState(Player player, Location destination, String clanName) {
this.destination = destination;
this.playerLocation = player.getLocation();
this.playerName = player.getName();
this.clanName = clanName;
this.counter = SimpleClans.getInstance().getSettingsManager().getWaitSecs();
this.playerUniqueId = player.getUniqueId();
}
/**
* @return
*/
public Location getLocation() {
return this.playerLocation;
}
/**
* Whether its time for teleport
*
* @return
*/
public boolean isTeleportTime() {
if (this.counter > 1) {
this.counter--;
@@ -47,20 +39,16 @@ public class TeleportState {
/**
* The player that is waiting for teleport
*
* @return
* @return the player
*/
public Player getPlayer() {
if (SimpleClans.getInstance().hasUUID()) {
return SimpleClans.getInstance().getServer().getPlayer(this.playerUniqueId);
} else {
return SimpleClans.getInstance().getServer().getPlayer(this.playerName);
}
public @Nullable Player getPlayer() {
return SimpleClans.getInstance().getServer().getPlayer(this.playerUniqueId);
}
/**
* Get seconds left before teleport
*
* @return
* @return the counter
*/
public int getCounter() {
return this.counter;
@@ -0,0 +1,46 @@
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,71 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
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.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
/**
* @author phaed
*/
public class AlliancesCommand {
public AlliancesCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.clan.alliances"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.anyone.alliances")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
List<Clan> clans = plugin.getClanManager().getClans();
plugin.getClanManager().sortClansByKDR(clans);
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("alliances") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
chatBlock.setAlignment("l", "l");
chatBlock.addRow(" " + headColor + plugin.getLang("clan"), plugin.getLang("allies"));
for (Clan clan : clans) {
if (!clan.isVerified()) {
continue;
}
chatBlock.addRow(" " + ChatColor.AQUA + clan.getName(), clan.getAllyString(ChatColor.DARK_GRAY + ", "));
}
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,100 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
/**
* @author phaed
*/
public class AllyCommand {
public AllyCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.ally")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 2) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.ally"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (clan.getSize() < plugin.getSettingsManager().getClanMinSizeToAlly()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("minimum.to.make.alliance"), plugin.getSettingsManager().getClanMinSizeToAlly()));
return;
}
String action = arg[0];
Clan ally = plugin.getClanManager().getClan(arg[1]);
if (ally == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
return;
}
if (!ally.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("cannot.ally.with.an.unverified.clan"));
}
if (action.equals(plugin.getLang("add"))) {
if (clan.isAlly(ally.getTag())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clans.are.already.allies"));
return;
}
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(clan.getLeaders());
if (onlineLeaders.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("at.least.one.leader.accept.the.alliance"));
return;
}
plugin.getRequestManager().addAllyRequest(cp, ally, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("leaders.have.been.asked.for.an.alliance"), Helper.capitalize(ally.getName())));
} else if (action.equals(plugin.getLang("remove"))) {
if (!clan.isAlly(ally.getTag())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clans.are.not.allies"));
return;
}
clan.removeAlly(ally);
ally.addBb(cp.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.broken.the.alliance"), Helper.capitalize(clan.getName()), ally.getName()), false);
clan.addBb(cp.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.broken.the.alliance"), Helper.capitalize(cp.getName()), Helper.capitalize(ally.getName())));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.ally"), plugin.getSettingsManager().getCommandClan()));
}
}
}
@@ -1,73 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.UUID;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
/**
* @author phaed
*/
public class BanCommand {
public BanCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("usage.ban.unban"), ChatColor.RED, plugin.getSettingsManager().getCommandClan()));
return;
}
String banned = arg[0];
if (SimpleClans.getInstance().hasUUID()) {
UUID PlayerUniqueId = UUIDMigration.getForcedPlayerUUID(banned);
if (plugin.getSettingsManager().isBanned(PlayerUniqueId)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned"));
return;
}
Player pl = SimpleClans.getInstance().getServer().getPlayer(PlayerUniqueId);
if (pl != null) {
ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned"));
}
plugin.getClanManager().ban(banned);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list"));
} else {
if (plugin.getSettingsManager().isBanned(banned)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned"));
return;
}
Player pl = SimpleClans.getInstance().getServer().getPlayerExact(banned);
if (pl != null) {
ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned"));
}
plugin.getClanManager().ban(banned);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list"));
}
}
}
@@ -1,92 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class BankCommand {
public BankCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.bank")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
double plmoney = plugin.getPermissionsManager().playerGetMoney(player);
double money = 0;
Clan clan = cp.getClan();
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
double clanbalance = clan.getBalance();
if (clan.isMember(player)) {
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.stats"));
return;
}
if (arg.length == 1) {
if (arg[0].equalsIgnoreCase("status")) {
player.sendMessage(ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.balance"), clanbalance));
}
} else if (arg.length == 2) {
if (arg[1].matches("[0-9]+")) {
money = Double.parseDouble(arg[1]);
}
if (arg[0].equalsIgnoreCase("deposit")) {
if (!cp.getClan().isLeader(player) && !clan.isAllowDeposit()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg[1].equalsIgnoreCase("all")) {
clan.deposit(plmoney, player);
} else {
clan.deposit(money, player);
}
} else if (arg[0].equalsIgnoreCase("withdraw")) {
if (!cp.getClan().isLeader(player) && !clan.isAllowWithdraw()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg[1].equalsIgnoreCase("all")) {
clan.withdraw(clanbalance, player);
} else {
clan.withdraw(money, player);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.bank"), plugin.getSettingsManager().getCommandClan()));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.bank"), plugin.getSettingsManager().getCommandClan()));
}
}
}
}
@@ -1,75 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class BbCommand {
public BbCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (arg.length == 0) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.bb")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
clan.displayBb(player);
return;
}
if (arg.length == 1 && arg[0].equalsIgnoreCase("clear")) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.bb-clear")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (!cp.isTrusted() || !cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
cp.getClan().clearBb();
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("cleared.bb"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.bb-add")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
String msg = Helper.toMessage(arg);
clan.addBb(player.getName(), ChatColor.AQUA + player.getName() + ": " + ChatColor.WHITE + msg);
plugin.getStorageManager().updateClan(clan);
}
}
@@ -0,0 +1,32 @@
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);
}
}
@@ -0,0 +1,32 @@
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,69 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class ClanffCommand {
public ClanffCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.ff")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.clanff"), plugin.getSettingsManager().getCommandClan()));
return;
}
String action = arg[0];
if (action.equalsIgnoreCase(plugin.getLang("allow"))) {
clan.addBb(player.getName(), ChatColor.AQUA + plugin.getLang("clan.wide.friendly.fire.is.allowed"));
clan.setFriendlyFire(true);
plugin.getStorageManager().updateClan(clan);
return;
}
if (!action.equalsIgnoreCase(plugin.getLang("block"))) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.clanff"), plugin.getSettingsManager().getCommandClan()));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + plugin.getLang("clan.wide.friendly.fire.blocked"));
clan.setFriendlyFire(false);
plugin.getStorageManager().updateClan(clan);
}
}
@@ -1,112 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* @author phaed
*/
public class CoordsCommand {
public CoordsCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.coords")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.coords"));
return;
}
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.coords"), plugin.getSettingsManager().getCommandClan()));
return;
}
ChatBlock chatBlock = new ChatBlock();
chatBlock.setFlexibility(true, false, false, false);
chatBlock.setAlignment("l", "c", "c", "c");
chatBlock.addRow(" " + headColor + plugin.getLang("name"), plugin.getLang("distance"), plugin.getLang("coords.upper"), plugin.getLang("world"));
List<ClanPlayer> members = Helper.stripOffLinePlayers(clan.getMembers());
Map<Integer, List<String>> rows = new TreeMap<>();
for (ClanPlayer cpm : members) {
Player p = cpm.toPlayer();
if (p != null) {
String name = (cpm.isLeader() ? plugin.getSettingsManager().getPageLeaderColor() : (cpm.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() : plugin.getSettingsManager().getPageUnTrustedColor())) + cpm.getName();
Location loc = p.getLocation();
int distance = (int) Math.ceil(loc.toVector().distance(player.getLocation().toVector()));
String coords = loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ();
String world = loc.getWorld().getName();
List<String> cols = new ArrayList<>();
cols.add(" " + name);
cols.add(ChatColor.AQUA + "" + distance);
cols.add(ChatColor.WHITE + "" + coords);
cols.add(world);
rows.put(distance, cols);
}
}
if (rows.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.are.the.only.member.online"));
return;
}
for (List<String> col : rows.values()) {
chatBlock.addRow(col.get(0), col.get(1), col.get(2), col.get(3));
}
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("coords") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,112 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class CreateCommand {
public CreateCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.create")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (arg.length < 2) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.create.tag"), plugin.getSettingsManager().getCommandClan()));
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("example.clan.create"));
return;
}
String tag = arg[0];
String cleanTag = Helper.cleanTag(arg[0]);
String name = Helper.toMessage(Helper.removeFirst(arg));
boolean bypass = plugin.getPermissionsManager().has(player, "simpleclans.mod.bypass");
if (!bypass) {
if (cleanTag.length() > plugin.getSettingsManager().getTagMaxLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.tag.cannot.be.longer.than.characters"), plugin.getSettingsManager().getTagMaxLength()));
return;
}
if (cleanTag.length() <= plugin.getSettingsManager().getTagMinLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.tag.must.be.longer.than.characters"), plugin.getSettingsManager().getTagMinLength()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.coloredtag") && tag.contains("&")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.tag.cannot.contain.color.codes"));
return;
}
if (plugin.getSettingsManager().hasDisallowedColor(tag)) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.tag.cannot.contain.the.following.colors"), plugin.getSettingsManager().getDisallowedColorString()));
return;
}
if (Helper.stripColors(name).length() > plugin.getSettingsManager().getClanMaxLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.name.cannot.be.longer.than.characters"), plugin.getSettingsManager().getClanMaxLength()));
return;
}
if (Helper.stripColors(name).length() <= plugin.getSettingsManager().getClanMinLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.name.must.be.longer.than.characters"), plugin.getSettingsManager().getClanMinLength()));
return;
}
if (plugin.getSettingsManager().isDisallowedWord(cleanTag.toLowerCase())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("that.tag.name.is.disallowed"));
return;
}
}
if (!cleanTag.matches("[0-9a-zA-Z]*")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clan.tag.can.only.contain.letters.numbers.and.color.codes"));
return;
}
if (name.contains("&")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clan.name.cannot.contain.color.codes"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("you.must.first.resign"), cp.getClan().getName()));
return;
}
if (plugin.getClanManager().isClan(cleanTag)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.with.this.tag.already.exists"));
return;
}
if (plugin.getClanManager().purchaseCreation(player)) {
plugin.getClanManager().createClan(player, tag, name);
Clan clan = plugin.getClanManager().getClan(tag);
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.created"), name));
plugin.getStorageManager().updateClan(clan);
if (plugin.getSettingsManager().isRequireVerification()) {
boolean verified = !plugin.getSettingsManager().isRequireVerification() || plugin.getPermissionsManager().has(player, "simpleclans.mod.verify");
if (!verified) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("get.your.clan.verified.to.access.advanced.features"));
}
}
}
}
}
@@ -1,126 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.UUID;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
/**
* @author phaed
*/
public class DemoteCommand {
public DemoteCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.demote.leader"), plugin.getSettingsManager().getCommandClan()));
return;
}
String demotedName = arg[0];
if (demotedName == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
final boolean hasUUID = SimpleClans.getInstance().hasUUID();
ClanPlayer toDemote;
if (hasUUID) {
UUID uuid = UUIDMigration.getForcedPlayerUUID(demotedName);
toDemote = plugin.getClanManager().getAnyClanPlayer(uuid);
} else {
toDemote = plugin.getClanManager().getAnyClanPlayer(demotedName);
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.demote")) {
if (!toDemote.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.any.clan"));
return;
}
final Clan clan = toDemote.getClan();
if (clan.getLeaders().size() == 1) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.demote.the.last.leader"));
return;
}
if (hasUUID) {
clan.demote(toDemote.getUniqueId());
} else {
clan.demote(demotedName);
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("demoted.back.to.member"), Helper.capitalize(demotedName)));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.successfully.demoted"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.demote")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (!clan.enoughLeadersOnlineToDemote(toDemote)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.enough.leaders.online.to.vote.on.demotion"));
return;
}
if (hasUUID) {
UUID uuid = UUIDMigration.getForcedPlayerUUID(demotedName);
if (!clan.isLeader(uuid)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.your.clan"));
return;
}
if (clan.getLeaders().size() != 1 && plugin.getSettingsManager().isConfirmationForDemote()) {
plugin.getRequestManager().addDemoteRequest(cp, demotedName, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("demotion.vote.has.been.requested.from.all.leaders"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("demoted.back.to.member"), Helper.capitalize(demotedName)));
clan.demote(uuid);
} else {
if (!clan.isLeader(demotedName)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("player.is.not.a.leader.of.your.clan"));
return;
}
if (clan.getLeaders().size() != 1 && plugin.getSettingsManager().isConfirmationForDemote()) {
plugin.getRequestManager().addDemoteRequest(cp, demotedName, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("demotion.vote.has.been.requested.from.all.leaders"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("demoted.back.to.member"), Helper.capitalize(demotedName)));
clan.demote(demotedName);
}
}
}
@@ -1,78 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class DisbandCommand {
public DisbandCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length == 0) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.disband")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (clan.getLeaders().size() != 1) {
plugin.getRequestManager().addDisbandRequest(cp, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("clan.disband.vote.has.been.requested.from.all.leaders"));
return;
}
clan.clanAnnounce(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.has.been.disbanded"), clan.getName()));
clan.disband();
return;
}
if (arg.length > 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.disband"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.disband")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
Clan clan = plugin.getClanManager().getClan(arg[0]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
return;
}
plugin.getClanManager().serverAnnounce(ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.has.been.disbanded"), clan.getName()));
clan.disband();
}
}
@@ -1,85 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
*
* @author roinujnosde
*/
public class FeeCommand {
/**
* Executes the command
*
* @param player
* @param args
*/
public void execute(Player player, String[] args) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getSettingsManager().isMemberFee()) {
return;
}
if (args.length >= 1) {
ClanPlayer cp = plugin.getClanManager().getAnyClanPlayer(player.getUniqueId());
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (args[0].equalsIgnoreCase("check")) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.fee-check")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ChatBlock.sendMessage(player, ChatColor.AQUA
+ MessageFormat.format(
plugin.getLang("the.fee.is.0.and.its.current.value.is.1"),
clan.isMemberFeeEnabled() ? plugin.getLang("fee.enabled") : plugin.getLang("fee.disabled"),
clan.getMemberFee()
));
return;
}
if (args.length == 2 && args[0].equalsIgnoreCase("set")) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
double newFee = 0;
try {
newFee = Double.parseDouble(args[1]);
} catch (NumberFormatException ignored) {
player.sendMessage(ChatColor.RED + plugin.getLang("invalid.fee"));
return;
}
double maxFee = plugin.getSettingsManager().getMaxMemberFee();
if (newFee > maxFee) {
ChatBlock.sendMessage(player, ChatColor.RED
+ MessageFormat.format(plugin.getLang("max.fee.allowed.is.0"), maxFee));
return;
}
if (plugin.getClanManager().purchaseMemberFeeSet(player)) {
clan.setMemberFee(newFee);
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("bb.fee.set"), newFee));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("fee.set"));
plugin.getStorageManager().updateClanAsync(clan);
}
return;
}
}
ChatBlock.sendMessage(player, ChatColor.RED
+ MessageFormat.format(plugin.getLang("usage.fee"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,61 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class FfCommand {
public FfCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.ff")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.ff.allow.auto"), plugin.getSettingsManager().getCommandClan()));
return;
}
String action = arg[0];
if (action.equalsIgnoreCase(plugin.getLang("allow"))) {
cp.setFriendlyFire(true);
plugin.getStorageManager().updateClanPlayer(cp);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("personal.friendly.fire.is.set.to.allowed"));
return;
}
if (action.equalsIgnoreCase(plugin.getLang("auto"))) {
cp.setFriendlyFire(false);
plugin.getStorageManager().updateClanPlayer(cp);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("friendy.fire.is.now.managed.by.your.clan"));
return;
}
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.ff.allow.auto"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,55 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class GlobalffCommand {
public GlobalffCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(CommandSender player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.ff.allow.auto"), plugin.getSettingsManager().getCommandClan()));
return;
}
String action = arg[0];
if (action.equalsIgnoreCase(plugin.getLang("allow"))) {
if (plugin.getSettingsManager().isGlobalff()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("global.friendly.fire.is.already.being.allowed"));
} else {
plugin.getSettingsManager().setGlobalff(true);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("global.friendly.fire.is.set.to.allowed"));
}
return;
}
if (action.equalsIgnoreCase(plugin.getLang("auto"))) {
if (!plugin.getSettingsManager().isGlobalff()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("global.friendy.fire.is.already.being.managed.by.each.clan"));
} else {
plugin.getSettingsManager().setGlobalff(false);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("global.friendy.fire.is.now.managed.by.each.clan"));
}
return;
}
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.globalff.allow.auto"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,209 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
import java.util.Random;
import net.sacredlabyrinth.phaed.simpleclans.events.HomeRegroupEvent;
import net.sacredlabyrinth.phaed.simpleclans.events.PlayerHomeSetEvent;
/**
* @author phaed
*/
public class HomeCommand {
public HomeCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length == 2) {
if (arg[0].equalsIgnoreCase("set") && plugin.getPermissionsManager().has(player, "simpleclans.mod.home")) {
if (!plugin.getClanManager().purchaseHomeTeleportSet(player)) {
return;
}
Location loc = player.getLocation();
Clan clan = plugin.getClanManager().getClan(arg[1]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.does.not.exist"));
return;
}
clan.setHomeLocation(loc);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("hombase.mod.set"), clan.getName()) + " " + ChatColor.YELLOW + Helper.toLocationString(loc));
return;
}
if (arg[0].equalsIgnoreCase("tp") && plugin.getPermissionsManager().has(player, "simpleclans.mod.hometp")) {
Clan clan = plugin.getClanManager().getClan(arg[1]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.does.not.exist"));
return;
}
Location loc = clan.getHomeLocation();
if (loc == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("hombase.not.set"));
return;
}
player.teleport(loc);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("now.at.homebase"), clan.getName()));
return;
}
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.vitals"));
return;
}
if (arg.length == 0) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.home")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
Location loc = clan.getHomeLocation();
if (loc == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("hombase.not.set"));
return;
}
if (plugin.getClanManager().purchaseHomeTeleport(player)) {
plugin.getTeleportManager().addPlayer(player, clan.getHomeLocation(), clan.getName());
}
return;
}
if (arg[0].equalsIgnoreCase("set")) {
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.home-set")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (plugin.getSettingsManager().isHomebaseSetOnce() && clan.getHomeLocation() != null && !plugin.getPermissionsManager().has(player, "simpleclans.mod.home")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("home.base.only.once"));
return;
}
PlayerHomeSetEvent homeSetEvent = new PlayerHomeSetEvent(clan, cp, player.getLocation());
SimpleClans.getInstance().getServer().getPluginManager().callEvent(homeSetEvent);
if (homeSetEvent.isCancelled() || !plugin.getClanManager().purchaseHomeTeleportSet(player)) {
return;
}
clan.setHomeLocation(player.getLocation());
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("hombase.set"), ChatColor.YELLOW + Helper.toLocationString(player.getLocation())));
return;
}
if (arg[0].equalsIgnoreCase("clear")) {
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.home-set")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (plugin.getSettingsManager().isHomebaseSetOnce() && clan.getHomeLocation() != null && !plugin.getPermissionsManager().has(player, "simpleclans.mod.home")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("home.base.only.once"));
return;
}
clan.setHomeLocation(null);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("hombase.cleared"));
return;
}
if (arg[0].equalsIgnoreCase("regroup")) {
if (!SimpleClans.getInstance().getSettingsManager().getAllowReGroupCommand()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
Location loc;
if (arg.length >= 2 && arg[1].equalsIgnoreCase("me")) {
loc = player.getLocation();
} else {
loc = cp.getClan().getHomeLocation();
}
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.home-regroup")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
HomeRegroupEvent homeRegroupEvent = new HomeRegroupEvent(clan, cp, clan.getOnlineMembers(), loc);
SimpleClans.getInstance().getServer().getPluginManager().callEvent(homeRegroupEvent);
if (homeRegroupEvent.isCancelled() || !plugin.getClanManager().purchaseHomeRegroup(player)) {
return;
}
List<ClanPlayer> members = clan.getOnlineMembers();
for (ClanPlayer ccp : members) {
Player pl = ccp.toPlayer();
if (pl == null) {
continue;
}
int x = loc.getBlockX();
int z = loc.getBlockZ();
player.sendBlockChange(new Location(loc.getWorld(), x + 1, loc.getBlockY(), z + 1), Material.GLASS, (byte) 0);
player.sendBlockChange(new Location(loc.getWorld(), x - 1, loc.getBlockY(), z - 1), Material.GLASS, (byte) 0);
player.sendBlockChange(new Location(loc.getWorld(), x + 1, loc.getBlockY(), z - 1), Material.GLASS, (byte) 0);
player.sendBlockChange(new Location(loc.getWorld(), x - 1, loc.getBlockY(), z + 1), Material.GLASS, (byte) 0);
Random r = new Random();
int xx = r.nextInt(2) - 1;
int zz = r.nextInt(2) - 1;
if (xx == 0 && zz == 0) {
xx = 1;
}
x = x + xx;
z = z + zz;
plugin.getTeleportManager().addPlayer(player, new Location(loc.getWorld(), x + .5, loc.getBlockY(), z + .5), clan.getName());
}
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("hombase.set") + ChatColor.YELLOW + Helper.toLocationString(loc));
return;
}
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
}
@@ -1,85 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class InviteCommand {
public InviteCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.invite")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.invite.player"), plugin.getSettingsManager().getCommandClan()));
return;
}
Player invited = Helper.getPlayer(arg[0]);
if (invited == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (!plugin.getPermissionsManager().has(invited, "simpleclans.member.can-join")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.doesn.t.not.have.the.permissions.to.join.clans"));
return;
}
if (invited.getName().equals(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.invite.yourself"));
return;
}
if (plugin.getSettingsManager().isBanned(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.banned.from.using.clan.commands"));
return;
}
ClanPlayer cpInv = plugin.getClanManager().getClanPlayer(invited);
if (cpInv != null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.already.member.of.another.clan"));
return;
}
if (!plugin.getClanManager().purchaseInvite(player)) {
return;
}
if (clan.getSize() >= plugin.getSettingsManager().getMaxMembers()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.members.reached.limit"));
return;
}
plugin.getRequestManager().addInviteRequest(cp, invited.getName(), clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.been.asked.to.join"), Helper.capitalize(invited.getName()), clan.getName()));
}
}
@@ -1,81 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
/**
* @author phaed
*/
public class KickCommand {
public KickCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.kick")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.kick.player"), plugin.getSettingsManager().getCommandClan()));
return;
}
String kicked = arg[0];
if (kicked == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (kicked.equalsIgnoreCase(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.kick.yourself"));
return;
}
if (!clan.isMember(kicked)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
return;
}
if (clan.isLeader(kicked)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.kick.another.leader"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.been.kicked.by"), Helper.capitalize(kicked), player.getName()));
if (SimpleClans.getInstance().hasUUID()) {
clan.removePlayerFromClan(UUIDMigration.getForcedPlayerUUID(kicked));
} else {
clan.removePlayerFromClan(kicked);
}
}
}
@@ -1,90 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class KillsCommand {
public KillsCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.kills")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.stats"));
return;
}
String polledPlayerName = player.getName();
if (arg.length == 1) {
polledPlayerName = arg[0];
}
ChatBlock chatBlock = new ChatBlock();
chatBlock.setFlexibility(true, false);
chatBlock.setAlignment("l", "c");
chatBlock.addRow(" " + headColor + plugin.getLang("victim"), plugin.getLang("killcount"));
Map<String, Integer> killsPerPlayerUnordered = plugin.getStorageManager().getKillsPerPlayer(polledPlayerName);
if (killsPerPlayerUnordered.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("nokillsfound"));
return;
}
Map<String, Integer> killsPerPlayer = Helper.sortByValue(killsPerPlayerUnordered);
for (Entry<String, Integer> playerKills : killsPerPlayer.entrySet()) {
int count = playerKills.getValue();
chatBlock.addRow(" " + playerKills.getKey(), ChatColor.AQUA + "" + count);
}
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(polledPlayerName) + subColor + " " + plugin.getLang("kills") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,91 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
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 org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.List;
/**
* @author phaed
*/
public class LeaderboardCommand {
public LeaderboardCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.leaderboard"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.anyone.leaderboard")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
List<ClanPlayer> clanPlayers = plugin.getClanManager().getAllClanPlayers();
plugin.getClanManager().sortClanPlayersByKDR(clanPlayers);
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("leaderboard.command") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("total.clan.players.0"), subColor + clanPlayers.size()));
ChatBlock.sendBlank(player);
chatBlock.setAlignment("c", "l", "c", "c", "c", "c");
chatBlock.addRow(" " + headColor + plugin.getLang("rank"), plugin.getLang("player"), plugin.getLang("kdr"), plugin.getLang("clan"), plugin.getLang("seen"));
int rank = 1;
for (ClanPlayer cp : clanPlayers) {
Player p = cp.toPlayer();
boolean isOnline = false;
if (p != null) {
isOnline = true;
}
String name = (cp.isLeader() ? plugin.getSettingsManager().getPageLeaderColor() : (cp.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() : plugin.getSettingsManager().getPageUnTrustedColor())) + cp.getName();
String lastSeen = isOnline ? ChatColor.GREEN + plugin.getLang("online") : ChatColor.WHITE + cp.getLastSeenDaysString();
String clanTag = ChatColor.WHITE + plugin.getLang("free.agent");
if (cp.getClan() != null) {
clanTag = cp.getClan().getColorTag();
}
chatBlock.addRow(" " + rank, name, ChatColor.YELLOW + "" + formatter.format(cp.getKDR()), ChatColor.WHITE + clanTag, lastSeen);
rank++;
}
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,92 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
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.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.List;
/**
* @author phaed
*/
public class ListCommand {
public ListCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
if (!plugin.getPermissionsManager().has(player, "simpleclans.anyone.list")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.list"), plugin.getSettingsManager().getCommandClan()));
return;
}
List<Clan> clans = plugin.getClanManager().getClans();
plugin.getClanManager().sortClansByKDR(clans);
if (clans.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clans.have.been.created"));
return;
}
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("clans.lower") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + plugin.getLang("total.clans") + " " + subColor + clans.size());
ChatBlock.sendBlank(player);
chatBlock.setAlignment("c", "l", "c", "c");
chatBlock.setFlexibility(false, true, false, false);
chatBlock.addRow(" " + headColor + plugin.getLang("rank"), plugin.getLang("name"), plugin.getLang("kdr"), plugin.getLang("members"));
int rank = 1;
for (Clan clan : clans) {
if (!plugin.getSettingsManager().isShowUnverifiedOnList() && !clan.isVerified()) {
continue;
}
String tag = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + clan.getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight();
String name = (clan.isVerified() ? plugin.getSettingsManager().getPageClanNameColor() : ChatColor.GRAY) + clan.getName();
String fullname = tag + " " + name;
String size = ChatColor.WHITE + "" + clan.getSize();
String kdr = clan.isVerified() ? ChatColor.YELLOW + "" + formatter.format(clan.getTotalKDR()) : "";
chatBlock.addRow(" " + rank, fullname, kdr, size);
rank++;
}
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,111 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
/**
* @author phaed
*/
public class LookupCommand {
public LookupCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
String playerName = null;
if (arg.length == 0) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.lookup")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
playerName = player.getName();
} else if (arg.length == 1) {
if (!plugin.getPermissionsManager().has(player, "simpleclans.anyone.lookup")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
playerName = arg[0];
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.lookup.tag"), plugin.getSettingsManager().getCommandClan()));
return;
}
ClanPlayer targetCp = plugin.getClanManager().getAnyClanPlayer(playerName);
ClanPlayer myCp = plugin.getClanManager().getClanPlayer(player.getName());
Clan myClan = myCp == null ? null : myCp.getClan();
if (targetCp != null) {
Clan targetClan = targetCp.getClan();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, MessageFormat.format(plugin.getLang("s.player.info"), plugin.getSettingsManager().getPageClanNameColor() + targetCp.getName() + subColor) + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
String clanName = ChatColor.WHITE + plugin.getLang("none");
if (targetClan != null) {
clanName = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + targetClan.getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight() + " " + plugin.getSettingsManager().getPageClanNameColor() + targetClan.getName();
}
String status = targetClan == null ? ChatColor.WHITE + plugin.getLang("free.agent") : (targetCp.isLeader() ? plugin.getSettingsManager().getPageLeaderColor() + plugin.getLang("leader") : (targetCp.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() + plugin.getLang("trusted") : plugin.getSettingsManager().getPageUnTrustedColor() + plugin.getLang("untrusted")));
String rank = ChatColor.WHITE + "" + Helper.parseColors(targetCp.getRank());
String joinDate = ChatColor.WHITE + "" + targetCp.getJoinDateString();
String lastSeen = ChatColor.WHITE + "" + targetCp.getLastSeenString();
String inactive = ChatColor.WHITE + "" + targetCp.getInactiveDays() + subColor + "/" + ChatColor.WHITE + plugin.getSettingsManager().getPurgePlayers() + " days";
String rival = ChatColor.WHITE + "" + targetCp.getRivalKills();
String neutral = ChatColor.WHITE + "" + targetCp.getNeutralKills();
String civilian = ChatColor.WHITE + "" + targetCp.getCivilianKills();
String deaths = ChatColor.WHITE + "" + targetCp.getDeaths();
String kdr = ChatColor.YELLOW + "" + formatter.format(targetCp.getKDR());
String pastClans = ChatColor.WHITE + "" + targetCp.getPastClansString(headColor + ", ");
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("clan.0"), clanName));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("rank.0"), rank));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("status.0"), status));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("kdr.0"), kdr));
ChatBlock.sendMessage(player, " " + subColor + plugin.getLang("kill.totals") + " " + headColor + "[" + plugin.getLang("rival") + ":" + rival + " " + headColor + "" + plugin.getLang("neutral") + ":" + neutral + " " + headColor + "" + plugin.getLang("civilian") + ":" + civilian + headColor + "]");
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("deaths.0"), deaths));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("join.date.0"), joinDate));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("last.seen.0"), lastSeen));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("past.clans.0"), pastClans));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("inactive.0"), inactive));
if (arg.length == 1 && !targetCp.equals(myCp)) {
String killType = ChatColor.GRAY + plugin.getLang("neutral");
if (targetClan == null) {
killType = ChatColor.DARK_GRAY + plugin.getLang("civilian");
} else if (myClan != null && myClan.isRival(targetClan.getTag())) {
killType = ChatColor.WHITE + plugin.getLang("rival");
}
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("kill.type.0"), killType));
}
ChatBlock.sendBlank(player);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.data.found"));
if (arg.length == 1 && myClan != null) {
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("kill.type.civilian"), ChatColor.DARK_GRAY));
}
}
}
}
@@ -1,295 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
/**
* @author phaed
*/
public class MenuCommand {
private List<String> menuItems = new LinkedList<>();
public MenuCommand() {
}
/**
* Execute the command
*
* @param player
*/
public void execute(Player player) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
Clan clan = cp == null ? null : cp.getClan();
boolean isLeader = cp != null && cp.isLeader();
boolean isTrusted = cp != null && cp.isTrusted();
boolean isVerified = clan != null && clan.isVerified();
boolean isNonVerified = clan != null && !clan.isVerified();
String clanCommand = plugin.getSettingsManager().getCommandClan();
ChatBlock chatBlock = new ChatBlock();
if (clan == null && plugin.getPermissionsManager().has(player, "simpleclans.leader.create")) {
if (plugin.getSettingsManager().isePurchaseCreation()) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.create.tag.name.1.purchase.a.new.clan"), clanCommand, ChatColor.WHITE));
} else {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.create.tag.name.1.create.a.new.clan"), clanCommand, ChatColor.WHITE));
}
}
if (isNonVerified && plugin.getSettingsManager().isRequireVerification() && plugin.getSettingsManager().isePurchaseVerification()) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.verify.1.purchase.verification.of.your.clan"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.list")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.list.1.lists.all.clans"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.profile")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.profile.1.view.your.clan.s.profile"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.profile")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.profile.tag.1.view.a.clan.s.profile"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.member.lookup")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.lookup.1.lookup.your.info"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.lookup")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.lookup.player.1.lookup.a.player.s.info"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.leaderboard")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.leaderboard.1.view.leaderboard"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.alliances")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.alliances.1.view.all.clan.alliances"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.rivalries")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.rivalries.1.view.all.clan.rivalries"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.roster")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.roster.1.view.your.clan.s.member.list"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.roster")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.roster.tag.1.view.a.clan.s.member.list"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.vitals")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.vitals.1.view.your.clan.member.s.vitals"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.coords")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.coords.1.view.your.clan.member.s.coordinates"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.stats")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.stats.1.view.your.clan.member.s.stats"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.kills")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.kills"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.kills")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.killsplayer"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.fee-check")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.fee.check"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.fee.set"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.ally")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.ally.add.remove.tag.1.add.remove.an.ally.clan"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.rival")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.rival.add.remove.tag.1.add.remove.a.rival.clan"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.home")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("home-menu"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.home-set")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("home-set-menu"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.home-set")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("home-clear-menu"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.home-regroup")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("home-regroup-menu"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.war")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.war"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.member.resetkdr")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.resetkdr.1.resets.your.kdr"), clanCommand, ChatColor.WHITE));
}
if (isVerified && plugin.getPermissionsManager().has(player, "simpleclans.member.bb")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.bb.1.display.bulletin.board"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.bb-add")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.bb.msg.1.add.a.message.to.the.bulletin.board"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.modtag")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.modtag.tag.1.modify.the.clan.s.tag"), clanCommand, ChatColor.WHITE));
}
String toggles = "";
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.bb-toggle")) {
toggles += "bb/";
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.member.tag-toggle")) {
toggles += "tag/";
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
toggles += "fee/";
}
if (!toggles.isEmpty()) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.toggle.command"), clanCommand, ChatColor.WHITE, Helper.stripTrailing(toggles, "/")));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.invite")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.invite.player.1.invite.a.player"), clanCommand, ChatColor.WHITE));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.kick")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.kick.player.1.kick.a.player.from.the.clan"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.setrank")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.trust.setrank"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.settrust")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.trust.untrust.player.1.set.trust.level1"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.settrust")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.trust.untrust.player.1.set.trust.level2"), clanCommand, ChatColor.WHITE));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.promote")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.promote.member.1.promote.a.member.to.leader"), clanCommand, ChatColor.WHITE));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.demote")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.demote.leader.1.demote.a.leader.to.member"), clanCommand, ChatColor.WHITE));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.ff")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.clanff.allow.block.1.toggle.clan.s.friendly.fire"), clanCommand, ChatColor.WHITE));
}
if (isLeader && plugin.getPermissionsManager().has(player, "simpleclans.leader.disband")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.disband.1.disband.your.clan"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.member.ff")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.ff.allow.auto.1.toggle.personal.friendly.fire"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.member.resign")) {
chatBlock.addRow(ChatColor.AQUA + " " + MessageFormat.format(plugin.getLang("0.resign.1.resign.from.the.clan"), clanCommand, ChatColor.WHITE));
}
for (String item : menuItems) {
chatBlock.addRow(ChatColor.AQUA + " " + item);
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.verify") && plugin.getSettingsManager().isRequireVerification()) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.verify.tag.1.verify.an.unverified.clan"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.place")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.place"), clanCommand, ChatColor.WHITE));
}
if (isVerified && isTrusted && plugin.getPermissionsManager().has(player, "simpleclans.mod.mostkilled")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.mostkilled"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.disband")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.disband.tag.1.disband.a.clan"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.ban.unban.player.1.ban.unban.a.player"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.hometp")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.hometp.clan.1.tp.home.a.clan"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.mod.globalff")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.globalff.allow.auto.1.set.global.friendly.fire"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.demote")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.demote.leader.1.demote.a.leader.to.member"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.purge")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.purge.player.1.purge.a.player"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.resetkdr")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.resetkdr.1.resets.kdr"), clanCommand, ChatColor.WHITE));
}
if (plugin.getPermissionsManager().has(player, "simpleclans.admin.reload")) {
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.reload.1.reload.configuration"), clanCommand, ChatColor.WHITE));
}
if (chatBlock.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("clan.commands") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
/**
* Execute the command
*
* @param sender
*/
public void executeSender(CommandSender sender) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
String clanCommand = plugin.getSettingsManager().getCommandClan();
ChatBlock chatBlock = new ChatBlock();
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.purge.player.1.purge.a.player"), clanCommand, ChatColor.WHITE));
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.verify.tag.1.verify.an.unverified.clan"), clanCommand, ChatColor.WHITE));
chatBlock.addRow(ChatColor.DARK_RED + " " + MessageFormat.format(plugin.getLang("0.reload.1.reload.configuration"), clanCommand, ChatColor.WHITE));
ChatBlock.sendBlank(sender);
ChatBlock.saySingle(sender, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("clan.commands") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(sender);
chatBlock.sendBlock(sender, plugin.getSettingsManager().getPageSize());
ChatBlock.sendBlank(sender);
}
/**
* Adds a menu item to the /clan menu
*
* @param syntax
* @param description
*/
public void addMenuItem(String syntax, String description) {
addMenuItem(syntax, description, ChatColor.AQUA);
}
/**
* Adds a menu item to the /clan menu, specifying syntax color
* [color] /[syntax] - [description]
*
* @param syntax
* @param description
* @param color
*/
public void addMenuItem(String syntax, String description, ChatColor color) {
menuItems.add(color + "/" + syntax + ChatColor.WHITE + " - " + description);
}
}
@@ -1,85 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class ModtagCommand {
public ModtagCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.modtag")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.modtag.tag"), plugin.getSettingsManager().getCommandClan()));
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("example.clan.modtag.4kfo.4l"));
return;
}
String newtag = arg[0];
String cleantag = Helper.cleanTag(newtag);
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.coloredtag") && newtag.contains("&")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.tag.cannot.contain.color.codes"));
return;
}
if (Helper.stripColors(newtag).length() > plugin.getSettingsManager().getTagMaxLength()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.clan.tag.cannot.be.longer.than.characters"), plugin.getSettingsManager().getTagMaxLength()));
return;
}
if (plugin.getSettingsManager().hasDisallowedColor(newtag)) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("your.tag.cannot.contain.the.following.colors"), plugin.getSettingsManager().getDisallowedColorString()));
return;
}
if (!Helper.stripColors(newtag).matches("[0-9a-zA-Z]*")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clan.tag.can.only.contain.letters.numbers.and.color.codes"));
return;
}
if (!cleantag.equals(clan.getTag())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.can.only.modify.the.color.and.case.of.the.tag"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("tag.changed.to.0"), Helper.parseColors(newtag)));
clan.changeClanTag(newtag);
plugin.getClanManager().updateDisplayName(player.getPlayer());
}
}
@@ -1,93 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class MostKilledCommand {
public MostKilledCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.mostkilled")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.stats"));
return;
}
ChatBlock chatBlock = new ChatBlock();
chatBlock.setFlexibility(true, false, false);
chatBlock.setAlignment("l", "c", "l");
chatBlock.addRow(" " + headColor + plugin.getLang("victim"), headColor + plugin.getLang("killcount"), headColor + plugin.getLang("attacker"));
Map<String, Integer> killsPerPlayerUnordered = plugin.getStorageManager().getMostKilled();
if (killsPerPlayerUnordered.isEmpty()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("nokillsfound"));
return;
}
Map<String, Integer> killsPerPlayer = Helper.sortByValue(killsPerPlayerUnordered);
for (Entry<String, Integer> attackerVictim : killsPerPlayer.entrySet()) {
String[] split = attackerVictim.getKey().split(" ");
if (split.length < 2) {
continue;
}
int count = attackerVictim.getValue();
String attacker = split[0];
String victim = split[1];
chatBlock.addRow(" " + ChatColor.WHITE + victim, ChatColor.AQUA + "" + count, ChatColor.YELLOW + attacker);
}
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("mostkilled") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,83 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
public class PlaceCommand {
public PlaceCommand() {
}
/**
* Execute the command
*
* @param sender
* @param arg
*/
public void execute(CommandSender sender, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (sender instanceof Player) {
Player player = (Player) sender;
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.place")) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
}
if (arg.length != 2) {
ChatBlock.sendMessage(sender, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.place"), plugin.getSettingsManager().getCommandClan()));
return;
}
Player player = Helper.getPlayer(arg[0]);
if (player == null) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
Clan newClan = plugin.getClanManager().getClan(arg[1]);
if (newClan == null) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("the.clan.does.not.exist"));
return;
}
ClanPlayer oldCp = plugin.getClanManager().getClanPlayer(player);
if (oldCp != null) {
Clan oldClan = oldCp.getClan();
if (oldClan.isLeader(player) && oldClan.getLeaders().size() <= 1) {
oldClan.clanAnnounce(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.has.been.disbanded"), oldClan.getName()));
oldClan.disband();
} else {
oldClan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("0.has.resigned"), Helper.capitalize(player.getName())));
if (SimpleClans.getInstance().hasUUID()) {
oldClan.removePlayerFromClan(player.getUniqueId());
} else {
oldClan.removePlayerFromClan(player.getName());
}
}
}
ClanPlayer cp = plugin.getClanManager().getCreateClanPlayerUUID(player.getName());
if (cp == null) {
return;
}
newClan.addBb(ChatColor.AQUA + MessageFormat.format(plugin.getLang("joined.the.clan"), player.getName()));
plugin.getClanManager().serverAnnounce(MessageFormat.format(plugin.getLang("has.joined"), player.getName(), newClan.getName()));
newClan.addPlayerToClan(cp);
}
}
@@ -1,104 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
/**
* @author phaed
*/
public class ProfileCommand {
public ProfileCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
NumberFormat formatter = new DecimalFormat("#.#");
Clan clan = null;
if (arg.length == 0) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.profile")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
} else {
if (cp.getClan().isVerified()) {
clan = cp.getClan();
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else if (arg.length == 1) {
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.profile")) {
clan = plugin.getClanManager().getClan(arg[0]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.profile.tag"), plugin.getSettingsManager().getCommandClan()));
}
if (clan != null) {
if (clan.isVerified()) {
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("profile") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
String name = plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketLeft() + plugin.getSettingsManager().getTagDefaultColor() + clan.getColorTag() + plugin.getSettingsManager().getClanChatBracketColor() + plugin.getSettingsManager().getClanChatTagBracketRight() + " " + plugin.getSettingsManager().getPageClanNameColor() + clan.getName();
String leaders = clan.getLeadersString(plugin.getSettingsManager().getPageLeaderColor(), subColor + ", ");
String onlineCount = ChatColor.WHITE + "" + Helper.stripOffLinePlayers(clan.getMembers()).size();
String membersOnline = onlineCount + subColor + "/" + ChatColor.WHITE + clan.getSize();
String inactive = ChatColor.WHITE + "" + clan.getInactiveDays() + subColor + "/" + ChatColor.WHITE + (clan.isVerified() ? plugin.getSettingsManager().getPurgeClan() : plugin.getSettingsManager().getPurgeUnverified()) + " " + plugin.getLang("days");
String founded = ChatColor.WHITE + "" + clan.getFoundedString();
String allies = ChatColor.WHITE + "" + clan.getAllyString(subColor + ", ");
String rivals = ChatColor.WHITE + "" + clan.getRivalString(subColor + ", ");
String kdr = ChatColor.YELLOW + "" + formatter.format(clan.getTotalKDR());
String deaths = ChatColor.WHITE + "" + clan.getTotalDeaths();
String rival = ChatColor.WHITE + "" + clan.getTotalRival();
String neutral = ChatColor.WHITE + "" + clan.getTotalNeutral();
String civ = ChatColor.WHITE + "" + clan.getTotalCivilian();
String status = ChatColor.WHITE + "" + (clan.isVerified() ? plugin.getSettingsManager().getPageTrustedColor() + plugin.getLang("verified") : plugin.getSettingsManager().getPageUnTrustedColor() + plugin.getLang("unverified"));
String feeEnabled = ChatColor.WHITE + (clan.isMemberFeeEnabled() ? plugin.getLang("fee.enabled") : plugin.getLang("fee.disabled"));
String feeValue = ChatColor.WHITE + "" + clan.getMemberFee();
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("name.0"), name));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("status.0"), status));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("leaders.0"), leaders));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("members.online.0"), membersOnline));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("kdr.0"), kdr));
ChatBlock.sendMessage(player, " " + subColor + plugin.getLang("kill.totals") + " " + headColor + "[" + plugin.getLang("rival") + ":" + rival + " " + headColor + "" + plugin.getLang("neutral") + ":" + neutral + " " + headColor + "" + plugin.getLang("civilian") + ":" + civ + headColor + "]");
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("deaths.0"), deaths));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("fee.0.value.1"), feeEnabled, feeValue));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("allies.0"), allies));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("rivals.0"), rivals));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("founded.0"), founded));
ChatBlock.sendMessage(player, " " + subColor + MessageFormat.format(plugin.getLang("inactive.0"), inactive));
ChatBlock.sendBlank(player);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
}
}
}
@@ -1,80 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class PromoteCommand {
public PromoteCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.promote")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.promote.member"), plugin.getSettingsManager().getCommandClan()));
return;
}
Player promoted = Helper.getPlayer(arg[0]);
if (promoted == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.member.to.be.promoted.must.be.online"));
return;
}
if (!plugin.getPermissionsManager().has(promoted, "simpleclans.leader.promotable")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.does.not.have.the.permissions.to.lead.a.clan"));
return;
}
if (promoted.getName().equals(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.promote.yourself"));
return;
}
if (!clan.isMember(promoted)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
return;
}
if (clan.isLeader(promoted) && plugin.getSettingsManager().isConfirmationForPromote()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.already.a.leader"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("promoted.to.leader"), Helper.capitalize(promoted.getName())));
if (SimpleClans.getInstance().hasUUID()) {
clan.promote(promoted.getUniqueId());
} else {
clan.promote(promoted.getName());
}
}
}
@@ -1,47 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
*
* @author roinujnosde
*/
public class PurgeCommand {
/**
* Executes the command
*
* @param sender
* @param args
*/
public void execute(CommandSender sender, String args[]) {
SimpleClans plugin = SimpleClans.getInstance();
if (sender instanceof Player) {
if (!plugin.getPermissionsManager().has((Player) sender, "simpleclans.admin.purge")) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
}
if (args.length == 1) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(args[0]);
if (cp == null) {
ChatBlock.sendMessage(sender, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
plugin.getClanManager().deleteClanPlayer(cp);
ChatBlock.sendMessage(sender, ChatColor.AQUA + plugin.getLang("player.purged"));
return;
}
ChatBlock.sendMessage(sender, ChatColor.RED
+ MessageFormat.format(plugin.getLang("usage.purge"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,47 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class ReloadCommand
{
public ReloadCommand()
{
}
/**
* Execute the command
*
* @param sender
* @param arg
*/
public void execute(CommandSender sender, String[] arg)
{
SimpleClans plugin = SimpleClans.getInstance();
if (sender instanceof Player && !plugin.getPermissionsManager().has((Player)sender, "simpleclans.admin.reload"))
{
ChatBlock.sendMessage(sender, ChatColor.RED + "Does not match a clan command");
return;
}
plugin.reloadConfig();
plugin.getSettingsManager().load();
plugin.getLanguageManager().load();
plugin.getStorageManager().importFromDatabase();
SimpleClans.getInstance().getPermissionsManager().loadPermissions();
for (Clan clan : plugin.getClanManager().getClans())
{
SimpleClans.getInstance().getPermissionsManager().updateClanPermissions(clan);
}
ChatBlock.sendMessage(sender, ChatColor.AQUA + plugin.getLang("configuration.reloaded"));
}
}
@@ -1,72 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.MessageFormat;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class ResetKDRCommand {
public ResetKDRCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg == null || arg.length == 0) {
if (!plugin.getSettingsManager().isAllowResetKdr()) {
ChatBlock.sendMessage(player, ChatColor.RED
+ MessageFormat.format(plugin.getLang("usage.resetkdr"),
plugin.getSettingsManager().getCommandClan()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.resetkdr")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
if (plugin.getClanManager().purchaseResetKdr(player)) {
plugin.getClanManager().resetKdr(cp);
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.have.reseted.your.kdr"));
}
return;
}
if (arg.length == 1 && plugin.getPermissionsManager().has(player, "simpleclans.admin.resetkdr")) {
if (arg[0].equalsIgnoreCase("all")) {
for (ClanPlayer cp : SimpleClans.getInstance().getClanManager().getAllClanPlayers()) {
plugin.getClanManager().resetKdr(cp);
}
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.have.reseted.kdr.of.all.players"));
} else {
OfflinePlayer toReset = Bukkit.getOfflinePlayer(arg[0]);
if (toReset == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
ClanPlayer trcp = plugin.getClanManager().getClanPlayer(toReset);
if (trcp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.data.found"));
return;
}
plugin.getClanManager().resetKdr(trcp);
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("you.have.reseted.0.kdr"), toReset.getName()));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
}
}
@@ -1,45 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import net.sacredlabyrinth.phaed.simpleclans.conversation.ResignPrompt;
import org.bukkit.conversations.ConversationFactory;
/**
* @author phaed
*/
public class ResignCommand {
public ResignCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.resign")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
new ConversationFactory(plugin)
.withFirstPrompt(new ResignPrompt())
.withLocalEcho(true)
.withTimeout(10)
.buildConversation(player).begin();
}
}
@@ -1,117 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class RivalCommand {
public RivalCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.rival")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (clan.isUnrivable()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clan.cannot.create.rivals"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 2) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.rival"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (clan.getSize() < plugin.getSettingsManager().getClanMinSizeToRival()) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("min.players.rivalries"), plugin.getSettingsManager().getClanMinSizeToRival()));
return;
}
String action = arg[0];
Clan rival = plugin.getClanManager().getClan(arg[1]);
if (rival == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
return;
}
if (clan.getTag().equals(rival.getTag()))
{
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.rival.your.own.clan"));
return;
}
if (plugin.getSettingsManager().isUnrivable(rival.getTag())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.cannot.be.rivaled"));
return;
}
if (!rival.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("cannot.rival.an.unverified.clan"));
return;
}
if (action.equals(plugin.getLang("add"))) {
if (!clan.reachedRivalLimit()) {
if (!clan.isRival(rival.getTag())) {
clan.addRival(rival);
rival.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.initiated.a.rivalry"), Helper.capitalize(clan.getName()), rival.getName()), false);
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.initiated.a.rivalry"), Helper.capitalize(player.getName()), Helper.capitalize(rival.getName())));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clans.are.already.rivals"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("rival.limit.reached"));
}
return;
}
if (action.equals(plugin.getLang("remove"))) {
if (clan.isRival(rival.getTag())) {
plugin.getRequestManager().addRivalryBreakRequest(cp, rival, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("leaders.asked.to.end.rivalry"), Helper.capitalize(rival.getName())));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("your.clans.are.not.rivals"));
}
return;
}
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.rival"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -1,72 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
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.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
/**
* @author phaed
*/
public class RivalriesCommand {
public RivalriesCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.rivalries"), plugin.getSettingsManager().getCommandClan()));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.anyone.rivalries")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
List<Clan> clans = plugin.getClanManager().getClans();
plugin.getClanManager().sortClansByKDR(clans);
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getServerName() + subColor + " " + plugin.getLang("rivalries") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + plugin.getLang("legend") + ChatColor.DARK_RED + " [" + plugin.getLang("war") + "]");
ChatBlock.sendBlank(player);
chatBlock.setAlignment("l", "l");
chatBlock.addRow(plugin.getLang("clan"), plugin.getLang("rivals"));
for (Clan clan : clans) {
if (!clan.isVerified()) {
continue;
}
chatBlock.addRow(" " + ChatColor.AQUA + clan.getName(), clan.getRivalString(ChatColor.DARK_GRAY + ", "));
}
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
}
@@ -1,112 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
/**
* @author phaed
*/
public class RosterCommand {
public RosterCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
Clan clan = null;
if (arg.length == 0) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.roster")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
} else {
clan = cp.getClan();
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else if (arg.length == 1) {
if (plugin.getPermissionsManager().has(player, "simpleclans.anyone.roster")) {
clan = plugin.getClanManager().getClan(arg[0]);
if (clan == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.roster.tag"), plugin.getSettingsManager().getCommandClan()));
}
if (clan != null) {
if (clan.isVerified()) {
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("roster") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + plugin.getLang("legend") + " " + plugin.getSettingsManager().getPageLeaderColor() + plugin.getLang("leader") + headColor + ", " + plugin.getSettingsManager().getPageTrustedColor() + plugin.getLang("trusted") + headColor + ", " + plugin.getSettingsManager().getPageUnTrustedColor() + plugin.getLang("untrusted"));
ChatBlock.sendBlank(player);
chatBlock.setFlexibility(false, true, false, true);
chatBlock.addRow(" " + headColor + plugin.getLang("player"), plugin.getLang("rank"), plugin.getLang("seen"));
List<ClanPlayer> leaders = clan.getLeaders();
plugin.getClanManager().sortClanPlayersByLastSeen(leaders);
List<ClanPlayer> members = clan.getNonLeaders();
plugin.getClanManager().sortClanPlayersByLastSeen(members);
for (ClanPlayer cp : leaders) {
Player p = cp.toPlayer();
String name = plugin.getSettingsManager().getPageLeaderColor() + cp.getName();
String lastSeen = p != null && p.isOnline() && !Helper.isVanished(p) ? ChatColor.GREEN + plugin.getLang("online") : ChatColor.WHITE + cp.getLastSeenDaysString();
chatBlock.addRow(" " + name, ChatColor.YELLOW + Helper.parseColors(cp.getRank()), lastSeen);
}
for (ClanPlayer cp : members) {
Player p = cp.toPlayer();
String name = (cp.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() : plugin.getSettingsManager().getPageUnTrustedColor()) + cp.getName();
String lastSeen = p != null && p.isOnline() && !Helper.isVanished(p) ? ChatColor.GREEN + plugin.getLang("online") : ChatColor.WHITE + cp.getLastSeenDaysString();
chatBlock.addRow(" " + name, ChatColor.YELLOW + Helper.parseColors(cp.getRank()), lastSeen);
}
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.roster.tag"), plugin.getSettingsManager().getCommandClan()));
}
}
}
@@ -0,0 +1,224 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.BukkitLocales;
import co.aikar.commands.CommandIssuer;
import co.aikar.commands.PaperCommandManager;
import co.aikar.locales.MessageKey;
import co.aikar.locales.MessageKeyProvider;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractAsyncCompletion;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractCompletion;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractStaticCompletion;
import net.sacredlabyrinth.phaed.simpleclans.commands.completions.AbstractSyncCompletion;
import net.sacredlabyrinth.phaed.simpleclans.commands.conditions.AbstractCommandCondition;
import net.sacredlabyrinth.phaed.simpleclans.commands.conditions.AbstractCondition;
import net.sacredlabyrinth.phaed.simpleclans.commands.conditions.AbstractParameterCondition;
import net.sacredlabyrinth.phaed.simpleclans.commands.contexts.AbstractContextResolver;
import net.sacredlabyrinth.phaed.simpleclans.commands.contexts.AbstractInputOnlyContextResolver;
import net.sacredlabyrinth.phaed.simpleclans.commands.contexts.AbstractIssuerOnlyContextResolver;
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.reflections.Reflections;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.optionalLang;
public class SCCommandManager extends PaperCommandManager {
private final SimpleClans plugin;
private static final List<String> SUBCOMMANDS;
public SCCommandManager(@NotNull SimpleClans plugin) {
super(plugin);
this.plugin = plugin;
configure();
}
private void configure() {
registerDependencies();
enableUnstableAPI("help");
addCommandReplacements();
registerContexts();
registerCommands();
registerConditions();
registerCompletions();
}
private void registerDependencies() {
registerDependency(ClanManager.class, plugin.getClanManager());
registerDependency(SettingsManager.class, plugin.getSettingsManager());
registerDependency(StorageManager.class, plugin.getStorageManager());
registerDependency(PermissionsManager.class, plugin.getPermissionsManager());
registerDependency(RequestManager.class, plugin.getRequestManager());
registerDependency(ProtectionManager.class, plugin.getProtectionManager());
}
private void registerCompletions() {
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.completions");
Set<Class<? extends AbstractCompletion>> completions = reflections.getSubTypesOf(AbstractCompletion.class);
plugin.getLogger().info(String.format("Registering %d command completions...", completions.size()));
for (Class<? extends AbstractCompletion> c : completions) {
if (Modifier.isAbstract(c.getModifiers())) {
continue;
}
try {
AbstractCompletion obj = c.getConstructor(SimpleClans.class).newInstance(plugin);
if (obj instanceof AbstractStaticCompletion) {
getCommandCompletions().registerStaticCompletion(obj.getId(),
((AbstractStaticCompletion) obj).getCompletions());
}
if (obj instanceof AbstractAsyncCompletion) {
getCommandCompletions().registerAsyncCompletion(obj.getId(), (AbstractAsyncCompletion) obj);
}
if (obj instanceof AbstractSyncCompletion) {
getCommandCompletions().registerCompletion(obj.getId(), ((AbstractSyncCompletion) obj));
}
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Error registering completion", ex);
}
}
}
@SuppressWarnings("unchecked")
private void registerConditions() {
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.conditions");
Set<Class<? extends AbstractCondition>> conditions = reflections.getSubTypesOf(AbstractCondition.class);
plugin.getLogger().info(String.format("Registering %d command conditions...", conditions.size()));
for (Class<? extends AbstractCondition> c : conditions) {
if (Modifier.isAbstract(c.getModifiers())) {
continue;
}
try {
AbstractCondition obj = c.getConstructor(SimpleClans.class).newInstance(plugin);
if (obj instanceof AbstractParameterCondition) {
@SuppressWarnings("rawtypes")
AbstractParameterCondition condition = (AbstractParameterCondition) obj;
getCommandConditions().addCondition(condition.getType(), condition.getId(), condition);
}
if (obj instanceof AbstractCommandCondition) {
AbstractCommandCondition condition = (AbstractCommandCondition) obj;
getCommandConditions().addCondition(condition.getId(), condition);
}
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Error registering condition", ex);
}
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
private void registerContexts() {
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands.contexts");
Set<Class<? extends AbstractContextResolver>> resolvers = reflections.getSubTypesOf(AbstractContextResolver.class);
plugin.getLogger().info(String.format("Registering %d command contexts...", resolvers.size()));
for (Class<? extends AbstractContextResolver> cr : resolvers) {
if (Modifier.isAbstract(cr.getModifiers())) {
continue;
}
try {
AbstractContextResolver obj = cr.getConstructor(SimpleClans.class).newInstance(plugin);
if (obj instanceof AbstractIssuerOnlyContextResolver) {
getCommandContexts().registerIssuerOnlyContext(obj.getType(), ((AbstractIssuerOnlyContextResolver) obj));
}
if (obj instanceof AbstractInputOnlyContextResolver) {
getCommandContexts().registerContext(obj.getType(), ((AbstractInputOnlyContextResolver<?>) obj));
}
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Error registering context", ex);
}
}
}
private void registerCommands() {
boolean forceCommandPriority = plugin.getSettingsManager().isForceCommandPriority();
Reflections reflections = new Reflections("net.sacredlabyrinth.phaed.simpleclans.commands");
Set<Class<? extends BaseCommand>> commands = reflections.getSubTypesOf(BaseCommand.class);
plugin.getLogger().info(String.format("Registering %d base commands...", commands.size()));
for (Class<? extends BaseCommand> c : commands) {
//ACF already registers nested classes
if (c.isMemberClass() || Modifier.isStatic(c.getModifiers())) {
continue;
}
try {
BaseCommand baseCommand = c.getConstructor().newInstance();
registerCommand(baseCommand, forceCommandPriority);
} catch (Exception ex) {
plugin.getLogger().log(Level.SEVERE, "Error registering command", ex);
}
}
}
private void addCommandReplacements() {
SettingsManager sm = plugin.getSettingsManager();
getCommandReplacements().addReplacements(
"basic_conditions", "not_blacklisted|not_banned",
"clan", sm.getCommandClan(),
"deny", sm.getCommandDeny() + "|deny",
"more", sm.getCommandMore(),
"ally_chat", sm.getCommandAlly(),
"accept", sm.getCommandAccept() + "|accept",
"clan_chat", sm.getCommandClanChat()
);
SUBCOMMANDS.forEach(s -> {
String command = optionalLang(s + ".command", null);
if (command == null) {
command = s;
}
command = command.replace(" ", "");
String replacement = command.equals(s) ? s : command + "|" + s;
getCommandReplacements().addReplacement(s, replacement);
});
}
@Override
public BukkitLocales getLocales() {
if (this.locales == null) {
this.locales = new BukkitLocales(this) {
@Nullable
private Player getPlayer(CommandIssuer issuer) {
if (issuer != null) {
return Bukkit.getPlayer(issuer.getUniqueId());
}
return null;
}
@Override
@Nullable
public String getOptionalMessage(CommandIssuer issuer, MessageKey key) {
return optionalLang(key.getKey(), getPlayer(issuer));
}
@Override
@NotNull
public String getMessage(CommandIssuer issuer, MessageKeyProvider key) {
return lang(key.getMessageKey().getKey(), getPlayer(issuer));
}
};
//this.locales.loadLanguages();
}
return this.locales;
}
static {
SUBCOMMANDS = Arrays.asList("setbanner", "resetkdr", "place", "rank", "home", "war", "regroup",
"mostkilled", "kills", "globalff", "reload", "unban", "ban", "verify", "disband", "resign", "ff",
"clanff", "demote", "promote", "untrust", "trust", "purge", "fee", "bank", "kick", "invite", "toggle",
"modtag", "bb", "clear", "rival", "ally", "add", "remove", "stats", "coords", "vitals", "rivalries",
"alliances", "leaderboard", "allow", "block", "auto", "check", "assign", "unassign", "delete", "me",
"setdisplayname", "permissions", "tag", "deposit", "withdraw", "set", "status", "tp", "all", "everyone",
"lookup", "roster", "profile", "list", "create", "description", "start", "end", "admin", "help", "mod",
"setdefault", "removedefault", "land", "break", "interact", "place_block", "damage", "interact_entity",
"container", "permanent", "take", "give");
}
}
@@ -1,68 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
public class SetRankCommand {
public SetRankCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.setrank")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length < 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.setrank"), plugin.getSettingsManager().getCommandClan()));
return;
}
String playerName = arg[0];
String rank = Helper.toMessage(Helper.removeFirst(arg));
if (!clan.isMember(playerName) && !clan.isLeader(playerName)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
ClanPlayer cpm = plugin.getClanManager().getClanPlayer(playerName);
cpm.setRank(rank);
plugin.getStorageManager().updateClanPlayer(cpm);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.rank.changed"));
}
}
@@ -1,105 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.List;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class StatsCommand {
public StatsCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.stats")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.stats"));
return;
}
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.stats"), plugin.getSettingsManager().getCommandClan()));
return;
}
ChatBlock chatBlock = new ChatBlock();
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("stats") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + plugin.getLang("kdr") + " = " + subColor + plugin.getLang("kill.death.ratio"));
ChatBlock.sendMessage(player, headColor + plugin.getLang("weights") + " = " + plugin.getLang("rival") + ": " + subColor + plugin.getSettingsManager().getKwRival() + headColor + " " + plugin.getLang("neutral") + ": " + subColor + plugin.getSettingsManager().getKwNeutral() + headColor + " " + plugin.getLang("civilian") + ": " + subColor + plugin.getSettingsManager().getKwCivilian());
ChatBlock.sendBlank(player);
chatBlock.setFlexibility(true, false, false, false, false, false, false);
chatBlock.setAlignment("l", "c", "c", "c", "c", "c", "c");
chatBlock.addRow(" " + headColor + plugin.getLang("name"), plugin.getLang("kdr"), plugin.getLang("rival"), plugin.getLang("neutral"), plugin.getLang("civilian.abbreviation"), plugin.getLang("deaths"));
List<ClanPlayer> leaders = clan.getLeaders();
plugin.getClanManager().sortClanPlayersByKDR(leaders);
List<ClanPlayer> members = clan.getNonLeaders();
plugin.getClanManager().sortClanPlayersByKDR(members);
addRows(leaders, chatBlock);
addRows(members, chatBlock);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
private void addRows(List<ClanPlayer> leaders, ChatBlock chatBlock) {
SimpleClans plugin = SimpleClans.getInstance();
NumberFormat formatter = new DecimalFormat("#.#");
for (ClanPlayer cpm : leaders) {
String name = (cpm.isLeader() ? plugin.getSettingsManager().getPageLeaderColor() : (cpm.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() : plugin.getSettingsManager().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 = formatter.format(cpm.getKDR());
chatBlock.addRow(" " + name, ChatColor.YELLOW + kdr, ChatColor.WHITE + rival, ChatColor.GRAY + neutral, ChatColor.DARK_GRAY + civilian, ChatColor.DARK_RED + deaths);
}
}
}
@@ -1,159 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
/**
* @author phaed
*/
public class ToggleCommand {
public ToggleCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (arg.length == 0) {
return;
}
String cmd = arg[0];
if (cmd.equalsIgnoreCase("cape")) {
if (plugin.getPermissionsManager().has(player, "simpleclans.member.cape-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isCapeEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeoff"));
cp.setCapeEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("capeon"));
cp.setCapeEnabled(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
}
}
if (cmd.equalsIgnoreCase("bb") && plugin.getPermissionsManager().has(player, "simpleclans.member.bb-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isBbEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bboff"));
cp.setBbEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("bbon"));
cp.setBbEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("tag") && plugin.getPermissionsManager().has(player, "simpleclans.member.tag-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (cp.isTagEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagoff"));
cp.setTagEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("tagon"));
cp.setTagEnabled(true);
}
plugin.getStorageManager().updateClanPlayer(cp);
}
}
}
if (cmd.equalsIgnoreCase("deposit") && plugin.getPermissionsManager().has(player, "simpleclans.leader.deposit-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isLeader(player)) {
if (clan.isVerified()) {
if (clan.isAllowDeposit()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositoff"));
clan.setAllowDeposit(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("depositon"));
clan.setAllowDeposit(true);
}
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
if (cmd.equalsIgnoreCase("fee") && plugin.getPermissionsManager().has(player, "simpleclans.leader.fee")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (clan.isLeader(player)) {
if (clan.isMemberFeeEnabled()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("feeoff"));
clan.setMemberFeeEnabled(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("feeon"));
clan.setMemberFeeEnabled(true);
}
plugin.getStorageManager().updateClanAsync(clan);
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
}
if (cmd.equalsIgnoreCase("withdraw") && plugin.getPermissionsManager().has(player, "simpleclans.leader.withdraw-toggle")) {
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp != null) {
Clan clan = cp.getClan();
if (clan.isVerified()) {
if (clan.isLeader(player)) {
if (clan.isAllowWithdraw()) {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawoff"));
clan.setAllowWithdraw(false);
} else {
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("withdrawon"));
clan.setAllowWithdraw(true);
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
}
}
}
}
}
}
@@ -1,95 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class TrustCommand {
public TrustCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.settrust")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.trust.player"), plugin.getSettingsManager().getCommandClan()));
return;
}
String trusted = arg[0];
if (trusted == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (trusted.equals(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.trust.yourself"));
return;
}
if (!clan.isMember(trusted)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
return;
}
if (clan.isLeader(trusted)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("leaders.are.already.trusted"));
return;
}
ClanPlayer tcp = plugin.getClanManager().getClanPlayer(trusted);
if (tcp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (tcp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.trusted"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.been.given.trusted.status.by"), Helper.capitalize(trusted), player.getName()));
tcp.setTrusted(true);
plugin.getStorageManager().updateClanPlayer(tcp);
}
}
@@ -1,56 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class UnbanCommand {
public UnbanCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.ban.unban"), plugin.getSettingsManager().getCommandClan()));
return;
}
String banned = arg[0];
if (!plugin.getSettingsManager().isBanned(banned)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.not.banned"));
return;
}
Player pl = Helper.getPlayer(banned);
if (pl != null) {
ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.have.been.unbanned.from.clan.commands"));
}
plugin.getSettingsManager().removeBanned(banned);
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.removed.from.the.banned.list"));
}
}
@@ -1,93 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class UntrustCommand {
public UntrustCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.settrust")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 1) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.untrust.player"), plugin.getSettingsManager().getCommandClan()));
return;
}
String trusted = arg[0];
if (trusted == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (trusted.equals(player.getName())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.untrust.yourself"));
return;
}
if (!clan.isMember(trusted)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.player.is.not.a.member.of.your.clan"));
return;
}
if (clan.isLeader(trusted)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("leaders.cannot.be.untrusted"));
return;
}
ClanPlayer tcp = plugin.getClanManager().getClanPlayer(trusted);
if (tcp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
if (!tcp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.untrusted"));
return;
}
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("has.been.given.untrusted.status.by"), Helper.capitalize(trusted), player.getName()));
tcp.setTrusted(false);
plugin.getStorageManager().updateClanPlayer(tcp);
}
}
@@ -1,85 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
/**
* @author phaed
*/
public class VerifyCommand {
public VerifyCommand() {
}
/**
* Execute the command
*
* @param sender
* @param arg
*/
public void execute(CommandSender sender, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (sender instanceof Player) {
Player player = (Player) sender;
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
Clan clan = cp == null ? null : cp.getClan();
boolean isNonVerified = clan != null && !clan.isVerified();
boolean isBuyer = isNonVerified && plugin.getSettingsManager().isRequireVerification() && plugin.getSettingsManager().isePurchaseVerification();
if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.verify")) {
//if the player does specify a tag, but does not have mod permission to verify
//if the player does not specify a tag, but does not have leader permission to verify
if (arg.length != 0 || !plugin.getPermissionsManager().has(player, "simpleclans.leader.verify")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (isBuyer) {
if (arg.length == 0 && plugin.getClanManager().purchaseVerification(player)) {
clan.verifyClan();
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.0.has.been.verified"), clan.getName()));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("the.clan.has.been.verified"));
}
}
} else {
if (arg.length != 1) {
ChatBlock.sendMessage(sender, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.verify.tag"), plugin.getSettingsManager().getCommandClan()));
return;
}
verify(player, arg[0]);
}
} else {
if (arg.length != 1) {
ChatBlock.sendMessage(sender, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.verify.tag"), plugin.getSettingsManager().getCommandClan()));
return;
}
verify(sender, arg[0]);
}
}
private void verify(CommandSender player, String clanName) {
SimpleClans plugin = SimpleClans.getInstance();
Clan clan = plugin.getClanManager().getClan(clanName);
if (clan != null) {
if (!clan.isVerified()) {
clan.verifyClan();
clan.addBb(player.getName(), ChatColor.AQUA + MessageFormat.format(plugin.getLang("clan.0.has.been.verified"), clan.getName()));
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("the.clan.has.been.verified"));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.is.already.verified"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("the.clan.does.not.exist"));
}
}
}
@@ -1,105 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* @author phaed
*/
public class VitalsCommand {
public VitalsCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
String headColor = plugin.getSettingsManager().getPageHeadingsColor();
String subColor = plugin.getSettingsManager().getPageSubTitleColor();
if (!plugin.getPermissionsManager().has(player, "simpleclans.member.vitals")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!cp.isTrusted()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("only.trusted.players.can.access.clan.vitals"));
return;
}
if (arg.length != 0) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.0.vitals"), plugin.getSettingsManager().getCommandClan()));
return;
}
ChatBlock chatBlock = new ChatBlock();
ChatBlock.sendBlank(player);
ChatBlock.saySingle(player, plugin.getSettingsManager().getPageClanNameColor() + Helper.capitalize(clan.getName()) + subColor + " " + plugin.getLang("vitals") + " " + headColor + Helper.generatePageSeparator(plugin.getSettingsManager().getPageSep()));
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + plugin.getLang("weapons") + ": " + MessageFormat.format(plugin.getLang("0.s.sword.1.2.b.bow.3.4.a.arrow"), ChatColor.WHITE, ChatColor.DARK_GRAY, ChatColor.WHITE, ChatColor.DARK_GRAY, ChatColor.WHITE));
ChatBlock.sendMessage(player, headColor + plugin.getLang("materials") + ": " + ChatColor.AQUA + plugin.getLang("diamond") + ChatColor.DARK_GRAY + ", " + ChatColor.YELLOW + plugin.getLang("gold") + ChatColor.DARK_GRAY + ", " + ChatColor.GRAY + plugin.getLang("stone") + ChatColor.DARK_GRAY + ", " + ChatColor.WHITE + plugin.getLang("iron") + ChatColor.DARK_GRAY + ", " + ChatColor.GOLD + plugin.getLang("wood"));
ChatBlock.sendBlank(player);
chatBlock.setFlexibility(true, false, false, false, false, false);
chatBlock.setAlignment("l", "l", "l", "c", "c", "c");
chatBlock.addRow(" " + headColor + plugin.getLang("name"), plugin.getLang("health"), plugin.getLang("hunger"), plugin.getLang("food"), plugin.getLang("armor"), plugin.getLang("weapons"));
List<ClanPlayer> members = Helper.stripOffLinePlayers(clan.getLeaders());
members.addAll(Helper.stripOffLinePlayers(clan.getNonLeaders()));
addRows(members, chatBlock);
chatBlock.addRow(" -- Allies -- ", "", "", "", "", "");
addRows(clan.getAllAllyMembers(), chatBlock);
boolean more = chatBlock.sendBlock(player, plugin.getSettingsManager().getPageSize());
if (more) {
plugin.getStorageManager().addChatBlock(player, chatBlock);
ChatBlock.sendBlank(player);
ChatBlock.sendMessage(player, headColor + MessageFormat.format(plugin.getLang("view.next.page"), plugin.getSettingsManager().getCommandMore()));
}
ChatBlock.sendBlank(player);
}
private void addRows(Collection<ClanPlayer> players, ChatBlock chatBlock){
SimpleClans plugin = SimpleClans.getInstance();
for (ClanPlayer cpm : players) {
Player p = cpm.toPlayer();
if (p != null) {
String name = (cpm.isLeader() ? plugin.getSettingsManager().getPageLeaderColor() : (cpm.isTrusted() ? plugin.getSettingsManager().getPageTrustedColor() : plugin.getSettingsManager().getPageUnTrustedColor())) + cpm.getName();
String health = plugin.getClanManager().getHealthString(p.getHealth());
String hunger = plugin.getClanManager().getHungerString(p.getFoodLevel());
String armor = plugin.getClanManager().getArmorString(p.getInventory());
String weapons = plugin.getClanManager().getWeaponString(p.getInventory());
String food = plugin.getClanManager().getFoodString(p.getInventory());
chatBlock.addRow(" " + name, ChatColor.RED + health, hunger, ChatColor.WHITE + food, armor, weapons);
}
}
}
}
@@ -1,94 +0,0 @@
package net.sacredlabyrinth.phaed.simpleclans.commands;
import net.sacredlabyrinth.phaed.simpleclans.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.MessageFormat;
import java.util.List;
/**
* @author phaed
*/
public class WarCommand {
public WarCommand() {
}
/**
* Execute the command
*
* @param player
* @param arg
*/
public void execute(Player player, String[] arg) {
SimpleClans plugin = SimpleClans.getInstance();
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.war")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
ClanPlayer cp = plugin.getClanManager().getClanPlayer(player);
if (cp == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("not.a.member.of.any.clan"));
return;
}
Clan clan = cp.getClan();
if (!clan.isVerified()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clan.is.not.verified"));
return;
}
if (!clan.isLeader(player)) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (arg.length != 2) {
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.war"), plugin.getSettingsManager().getCommandClan()));
return;
}
String action = arg[0];
Clan war = plugin.getClanManager().getClan(arg[1]);
if (war == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.clan.matched"));
return;
}
if (!clan.isRival(war.getTag())) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.can.only.start.war.with.rivals"));
return;
}
if (action.equals(plugin.getLang("start"))) {
if (!clan.isWarring(war.getTag())) {
List<ClanPlayer> onlineLeaders = Helper.stripOffLinePlayers(clan.getLeaders());
if (!onlineLeaders.isEmpty()) {
plugin.getRequestManager().addWarStartRequest(cp, war, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("leaders.have.been.asked.to.accept.the.war.request"), Helper.capitalize(war.getName())));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("at.least.one.leader.accept.the.alliance"));
}
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clans.already.at.war"));
}
return;
}
if (action.equals(plugin.getLang("end"))) {
if (clan.isWarring(war.getTag())) {
plugin.getRequestManager().addWarEndRequest(cp, war, clan);
ChatBlock.sendMessage(player, ChatColor.AQUA + MessageFormat.format(plugin.getLang("leaders.asked.to.end.rivalry"), Helper.capitalize(war.getName())));
} else {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("clans.not.at.war"));
}
return;
}
ChatBlock.sendMessage(player, ChatColor.RED + MessageFormat.format(plugin.getLang("usage.war"), plugin.getSettingsManager().getCommandClan()));
}
}
@@ -0,0 +1,30 @@
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);
}
}
@@ -0,0 +1,126 @@
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);
}
}
}
}
@@ -0,0 +1,52 @@
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);
}
}
@@ -0,0 +1,30 @@
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);
}
}
@@ -0,0 +1,367 @@
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();
}
}
@@ -0,0 +1,69 @@
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();
}
}
@@ -0,0 +1,134 @@
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())));
}
}
@@ -0,0 +1,176 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.clan;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.*;
import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.Land;
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@CommandAlias("%clan")
@Subcommand("%land")
@Conditions("%basic_conditions|land_sharing|own_land")
@CommandPermission("simpleclans.member.land")
public class LandCommand extends BaseCommand {
@Dependency
private ProtectionManager protection;
@Dependency
private SettingsManager settings;
private Set<Land> getLands(ClanPlayer cp, Location location) {
Player player = Objects.requireNonNull(cp.toPlayer());
if (settings.isEditAllLands()) {
return protection.getLands(player, location);
} else {
return protection.getLandsAt(location).stream().filter(l -> l.getOwners().contains(player.getUniqueId()))
.collect(Collectors.toSet());
}
}
@Subcommand("%allow")
public class AllowCommand extends BaseCommand {
private void allow(ClanPlayer cp, ProtectionManager.Action action, Location location) {
allow(cp, action, location, true);
}
private void allow(ClanPlayer cp, ProtectionManager.Action action, Location location, boolean notify) {
for (Land land : getLands(cp, location)) {
cp.allow(action, land.getId());
}
if (notify) {
ChatBlock.sendMessageKey(cp.toPlayer(), "land.allowed.action");
}
}
@Subcommand("%container")
@Description("{@@command.description.land.allow.container}")
@CommandPermission("simpleclans.member.land.allow.container")
public void container(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.CONTAINER, player.getLocation());
}
@Subcommand("%place")
@Description("{@@command.description.land.allow.place}")
@CommandPermission("simpleclans.member.land.allow.place")
public void place(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.PLACE, player.getLocation());
}
@Subcommand("%damage")
@Description("{@@command.description.land.allow.damage}")
@CommandPermission("simpleclans.member.land.allow.damage")
public void damage(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.DAMAGE, player.getLocation());
}
@Subcommand("%interact_entity")
@Description("{@@command.description.land.allow.interact_entity}")
@CommandPermission("simpleclans.member.land.allow.interact_entity")
public void interactEntity(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.INTERACT_ENTITY, player.getLocation());
}
@Subcommand("%interact")
@Description("{@@command.description.land.allow.interact}")
@CommandPermission("simpleclans.member.land.allow.interact")
public void interact(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.INTERACT, player.getLocation());
}
@Subcommand("%break")
@Description("{@@command.description.land.allow.break}")
@CommandPermission("simpleclans.member.land.allow.break")
public void allowBreak(Player player, ClanPlayer cp) {
allow(cp, ProtectionManager.Action.BREAK, player.getLocation());
}
@Subcommand("%all")
@Description("{@@command.description.land.allow.all}")
@CommandPermission("simpleclans.member.land.allow.all")
public void all(Player player, ClanPlayer cp) {
for (ProtectionManager.Action action : ProtectionManager.Action.values()) {
allow(cp, action, player.getLocation(), false);
}
ChatBlock.sendMessageKey(player, "land.allowed.all.actions");
}
}
@Subcommand("%block")
public class BlockCommand extends BaseCommand {
private void block(ClanPlayer cp, ProtectionManager.Action action, Location location) {
block(cp, action, location, true);
}
private void block(ClanPlayer cp, ProtectionManager.Action action, Location location, boolean notify) {
for (Land land : getLands(cp, location)) {
cp.disallow(action, land.getId());
}
if (notify) {
ChatBlock.sendMessageKey(cp.toPlayer(), "land.blocked.action");
}
}
@Subcommand("%container")
@Description("{@@command.description.land.block.container}")
@CommandPermission("simpleclans.member.land.block.container")
public void container(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.CONTAINER, player.getLocation());
}
@Subcommand("%place")
@Description("{@@command.description.land.block.place}")
@CommandPermission("simpleclans.member.land.block.place")
public void place(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.PLACE, player.getLocation());
}
@Subcommand("%damage")
@Description("{@@command.description.land.block.damage}")
@CommandPermission("simpleclans.member.land.block.damage")
public void damage(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.DAMAGE, player.getLocation());
}
@Subcommand("%interact_entity")
@Description("{@@command.description.land.block.interact_entity}")
@CommandPermission("simpleclans.member.land.block.interact_entity")
public void interactEntity(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.INTERACT_ENTITY, player.getLocation());
}
@Subcommand("%interact")
@Description("{@@command.description.land.block.interact}")
@CommandPermission("simpleclans.member.land.block.interact")
public void interact(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.INTERACT, player.getLocation());
}
@Subcommand("%break")
@Description("{@@command.description.land.block.break}")
@CommandPermission("simpleclans.member.land.block.break")
public void blockBreak(Player player, ClanPlayer cp) {
block(cp, ProtectionManager.Action.BREAK, player.getLocation());
}
@Subcommand("%all")
@Description("{@@command.description.land.block.all}")
@CommandPermission("simpleclans.member.land.block.all")
public void all(Player player, ClanPlayer cp) {
protection.getLandsAt(player.getLocation());
for (ProtectionManager.Action action : ProtectionManager.Action.values()) {
block(cp, action, player.getLocation(), false);
}
ChatBlock.sendMessageKey(player, "land.blocked.all.actions");
}
}
}
@@ -0,0 +1,180 @@
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);
}
}
@@ -0,0 +1,214 @@
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);
}
}
}
@@ -0,0 +1,84 @@
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);
}
}
@@ -0,0 +1,13 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.CommandCompletions.AsyncCommandCompletionHandler;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractAsyncCompletion extends AbstractCompletion
implements AsyncCommandCompletionHandler<BukkitCommandCompletionContext> {
public AbstractAsyncCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
}
@@ -0,0 +1,16 @@
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();
}
}
@@ -0,0 +1,17 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
public abstract class AbstractStaticCompletion extends AbstractCompletion {
public AbstractStaticCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@NotNull
public abstract Collection<String> getCompletions();
}
@@ -0,0 +1,13 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.CommandCompletions.CommandCompletionHandler;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractSyncCompletion extends AbstractCompletion
implements CommandCompletionHandler<BukkitCommandCompletionContext> {
public AbstractSyncCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
}
@@ -0,0 +1,29 @@
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 AllLeadersCompletion extends AbstractSyncCompletion {
public AllLeadersCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
return clanManager
.getAllClanPlayers().stream().filter(ClanPlayer::isLeader).map(ClanPlayer::getName)
.collect(Collectors.toList());
}
@Override
public @NotNull String getId() {
return "all_leaders";
}
}
@@ -0,0 +1,29 @@
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";
}
}
@@ -0,0 +1,35 @@
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.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
@SuppressWarnings("unused")
public class AlliedClansCompletion extends AbstractSyncCompletion {
public AlliedClansCompletion(@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.getAllies();
}
}
return Collections.emptyList();
}
@Override
public @NotNull String getId() {
return "allied_clans";
}
}
@@ -0,0 +1,44 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.InvalidCommandArgument;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
@SuppressWarnings("unused")
public class ChatSubcommandsCompletion extends AbstractSyncCompletion {
public ChatSubcommandsCompletion(@NotNull SimpleClans plugin) {
super(plugin);
}
@Override
public @NotNull String getId() {
return "chat_subcommands";
}
@Override
public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
Player player = context.getPlayer();
if (player == null) {
return Collections.emptyList();
}
String leave = lang("leave", player);
List<String> subcommands = new ArrayList<>(Arrays.asList(lang("join", player), leave, lang("mute",
player)));
ClanPlayer cp = clanManager.getAnyClanPlayer(player.getUniqueId());
if (cp != null) {
if (cp.getChannel() == ClanPlayer.Channel.NONE) {
subcommands.remove(leave);
}
}
return subcommands;
}
}
@@ -0,0 +1,36 @@
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";
}
}
@@ -0,0 +1,36 @@
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";
}
}
@@ -0,0 +1,36 @@
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";
}
}
@@ -0,0 +1,34 @@
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";
}
}
@@ -0,0 +1,9 @@
package net.sacredlabyrinth.phaed.simpleclans.commands.completions;
import org.jetbrains.annotations.NotNull;
public interface IdentifiableCompletion {
@NotNull
String getId();
}
Loaded 100 of 349 files, more files were not shown because too many files have changed in this diff. Show more