Compare commits

...

528 Commits
4.0.6 ... main

Author SHA1 Message Date
PikaMug 5d9bab93c3 Update locale library, fixes #2215 2024-05-27 05:47:47 -04:00
PikaMug 3f9d43c93d End distribution on BuiltByBit. Bump version 2024-05-22 20:38:13 -04:00
PikaMug c56d358153 Include base 1.8 for particles 2024-05-22 19:44:37 -04:00
PikaMug 7ce87b8644 Update locale library 2024-05-22 04:52:44 -04:00
PikaMug 4dacb4532f Clean up a few warnings, update library 2024-05-21 05:03:52 -04:00
PikaMug a7e9e41d68 Employ safer collections in factories, fixes #2212 2024-05-21 04:57:30 -04:00
PikaMug 0b19116362 Merge branch 'main' of https://github.com/PikaMug/Quests 2024-05-19 00:53:52 -04:00
PikaMug 37316238e2 Only get package name for 1.8 versions 2024-05-19 00:53:18 -04:00
PikaMug abe97e558e
New Crowdin updates (#2210)
* New translations strings.yml (Belarusian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Arabic)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Estonian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)
2024-05-17 23:03:50 -04:00
PikaMug 15044ba9e2 Display tipped arrow level, fixes #2208 2024-05-17 22:55:15 -04:00
PikaMug 9f26e9d053 Show input when name not found, fixes #2209 2024-05-17 19:41:42 -04:00
PikaMug 181f4e0dec Expose potion level for 1.9+, part 3. See #2205 2024-05-14 18:16:24 -04:00
PikaMug 90f8f0ec27 Expose potion level for 1.9+, part 2. See #2205 2024-05-13 01:44:40 -04:00
PikaMug 1fdb1b8a80 Check bottle after shift-click, fixes #2206 2024-05-13 01:20:38 -04:00
PikaMug 3d6c0fad63
New Crowdin updates (#2207)
* New translations strings.yml (Belarusian)

* New translations strings.yml (Spanish)

* New translations strings.yml (French)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)
2024-05-13 00:11:34 -04:00
PikaMug 94fee10e96 Expose potion level for 1.9+, fixes #2205 2024-05-12 23:04:18 -04:00
PikaMug 74a3d093fa Prevent brew result drag, fixes #2203 2024-05-10 01:24:04 -04:00
PikaMug d0c1f92acf
New Crowdin updates (#2196)
* New translations strings.yml (French)

* New translations strings.yml (Romanian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Persian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (English)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (English)
2024-05-04 20:55:21 -04:00
PikaMug 6c4f0b2196 Update strings.yml 2024-05-04 20:44:27 -04:00
PikaMug a40054d420 Divert tag color to lang files, part 2. Fixes #2202 2024-05-03 13:02:55 -04:00
PikaMug a6635bb79c Divert tag color to lang files, part 1. See #2202 2024-05-03 10:11:48 -04:00
PikaMug c31362baa7 Update mcMMO Overhaul party support via Unite 2024-04-21 08:48:13 -04:00
PikaMug 63f6ea0402 Check if player online for fail quest, see #2199 2024-04-18 19:17:16 -04:00
PikaMug d8a7addc9b Check if player online for Action timer, see #2199 2024-04-17 06:00:35 -04:00
PikaMug 605e63d2a4 Use offline player on quit, fixes #2199 2024-04-17 04:21:24 -04:00
PikaMug c58e591e43 Shade NBT API by @tr7zw 2024-04-13 22:59:17 -04:00
PikaMug 00046d1dcb Check for bad split in Quests Journal 2024-04-12 20:23:09 -04:00
PikaMug 085cb1e53f Remove unused dependency information 2024-03-20 06:14:11 -04:00
PikaMug 190e4f4b34 Bump version 2024-03-20 06:09:26 -04:00
PikaMug 2c1a0e8551
New Crowdin updates (#2195)
* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Dutch)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)
2024-03-19 03:52:57 -04:00
PikaMug f908d1c353 Remove legacy objective message code 2024-03-19 03:51:56 -04:00
PikaMug a4446cc3d5 Permit module error for missing dependency 2024-03-15 07:10:13 -04:00
PikaMug f440ea43cd Restore missing NPC effects, see #2189 2024-03-02 02:47:29 -05:00
PikaMug ff4dcacea8 Null check between stage. Bump version 2024-03-02 02:34:31 -05:00
PikaMug 9a5b5725bb
New Crowdin updates (#2185)
* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Persian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Estonian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Belarusian)
2024-02-25 20:50:21 -05:00
PikaMug a153702387 Welcome to Quests 5 2024-02-23 13:19:55 -05:00
PikaMug f619b6c091 Always let player login find compass target 2024-02-23 13:16:19 -05:00
PikaMug d75aa9b248 Reduce erroneous module event dependency messages 2024-02-20 17:25:41 -05:00
PikaMug 307326d1b1 Remove legacy events permissions 2024-02-15 14:55:30 -05:00
PikaMug 8eae46ad07 Remove YAML-only pointsall subcommand 2024-02-15 14:32:46 -05:00
PikaMug 0cc6d7770b
New Crowdin updates (#2184)
* New translations strings.yml (Belarusian)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Persian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)
2024-02-15 13:19:23 -05:00
PikaMug f0eb129843 Match custom objectives to other prompt titles 2024-02-15 12:38:58 -05:00
PikaMug d35301d1e5 Process custom requirement display placeholders 2024-02-15 12:31:34 -05:00
PikaMug a85c2d4b81 Update NPC effect thread (breaking) 2024-02-08 00:51:13 -05:00
PikaMug 5ebeb77cd7 Require amount for legacy items 2024-01-18 16:46:34 -05:00
PikaMug 76397b6e1a Update method comments 2024-01-18 03:00:02 -05:00
PikaMug 2695d4008d Update locale library, fixes #2178 2024-01-17 00:29:46 -05:00
PikaMug c91e2f6149 Null check before compass comparison, fixes #2182 2024-01-16 21:33:46 -05:00
PikaMug 38d58088be Check for ZNPCsPlus before class, fixes #2180 2024-01-15 23:30:28 -05:00
PikaMug 3f2465fe6c Clear extra space from custom objective display 2024-01-12 05:17:07 -05:00
PikaMug 3e59fc5659 Parse format tokens in objective message 2024-01-11 17:23:39 -05:00
PikaMug 3413895abf Reset target of Quest Compass on quit 2024-01-08 19:06:58 -05:00
PikaMug 969bac022d Incomplete stage timer workaround, fixes #2172 2024-01-02 21:33:28 -05:00
PikaMug 82de833b60 Update target of Quest Compass for OP 2024-01-01 17:53:34 -05:00
PikaMug a587a0c1c0 Load amount of legacy items 2023-12-11 21:21:47 -05:00
PikaMug f565a6d263 Bump version 2023-12-11 20:36:01 -05:00
PikaMug 0675b357fc Remove confusing registered events message 2023-12-10 21:23:29 -05:00
PikaMug 7e42ec5ecb Improve incrementation of quest IDs 2023-12-09 19:55:52 -05:00
PikaMug 577f4d13ce
New Crowdin updates (#2158)
* New translations strings.yml (Belarusian)

* New translations strings.yml (Persian)
2023-12-06 18:50:17 -05:00
PikaMug 5805b47e88 New quest IDs use leading zeros 2023-12-06 18:47:54 -05:00
PikaMug 45a64a05ed Move storage files to nested folder 2023-12-06 02:14:20 -05:00
PikaMug 5c5d4dd0b3 Specify jar name on load error, fixes #2166 2023-12-05 01:18:06 -05:00
PikaMug 7a581532cf Prevent duplicate ZNPCsPlus 2.x listener 2023-12-05 00:26:33 -05:00
PikaMug 3359fd3175 Audio on original video got yoinked 2023-12-04 23:36:22 -05:00
PikaMug bc65715551 Merely set to zero points, see #2167 2023-12-04 02:30:34 -05:00
PikaMug dfd987dd32 Target quest points must be positive, fixes #2167 2023-12-03 22:39:00 -05:00
PikaMug c9ae34c146 Adjust log output 2023-12-03 22:30:52 -05:00
PikaMug 85c99bac5a Check NPC registry at startup, fixes #2168 2023-12-03 22:29:56 -05:00
PikaMug 8507ebcb64 Correct loading of locations reached, fixes #2164 2023-11-28 17:59:00 -05:00
D3v1s0m 24272a7243
Parse display name for ZNPCsPlus (#2163) 2023-11-16 22:59:01 -05:00
PikaMug 46e5364b88 Undo 2e6ab6c but apply to 2.x since API can be null 2023-11-15 15:08:21 -05:00
D3v1s0m 90a38e06ae
Add support for ZNPCsPlus 2.x (#2161) 2023-11-15 12:34:29 -05:00
PikaMug 2e6ab6c038 Verify compatibility of ZNPCsPlus version 2023-11-11 00:30:25 -05:00
PikaMug 4a935b0346 Bump version 2023-11-11 00:28:24 -05:00
PikaMug 521f7ab278
New Crowdin updates (#2149)
* New translations strings.yml (Persian)

* New translations strings.yml (Persian)

* New translations strings.yml (Polish)

* New translations strings.yml (Persian)

* New translations strings.yml (Persian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Persian)

* New translations strings.yml (Belarusian)

* New translations strings.yml (Persian)

* New translations strings.yml (Norwegian Bokmal)
2023-11-04 19:54:49 -04:00
PikaMug 8240d0555c Restore saving of completed quests, fixes #2155 2023-11-02 00:19:30 -04:00
PikaMug 977a386366 Weak loading of legacy items, see #2151 2023-11-01 18:31:37 -04:00
PikaMug 6c15c41d97 Adhere to ISO 8601, fixes #2130 2023-10-31 23:48:40 -04:00
PikaMug 162db479d2 Fix progress for singular objectives, fixes #2152 2023-10-31 00:08:32 -04:00
PikaMug 07c1ae8610 Workaround invalid custom objective string 2023-10-30 22:21:51 -04:00
PikaMug 10fc926395 Add ZNPCsPlus to softdepend 2023-10-28 00:03:52 -04:00
PikaMug fa2c34d36e Bump version 2023-10-28 00:03:08 -04:00
PikaMug 16ee58326b Interface isEnabled method 2023-10-09 20:56:29 -04:00
PikaMug 19c6f02cc8 Refactor current quests method 2023-10-09 18:42:19 -04:00
PikaMug f5f872bd25
New Crowdin updates (#2136)
* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Italian)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (LOLCAT)
2023-10-01 22:30:43 -04:00
PikaMug 720538d0f8
Quests 5 (#2146)
* Begin refactoring, update license. Bump version

* Update locale library

* More refactoring

* Still more refactoring

* Even more refactoring

* Cut missing quest requirement, fixes #2131

* Yet more refactoring

* Refactoring intensifies

* Wreaks of refactoring

* Add debug warning for #2138

* Refactoring too stronk

* Such refactoring wow

* Do not assume click index, fixes #2143

* Bump version

* Update headers
2023-10-01 10:53:50 -04:00
PikaMug e0970db2a4 Update locale library 2023-06-30 20:35:43 -04:00
PikaMug 93e57c2573 Catch unsupported ZNPCsPlus versions 2023-06-26 22:31:06 -04:00
PikaMug 45235ec59e Fix duplicate custom objective display text 2023-06-23 23:13:04 -04:00
PikaMug d08df181a7 Delay close of NPC GUI, fixes #2120. Bump version 2023-06-20 23:14:32 -04:00
PikaMug d76082d484 Ensure UUID is not null before script, fixes #2127 2023-06-19 23:45:10 -04:00
PikaMug 3eb180a36e
New Crowdin updates (#2122)
* New translations strings.yml (Bulgarian)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Russian)
2023-06-17 17:53:36 -04:00
Drăghiciu Nicolae 870eb02540
Update AstralBooks to latest version (#2118) 2023-06-08 19:09:35 -04:00
PikaMug af1469a913 Permit yes/no input from source or client, fixes #2117 2023-06-07 18:09:48 -04:00
PikaMug 90bf028624 Reveal display names and update library, fixes #2116 2023-06-06 22:51:28 -04:00
PikaMug 56a75acc37 Cancel timer does not auto-fail quest, fixes #2113 2023-06-01 23:41:43 -04:00
PikaMug 8d4b39c9d7 Book titles can be null, fixes #2108 2023-05-20 21:55:20 -04:00
PikaMug 5b63533e7b Bump version 🙄 2023-05-20 16:47:21 -04:00
PikaMug 5e2e122a05 Support PAF Extended for Bungeecord using Unite 2023-05-15 21:29:40 -04:00
PikaMug 7ae0551bf3
New Crowdin updates (#2092)
* New translations strings.yml (Indonesian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Turkish)
2023-05-14 21:21:03 -04:00
PikaMug 068ac6fe6d Finalize dependency 2023-05-14 21:08:01 -04:00
PikaMug a34978a14a Require plugin at offer creation, fixes #2102 2023-05-14 10:27:49 -04:00
PikaMug efb42f4d2c Update locale library, fixes #2103 2023-05-12 23:51:12 -04:00
PikaMug b3bd277478 Switch dependency 2023-05-12 18:25:17 -04:00
PikaMug 7f821a8b17 Update dependency 2023-05-10 18:24:19 -04:00
PikaMug b2b20144d0 Update locale library, fixes #2099 2023-05-07 14:16:27 -04:00
PikaMug 85d0f035a6 Ignore placing of Water Bottle, see #2096 2023-05-04 23:04:11 -04:00
PikaMug 3d8179f55d Ignore placing of Glass Bottle, see #2096 2023-04-30 16:22:36 -04:00
PikaMug 60368fddd9 Experimental support for ZNPCsPlus 2023-04-27 22:54:45 -04:00
PikaMug ab0879d5a3 Prevent item place during brew obj, fixes #2096 2023-04-25 19:47:55 -04:00
PikaMug 7c30a0ce8e More descriptive module failure notice 2023-04-15 11:06:23 -04:00
PikaMug 778c41f254 Check quest reqs despite number completed, fixes #2091 2023-04-07 20:22:54 -04:00
PikaMug cc916c5af4 Limit tameable mob selection, fixes #2090 2023-04-05 21:33:36 -04:00
PikaMug 85b0e0017a Bump version 2023-04-05 21:11:02 -04:00
PikaMug 8b9385c0de Pass plugin to abandon prompt, fixes #2085 2023-04-02 13:33:32 -04:00
PikaMug e5322074b8 Fix loading of underscored mobs-to-tame, fixes #2084 2023-04-02 13:01:20 -04:00
PikaMug 3c8acea21a Ignore quest requirements if empty, fixes #2083 2023-04-01 13:51:58 -04:00
PikaMug 0ee5e9e730 Bump version 2023-04-01 13:50:26 -04:00
PikaMug 1f5ede8f2c Cleaner data in item prompt 2023-03-27 22:54:06 -04:00
PikaMug 5344c4c6d7 Quest requirements must be loaded as ID, fixes #2082 2023-03-26 22:45:28 -04:00
Drăghiciu Nicolae 5f681e7e92
Update repo for AstralBooks (#2081) 2023-03-25 12:04:04 -04:00
PikaMug a91b033d4e CitizensBooks is now AstralBooks 2023-03-24 23:21:08 -04:00
PikaMug ccea1acba5 Deny physical journal to Chiseled Bookshelf 2023-03-19 15:33:15 -04:00
PikaMug c5a753e19e Cleaner quest accept prompt input 2023-03-19 15:29:45 -04:00
PikaMug 49392e5d1c Correct default return of item prompt 2023-03-18 15:10:27 -04:00
PikaMug 496e8eedce Stop matching kill obj to progress maker, see #2079 2023-03-11 15:28:01 -05:00
PikaMug 87e7bdbd6c Prevent double party kill obj increment, fixes #2079 2023-03-10 22:58:49 -05:00
PikaMug b82cf9e377 Update NPC ID-related exception messages 2023-03-10 18:14:28 -05:00
PikaMug ec24e5f0ea
New Crowdin updates (#2077)
* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Italian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Japanese)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Russian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Romanian)

* New translations strings.yml (Russian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (LOLCAT)
2023-03-05 18:40:32 -05:00
PikaMug e7a6456a34 Update locale library 2023-03-05 18:21:13 -05:00
PikaMug 0fe72d418b Better quality objective display method 2023-03-04 19:42:21 -05:00
PikaMug fc2d558e5c Increment objective index before continue 2023-03-03 21:43:36 -05:00
PikaMug 9b3736be87 Improve NPC UUID prompts 2023-03-01 21:39:57 -05:00
PikaMug 447023626e Change modified note strings 2023-02-28 22:57:11 -05:00
PikaMug 5c061f17a6 Prompt formatting cleanup, part 3 2023-02-28 22:34:37 -05:00
PikaMug df9c40785d Prompt formatting cleanup, part 2 2023-02-28 22:08:42 -05:00
PikaMug aa02e57735 Ensure plugin context is global 2023-02-27 22:30:31 -05:00
PikaMug 656b99703b Refactor prompt names 2023-02-26 19:05:39 -05:00
PikaMug 4a428c014f Deny actions and conditions not installed 2023-02-26 17:01:48 -05:00
PikaMug 858c81bcd6
New Crowdin updates (#2076)
* New translations strings.yml (Russian)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Russian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)
2023-02-26 14:05:22 -05:00
PikaMug dea6d561b3 Remove extraneous space 2023-02-26 12:43:34 -05:00
PikaMug fcdff55310 Prompt formatting cleanup 2023-02-26 12:40:56 -05:00
PikaMug 7f2430441a NEW show completed objectives setting, fixes #1946 2023-02-25 19:29:36 -05:00
PikaMug 0d106297ad Cleanup and fix prompt inheritance. Bump version 2023-02-25 00:09:09 -05:00
PikaMug be0dce3cbe
New Crowdin updates (#2073)
* New translations strings.yml (Thai)

* New translations strings.yml (Romanian)

* New translations strings.yml (Thai)

* New translations strings.yml (Romanian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Dutch)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Filipino)

* New translations strings.yml (Korean)

* New translations strings.yml (Polish)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Russian)

* New translations strings.yml (Polish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)
2023-02-22 19:20:06 -05:00
PikaMug a77771cf72 Support Party and Friends for Spigot using Unite 2023-02-14 17:11:48 -05:00
PikaMug b8aa2d0379 Fix external party plugin support 2023-02-13 21:11:55 -05:00
PikaMug 0520145baf
New translations strings.yml (Italian) (#2072) 2023-02-12 20:09:04 -05:00
PikaMug 0e177afdc1 Fire fail action synchronously, fixes #2023 2023-02-11 23:43:35 -05:00
PikaMug e6472bcae2
New Crowdin updates (#2071)
* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Russian)

* New translations strings.yml (Polish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)
2023-02-11 21:22:39 -05:00
PikaMug 40b78b68ff NEW while wearing condition, per #1957 2023-02-11 19:40:07 -05:00
PikaMug 64aa1387a0 NEW while within ticks condition, fixes #1634 2023-02-11 16:33:29 -05:00
PikaMug 609d8e9c4d Correct loading on legacy servers, fixes #2070 2023-01-29 21:31:38 -05:00
PikaMug 12c8e1e4a8 Bump version 2023-01-29 21:16:51 -05:00
PikaMug 3277eef7d3
New Crowdin updates (#2068)
* New translations strings.yml (Arabic)

* New translations strings.yml (Arabic)
2023-01-28 04:52:30 -05:00
PikaMug 43e9b6a7ae Avoid exception on unpopulated lang files, fixes #2063 2023-01-28 00:17:57 -05:00
PikaMug e38e6006c4
New Crowdin updates (#2061)
* New translations strings.yml (Romanian)

* New translations strings.yml (Romanian)

* New translations strings.yml (Japanese)
2023-01-26 03:40:02 -05:00
PikaMug 20bbd3d6e8 Debug for #2063 2023-01-25 21:45:59 -05:00
PikaMug aa4d7b6d3d
New Crowdin updates (#2055)
* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Romanian)

* New translations strings.yml (Romanian)
2023-01-13 02:30:32 -05:00
PikaMug 763be3bb94 Fix NPC particles. Bump version 2023-01-12 02:02:05 -05:00
PikaMug 9e4c1de8e2 Bump version 2023-01-11 13:33:45 -05:00
PikaMug 60cefdaf1c Remove deprecated confirmation setting, part 2 2023-01-11 13:32:47 -05:00
PikaMug 5261576517 Remove deprecated confirmation setting 2023-01-11 13:16:27 -05:00
PikaMug 12e540e923 Trigger legacy material support at startup 2023-01-11 00:47:06 -05:00
PikaMug 32913081f2 Explicitly set config header 2023-01-10 20:29:19 -05:00
PikaMug aec6219f21 Preliminary support for ZNPCs, part 2 2023-01-10 20:21:28 -05:00
PikaMug 387913e173 Remove PhatLoots integration in favor of module 2023-01-09 02:33:57 -05:00
PikaMug 2b2fdc69b0 Change view effect event again 2023-01-07 18:00:49 -05:00
PikaMug 328aba4bc3 Actions ignore extra command parameters, fixes #2057 2022-12-28 18:06:01 -05:00
PikaMug b32b2b6ef2 Change view effect event 2022-12-27 09:15:41 -05:00
PikaMug fd40f15b8b Add view effect event 2022-12-26 18:42:28 -05:00
PikaMug f14040c7fe Finalize matching item display workaround 2022-12-25 15:47:38 -05:00
PikaMug d9292e0222
New translations strings.yml (Chinese Traditional) (#2052) 2022-12-25 15:45:24 -05:00
PikaMug 11a251bbf4 Untested workaround for #2048 2022-12-23 14:15:26 -05:00
PikaMug 354c72ba4a Catch missing Citizens for kill IDs 2022-12-18 05:18:01 -05:00
PikaMug e0bbbe7e90 Add debug console logging for party count 2022-12-10 05:40:14 -05:00
PikaMug 0329e71f3c Clean up spacing 2022-12-10 05:26:24 -05:00
PikaMug 5604392814 Return cancelled objective events, part 2 2022-12-10 05:20:26 -05:00
PikaMug cd4818bfee Return cancelled objective events 2022-12-10 05:18:41 -05:00
PikaMug 35819b619c Support placeholders in ask message, part 3 2022-12-07 04:12:16 -05:00
PikaMug 676eae4819 Support placeholders in ask message, part 2 2022-12-07 03:45:37 -05:00
PikaMug 96780c0bfd Support placeholders in ask message 2022-12-07 03:42:34 -05:00
PikaMug e83db9a0fe Descriptive error for null file objects, see #2034 2022-11-30 13:43:25 -05:00
PikaMug 4c4c0dc21c Bump version 2022-11-29 00:36:04 -05:00
PikaMug a5429d3ede Skip help output of choice command 2022-11-23 13:46:42 -05:00
PikaMug ee45d26a5a Re-add more clickable prompts, fixes #2032 2022-11-23 08:23:09 -05:00
PikaMug a28e94813d Merge remote-tracking branch 'origin/main' 2022-11-22 16:48:05 -05:00
PikaMug 71abe19187 Prevent multiple block start attempts, fixes #2032 2022-11-22 16:47:28 -05:00
PikaMug f78dccf90e
New Crowdin updates (#2020)
* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Bulgarian)

* New translations strings.yml (Greek)

* New translations strings.yml (Lithuanian)

* New translations strings.yml (English, United Kingdom)

* New translations strings.yml (German, Switzerland)
2022-11-17 12:02:16 -05:00
PikaMug b5d7dccbad Use item display names in Quest Journal, fixes #2028 2022-11-17 11:59:31 -05:00
PikaMug 7bc860248d Upgrade dependency for core 2022-11-04 16:13:39 -04:00
PikaMug dd227102d6 Upgrade dependency 2022-11-04 16:05:37 -04:00
PikaMug d676f86758 Downgrade dependency 2022-10-20 14:12:40 -04:00
PikaMug 0a0952eaa6 Update compiler plugin 2022-10-20 14:04:41 -04:00
PikaMug ee2a3190aa Update dependencies 2022-10-20 13:39:10 -04:00
PikaMug 468491e8d8 Bump version 2022-10-20 13:37:41 -04:00
PikaMug af4c6232c6 Update README.md 2022-09-24 17:31:29 -04:00
PikaMug 19dc1dce37
New Crowdin updates (#2015)
* New translations strings.yml (French)

* New translations strings.yml (French)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (French)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (French)

* New translations strings.yml (Ukrainian)
2022-09-24 17:28:48 -04:00
PikaMug ec4dc943c5 Improve Geyser/Floodgate compatibility, fixes #2011 2022-09-24 17:20:46 -04:00
PikaMug 3423424908 Re-add clickable accept prompt, fixes #2017 2022-09-24 00:10:12 -04:00
PikaMug 4b50760c2e Wait if necessary for quester save, per #1947 2022-08-31 20:57:34 -04:00
PikaMug a9446d9168 Bump version 2022-08-31 20:53:24 -04:00
PikaMug 56e2fb1cf9
New Crowdin updates (#1994)
Japanese language completed
2022-08-19 17:14:54 -04:00
PikaMug d6586bec9f Already conversing grammar correction 2022-08-18 17:57:48 -04:00
PikaMug cfe2a660ec
Minor command subargument tweak 2022-08-13 14:01:50 -04:00
datatags a070255c0b
Re-add clickable text in 1.19 (#1999) (#2001) 2022-08-13 13:38:36 -04:00
PikaMug 0df7b37529 Restore exp requirement check, fixes #1997 2022-08-11 17:17:46 -04:00
PikaMug 7e194579d2 Bump version 2022-07-29 11:17:23 -04:00
PikaMug 74ad68d49c
New Crowdin updates (#1986)
* New translations strings.yml (Swedish)

* New translations strings.yml (French)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Ukrainian)
2022-07-27 10:43:51 -04:00
PikaMug c8d4b02060 Partially undo 8d7fe3e 2022-07-27 10:32:55 -04:00
PikaMug 8d7fe3e108 Update dependencies 2022-07-27 10:09:34 -04:00
PikaMug 72ab32c71a Fire fail Action during Condition fail, fixes #1777 2022-07-27 06:14:09 -04:00
PikaMug b38ee19dab Prevent exception from stage Action via console 2022-07-27 01:32:52 -04:00
PikaMug 67a72d31c6 Separate method to check punctuality, see #1991 2022-07-26 07:32:26 -04:00
PikaMug 55d2679f56 Block nuisance hikari shutdown message 2022-07-09 03:05:56 -04:00
PikaMug e5d00e04d4
New Crowdin updates (#1985)
* New translations strings.yml (Romanian)

* New translations strings.yml (Persian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Estonian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Arabic)

* New translations strings.yml (Finnish)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Serbian (Cyrillic))
2022-07-06 02:16:19 -04:00
PikaMug abe4570d6e Merge branch 'main' of https://github.com/PikaMug/Quests 2022-07-06 02:12:00 -04:00
PikaMug b634348cd7 Get default key as backup, see #1983 2022-07-06 02:09:38 -04:00
PikaMug a367831405
New Crowdin updates (#1984)
* New translations strings.yml (Romanian)

* New translations strings.yml (Persian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Ukrainian)

* New translations strings.yml (Estonian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Arabic)

* New translations strings.yml (Finnish)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Serbian (Cyrillic))
2022-07-06 01:05:51 -04:00
PikaMug 03136d8945 Reject null Lang keys, see #1983 2022-07-06 01:03:23 -04:00
PikaMug f12a592f06 Consolidate custom data string formatting 2022-07-03 18:40:29 -04:00
PikaMug 565bfe02e0 Separate method to prepare GUI items 2022-07-03 17:39:32 -04:00
PikaMug 70615b30c9 Clone items for GUI display 2022-07-03 16:15:21 -04:00
PikaMug 1eb85f0178 Bump version 2022-07-03 16:11:34 -04:00
PikaMug a54700a870
Update FUNDING.yml 2022-07-03 13:24:12 -04:00
PikaMug 6c322582dc
Create FUNDING.yml 2022-07-03 13:21:56 -04:00
PikaMug 4d9a102a7d Send ZNPCs usage warning 2022-06-28 17:52:29 -04:00
dependabot[bot] 635de4a0fd
Bump mysql-connector-java from 8.0.25 to 8.0.28 in /core (#1977)
Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.25 to 8.0.28.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.25...8.0.28)

---
updated-dependencies:
- dependency-name: mysql:mysql-connector-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-21 17:04:07 -04:00
PikaMug c59f1882e8 Reorder NPC offer acceptance, fixes #1975 2022-06-21 16:56:40 -04:00
PikaMug 581e00c6a1 Update locale library 2022-06-20 09:54:59 -04:00
PikaMug 78f5766b78 Add icon. Bump version 2022-06-16 14:07:07 -04:00
PikaMug 1e1175d061 Bump version 2022-06-15 11:28:45 -04:00
PikaMug df2716074f NEW translate to client language with setting 2022-06-14 14:24:23 -04:00
PikaMug 86df2aa0b0 Auto-fill item requirement list 2022-06-13 06:10:47 -04:00
PikaMug 5c66d01d7c Update and expose language setting 2022-06-13 03:25:05 -04:00
PikaMug fae968c3e6
New Crowdin updates (#1966)
* New translations strings.yml (Ukrainian)

* New translations strings.yml (Spanish)

* New translations strings.yml (German)

* New translations strings.yml (Spanish)

* New translations strings.yml (Finnish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Portuguese)

* New translations strings.yml (English)

* New translations strings.yml (Romanian)

* New translations strings.yml (Estonian)

* New translations strings.yml (Pirate English)

* New translations strings.yml (French)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Czech)

* New translations strings.yml (Polish)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Russian)

* New translations strings.yml (Filipino)

* New translations strings.yml (Turkish)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)
2022-06-11 06:03:24 -04:00
PikaMug 5a78e20efc Update input validity strings 2022-06-11 01:14:16 -04:00
PikaMug 6ff11bed03 Update locale library 2022-06-10 22:21:30 -04:00
PikaMug 12174c5164 Suppress PhatLoots integration in favor of module 2022-06-10 21:53:08 -04:00
PikaMug 2f360562a6 Preliminary support for ZNPCs 2022-06-04 03:47:44 -04:00
PikaMug 7cbf317b42 Bump version with flatten plugin 2022-05-31 05:07:30 -04:00
PikaMug 2d1387cda1 Bump version 2022-05-26 21:19:41 -04:00
PikaMug 5c212cb5d3
New Crowdin updates (#1963)
* New translations strings.yml (Romanian)

* New translations strings.yml (Croatian)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Turkish)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Pirate English)

* New translations strings.yml (English)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Spanish)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (French)

* New translations strings.yml (Thai)

* New translations strings.yml (Filipino)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Russian)

* New translations strings.yml (Polish)

* New translations strings.yml (Dutch)

* New translations strings.yml (Korean)

* New translations strings.yml (Italian)

* New translations strings.yml (LOLCAT)
2022-05-26 21:12:39 -04:00
PikaMug ea1d720b51 Align dependency 2022-05-26 20:19:16 -04:00
PikaMug b234e097e3 Begin to support NPC in Denizen script, fixes #1560 2022-05-26 20:10:03 -04:00
PikaMug a7be8e9eb6 Fix saving of new Action booleans, fixes #1962 2022-05-26 19:25:43 -04:00
PikaMug 9dbbce3ea1 Cleanup POM files 2022-05-15 19:52:42 -04:00
PikaMug 1eb79a6d14 Ignore NPCs without plugin affiliation, fixes #1964 2022-05-15 13:12:11 -04:00
therbz 11612439f9
Add ignore-block-replace quest option (#1960) 2022-05-15 12:19:07 -04:00
PikaMug baf377e304 Properly display command usage 2022-05-15 11:21:54 -04:00
PikaMug 67b8018f93 Show help on qa subcommand lacking args 2022-05-15 08:52:41 -04:00
PikaMug ae70523ac6 Correct loading of exp requirement, fixes #1961 2022-05-14 17:00:45 -04:00
PikaMug 69f6d0acc4
Update README.md 2022-05-11 14:12:18 -04:00
PikaMug 53a4e5ef6e Bump version 2022-05-10 07:56:25 -04:00
PikaMug 44ce64a7e9 Invert plugin availability check per #1955 2022-05-09 04:03:32 -04:00
PikaMug a02ca87d79 Update more editor toggles 2022-05-09 03:59:48 -04:00
PikaMug ea6e50a49f Some conditions only need at least one present 2022-05-09 02:41:08 -04:00
PikaMug 74d071ffe8 Forego no more quest string if empty, fixes #1956 2022-05-09 02:11:27 -04:00
PikaMug 054d86d6bc All conditions must be true, fixes #1955 2022-05-09 02:04:14 -04:00
PikaMug 8fc1ad4bda
New Crowdin updates (#1950)
* New translations strings.yml (Spanish)

* New translations strings.yml (English)

* New translations strings.yml (Spanish)

* New translations strings.yml (Pirate English)
2022-05-08 11:25:12 -04:00
PikaMug 5ef365c861 Update toggle for cancel action timer, fixes #1941 2022-05-07 02:24:39 -04:00
therbz 56ccaaab32
Deduct from blocks broken objective (#1953) 2022-05-06 23:15:33 -04:00
PikaMug c351ad699d
New translations strings.yml (Vietnamese) (#1949) 2022-05-06 12:13:02 -04:00
PikaMug e40a00b236 Meet condition for talk and custom objs, fixes #1943 2022-05-06 12:10:52 -04:00
PikaMug 68a626b117
New Crowdin updates (#1948)
* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (French)

* New translations strings.yml (Polish)

* New translations strings.yml (Filipino)

* New translations strings.yml (Thai)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Russian)

* New translations strings.yml (Dutch)

* New translations strings.yml (Spanish)

* New translations strings.yml (Korean)

* New translations strings.yml (Italian)

* New translations strings.yml (Hungarian)

* New translations strings.yml (German)

* New translations strings.yml (Danish)

* New translations strings.yml (Czech)

* New translations strings.yml (LOLCAT)
2022-05-05 02:03:46 -04:00
PikaMug 9aa26d5b28 Auto-fill supplemental objective lists 2022-05-04 06:16:25 -04:00
PikaMug 86d9e2c665 Revert "Debug output for #1936"
This reverts commit 2a1c78b947.
2022-05-01 16:28:16 -04:00
PikaMug 2a1c78b947 Debug output for #1936 2022-04-28 21:01:30 -04:00
PikaMug 939b6b8f63 NPCs killable with projectiles, fixes #1940 2022-04-28 01:03:21 -04:00
PikaMug 2d3592a89c Tab complete applicable quests only 2022-04-27 05:24:27 -04:00
PikaMug 684a3ebbdb All NPCs use UUID instead 2022-04-26 16:57:47 -04:00
PikaMug 9bf260ad59
Update bug_report.yml 2022-04-25 17:01:47 -04:00
PikaMug 3338001a97 Adjust custom module prompts, part 2 2022-04-22 04:48:43 -04:00
PikaMug 002c4607cc Adjust custom module prompts 2022-04-22 04:25:15 -04:00
PikaMug c1ef9b8fb2
New Crowdin updates (#1925)
* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Danish)

* New translations strings.yml (Korean)

* New translations strings.yml (Hungarian)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Czech)

* New translations strings.yml (Spanish)

* New translations strings.yml (French)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Filipino)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Thai)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (English)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Turkish)

* New translations strings.yml (Russian)

* New translations strings.yml (Polish)

* New translations strings.yml (Dutch)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Croatian)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Swedish)

* New translations strings.yml (German)

* New translations strings.yml (Romanian)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Dutch)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Filipino)

* New translations strings.yml (Indonesian)

* New translations strings.yml (French)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Spanish)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Thai)

* New translations strings.yml (German)

* New translations strings.yml (Indonesian)
2022-04-20 00:11:12 -04:00
PikaMug 1345b8251b Avoid errors without NPC, fixes #1930 #1934 2022-04-19 23:52:35 -04:00
PikaMug 298b18a536 Reduce compilation warnings 2022-04-17 20:26:46 -04:00
PikaMug c593c210a3 Track NPCs by UUID instead. Bump version 2022-04-17 19:28:23 -04:00
PikaMug b7282cbada Catch charged Crossbow state, fixes #1927 2022-04-14 15:09:00 -04:00
PikaMug d3c3b1d6c9 Clean up YAML storage methods 2022-04-12 19:24:42 -04:00
PikaMug 0ba111ec6a NEW experience requirement 2022-04-11 23:52:07 -04:00
PikaMug 39633f2d15 Disallow addition of null item to stages 2022-04-11 14:21:39 -04:00
PikaMug 67dc1dfe88 Send Silk Touch message to action bar 2022-04-11 13:38:23 -04:00
Maximilian Dorn 89922c3255
Fix quest edit select prompt (#1924)
* Add Citizens dependency check

* Undo formatting
2022-04-10 23:59:05 -04:00
PikaMug 746f294628 Address color in action mob prompts 2022-04-09 14:58:53 -04:00
PikaMug 025badce6b Bump version 2022-04-09 10:47:08 -04:00
PikaMug 2c34ace51e Convert block ID input to name 2022-04-09 10:39:39 -04:00
PikaMug 33474fbc5c Send condition messages to action bar 2022-04-09 10:30:11 -04:00
PikaMug 17e8510335
Update bug_report.yml 2022-04-07 16:07:42 -04:00
PikaMug 11ffbf46be Fix exception on NPC right-click 2022-04-07 15:32:55 -04:00
PikaMug acf3daac60 Correct order of config 2022-04-07 14:58:18 -04:00
PikaMug d07a777818 Translate mob names in Quest Journal. Bump version 2022-04-07 12:36:59 -04:00
PikaMug 77d392dba2
New Crowdin updates (#1916)
* New translations strings.yml (French)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Filipino)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Turkish)
2022-04-06 18:28:31 -04:00
PikaMug 260c66f4de Translate item names in Quest Journal, fixes #1915 2022-04-05 13:55:09 -04:00
PikaMug 38ab11e088 Fix progress sharing on some objs, fixes #1912 2022-04-02 13:58:52 -04:00
PikaMug 5c93285df2 Merge remote-tracking branch 'origin/main' 2022-04-01 04:08:17 -04:00
PikaMug 2db149067d Default to Quests Journal without item 2022-04-01 04:07:49 -04:00
PikaMug 80088d7f52
New Crowdin updates (#1910)
* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Japanese)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (German)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Finnish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Japanese)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (German)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Italian)

* New translations strings.yml (Spanish)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Spanish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (German)

* New translations strings.yml (French)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)
2022-03-31 08:46:03 -04:00
PikaMug 81f7fb4d3c Cleanup action list prompts 2022-03-31 08:08:49 -04:00
PikaMug d363d6d81c Do not build version modules 2022-03-31 06:51:01 -04:00
PikaMug e036074af5 Remove bungee module 2022-03-31 06:40:11 -04:00
PikaMug b8e8c97b3e
Rename LICENSE to LICENSE.txt 2022-03-30 09:29:24 -04:00
PikaMug 9302fe0e54 Update library 2022-03-30 08:35:52 -04:00
PikaMug 126e531fe2 Update CONTRIBUTING.md 2022-03-30 07:26:05 -04:00
PikaMug 91cb2c6851
Create LICENSE 2022-03-30 06:39:38 -04:00
PikaMug 9528042751 Adjust mob-spawn action prompt, part 2 2022-03-30 06:32:06 -04:00
PikaMug b81e4fc16b Adjust mob-spawn action prompt, part 1 2022-03-30 01:50:30 -04:00
PikaMug d38d09f482 Delay player data load by @SakurajiKanade 2022-03-29 22:53:31 -04:00
PikaMug d382da8a42 Revert 34eb2e458a 2022-03-28 11:48:21 -04:00
PikaMug 965071a907 Add missing headers 2022-03-28 10:05:57 -04:00
PikaMug 51d55ac626 Delay loading of bungee data 2022-03-28 10:04:31 -04:00
PikaMug 02e7f284b3 Bump version 2022-03-27 03:07:08 -04:00
PikaMug 570d3ea854 Remove debug 2022-03-27 03:02:32 -04:00
PikaMug 34eb2e458a Save on Bungee server switch, fixes #1906 2022-03-27 03:01:57 -04:00
PikaMug 83c720c021 Restore multiple mob-spawn per action, fixes #1632 2022-03-26 06:09:47 -04:00
PikaMug c999f7697d Tropical Fish variant must match, fixes #1909 2022-03-26 02:21:25 -04:00
PikaMug d1875ae377 Forego permission check on login, fixes #1908 2022-03-26 00:46:12 -04:00
PikaMug 609eb183bd Remove color on quest tab complete, part 2 2022-03-26 00:18:06 -04:00
PikaMug 637ac02ee2 Remove color on quest tab complete, fixes #1907 2022-03-24 01:28:51 -04:00
PikaMug 0c699b2de8 Bump version 2022-03-23 06:00:48 -04:00
PikaMug ba14b57741 Clickable quest requirement list 2022-03-23 04:07:25 -04:00
PikaMug ea80add107 Prevent color click kick, fixes #1902 #1905 2022-03-23 03:48:03 -04:00
PikaMug 8dd848ae16
New Crowdin updates (#1900)
* New translations strings.yml (Russian)

* New translations strings.yml (Finnish)

* New translations strings.yml (Finnish)

* New translations strings.yml (Finnish)

* New translations strings.yml (Finnish)
2022-03-23 00:04:39 -04:00
PikaMug b25449f89f Send 1.8 titles using packets, fixes #1903 2022-03-22 23:44:07 -04:00
PikaMug 945e06c33f Correct string replacement, part 3. Fixes #1904 2022-03-21 21:03:59 -04:00
PikaMug 2bfbc68cfa NEW sql support for Bungee via plugin, fixes #1836 2022-03-20 08:39:06 -04:00
PikaMug 5befbb1e8c Check for player on compass update, fixes #1897 2022-03-15 17:23:49 -04:00
PikaMug 08ae5b4f76 Load quester data at login, fixes #1796 2022-03-15 00:27:44 -04:00
PikaMug ce5039d67b Update locale library 2022-03-15 00:25:01 -04:00
PikaMug 5b2d9a97dd Remove new line on stage actions 2022-03-13 05:21:09 -04:00
PikaMug afcc682261 Better command validation, fixes #1895 2022-03-13 05:15:08 -04:00
PikaMug 77b79f0689 Test progress for expired delays, fixes #1685 2022-03-13 01:29:36 -05:00
PikaMug ee82e62805 Fix new line on some action prompts 2022-03-11 18:53:00 -05:00
PikaMug d38fad634f Bump version 2022-03-11 03:54:36 -05:00
PikaMug bc5df18c06
New Crowdin updates (#1891)
* New translations strings.yml (Japanese)

* New translations strings.yml (Japanese)

* New translations strings.yml (Persian)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)
2022-03-10 20:55:34 -05:00
PikaMug a82df20994 Format actions timers, fixes #1832 2022-03-10 19:45:45 -05:00
PikaMug 423357c6e1 Update README.md 2022-03-10 17:46:45 -05:00
PikaMug 6140580fd2 NEW tab completion for commands 2022-03-10 17:22:11 -05:00
PikaMug 5739998125 Restore quest not found message 2022-03-08 01:41:31 -05:00
PikaMug 8a218031cf Correct string replacement, part 2 2022-03-07 23:25:14 -05:00
PikaMug c7cfa9aaa5 Correct string replacement, fixes #1890 2022-03-04 14:27:44 -05:00
PikaMug 7205e5a14a Clear compass target on quest quit 2022-03-03 00:09:01 -05:00
PikaMug fd5b6c1eca Exclude bullet from custom objectives 2022-03-01 22:22:11 -05:00
PikaMug 4e996bb1f4 Avoid NPE on some missing translations 2022-02-25 12:17:52 -05:00
PikaMug 51ba556864
New Crowdin updates (#1879)
* New translations strings.yml (Japanese)

* New translations strings.yml (Japanese)
2022-02-18 08:05:05 -05:00
PikaMug fbae888275 Armor can be removed as requirement, fixes #1856 2022-02-18 08:02:18 -05:00
PikaMug a81fdf2918 Fix kill NPC objectives, fixes #1883 2022-02-18 04:06:26 -05:00
PikaMug 4fb8e5e781 Warn missing completed times for SQL, fixes #1867 2022-02-18 02:08:12 -05:00
PikaMug a00a5176e2 Support SimpleClans party using Unite, fixes #1615 2022-02-18 01:40:02 -05:00
PikaMug 2922808834 Fix multiplayer place block objectives 2022-02-16 07:39:42 -05:00
PikaMug 0640ac8852 Abstract command classes 2022-02-16 07:38:09 -05:00
PikaMug 0c7c727acc Update quester on set stage, fixes #1871 2022-02-10 18:29:46 -05:00
PikaMug fa768de8b0
New Crowdin updates (#1876)
* New translations strings.yml (Dutch)

* New translations strings.yml (Dutch)

* New translations strings.yml (Dutch)
2022-02-07 02:48:51 -05:00
PikaMug 275e1759f4 Add missing disclaimers 2022-02-07 02:32:12 -05:00
PikaMug 7c05200909 Support Denizen 1.2.2+, fixes #1877. Bump version 2022-02-07 02:27:08 -05:00
PikaMug 2c92e6cd46
New Crowdin updates (#1874)
* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (French)

* New translations strings.yml (Turkish)

* New translations strings.yml (Filipino)

* New translations strings.yml (Thai)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Russian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Polish)

* New translations strings.yml (Korean)

* New translations strings.yml (Italian)

* New translations strings.yml (Hungarian)

* New translations strings.yml (German)

* New translations strings.yml (Danish)

* New translations strings.yml (Czech)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Thai)
2022-02-05 20:30:46 -05:00
PikaMug 7ba5a884af
New Crowdin updates (#1873)
* New translations strings.yml (English)

* New translations strings.yml (Pirate English)
2022-02-04 06:48:17 -05:00
PikaMug 63a6456d80 Quest compass improvements, fixes #1872 2022-02-04 06:41:23 -05:00
PikaMug dc406ce60f Temporary workaround for current quests 2022-02-03 04:46:48 -05:00
PikaMug 722ccf7678 Temporary workaround for custom objectives 2022-02-02 05:55:00 -05:00
PikaMug 6320122549
New Crowdin updates (#1870)
* New translations strings.yml (Turkish)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Dutch)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Filipino)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)
2022-02-02 04:34:37 -05:00
PikaMug 5813d7fbd3 Correct setting of item consume objectives 2022-02-01 01:39:07 -05:00
PikaMug d94a015e9e Merge branch 'l10n_main' 2022-01-26 01:06:12 -05:00
PikaMug 8b7013df0b New translations strings.yml (LOLCAT) 2022-01-26 00:51:46 -05:00
PikaMug e2282494e0 Split ask-confirmation setting, per #1866 2022-01-26 00:41:49 -05:00
PikaMug 1f204f2590 New translations strings.yml (Pirate English) 2022-01-25 20:45:00 -05:00
PikaMug c243a5e6d0 New translations strings.yml (English) 2022-01-25 20:44:59 -05:00
PikaMug 3554de1c0d Ask for confirmation on quit, fixes #1866 2022-01-25 19:39:27 -05:00
PikaMug 2e622d5673 Add condition notice interval setting. Fixes #1861 2022-01-23 22:18:10 -05:00
PikaMug 0e9bb7ce75 Correct improper merge conflicts 2022-01-23 14:59:21 -05:00
PikaMug 60be61fe8f New translations strings.yml (LOLCAT) 2022-01-23 14:29:05 -05:00
PikaMug 7d936ba72a New translations strings.yml (Russian) 2022-01-23 14:29:04 -05:00
PikaMug af14209e12 New translations strings.yml (Portuguese) 2022-01-23 14:29:03 -05:00
PikaMug 448c5398a0 New translations strings.yml (Polish) 2022-01-23 14:29:01 -05:00
PikaMug 49341ea4f5 New translations strings.yml (Dutch) 2022-01-23 14:29:00 -05:00
PikaMug 25ea0c5377 New translations strings.yml (Korean) 2022-01-23 14:28:59 -05:00
PikaMug 25044baafa New translations strings.yml (Japanese) 2022-01-23 14:28:58 -05:00
PikaMug 278accd4ad New translations strings.yml (Serbian (Cyrillic)) 2022-01-23 14:28:57 -05:00
PikaMug f9e9e49b04 New translations strings.yml (Italian) 2022-01-23 14:28:57 -05:00
PikaMug f47b955c62 New translations strings.yml (Finnish) 2022-01-23 14:28:55 -05:00
PikaMug 2f0063a8af New translations strings.yml (German) 2022-01-23 14:28:54 -05:00
PikaMug 39439f552e New translations strings.yml (Danish) 2022-01-23 14:28:54 -05:00
PikaMug 4069c73c67 New translations strings.yml (Czech) 2022-01-23 14:28:52 -05:00
PikaMug 021af0c4e3 New translations strings.yml (Arabic) 2022-01-23 14:28:51 -05:00
PikaMug 7c8c0acd3e New translations strings.yml (Spanish) 2022-01-23 14:28:51 -05:00
PikaMug dbe35fa95e New translations strings.yml (Hungarian) 2022-01-23 14:28:50 -05:00
PikaMug 4e832817e0 New translations strings.yml (French) 2022-01-23 14:28:49 -05:00
PikaMug 849b881b2d New translations strings.yml (Swedish) 2022-01-23 14:28:48 -05:00
PikaMug a5b2617855 New translations strings.yml (Chinese Simplified) 2022-01-23 14:28:47 -05:00
PikaMug aea20a7b12 New translations strings.yml (Serbian (Latin)) 2022-01-23 14:28:46 -05:00
PikaMug 459a3fd4b7 New translations strings.yml (Norwegian Bokmal) 2022-01-23 14:28:45 -05:00
PikaMug 37e63821ed New translations strings.yml (Sinhala) 2022-01-23 14:28:44 -05:00
PikaMug 27cb51c4cf New translations strings.yml (Filipino) 2022-01-23 14:28:43 -05:00
PikaMug 25079d5129 New translations strings.yml (Pirate English) 2022-01-23 14:28:42 -05:00
PikaMug 429b8b0e8f New translations strings.yml (Hindi) 2022-01-23 14:28:41 -05:00
PikaMug d553e1701e New translations strings.yml (Turkish) 2022-01-23 14:28:40 -05:00
PikaMug e3b0ddf959 New translations strings.yml (Estonian) 2022-01-23 14:28:39 -05:00
PikaMug 69486dbfb9 New translations strings.yml (Thai) 2022-01-23 14:28:38 -05:00
PikaMug d2136df07f New translations strings.yml (Indonesian) 2022-01-23 14:28:37 -05:00
PikaMug 10a9b7a102 New translations strings.yml (Portuguese, Brazilian) 2022-01-23 14:28:36 -05:00
PikaMug e3aef932e7 New translations strings.yml (Vietnamese) 2022-01-23 14:28:35 -05:00
PikaMug 26c23a991b New translations strings.yml (English) 2022-01-23 14:28:34 -05:00
PikaMug 83852c7051 New translations strings.yml (Chinese Traditional) 2022-01-23 14:28:33 -05:00
PikaMug 4bfdc2132c New translations strings.yml (Croatian) 2022-01-23 14:28:32 -05:00
PikaMug 1fad8d6b7e New translations strings.yml (Romanian) 2022-01-23 14:28:31 -05:00
PikaMug 823b82edaa Update Crowdin configuration file 2022-01-23 14:27:14 -05:00
PikaMug e8e8d1d0dd Revert lang issue from 4cfde2b126 2022-01-23 14:24:24 -05:00
PikaMug 7eaedf079f Merge branch 'develop' 2022-01-23 14:07:59 -05:00
PikaMug 7dbe851d8b Refactor to core module, part 6 2022-01-23 00:29:15 -05:00
PikaMug 47f52fbb1f Add filter to suppress misleading errors 2022-01-22 18:42:06 -05:00
PikaMug 25910ac66d Refactor to core module, part 5 2022-01-20 23:03:40 -05:00
PikaMug 4cfde2b126 Refactor to core module, part 4 2022-01-18 21:15:49 -05:00
PikaMug 9df27c2fa7 New translations strings.yml (Japanese) 2022-01-15 12:53:45 -05:00
PikaMug f4b96c0dac New translations strings.yml (Japanese) 2022-01-15 11:54:49 -05:00
PikaMug 5a28fc10c3 Invalid sheep color workaround, fixes #1862 2022-01-14 16:16:33 -05:00
PikaMug 108ecb9952 Descriptive exception for invalid mobs killed, fixes #1858 2022-01-14 15:21:11 -05:00
PikaMug 33e4a5661f Refactor to core module, part 3 2022-01-13 11:02:43 -05:00
PikaMug b45ca9b8d3 Refactor to core module, part 2 2022-01-12 15:10:01 -05:00
PikaMug 7656f6ace6 Update dependencies 2022-01-11 10:54:04 -05:00
PikaMug 40b23bcb96 Update dependencies 2022-01-10 09:32:12 -05:00
PikaMug 731d21deb7 Add keepalive property to config, part 1 2022-01-09 12:14:33 -05:00
PikaMug 613ba96e34 Avoid exception from misconfigured SQL table 2022-01-07 06:21:38 -05:00
PikaMug ba1aa443e3 Debug for #1858 2022-01-06 11:18:49 -05:00
PikaMug 182ecb3433 Refactor to core module, part 1 2022-01-06 10:59:21 -05:00
PikaMug d9d93552a3 Merge branch 'main' of https://github.com/PikaMug/Quests 2022-01-04 05:38:46 -05:00
PikaMug 8f8c1bd2d5 Remove legacy allow-quitting config node 2022-01-04 05:38:23 -05:00
PikaMug 6e139cc465
New Crowdin updates (#1849)
* New translations strings.yml (French)

* New translations strings.yml (French)

* New translations strings.yml (Russian)

* New translations strings.yml (Pirate English)
2022-01-04 04:54:23 -05:00
PikaMug 3222c42999 Reload questers only after save, fixes #1707 #1811 2022-01-04 04:51:14 -05:00
PikaMug 0850f4c404 Clickable custom module prompts 2022-01-04 01:15:52 -05:00
PikaMug e325e67635 Properly colorize quest quit message 2022-01-02 05:23:10 -05:00
PikaMug 378b8bc909 Update editor password string 2021-12-29 08:46:49 -05:00
PikaMug 513a4e8be0 Recolor duplicate custom messages 2021-12-29 08:26:12 -05:00
PikaMug a2bc97dfa0
Create CONTRIBUTING.md 2021-12-27 02:46:01 -05:00
PikaMug 00972980e6 Update remaining templates 2021-12-26 08:25:03 -05:00
PikaMug 506d584291 Remove unused text 2021-12-26 08:11:14 -05:00
PikaMug b3b378fe9f Separate field 2021-12-26 08:06:07 -05:00
PikaMug 359e03837c No placeholder 2021-12-26 08:02:52 -05:00
PikaMug cc646478f0 Render shell 2021-12-26 08:00:38 -05:00
PikaMug de40e2f57c Bug report file extension 2021-12-26 07:55:25 -05:00
PikaMug 668ce8f1f9
Update bug_report.md 2021-12-26 07:54:31 -05:00
PikaMug 8f6752eb9a
Update config.yml 2021-12-26 07:29:21 -05:00
PikaMug e1f658935a
Update config.yml 2021-12-26 07:25:53 -05:00
PikaMug 1347f32e49 Sort NPC offer quest prompt 2021-12-18 06:04:54 -05:00
PikaMug 089362b0f5 Clickable NPC offer quest prompt 2021-12-17 07:57:02 -05:00
datatags d084823deb
Add clickable prompts config option (#1847) 2021-12-16 03:50:36 -05:00
PikaMug 25c9f9ece8 Switch to CodeMC NMS repository 2021-12-14 22:36:52 -05:00
PikaMug 66d5cfe8ea
Update README.md 2021-12-10 05:42:52 -05:00
PikaMug e8b3ba5ef5 Bump version 2021-12-08 01:12:13 -05:00
PikaMug c1b2a94ee3 Update dependencies 2021-12-07 18:34:09 -05:00
PikaMug 7b820e32e9 Merge remote-tracking branch 'origin/main' 2021-12-06 04:59:03 -05:00
PikaMug 9926ee3746 Remove excessive new lines in editor 2021-12-06 04:58:41 -05:00
PikaMug a6a3a1a14f
New translations strings.yml (Japanese) (#1839) 2021-12-05 04:37:17 -05:00
PikaMug e68a8858e8 Skip condition notice if objective override exists 2021-12-05 02:16:49 -05:00
PikaMug 3d82e95beb Update a couple of strings 2021-12-05 01:05:37 -05:00
PikaMug 680afe8c44 Return from custom module prompts after clear 2021-12-04 20:14:19 -05:00
PikaMug 164d9801e2
New Crowdin updates (#1838)
* New translations strings.yml (Russian)

* New translations strings.yml (Russian)

* New translations strings.yml (Romanian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Hindi)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Swedish)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Japanese)
2021-12-04 03:40:49 -05:00
PikaMug 26430e8c10 Update Crowdin configuration file 2021-12-04 03:07:32 -05:00
PikaMug de50d3aa08 Rename quests-main module to quests-api 2021-12-04 03:04:02 -05:00
PikaMug 2bd85cae9f Store quest NPCs by their ID 2021-12-03 02:15:29 -05:00
PikaMug 71511a4f8a Move conversation listener to separate class 2021-12-02 17:06:20 -05:00
PikaMug 43e2044b98 Deal with spaces in sheep colors 2021-11-28 20:53:22 -05:00
PikaMug 7da6ea4b97 Exclude * permission from Trial Mode check 2021-11-24 04:17:34 -05:00
PikaMug ff3a8bbd1b Send quest titles using Bukkit API 2021-11-23 17:22:39 -05:00
PikaMug dce3d13707 Bump version 2021-11-11 19:50:50 -05:00
PikaMug 622578a002
New translations strings.yml (LOLCAT) (#1826) 2021-11-11 19:26:31 -05:00
PikaMug cb0793e0d4 Ignore OPs when checking for limited access 2021-11-10 18:03:08 -05:00
PikaMug 5004e0c930 Default Trial Mode false for quests.* permission 2021-11-10 17:58:42 -05:00
PikaMug 90329ffcf4 Resolve cast issue for custom module prompts 2021-11-09 14:14:42 -05:00
PikaMug 002adc653e Fix deliver item after relog on SQL, fixes #1830 2021-11-08 22:44:40 -05:00
PikaMug ee97390f8e Patch multi-stack item delivery, fixes #1821 2021-11-08 03:17:03 -05:00
PikaMug 5c166f2041 Correct sheep color formatting, fixes #1828 2021-11-07 23:34:12 -05:00
PikaMug 7b7b676b8d Clickable quest accept prompt 2021-11-01 03:29:36 -04:00
PikaMug 095fd8c419 Resolve impasse from Enchanted Books, fixes #1825 2021-10-31 06:26:36 -04:00
PikaMug 5b0ab9c817 Password objectives separable by semicolon, fixes #1823 2021-10-27 05:01:01 -04:00
PikaMug d80b09c64f Better way of doing aaf5472, thanks @datatags 2021-10-26 17:26:01 -04:00
PikaMug aaf54722a2 Fix transfer of lang files to directory paths with spaces 2021-10-25 23:36:25 -04:00
PikaMug 5c45682cf7 Add debug info for #1812 2021-10-25 01:33:47 -04:00
datatags 1e91a8568a
Add clickable menus support (#1818)
* Add missing disable-command-feedback config check

* Draft clickable menu support

* Fix console support, rename methods

* Add Javadocs, remove unused imports

* Fix a couple prompts that slipped through
2021-10-25 00:48:12 -04:00
PikaMug 18e29ce396 Bump version 2021-10-22 05:52:42 -04:00
PikaMug 7871e370c9 Correct miscellaneous MySQL data types 2021-10-21 03:57:00 -04:00
PikaMug d11d1a5146 Correct mobs_killed MySQL data type, fixes #1820 2021-10-19 04:55:56 -04:00
PikaMug 69e1a1f2a5 Improve code syntax, part 9 2021-10-19 04:54:08 -04:00
PikaMug 826d5883e1 Add notice for Trial Mode at menus 2021-10-19 04:42:04 -04:00
PikaMug 21e6c03d7b Restore compatibility with MC <1.11 2021-10-19 02:05:17 -04:00
PikaMug 4f6c032e68 Do not require Action mob name, fixes #1815 2021-10-16 21:25:13 -04:00
PikaMug 480e53a2c0 Bump version 2021-10-15 00:46:15 -04:00
PikaMug fdf121252c Revert "Bump version"
This reverts commit 8f801f2094.
2021-10-15 00:41:58 -04:00
PikaMug 8f801f2094 Bump version 2021-10-14 23:25:33 -04:00
PikaMug 971931ded8 Restore event trigger for multiplayer prompt 2021-10-14 04:07:22 -04:00
PikaMug 84be40a3ed
New Crowdin updates (#1814)
* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (English)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Turkish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)
2021-10-13 00:31:53 -04:00
PikaMug a5f4c470d5 Update dependencies 2021-10-13 00:31:31 -04:00
PikaMug 20cecf8462 Support mcMMO Overhaul party using Unite 2021-10-12 03:20:22 -04:00
PikaMug 9da6fe3b4d Adjust module name and items 2021-10-10 03:29:35 -04:00
PikaMug 3d20f41add Location obj members must share world, fixes #1813 2021-10-10 01:57:26 -04:00
PikaMug 523da1cf19 Expose module item 2021-10-10 01:42:21 -04:00
PikaMug 0621ccd1e1 Expose module name 2021-10-09 20:48:08 -04:00
PikaMug b544a193e9 Attempt to reduce compile time 2021-10-09 16:24:55 -04:00
PikaMug be04b26fc5
New Crowdin updates (#1803)
* New translations strings.yml (Finnish)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Finnish)

* New translations strings.yml (LOLCAT)
2021-10-09 03:18:27 -04:00
PikaMug 2b0c808503 Add custom module submenu 2021-10-09 02:38:57 -04:00
PikaMug a8d59e6c12 Improve code syntax, part 8 2021-10-07 04:41:56 -04:00
PikaMug 3c8aa5ee4c Improve code syntax, part 7 2021-10-07 04:36:57 -04:00
PikaMug 8c2b077786 Change Trial Mode permission node 2021-10-06 01:09:44 -04:00
PikaMug d5f3f7f10e Correct permission condition loading, fixes #1805 2021-09-27 15:56:22 -04:00
PikaMug 1fcca05658 Bump version 2021-09-25 20:04:10 -04:00
PikaMug 7a6b642893
New Crowdin updates (#1790)
* New translations strings.yml (Croatian)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Czech)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Turkish)

* New translations strings.yml (Filipino)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Russian)
2021-09-25 19:52:43 -04:00
PikaMug 8e77e625ca Resolve kill objectives not incrementing, fixes #1792 2021-09-23 23:56:53 -04:00
PikaMug a078973df2 Always continue kill objective checks 2021-09-23 23:22:12 -04:00
PikaMug 3f26d3478b Update check with config setting and permission 2021-09-22 01:39:22 -04:00
PikaMug 75658b6399 Prevent placeholder condition from pausing load, fixes #1795 2021-09-21 14:44:35 -04:00
PikaMug 3b3eedf56c Fix some item objectives not working on relog, fixes #1784 2021-09-17 02:44:21 -04:00
PikaMug 48b6679a93
New Crowdin updates (#1789)
* New translations strings.yml (Romanian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Hindi)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Swedish)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Romanian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Hindi)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Filipino)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Swedish)

* New translations strings.yml (French)

* New translations strings.yml (Hungarian)

* New translations strings.yml (Spanish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Polish)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Romanian)

* New translations strings.yml (Croatian)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Sinhala)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Swedish)

* New translations strings.yml (Arabic)

* New translations strings.yml (Finnish)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Portuguese)

* New translations strings.yml (English)
2021-09-16 02:54:54 -04:00
PikaMug a795ebe360 Revert item meta comparison, fixes #1785 2021-09-16 01:02:35 -04:00
PikaMug 845753ebf4 Restore auto-fill block durability 2021-09-16 00:46:48 -04:00
PikaMug bd1f0b8389 Bump version 2021-09-09 01:09:34 -04:00
PikaMug 3f7e920043 Improve code syntax, part 6 2021-09-09 01:01:41 -04:00
PikaMug 3cf7ad2719 Limit notice to finish of custom obj, fixes #1783 2021-09-08 23:43:40 -04:00
PikaMug 7818d7ae1e Fix rewards prompt adding null override, fixes #1782 2021-09-08 13:39:36 -04:00
PikaMug 222313083e Improve code syntax, part 5 2021-09-08 03:17:38 -04:00
PikaMug 2383bafc98 Fix loss of custom obj progress after logout 2021-09-07 16:27:57 -04:00
PikaMug a7a03eca5b Custom objectives respect alt color codes again 2021-09-07 14:51:36 -04:00
PikaMug 9b402c28bf Save quest path requirements using ID, see #1715 2021-09-05 22:34:05 -04:00
PikaMug a7eebe7919 Specify Trial Mode false under asterisk 2021-09-04 22:36:32 -04:00
PikaMug df04c72c99 Improve code syntax, part 4 2021-09-04 22:23:33 -04:00
PikaMug e3b449ed8b Improve code syntax, part 3 2021-08-19 09:43:48 -04:00
PikaMug 7531e20d4e Improve code syntax, part 2 2021-08-17 05:24:32 -04:00
PikaMug 27b6f97c2b Improve code syntax, part 1 2021-08-16 04:11:55 -04:00
PikaMug 61f9f2ede2 Update copyright 2021-08-16 00:11:42 -04:00
PikaMug 7514820ef1 Swap back NPC warning, thanks @mcmonkey4eva 2021-08-14 17:32:22 -04:00
402 changed files with 59773 additions and 52218 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: PikaMug
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: paypal.com/donate/?hosted_button_id=FZAFJVB7FC4GU

View File

@ -1,12 +0,0 @@
---
name: Ask a question
about: if it's complex or code-related.
labels: question
---
<!--
Thanks for sticking with us! Please answer the following questions:
-->
**Where else have you looked for answers to this question?**
**Share your question with as much detail as possible?**

22
.github/ISSUE_TEMPLATE/ask_question.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Ask a question
description: if it's complex or code-related.
labels: [question]
body:
- type: markdown
attributes:
value: |
Thanks for inquiring about the project! Please answer the following questions:
- type: 'textarea'
attributes:
label: 'Where else have you looked for answers to this question?'
description: 'Such as the documentation or an Internet search.'
placeholder: 'I looked for an answer in...'
validations:
required: true
- type: 'textarea'
attributes:
label: 'Share your question with as much detail as possible.'
description: 'Every question is a cry to understand the world.'
placeholder: 'I could not figure out...'
validations:
required: true

View File

@ -1,14 +0,0 @@
---
name: Report a bug
about: when something isn't working right.
labels: bug
---
<!--
Thanks for submitting a bug report! Please answer the following questions:
-->
**What is your Quests version / build number (do _not_ say "latest")?**
**Describe the problem and how to replicate it. Any console errors to post _using a pastebin_?**
**If applicable, can you provide an example quest from quests.yml _using a pastebin_?**

36
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Report a bug
description: when something isn't working right.
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thanks for submitting a bug report! Please answer the following questions:
- type: 'textarea'
attributes:
label: 'What is your Quests version / build number (do *not* say "latest")?'
description: 'You can find this using the `/quests info` command.'
placeholder: 'The version used is...'
validations:
required: true
- type: 'textarea'
attributes:
label: 'Describe the problem and how to replicate it.'
description: 'Be as detailed as possible.'
placeholder: "What happened was..."
validations:
required: true
- type: 'textarea'
attributes:
label: 'Any console errors to share?'
description: 'Paste into the field below.'
render: shell
validations:
required: true
- type: 'textarea'
attributes:
label: 'If applicable, can you provide an example quest from quests.yml?'
description: 'Do not upload the file itself.'
render: yaml
validations:
required: false

View File

@ -1 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
about: 'to read before reporting issues.'
url: 'https://pikamug.gitbook.io/quests/'
- name: Discord
about: 'for quick answers to basic questions.'
url: 'https://discordapp.com/invite/QdJAv2G7qg'
- name: Development Builds
about: 'to try after backing up your server.'
url: 'https://ci.codemc.io/job/PikaMug/job/Quests/'

View File

@ -1,12 +0,0 @@
---
name: Suggest a feature
about: once you know all the details.
labels: enhancement
---
<!--
Thanks for sharing your new idea! Please answer the following questions:
-->
**What does your feature do?**
**How would people use it?**

View File

@ -0,0 +1,22 @@
name: Suggest a feature
description: once you know all the details.
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for sharing your idea! Please answer the following questions:
- type: 'textarea'
attributes:
label: 'What does your feature do?'
description: 'Be certain it does not already exist.'
placeholder: 'My new idea is...'
validations:
required: true
- type: 'textarea'
attributes:
label: 'How would people use it?'
description: 'Consider ways it would benefit all.'
placeholder: 'It would be used when...'
validations:
required: true

5
.gitignore vendored
View File

@ -19,10 +19,11 @@ nbdist/
# Maven files
*/target
*dependency-reduced-pom.xml
*.flattened-pom.xml
# Java files
*.class
*.log
*.ctxt
hs_err_pid*
/target/
hs_err_pid*
/target/

BIN
.idea/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

64
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,64 @@
Contributing
============
Thank you for your interest in contributing to Quests! We appreciate your
effort, but to make sure that the inclusion of your patch is a smooth process, we
ask that you make note of the following guidelines.
* **Target Java 8 for source and compilation.** Make sure to mark methods with
` @Override` that override methods of parent classes, or that implement
methods of interfaces.
* **Use only spaces for indentation.** Our indents are 4-spaces long, and tabs
are unacceptable.
* **Wrap code to a 120 column limit.** We do this to make side by side diffs
and other such tasks easier. Ignore this guideline if it makes the code
too unreadable.
* **Write complete Javadocs.** Do so only for public methods, and make sure
that your `@param` and `@return` fields are not just blank.
* **Don't tag classes with @author.** Some legacy classes may have this tag,
but we are phasing it out.
* **Make sure the code is efficient.** One way you can achieve this is to spend
around ten minutes to think about what the code is doing and whether it
seems awfully roundabout. If you had to copy the same large piece of
code in several places, that's bad.
* **Keep commit summaries under 70 characters.** For more details, place two
new lines after the summary line and write away!
* **Test your code.** We're not interested in broken code, for the obvious reasons.
Branches
----------------
When submitting a feature or bugfix, base your code on the newest development branch,
and PR against that same branch. If such a branch does not exist, base your code
against the `main` branch, and PR against that same branch.
Checklist
---------
Ready to submit? Perform the checklist below:
1. Have all tabs been replaced into four spaces? Are indentations 4-space wide?
2. Have I written proper Javadocs for my public methods? Are the @param and
@return fields actually filled out?
3. Have I run [`git rebase`](https://docs.github.com/github/getting-started-with-github/about-git-rebase) to the latest commit of the target branch?
4. Have I combined my commits into a reasonably small number (if not one)
commit using [`git rebase`](https://docs.github.com/github/getting-started-with-github/about-git-rebase)?
5. Have I made my pull request too large? Pull requests should introduce
small sets of changes at a time. Major changes should be discussed with
other contributors prior to starting work.
6. Are my commit messages descriptive?
Example
-------
This is **GOOD:**
if (var.func(param1, param2)) {
// do things
}
This is **BAD:**
if(vAR.func( param1, param2 ))
//do things

22
LICENSE.txt Normal file
View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) PikaMug
Copyright (c) contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -16,20 +16,23 @@ Download
---
Distributed through these fine vendors:
- CurseForge (https://www.curseforge.com/minecraft/bukkit-plugins/quests/)
- Modrinth (https://modrinth.com/plugin/quests.classic)
- SpigotMC (https://www.spigotmc.org/resources/quests.3711/)
- MC-Market (https://www.mc-market.org/resources/19187/)
Usage
---
Documentation can be found in the Wiki: https://github.com/PikaMug/Quests/wiki
Read about usage in the documentation: https://pikamug.gitbook.io/quests/
Compile
---
Requires Java 8 and Maven: https://github.com/PikaMug/Quests/wiki/Master-%E2%80%90-Plugin-Compilation
Java 8 and Maven required: https://pikamug.gitbook.io/quests/master/plugin-compilation
Translate
---
Help localize into your language: https://crowdin.com/project/translate-quests
Help localize into your language:
- Project (https://crowdin.com/project/translate-quests)
- Documentation (https://github.com/PikaMug/QuestsDoc)

129
api/pom.xml Normal file
View File

@ -0,0 +1,129 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>me.pikamug.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>${revision}</version>
</parent>
<artifactId>quests-api</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<!-- Do not update until Java 11 is min -->
<version>4.0.3</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
<configuration>
<artifactSet>
<includes>
<include>me.*</include>
<include>com.zaxxer:HikariCP</include>
<include>mysql</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>me.pikamug.quests.libs.hikari</shadedPattern>
</relocation>
<relocation>
<pattern>com.mysql</pattern>
<shadedPattern>me.pikamug.quests.libs.mysql</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,102 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests;
import me.pikamug.quests.actions.Action;
import me.pikamug.quests.actions.ActionFactory;
import me.pikamug.quests.conditions.Condition;
import me.pikamug.quests.conditions.ConditionFactory;
import me.pikamug.quests.config.ConfigSettings;
import me.pikamug.quests.dependencies.Dependencies;
import me.pikamug.quests.module.CustomObjective;
import me.pikamug.quests.module.CustomRequirement;
import me.pikamug.quests.module.CustomReward;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.quests.QuestFactory;
import java.io.File;
import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.logging.Logger;
public interface Quests {
boolean isEnabled();
boolean isLoading();
String getDetectedServerSoftwareVersion();
File getPluginDataFolder();
Logger getPluginLogger();
InputStream getPluginResource(String filename);
Dependencies getDependencies();
ConfigSettings getConfigSettings();
List<CustomObjective> getCustomObjectives();
List<CustomReward> getCustomRewards();
List<CustomRequirement> getCustomRequirements();
Collection<Quest> getLoadedQuests();
Collection<Action> getLoadedActions();
Collection<Condition> getLoadedConditions();
Quester getQuester(final UUID id);
Collection<Quester> getOnlineQuesters();
Collection<Quester> getOfflineQuesters();
void setOfflineQuesters(final Collection<Quester> questers);
QuestFactory getQuestFactory();
ActionFactory getActionFactory();
ConditionFactory getConditionFactory();
/*ConvoListener getConvoListener();
BlockListener getBlockListener();
ItemListener getItemListener();
NpcListener getNpcListener();
PlayerListener getPlayerListener();
UniteListener getUniteListener();
NpcEffectThread getNpcEffectThread();
PlayerMoveThread getPlayerMoveThread();
PartiesListener getPartiesListener();
DenizenTrigger getDenizenTrigger();
LocaleManager getLocaleManager();
QuesterStorage getStorage();*/
void saveResourceAs(String resourcePath, final String outputPath, final boolean replace);
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.actions;
import me.pikamug.quests.entity.QuestMob;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import java.util.LinkedList;
public interface Action extends Comparable<Action> {
String getName();
void setName(final String name);
String getMessage();
void setMessage(final String message);
boolean isClearInv();
void setClearInv(final boolean clearInv);
boolean isFailQuest();
void setFailQuest(final boolean failQuest);
int getStormDuration();
void setStormDuration(final int stormDuration);
int getThunderDuration();
void setThunderDuration(final int thunderDuration);
int getTimer();
void setTimer(final int timer);
boolean isCancelTimer();
void setCancelTimer(final boolean cancelTimer);
LinkedList<QuestMob> getMobSpawns();
void setMobSpawns(final LinkedList<QuestMob> mobSpawns);
LinkedList<String> getCommands();
void setCommands(final LinkedList<String> commands);
int getHunger();
void setHunger(final int hunger);
int getSaturation();
void setSaturation(final int saturation);
float getHealth();
void setHealth(final float health);
String getBook();
void setBook(final String book);
String getDenizenScript();
void setDenizenScript(final String scriptName);
void fire(final Quester quester, final Quest quest);
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.actions;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.Prompt;
import java.util.List;
public interface ActionFactory {
ConversationFactory getConversationFactory();
List<String> getNamesOfActionsBeingEdited();
void setNamesOfActionsBeingEdited(final List<String> actionNames);
Prompt returnToMenu(final ConversationContext context);
void loadData(final ConversationContext context, final Action action);
void clearData(final ConversationContext context);
void deleteAction(final ConversationContext context);
void saveAction(final ConversationContext context);
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.conditions;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import java.util.LinkedList;
import java.util.UUID;
public interface Condition extends Comparable<Condition> {
String getName();
void setName(final String name);
boolean isFailQuest();
void setFailQuest(final boolean failQuest);
LinkedList<String> getEntitiesWhileRiding();
void setEntitiesWhileRiding(final LinkedList<String> entitiesWhileRiding);
LinkedList<UUID> getNpcsWhileRiding();
void setNpcsWhileRiding(final LinkedList<UUID> npcsWhileRiding);
LinkedList<String> getPermissions();
void setPermissions(final LinkedList<String> permissions);
LinkedList<String> getWorldsWhileStayingWithin();
void setWorldsWhileStayingWithin(final LinkedList<String> worldsWhileStayingWithin);
int getTickStartWhileStayingWithin();
void setTickStartWhileStayingWithin(final int tickStartWhileStayingWithin);
int getTickEndWhileStayingWithin();
void setTickEndWhileStayingWithin(final int tickEndWhileStayingWithin);
LinkedList<String> getBiomesWhileStayingWithin();
void setBiomesWhileStayingWithin(final LinkedList<String> biomesWhileStayingWithin);
LinkedList<String> getRegionsWhileStayingWithin();
void setRegionsWhileStayingWithin(final LinkedList<String> biomesWhileStayingWithin);
LinkedList<String> getPlaceholdersCheckIdentifier();
void setPlaceholdersCheckIdentifier(final LinkedList<String> placeholdersCheckIdentifier);
LinkedList<String> getPlaceholdersCheckValue();
void setPlaceholdersCheckValue(final LinkedList<String> placeholdersCheckValue);
boolean check(final Quester quester, final Quest quest);
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.conditions;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.Prompt;
import java.util.List;
public interface ConditionFactory {
ConversationFactory getConversationFactory();
List<String> getNamesOfConditionsBeingEdited();
void setNamesOfConditionsBeingEdited(final List<String> conditionNames);
Prompt returnToMenu(final ConversationContext context);
void loadData(final ConversationContext context, final Condition condition);
void clearData(final ConversationContext context);
void deleteCondition(final ConversationContext context);
void saveCondition(final ConversationContext context);
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.config;
public interface ConfigSettings {
int getAcceptTimeout();
void setAcceptTimeout(final int acceptTimeout);
boolean canAllowCommands();
void setAllowCommands(final boolean allowCommands);
boolean canAllowCommandsForNpcQuests();
void setAllowCommandsForNpcQuests(final boolean allowCommandsForNpcQuests);
boolean canAllowPranks();
void setAllowPranks(final boolean allowPranks);
boolean canClickablePrompts();
void setClickablePrompts(boolean clickablePrompts);
int getConditionInterval();
void setConditionInterval(final int conditionInterval);
boolean canConfirmAbandon();
void setConfirmAbandon(final boolean confirmAbandon);
boolean canConfirmAccept();
void setConfirmAccept(final boolean confirmAccept);
int getConsoleLogging();
void setConsoleLogging(final int consoleLogging);
boolean canDisableCommandFeedback();
void setDisableCommandFeedback(final boolean disableCommandFeedback);
boolean canGenFilesOnJoin();
void setGenFilesOnJoin(final boolean genFilesOnJoin);
boolean canGiveJournalItem();
void setGiveJournalItem(final boolean giveJournalItem);
boolean canIgnoreLockedQuests();
void setIgnoreLockedQuests(final boolean ignoreLockedQuests);
int getKillDelay();
void setKillDelay(final int killDelay);
String getLanguage();
void setLanguage(final String language);
boolean canLanguageOverrideClient();
void setLanguageOverrideClient(final boolean languageOverrideClient);
int getMaxQuests();
void setMaxQuests(final int maxQuests);
boolean canNpcEffects();
void setNpcEffects(final boolean npcEffects);
String getEffect();
void setEffect(final String effect);
String getRedoEffect();
void setRedoEffect(final String redoEffect);
boolean canShowCompletedObjs();
void setShowCompletedObjs(final boolean showCompletedObjs);
boolean canShowQuestReqs();
void setShowQuestReqs(final boolean showQuestReqs);
boolean canShowQuestTitles();
void setShowQuestTitles(final boolean showQuestTitles);
int getStrictPlayerMovement();
void setStrictPlayerMovement(final int strictPlayerMovement);
boolean canTrialSave();
void setTrialSave(final boolean trialSave);
int getTopLimit();
void setTopLimit(final int topLimit);
boolean canTranslateNames();
void setTranslateNames(final boolean translateItems);
boolean canTranslateSubCommands();
void setTranslateSubCommands(final boolean translateSubCommands);
boolean canUpdateCheck();
void setUpdateCheck(final boolean updateCheck);
void init();
}

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo;
import me.pikamug.quests.Quests;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class QuestsNumericPrompt extends NumericPrompt {
private static final HandlerList HANDLERS = new HandlerList();
private static final Pattern NUMBER_PATTERN = Pattern.compile("^(\\d+) - ");
public QuestsNumericPrompt() {
}
public String getName() {
return getClass().getSimpleName();
}
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
@Override
public @NotNull String getPromptText(@NotNull final ConversationContext cc) {
return sendClickableSelection(getBasicPromptText(cc), cc);
}
public abstract String getBasicPromptText(ConversationContext cc);
/**
* Takes a Quests-styled conversation interface and decides how to send it
* to the target. Players receive clickable text, others (i.e. console)
* receive plain text, which is returned to be delivered through the
* Conversations API.
*
* @param input the Quests-styled conversation interface
* @param context the conversation context
* @return plain text to deliver
*/
public static String sendClickableSelection(final String input, final ConversationContext context) {
if (context.getPlugin() == null) {
return "ERROR";
}
if (!(context.getForWhom() instanceof Player) || !((Quests)context.getPlugin()).getConfigSettings().canClickablePrompts()) {
return input;
}
final String[] basicText = input.split("\n");
final TextComponent component = new TextComponent("");
boolean first = true;
for (final String line : basicText) {
final Matcher matcher = NUMBER_PATTERN.matcher(ChatColor.stripColor(line));
final TextComponent lineComponent = new TextComponent(TextComponent.fromLegacyText(line));
if (matcher.find()) {
lineComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + matcher.group(1)));
}
if (first) {
first = false;
} else {
component.addExtra("\n");
}
component.addExtra(lineComponent);
}
((Player)context.getForWhom()).spigot().sendMessage(component);
return "";
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo;
import me.pikamug.quests.Quests;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import java.util.List;
public abstract class QuestsStringPrompt extends StringPrompt {
private static final HandlerList HANDLERS = new HandlerList();
public QuestsStringPrompt() {
}
public String getName() {
return getClass().getSimpleName();
}
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* Takes a header, footer, and a list of names, formats them in Quests
* style, and decides how to deliver the result. Players are sent
* clickable text, all others (i.e. console) are sent plain text,
* which is returned to be delivered through the Conversations API.
*
* @param header the menu header
* @param list a list of strings to display
* @param footer the menu footer
* @param context the conversation context
* @return plain text to deliver
*/
protected String sendClickableMenu(final String header, final List<String> list, final String footer,
final ConversationContext context) {
if (context.getPlugin() == null) {
return "ERROR";
}
if (!(context.getForWhom() instanceof Player) || !((Quests)context.getPlugin()).getConfigSettings().canClickablePrompts()) {
return ChatColor.GOLD + header + "\n" + ChatColor.AQUA + String.join(ChatColor.GRAY + ", " + ChatColor.AQUA, list) + "\n" + ChatColor.YELLOW + footer;
}
final TextComponent component = new TextComponent(header + "\n");
component.setColor(ChatColor.GOLD);
final TextComponent footerComponent = new TextComponent("\n" + footer);
footerComponent.setColor(ChatColor.YELLOW);
final TextComponent separator = new TextComponent(", ");
separator.setColor(ChatColor.GRAY);
for (int i = 0; i < list.size(); i++) {
final TextComponent questName = new TextComponent(list.get(i));
questName.setColor(ChatColor.AQUA);
questName.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + ChatColor.stripColor(list.get(i))));
component.addExtra(questName);
if (i < (list.size() - 1)) {
component.addExtra(separator);
}
}
component.addExtra(footerComponent);
((Player)context.getForWhom()).spigot().sendMessage(component);
return "";
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.actions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.actions.ActionFactory;
import me.pikamug.quests.convo.QuestsNumericPrompt;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
public abstract class ActionsEditorNumericPrompt extends QuestsNumericPrompt {
private final ConversationContext context;
private ActionFactory factory;
public ActionsEditorNumericPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
this.factory = ((Quests)context.getPlugin()).getActionFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public ActionFactory getActionFactory() {
return factory;
}
public abstract int getSize();
public abstract String getTitle(ConversationContext context);
public abstract ChatColor getNumberColor(ConversationContext context, int number);
public abstract String getSelectionText(ConversationContext context, int number);
public abstract String getAdditionalText(ConversationContext context, int number);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.actions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.actions.ActionFactory;
import me.pikamug.quests.convo.QuestsStringPrompt;
import org.bukkit.conversations.ConversationContext;
public abstract class ActionsEditorStringPrompt extends QuestsStringPrompt {
private final ConversationContext context;
private ActionFactory factory;
public ActionsEditorStringPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
this.factory = ((Quests)context.getPlugin()).getActionFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public ActionFactory getActionFactory() {
return factory;
}
public abstract String getTitle(ConversationContext context);
public abstract String getQueryText(ConversationContext context);
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.conditions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.conditions.ConditionFactory;
import me.pikamug.quests.convo.QuestsNumericPrompt;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
public abstract class ConditionsEditorNumericPrompt extends QuestsNumericPrompt {
private final ConversationContext context;
private ConditionFactory factory;
public ConditionsEditorNumericPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public ConditionFactory getConditionFactory() {
return factory;
}
public abstract int getSize();
public abstract String getTitle(ConversationContext context);
public abstract ChatColor getNumberColor(ConversationContext context, int number);
public abstract String getSelectionText(ConversationContext context, int number);
public abstract String getAdditionalText(ConversationContext context, int number);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.conditions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.conditions.ConditionFactory;
import me.pikamug.quests.convo.QuestsStringPrompt;
import org.bukkit.conversations.ConversationContext;
public abstract class ConditionsEditorStringPrompt extends QuestsStringPrompt {
private final ConversationContext context;
private ConditionFactory factory;
public ConditionsEditorStringPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public ConditionFactory getConditionFactory() {
return factory;
}
public abstract String getTitle(ConversationContext context);
public abstract String getQueryText(ConversationContext context);
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.quests;
import me.pikamug.quests.quests.QuestFactory;
import me.pikamug.quests.Quests;
import me.pikamug.quests.convo.QuestsNumericPrompt;
import org.bukkit.ChatColor;
import org.bukkit.conversations.ConversationContext;
public abstract class QuestsEditorNumericPrompt extends QuestsNumericPrompt {
private final ConversationContext context;
private QuestFactory factory;
public QuestsEditorNumericPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
factory = ((Quests)context.getPlugin()).getQuestFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public QuestFactory getQuestFactory() {
return factory;
}
public abstract int getSize();
public abstract String getTitle(ConversationContext context);
public abstract ChatColor getNumberColor(ConversationContext context, int number);
public abstract String getSelectionText(ConversationContext context, int number);
public abstract String getAdditionalText(ConversationContext context, int number);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.convo.quests;
import me.pikamug.quests.quests.QuestFactory;
import me.pikamug.quests.Quests;
import me.pikamug.quests.convo.QuestsStringPrompt;
import org.bukkit.conversations.ConversationContext;
public abstract class QuestsEditorStringPrompt extends QuestsStringPrompt {
private final ConversationContext context;
private QuestFactory factory;
public QuestsEditorStringPrompt(final ConversationContext context) {
this.context = context;
if (context != null && context.getPlugin() != null) {
factory = ((Quests)context.getPlugin()).getQuestFactory();
}
}
@Override
public String getName() {
return getClass().getSimpleName();
}
public ConversationContext getConversationContext() {
return context;
}
public QuestFactory getQuestFactory() {
return factory;
}
public abstract String getTitle(ConversationContext context);
public abstract String getQueryText(ConversationContext context);
}

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.dependencies;
public interface Dependencies {
boolean isPluginAvailable(final String pluginName);
void init();
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.entity;
public interface QuestMob {
String getName();
void setName(final String name);
Integer getSpawnAmounts();
void setSpawnAmounts(final int spawnAmounts);
Float[] getDropChances();
void setDropChances(final Float[] dropChances);
void spawn();
}

View File

@ -1,83 +1,81 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.enums;
import java.util.HashMap;
import java.util.Map;
public enum ObjectiveType {
BREAK_BLOCK(1, "BreakBlock"),
DAMAGE_BLOCK(2, "DamageBlock"),
PLACE_BLOCK(3, "PlaceBlock"),
USE_BLOCK(4, "UseBlock"),
CUT_BLOCK(5, "CutBlock"),
CRAFT_ITEM(6, "CraftItem"),
SMELT_ITEM(7, "SmeltItem"),
ENCHANT_ITEM(8, "EnchantItem"),
BREW_ITEM(9, "BrewItem"),
CONSUME_ITEM(10, "ConsumeItem"),
DELIVER_ITEM(11, "DeliverItem"),
MILK_COW(12, "MilkCow"),
CATCH_FISH(13, "CatchFish"),
KILL_MOB(14, "KillMob"),
KILL_PLAYER(15, "KillPlayer"),
TALK_TO_NPC(16, "TalkToNPC"),
KILL_NPC(17, "KillNPC"),
TAME_MOB(18, "TameMob"),
SHEAR_SHEEP(19, "ShearSheep"),
REACH_LOCATION(20, "ReachLocation"),
PASSWORD(21, "Password"),
CUSTOM(127, "Custom");
private String name;
private byte typeId;
private static final Map<String, ObjectiveType> NAME_MAP = new HashMap<String, ObjectiveType>();
private static final Map<Byte, ObjectiveType> ID_MAP = new HashMap<Byte, ObjectiveType>();
static {
for (final ObjectiveType type : values()) {
if (type.name != null) {
NAME_MAP.put(type.name.toLowerCase(), type);
}
if (type.typeId > 0) {
ID_MAP.put(type.typeId, type);
}
}
}
private ObjectiveType(final int typeId, final String name) {
this.typeId = (byte) typeId;
// Capitalize first letter for legacy reasons
this.name = name.substring(0, 1).toUpperCase() + name.substring(1);
}
public static ObjectiveType fromName(final String name) {
if (name == null) {
return null;
}
// Return custom for legacy reasons
if (name.startsWith("custom")) {
return CUSTOM;
}
return NAME_MAP.get(name.toLowerCase());
}
public static ObjectiveType fromId(final int id) {
if (id > Byte.MAX_VALUE) {
return null;
}
return ID_MAP.get((byte) id);
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.enums;
import java.util.HashMap;
import java.util.Map;
public enum ObjectiveType {
BREAK_BLOCK(1, "BreakBlock"),
DAMAGE_BLOCK(2, "DamageBlock"),
PLACE_BLOCK(3, "PlaceBlock"),
USE_BLOCK(4, "UseBlock"),
CUT_BLOCK(5, "CutBlock"),
CRAFT_ITEM(6, "CraftItem"),
SMELT_ITEM(7, "SmeltItem"),
ENCHANT_ITEM(8, "EnchantItem"),
BREW_ITEM(9, "BrewItem"),
CONSUME_ITEM(10, "ConsumeItem"),
DELIVER_ITEM(11, "DeliverItem"),
MILK_COW(12, "MilkCow"),
CATCH_FISH(13, "CatchFish"),
KILL_MOB(14, "KillMob"),
KILL_PLAYER(15, "KillPlayer"),
TALK_TO_NPC(16, "TalkToNPC"),
KILL_NPC(17, "KillNPC"),
TAME_MOB(18, "TameMob"),
SHEAR_SHEEP(19, "ShearSheep"),
REACH_LOCATION(20, "ReachLocation"),
PASSWORD(21, "Password"),
CUSTOM(127, "Custom");
private final String name;
private final byte typeId;
private static final Map<String, ObjectiveType> NAME_MAP = new HashMap<>();
private static final Map<Byte, ObjectiveType> ID_MAP = new HashMap<>();
static {
for (final ObjectiveType type : values()) {
if (type.name != null) {
NAME_MAP.put(type.name.toLowerCase(), type);
}
if (type.typeId > 0) {
ID_MAP.put(type.typeId, type);
}
}
}
private ObjectiveType(final int typeId, final String name) {
this.typeId = (byte) typeId;
// Capitalize first letter for legacy reasons
this.name = name.substring(0, 1).toUpperCase() + name.substring(1);
}
public static ObjectiveType fromName(final String name) {
if (name == null) {
return null;
}
// Return custom for legacy reasons
if (name.startsWith("custom")) {
return CUSTOM;
}
return NAME_MAP.get(name.toLowerCase());
}
public static ObjectiveType fromId(final int id) {
if (id > Byte.MAX_VALUE) {
return null;
}
return ID_MAP.get((byte) id);
}
}

View File

@ -0,0 +1,58 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.enums;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public enum StorageType {
// Local text file
YAML("YAML", "yaml", "yml"),
// Remote database
MYSQL("MySQL", "mysql"),
// Local archive
JAR("JAR", "jar"),
// Custom
CUSTOM("Custom", "custom");
private final String name;
private final List<String> identifiers;
StorageType(final String name, final String... identifiers) {
this.name = name;
this.identifiers = Collections.unmodifiableList(Arrays.asList(identifiers));
}
public static StorageType parse(final String name, final StorageType def) {
for (final StorageType t : values()) {
for (final String id : t.getIdentifiers()) {
if (id.equalsIgnoreCase(name)) {
return t;
}
}
}
return def;
}
public String getName() {
return name;
}
public List<String> getIdentifiers() {
return identifiers;
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public abstract class QuestsEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
public QuestsEvent() {
}
public QuestsEvent(final boolean async) {
super(async);
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,80 +1,80 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.events.editor.actions;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.Quests;
import me.blackvein.quests.actions.ActionFactory;
import me.blackvein.quests.events.QuestsEvent;
/**
* Represents an Actions Editor-related event
*/
public abstract class ActionsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final ActionFactory factory;
private final Prompt prompt;
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests)context.getPlugin()).getActionFactory();
this.prompt = prompt;
}
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests)context.getPlugin()).getActionFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return ActionFactory which is involved in this event
*/
public ActionFactory getActionFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.actions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.actions.ActionFactory;
import me.pikamug.quests.events.QuestsEvent;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
/**
* Represents an Actions Editor-related event
*/
public abstract class ActionsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final ActionFactory factory;
private final Prompt prompt;
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getActionFactory();
this.prompt = prompt;
}
public ActionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getActionFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return ActionFactory which is involved in this event
*/
public ActionFactory getActionFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.actions;
import me.pikamug.quests.convo.actions.ActionsEditorNumericPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class ActionsEditorPostOpenNumericPromptEvent extends ActionsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final ActionsEditorNumericPrompt prompt;
public ActionsEditorPostOpenNumericPromptEvent(final ConversationContext context, final ActionsEditorNumericPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the numeric prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public ActionsEditorNumericPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.actions;
import me.pikamug.quests.convo.actions.ActionsEditorStringPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class ActionsEditorPostOpenStringPromptEvent extends ActionsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final ActionsEditorStringPrompt prompt;
public ActionsEditorPostOpenStringPromptEvent(final ConversationContext context, final ActionsEditorStringPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the string prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public ActionsEditorStringPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,80 +1,80 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.events.editor.conditions;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.Quests;
import me.blackvein.quests.conditions.ConditionFactory;
import me.blackvein.quests.events.QuestsEvent;
/**
* Represents an Conditions Editor-related event
*/
public abstract class ConditionsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final ConditionFactory factory;
private final Prompt prompt;
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
this.prompt = prompt;
}
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests)context.getPlugin()).getConditionFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return ConditionFactory which is involved in this event
*/
public ConditionFactory getConditionFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.conditions;
import me.pikamug.quests.Quests;
import me.pikamug.quests.conditions.ConditionFactory;
import me.pikamug.quests.events.QuestsEvent;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
/**
* Represents an Conditions Editor-related event
*/
public abstract class ConditionsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final ConditionFactory factory;
private final Prompt prompt;
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getConditionFactory();
this.prompt = prompt;
}
public ConditionsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getConditionFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return ConditionFactory which is involved in this event
*/
public ConditionFactory getConditionFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.conditions;
import me.pikamug.quests.convo.conditions.ConditionsEditorNumericPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class ConditionsEditorPostOpenNumericPromptEvent extends ConditionsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final ConditionsEditorNumericPrompt prompt;
public ConditionsEditorPostOpenNumericPromptEvent(final ConversationContext context, final ConditionsEditorNumericPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the numeric prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public ConditionsEditorNumericPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.conditions;
import me.pikamug.quests.convo.conditions.ConditionsEditorStringPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class ConditionsEditorPostOpenStringPromptEvent extends ConditionsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final ConditionsEditorStringPrompt prompt;
public ConditionsEditorPostOpenStringPromptEvent(final ConversationContext context, final ConditionsEditorStringPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the string prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public ConditionsEditorStringPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,80 +1,80 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.events.editor.quests;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.QuestFactory;
import me.blackvein.quests.Quests;
import me.blackvein.quests.events.QuestsEvent;
/**
* Represents a Quests Editor-related event
*/
public abstract class QuestsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final QuestFactory factory;
private final Prompt prompt;
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
this.prompt = prompt;
}
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests)context.getPlugin()).getQuestFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return QuestFactory which is involved in this event
*/
public QuestFactory getQuestFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.quests;
import me.pikamug.quests.quests.QuestFactory;
import me.pikamug.quests.Quests;
import me.pikamug.quests.events.QuestsEvent;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
/**
* Represents a Quests Editor-related event
*/
public abstract class QuestsEditorEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
protected ConversationContext context;
private final QuestFactory factory;
private final Prompt prompt;
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt) {
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getQuestFactory();
this.prompt = prompt;
}
public QuestsEditorEvent(final ConversationContext context, final Prompt prompt, final boolean async) {
super(async);
this.context = context;
this.factory = ((Quests) Objects.requireNonNull(context.getPlugin())).getQuestFactory();
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the factory involved in this event
*
* @return QuestFactory which is involved in this event
*/
public QuestFactory getQuestFactory() {
return factory;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.quests;
import me.pikamug.quests.convo.quests.QuestsEditorNumericPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class QuestsEditorPostOpenNumericPromptEvent extends QuestsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final QuestsEditorNumericPrompt prompt;
public QuestsEditorPostOpenNumericPromptEvent(final ConversationContext context, final QuestsEditorNumericPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the numeric prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public QuestsEditorNumericPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.editor.quests;
import me.pikamug.quests.convo.quests.QuestsEditorStringPrompt;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class QuestsEditorPostOpenStringPromptEvent extends QuestsEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final QuestsEditorStringPrompt prompt;
public QuestsEditorPostOpenStringPromptEvent(final ConversationContext context, final QuestsEditorStringPrompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the string prompt involved in this event
*
* @return Prompt which is involved in this event
*/
@Override
public QuestsEditorStringPrompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,21 +1,20 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
/*
* Copyright (c) PikaMug and contributors
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.blackvein.quests.events.misc;
package me.pikamug.quests.events.misc;
import me.blackvein.quests.events.QuestsEvent;
import me.pikamug.quests.events.QuestsEvent;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Represents a miscellaneous editor-related event
@ -55,7 +54,7 @@ public class MiscEditorEvent extends QuestsEvent {
}
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.misc;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class MiscPostNpcOfferQuestEvent extends MiscEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Prompt prompt;
public MiscPostNpcOfferQuestEvent(final ConversationContext context, final Prompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.misc;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class MiscPostQuestAbandonEvent extends MiscEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Prompt prompt;
public MiscPostQuestAbandonEvent(final ConversationContext context, final Prompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.misc;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class MiscPostQuestAcceptEvent extends MiscEditorEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Prompt prompt;
public MiscPostQuestAcceptEvent(final ConversationContext context, final Prompt prompt) {
super(context, prompt);
this.context = context;
this.prompt = prompt;
}
/**
* Returns the context involved in this event
*
* @return ConversationContext which is involved in this event
*/
public ConversationContext getConversationContext() {
return context;
}
/**
* Returns the prompt involved in this event
*
* @return Prompt which is involved in this event
*/
public Prompt getPrompt() {
return prompt;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.quest;
import me.pikamug.quests.events.QuestsEvent;
import me.pikamug.quests.quests.Quest;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Represents a quest-related event
*/
public abstract class QuestEvent extends QuestsEvent {
private static final HandlerList HANDLERS = new HandlerList();
private final Quest quest;
public QuestEvent(final Quest quest) {
this.quest = quest;
}
public QuestEvent(final Quest quest, final boolean async) {
super(async);
this.quest = quest;
}
/**
* Returns the quest involved in this event
*
* @return Quest which is involved in this event
*/
public final Quest getQuest() {
return quest;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.quest;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Called when a quest is quit by a quester
*/
public class QuestQuitEvent extends QuestEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final Quester quester;
private boolean cancel = false;
public QuestQuitEvent(final Quest quest, final Quester who) {
super(quest);
this.quester = who;
}
/**
* Returns the quester involved in this event
*
* @return Quester who is involved in this event
*/
public Quester getQuester() {
return quester;
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(final boolean cancel) {
this.cancel = cancel;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.quest;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Called when a quest is taken by a quester
*/
public class QuestTakeEvent extends QuestEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final Quester quester;
private boolean cancel = false;
public QuestTakeEvent(final Quest quest, final Quester who) {
super(quest);
this.quester = who;
}
/**
* Returns the quester involved in this event
*
* @return Quester who is involved in this event
*/
public Quester getQuester() {
return quester;
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(final boolean cancel) {
this.cancel = cancel;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -1,61 +1,72 @@
package me.blackvein.quests.events.quest;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import me.blackvein.quests.Quest;
import me.blackvein.quests.Quester;
/**
* Called when a quest has its compass target updated for a quester
*/
public class QuestUpdateCompassEvent extends QuestEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final Quester quester;
private final Location target;
private boolean cancel = false;
public QuestUpdateCompassEvent(final Quest quest, final Quester who, final Location target) {
super(quest);
this.quester = who;
this.target = target;
}
/**
* Returns the quester involved in this event
*
* @return Quester who is involved in this event
*/
public Quester getQuester() {
return quester;
}
/**
* Returns the new compass target in this event
*
* @return Location which shall be the new target
*/
public Location getNewCompassTarget() {
return target;
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(final boolean cancel) {
this.cancel = cancel;
}
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.events.quest;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Called when a quest has its compass target updated for a quester
*/
public class QuestUpdateCompassEvent extends QuestEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final Quester quester;
private final Location target;
private boolean cancel = false;
public QuestUpdateCompassEvent(final Quest quest, final Quester who, final Location target) {
super(quest);
this.quester = who;
this.target = target;
}
/**
* Returns the quester involved in this event
*
* @return Quester who is involved in this event
*/
public Quester getQuester() {
return quester;
}
/**
* Returns the new compass target in this event
*
* @return Location which shall be the new target
*/
public Location getNewCompassTarget() {
return target;
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(final boolean cancel) {
this.cancel = cancel;
}
@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.exceptions;
public class ActionFormatException extends Exception {
private static final long serialVersionUID = 6165516939621807530L;
private final String message;
private final String actionId;
public ActionFormatException(final String message, final String actionId) {
super(message + ", see action of ID " + actionId);
this.message = message + ", see action of ID " + actionId;
this.actionId = actionId;
}
/**
* Get the message associated with this exception.
*
* @return The message.
*/
@Override
public String getMessage() {
return message;
}
/**
* Get the action ID associated with this exception.
*
* @return The action that an invalid value was set within.
*/
public String getActionId() {
return actionId;
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.exceptions;
public class ConditionFormatException extends Exception {
private static final long serialVersionUID = 6165516939621807530L;
private final String message;
private final String conditionId;
public ConditionFormatException(final String message, final String conditionId) {
super(message + ", see condition of ID " + conditionId);
this.message = message + ", see condition of ID " + conditionId;
this.conditionId = conditionId;
}
/**
* Get the message associated with this exception.
*
* @return The message.
*/
@Override
public String getMessage() {
return message;
}
/**
* Get the condition ID associated with this exception.
*
* @return The condition that an invalid value was set within.
*/
public String getConditionId() {
return conditionId;
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.exceptions;
public class QuestFormatException extends Exception {
private static final long serialVersionUID = -5960613170308750149L;
private final String message;
private final String questId;
public QuestFormatException(final String message, final String questId) {
super(message + ", see quest of ID " + questId);
this.message = message + ", see quest of ID " + questId;
this.questId = questId;
}
/**
* Get the message associated with this exception.
*
* @return The message.
*/
@Override
public String getMessage() {
return message;
}
/**
* Get the quest ID associated with this exception.
*
* @return The quest that an invalid value was set within.
*/
public String getQuestId() {
return questId;
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.exceptions;
import me.pikamug.quests.quests.Quest;
public class StageFormatException extends Exception {
private static final long serialVersionUID = -8217391053042612896L;
private final String message;
private final Quest quest;
private final int stage;
public StageFormatException(final String message, final Quest quest, final int stage) {
super(message + ", see quest " + quest.getName() + " stage " + stage);
this.message = message + ", see quest " + quest.getName() + " stage " + stage;
this.quest = quest;
this.stage = stage;
}
/**
* Get the message associated with this exception.
*
* @return The message.
*/
@Override
public String getMessage() {
return message;
}
/**
* Get the quest instance associated with this exception.
*
* @return The quest that an invalid stage id was set within.
*/
public Quest getQuest() {
return quest;
}
/**
* Get the invalid stage id that was attempted to be set within the quest class.
*
* @return The invalid stage id that was set.
*/
public int getStage() {
return stage;
}
}

View File

@ -0,0 +1,15 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.interfaces;
public interface ReloadCallback<T> {
void execute(T response);
}

View File

@ -0,0 +1,96 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.module;
import me.pikamug.quests.quests.Quest;
import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
public interface CustomObjective {
String getModuleName();
@SuppressWarnings("unused")
Map.Entry<String, Short> getModuleItem();
String getName();
void setName(final String name);
String getAuthor();
void setAuthor(final String author);
String getDisplay();
void setDisplay(final String display);
Map.Entry<String, Short> getItem();
void setItem(final String type, final short durability);
LinkedList<Map.Entry<String, Object>> getData();
/**
* Add a new prompt<p>
*
* Note that the "defaultValue" Object will be cast to a String internally
*
* @param title Prompt name
* @param description Description of expected input
* @param defaultValue Value to be used if input is not received
*/
void addStringPrompt(final String title, final String description, final Object defaultValue);
Map<String, String> getDescriptions();
int getCount();
void setCount(final int count);
String getCountPrompt();
void setCountPrompt(final String countPrompt);
/**
* Check whether to let user set required amount for objective
*/
boolean canShowCount();
/**
* Set whether to let user set required amount for objective
*
* @param showCount Whether to show the count
*/
void setShowCount(final boolean showCount);
/**
* Get custom objective data for applicable player
*
* @param uuid UUID of player attempting this objective
* @param customObj The objective being attempted
* @param quest Current me.pikamug.quests.Quest which includes this objective
* @return data Map of custom objective data
*/
Map<String, Object> getDataForPlayer(final UUID uuid, final CustomObjective customObj, final Quest quest);
/**
* Increment objective count for applicable player
*
* @param uuid UUID of player attempting this objective
* @param customObj The objective being attempted
* @param quest Current me.pikamug.quests.Quest which includes this objective
* @param count Amount to increase objective count by
*/
void incrementObjective(final UUID uuid, final CustomObjective customObj, final Quest quest, final int count);
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.module;
import java.util.Map;
import java.util.UUID;
public interface CustomRequirement {
String getModuleName();
@SuppressWarnings("unused")
Map.Entry<String, Short> getModuleItem();
String getName();
void setName(final String name);
String getAuthor();
void setAuthor(final String author);
String getDisplay();
void setDisplay(final String display);
Map.Entry<String, Short> getItem();
void setItem(final String type, final short durability);
Map<String, Object> getData();
Map<String, String> getDescriptions();
/**
* Add a new prompt<p>
*
* Note that the "defaultValue" Object will be cast to a String internally
*
* @param title Prompt name
* @param description Description of expected input
* @param defaultValue Value to be used if input is not received
*/
void addStringPrompt(final String title, final String description, final Object defaultValue);
/**
* Test whether a player has met the requirement
*
* @param uuid UUID of player being tested
* @param data Map of custom requirement data
* @return true if met
*/
boolean testRequirement(UUID uuid, Map<String, Object> data);
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.module;
import java.util.Map;
import java.util.UUID;
public interface CustomReward {
String getModuleName();
@SuppressWarnings("unused")
Map.Entry<String, Short> getModuleItem();
String getName();
void setName(final String name);
String getAuthor();
void setAuthor(final String author);
String getDisplay();
void setDisplay(final String display);
Map.Entry<String, Short> getItem();
void setItem(final String type, final short durability);
Map<String, Object> getData();
Map<String, String> getDescriptions();
/**
* Add a new prompt<p>
*
* Note that the "defaultValue" Object will be cast to a String internally
*
* @param title Prompt name
* @param description Description of expected input
* @param defaultValue Value to be used if input is not received
*/
void addStringPrompt(final String title, final String description, final Object defaultValue);
/**
* Give loot reward to a player
*
* @param uuid UUID of player being tested
* @param data Map of custom reward data
*/
void giveReward(UUID uuid, Map<String, Object> data);
}

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.player;
import java.util.LinkedList;
public interface QuestProgress {
LinkedList<?> getBlocksBroken();
LinkedList<?> getBlocksDamaged();
LinkedList<?> getBlocksPlaced();
LinkedList<?> getBlocksUsed();
LinkedList<?> getBlocksCut();
LinkedList<?> getItemsCrafted();
LinkedList<?> getItemsSmelted();
LinkedList<?> getItemsEnchanted();
LinkedList<?> getItemsBrewed();
LinkedList<?> getItemsConsumed();
LinkedList<?> getItemsDelivered();
LinkedList<Boolean> getNpcsInteracted();
void setNpcsInteracted(final LinkedList<Boolean> npcsInteracted);
LinkedList<Integer> getNpcsNumKilled();
void setNpcsNumKilled(final LinkedList<Integer> npcsNumKilled);
LinkedList<Integer> getMobNumKilled();
void setMobNumKilled(final LinkedList<Integer> mobNumKilled);
LinkedList<Integer> getMobsTamed();
void setMobsTamed(final LinkedList<Integer> mobsTamed);
int getFishCaught();
void setFishCaught(final int fishCaught);
int getCowsMilked();
void setCowsMilked(final int cowsMilked);
LinkedList<Integer> getSheepSheared();
void setSheepSheared(final LinkedList<Integer> sheepSheared);
int getPlayersKilled();
void setPlayersKilled(final int playersKilled);
LinkedList<Boolean> getLocationsReached();
void setLocationsReached(final LinkedList<Boolean> locationsReached);
LinkedList<Boolean> getPasswordsSaid();
void setPasswordsSaid(final LinkedList<Boolean> passwordsSaid);
LinkedList<Integer> getCustomObjectiveCounts();
void setCustomObjectiveCounts(final LinkedList<Integer> customObjectiveCounts);
long getDelayStartTime();
void setDelayStartTime(final long delayStartTime);
long getDelayTimeLeft();
void setDelayTimeLeft(final long delayTimeLeft);
boolean canDoJournalUpdate();
void setDoJournalUpdate(final boolean b);
}

View File

@ -0,0 +1,256 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.player;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.quests.components.Stage;
import me.pikamug.quests.quests.components.Objective;
import me.pikamug.quests.enums.ObjectiveType;
import me.pikamug.quests.module.CustomObjective;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.BiFunction;
import java.util.function.Function;
public interface Quester extends Comparable<Quester> {
UUID getUUID();
void setUUID(final UUID id);
String getQuestIdToTake();
void setQuestIdToTake(final String questIdToTake);
String getQuestIdToQuit();
void setQuestIdToQuit(final String questIdToQuit);
String getLastKnownName();
void setLastKnownName(final String lastKnownName);
int getQuestPoints();
void setQuestPoints(final int questPoints);
/**
* Get compass target quest. Returns null if not set
*
* @return Quest or null
*/
Quest getCompassTarget();
/**
* Set compass target quest. Does not update in-game
*
* @param quest The target quest
*/
void setCompassTarget(final Quest quest);
ConcurrentHashMap<Integer, Quest> getTimers();
void setTimers(final ConcurrentHashMap<Integer, Quest> timers);
void removeTimer(final Integer timerId);
ConcurrentHashMap<Quest, Integer> getCurrentQuests();
void setCurrentQuests(final ConcurrentHashMap<Quest, Integer> currentQuests);
ConcurrentSkipListSet<Quest> getCompletedQuests();
void setCompletedQuests(final ConcurrentSkipListSet<Quest> completedQuests);
ConcurrentHashMap<Quest, Long> getCompletedTimes();
void setCompletedTimes(final ConcurrentHashMap<Quest, Long> completedTimes);
ConcurrentHashMap<Quest, Integer> getAmountsCompleted();
void setAmountsCompleted(final ConcurrentHashMap<Quest, Integer> amountsCompleted);
Player getPlayer();
OfflinePlayer getOfflinePlayer();
void sendMessage(final String message);
Stage getCurrentStage(final Quest quest);
QuestProgress getQuestDataOrDefault(final Quest quest);
boolean hasJournal();
ItemStack getJournal();
int getJournalIndex();
void updateJournal();
boolean offerQuest(final Quest quest, final boolean giveReason);
boolean canAcceptOffer(final Quest quest, final boolean giveReason);
boolean isOnTime(final Quest quest, final boolean giveReason);
void takeQuest(final Quest quest, final boolean ignoreRequirements);
boolean abandonQuest(final Quest quest, final String message);
boolean abandonQuest(final Quest quest, final String[] messages);
void quitQuest(final Quest quest, final String message);
void quitQuest(final Quest quest, final String[] messages);
void listQuests(final Quester quester, final int page);
LinkedList<String> getCurrentRequirements(final Quest quest, final boolean ignoreOverrides);
LinkedList<Objective> getCurrentObjectives(final Quest quest, final boolean ignoreOverrides, final boolean formatNames);
void showCurrentObjectives(final Quest quest, final Quester quester, final boolean ignoreOverrides);
boolean hasObjective(final Quest quest, final ObjectiveType type);
boolean hasCustomObjective(final Quest quest, final String name);
void showCurrentConditions(final Quest quest, final Quester quester);
void breakBlock(final Quest quest, final ItemStack itemStack);
void damageBlock(final Quest quest, final ItemStack itemStack);
void placeBlock(final Quest quest, final ItemStack itemStack);
void useBlock(final Quest quest, final ItemStack itemStack);
void cutBlock(final Quest quest, final ItemStack itemStack);
void craftItem(final Quest quest, final ItemStack itemStack);
void smeltItem(final Quest quest, final ItemStack itemStack);
void enchantBook(final Quest quest, final ItemStack itemStack, final Map<Enchantment, Integer> enchantsToAdd);
void enchantItem(final Quest quest, final ItemStack itemStack);
void brewItem(final Quest quest, final ItemStack itemStack);
void consumeItem(final Quest quest, final ItemStack itemStack);
void deliverToNPC(final Quest quest, final UUID npc, final ItemStack itemStack);
void interactWithNPC(final Quest quest, final UUID npc);
void killNPC(final Quest quest, final UUID npc);
void milkCow(final Quest quest);
void catchFish(final Quest quest);
void killMob(final Quest quest, final Location killedLocation, final EntityType entityType);
void killPlayer(final Quest quest, final Player player);
void reachLocation(final Quest quest, final Location location);
void tameMob(final Quest quest, final EntityType entityType);
void shearSheep(final Quest quest, final DyeColor color);
void sayPassword(final Quest quest, final AsyncPlayerChatEvent evt);
void finishObjective(final Quest quest, final Objective objective, final EntityType mob,
final String extra, final UUID npc, final Location location, final DyeColor color,
final String pass, final CustomObjective co);
boolean testComplete(final Quest quest);
void addEmptiesFor(final Quest quest, final int stage);
boolean saveData();
long getCompletionDifference(final Quest quest);
long getRemainingCooldown(final Quest quest);
FileConfiguration getBaseData();
boolean hasData();
boolean hasBaseData();
void startStageTimer(final Quest quest);
void stopStageTimer(final Quest quest);
long getStageTime(final Quest quest);
void checkQuest(final Quest quest);
void showGUIDisplay(final UUID npc, final LinkedList<Quest> quests);
void hardQuit(final Quest quest);
void hardRemove(final Quest quest);
void hardClear();
void hardStagePut(final Quest key, final Integer val);
void hardDataPut(final Quest key, final QuestProgress val);
boolean canUseCompass();
void resetCompass();
void findCompassTarget();
void findNextCompassTarget(final boolean notify);
boolean hasItem(final ItemStack is);
Set<String> dispatchMultiplayerEverything(final Quest quest, final ObjectiveType type,
final BiFunction<Quester, Quest, Void> fun);
Set<String> dispatchMultiplayerObjectives(final Quest quest, final Stage currentStage,
final Function<Quester, Void> fun);
List<Quester> getMultiplayerQuesters(final Quest quest);
boolean meetsCondition(final Quest quest, final boolean giveReason);
boolean isSelectingBlock();
boolean isInRegion(final String regionID);
boolean canAcceptQuest(final UUID npc);
boolean canAcceptCompletedQuest(final UUID npc);
boolean canAcceptCompletedRedoableQuest(final UUID npc);
}

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests;
import me.pikamug.quests.actions.Action;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.components.Options;
import me.pikamug.quests.quests.components.Planner;
import me.pikamug.quests.quests.components.Requirements;
import me.pikamug.quests.quests.components.Rewards;
import me.pikamug.quests.quests.components.Stage;
import java.util.LinkedList;
import java.util.UUID;
public interface Quest extends Comparable<Quest> {
String getId();
void setId(String id);
String getName();
void setName(final String name);
String getDescription();
void setDescription(final String description);
String getFinished();
void setFinished(final String finished);
String getRegionStart();
void setRegionStart(final String regionStart);
Stage getStage(final int index);
LinkedList<Stage> getStages();
UUID getNpcStart();
void setNpcStart(final UUID npcStart);
String getNpcStartName();
Action getInitialAction();
void setInitialAction(final Action initialAction);
Requirements getRequirements();
void setRequirements(final Requirements requirements);
Planner getPlanner();
void setPlanner(final Planner planner);
Rewards getRewards();
void setRewards(final Rewards rewards);
Options getOptions();
void setOptions(final Options options);
void nextStage(final Quester quester, final boolean allowSharedProgress);
void setStage(final Quester quester, final int stage);
boolean updateCompass(final Quester quester, final Stage stage);
boolean testRequirements(final Quester quester);
void completeQuest(final Quester quester);
void completeQuest(final Quester quester, final boolean allowMultiplayer);
void failQuest(final Quester quester);
void failQuest(final Quester quester, final boolean ignoreFailAction);
boolean isInRegionStart(final Quester quester);
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.Prompt;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
public interface QuestFactory {
ConcurrentSkipListSet<UUID> getSelectingNpcs();
void setSelectingNpcs(final ConcurrentSkipListSet<UUID> selectingNpcs);
List<String> getNamesOfQuestsBeingEdited();
void setNamesOfQuestsBeingEdited(final List<String> questNames);
ConversationFactory getConversationFactory();
Prompt returnToMenu(final ConversationContext context);
void loadQuest(final ConversationContext context, final Quest q);
void deleteQuest(final ConversationContext context);
void saveQuest(final ConversationContext context, final ConfigurationSection section);
/*void saveRequirements(final ConversationContext context, final ConfigurationSection section);
void saveStages(final ConversationContext context, final ConfigurationSection section);
void saveRewards(final ConversationContext context, final ConfigurationSection section);
void savePlanner(final ConversationContext context, final ConfigurationSection section);
void saveOptions(final ConversationContext context, final ConfigurationSection section);*/
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
import me.pikamug.quests.enums.ObjectiveType;
import org.jetbrains.annotations.NotNull;
public interface Objective {
ObjectiveType getType();
String getMessage();
int getProgress();
int getGoal();
@NotNull Object getProgressObject();
@NotNull Object getGoalObject();
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
public interface Options {
boolean canAllowCommands();
void setAllowCommands(final boolean allowCommands);
boolean canAllowQuitting();
void setAllowQuitting(final boolean allowQuitting);
boolean canIgnoreSilkTouch();
void setIgnoreSilkTouch(final boolean ignoreSilkTouch);
String getExternalPartyPlugin();
void setExternalPartyPlugin(final String externalPartyPlugin);
boolean canUsePartiesPlugin();
void setUsePartiesPlugin(final boolean usePartiesPlugin);
int getShareProgressLevel();
void setShareProgressLevel(final int shareProgressLevel);
boolean canShareSameQuestOnly();
void setShareSameQuestOnly(final boolean shareSameQuestOnly);
double getShareDistance();
void setShareDistance(final double shareDistance);
boolean canHandleOfflinePlayers();
void setHandleOfflinePlayers(final boolean handleOfflinePlayers);
boolean canIgnoreBlockReplace();
void setIgnoreBlockReplace(final boolean ignoreBlockReplace);
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
public interface Planner {
String getStart();
long getStartInMillis();
boolean hasStart();
void setStart(final String start);
String getEnd();
long getEndInMillis();
boolean hasEnd();
void setEnd(final String end);
long getRepeat();
boolean hasRepeat();
void setRepeat(final long repeat);
long getCooldown();
boolean hasCooldown();
void setCooldown(final long cooldown);
boolean getOverride();
void setOverride(final boolean override);
}

View File

@ -0,0 +1,77 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
import java.util.List;
import java.util.Map;
public interface Requirements {
int getMoney();
void setMoney(final int money);
int getQuestPoints();
void setQuestPoints(final int questPoints);
int getExp();
void setExp(final int exp);
List<?> getItems();
List<Boolean> getRemoveItems();
void setRemoveItems(final List<Boolean> removeItems);
List<String> getNeededQuestIds();
void setNeededQuestIds(final List<String> neededQuests);
List<String> getBlockQuestIds();
void setBlockQuestIds(final List<String> blockQuests);
List<String> getPermissions();
void setPermissions(final List<String> permissions);
List<String> getMcmmoSkills();
void setMcmmoSkills(final List<String> mcmmoSkills);
List<Integer> getMcmmoAmounts();
void setMcmmoAmounts(final List<Integer> mcmmoAmounts);
String getHeroesPrimaryClass();
void setHeroesPrimaryClass(final String heroesPrimaryClass);
String getHeroesSecondaryClass();
void setHeroesSecondaryClass(final String heroesSecondaryClass);
Map<String, Map<String, Object>> getCustomRequirements();
void setCustomRequirements(final Map<String, Map<String, Object>> customRequirements);
List<String> getDetailsOverride();
void setDetailsOverride(final List<String> detailsOverride);
/**
* Check if quest has at least one requirement
*
* @return true if quest contains an requirement
*/
boolean hasRequirement();
}

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
import java.util.List;
import java.util.Map;
public interface Rewards {
int getMoney();
void setMoney(final int money);
int getQuestPoints();
void setQuestPoints(final int questPoints);
int getExp();
void setExp(final int exp);
List<String> getCommands();
void setCommands(final List<String> commands);
List<String> getCommandsOverrideDisplay();
void setCommandsOverrideDisplay(final List<String> commandsOverrideDisplay);
List<String> getPermissions();
void setPermissions(final List<String> permissions);
List<String> getPermissionWorlds();
void setPermissionWorlds(final List<String> worldNames);
List<?> getItems();
List<String> getMcmmoSkills();
void setMcmmoSkills(final List<String> mcmmoSkills);
List<Integer> getMcmmoAmounts();
void setMcmmoAmounts(final List<Integer> mcmmoAmounts);
List<String> getHeroesClasses();
void setHeroesClasses(final List<String> heroesClasses);
List<Double> getHeroesAmounts();
void setHeroesAmounts(final List<Double> heroesAmounts);
int getPartiesExperience();
void setPartiesExperience(final int partiesExperience);
List<String> getPhatLoots();
void setPhatLoots(final List<String> phatLoots);
Map<String, Map<String, Object>> getCustomRewards();
void setCustomRewards(final Map<String, Map<String, Object>> customRewards);
List<String> getDetailsOverride();
void setDetailsOverride(final List<String> detailsOverride);
/**
* Check if quest has at least one reward
*
* @return true if quest contains an reward
*/
boolean hasReward();
}

View File

@ -0,0 +1,220 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.quests.components;
import me.pikamug.quests.actions.Action;
import me.pikamug.quests.conditions.Condition;
import me.pikamug.quests.enums.ObjectiveType;
import me.pikamug.quests.module.CustomObjective;
import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
public interface Stage {
LinkedList<?> getBlocksToBreak();
LinkedList<?> getBlocksToDamage();
LinkedList<?> getBlocksToPlace();
LinkedList<?> getBlocksToUse();
LinkedList<?> getBlocksToCut();
LinkedList<?> getItemsToCraft();
LinkedList<?> getItemsToSmelt();
LinkedList<?> getItemsToEnchant();
LinkedList<?> getItemsToBrew();
LinkedList<?> getItemsToConsume();
LinkedList<?> getItemsToDeliver();
LinkedList<UUID> getItemDeliveryTargets();
void setItemDeliveryTargets(final LinkedList<UUID> itemDeliveryTargets);
LinkedList<String> getDeliverMessages();
void setDeliverMessages(final LinkedList<String> deliverMessages);
LinkedList<UUID> getNpcsToInteract();
void setNpcsToInteract(final LinkedList<UUID> npcsToInteract);
LinkedList<UUID> getNpcsToKill();
void setNpcsToKill(final LinkedList<UUID> npcsToKill);
LinkedList<Integer> getNpcNumToKill();
void setNpcNumToKill(final LinkedList<Integer> npcNumToKill);
LinkedList<?> getMobsToKill();
LinkedList<Integer> getMobNumToKill();
void setMobNumToKill(final LinkedList<Integer> mobNumToKill);
LinkedList<?> getLocationsToKillWithin();
LinkedList<Integer> getRadiiToKillWithin();
void setRadiiToKillWithin(final LinkedList<Integer> radiiToKillWithin);
LinkedList<String> getKillNames();
void setKillNames(final LinkedList<String> killNames);
LinkedList<?> getLocationsToReach();
LinkedList<Integer> getRadiiToReachWithin();
void setRadiiToReachWithin(final LinkedList<Integer> radiiToReachWithin);
LinkedList<?> getWorldsToReachWithin();
LinkedList<String> getLocationNames();
void setLocationNames(final LinkedList<String> locationNames);
LinkedList<?> getMobsToTame();
LinkedList<Integer> getMobNumToTame();
void setMobNumToTame(final LinkedList<Integer> mobNumToTame);
Integer getFishToCatch();
void setFishToCatch(final Integer fishToCatch);
Integer getCowsToMilk();
void setCowsToMilk(final Integer cowsToMilk);
Integer getPlayersToKill();
void setPlayersToKill(final Integer playersToKill);
LinkedList<?> getSheepToShear();
LinkedList<Integer> getSheepNumToShear();
void setSheepNumToShear(final LinkedList<Integer> sheepNumToShear);
LinkedList<String> getPasswordDisplays();
void setPasswordDisplays(final LinkedList<String> passwordDisplays);
LinkedList<String> getPasswordPhrases();
void setPasswordPhrases(final LinkedList<String> passwordPhrases);
String getScript();
void setScript(final String script);
Action getStartAction();
void setStartAction(final Action startAction);
Action getFinishAction();
void setFinishAction(final Action finishAction);
Action getFailAction();
void setFailAction(final Action failAction);
Action getDeathAction();
void setDeathAction(final Action deathAction);
Map<String, Action> getChatActions();
void setChatActions(final Map<String, Action> chatActions);
Map<String, Action> getCommandActions();
void setCommandActions(final Map<String, Action> commandActions);
Action getDisconnectAction();
void setDisconnectAction(final Action disconnectAction);
Condition getCondition();
void setCondition(final Condition condition);
long getDelay();
void setDelay(final long delay);
String getDelayMessage();
void setDelayMessage(final String delayMessage);
String getCompleteMessage();
void setCompleteMessage(final String completeMessage);
String getStartMessage();
void setStartMessage(final String startMessage);
LinkedList<String> getObjectiveOverrides();
void setObjectiveOverrides(final LinkedList<String> objectiveOverrides);
LinkedList<CustomObjective> getCustomObjectives();
void clearCustomObjectives();
LinkedList<Integer> getCustomObjectiveCounts();
void clearCustomObjectiveCounts();
LinkedList<String> getCustomObjectiveDisplays();
void clearCustomObjectiveDisplays();
LinkedList<Map.Entry<String, Object>> getCustomObjectiveData();
void clearCustomObjectiveData();
/**
* Check if stage has at least one objective<p>
*
* Excludes start/complete message, delay, and objective-override
*
* @return true if stage contains an objective
*/
boolean hasObjective();
/**
* Check if stage has at least one objective of which the target can be located easily<p>
*
* @return true if stage contains a locatable objective
*/
boolean hasLocatableObjective();
/**
* Check if stage has the specified type of objective<p>
*
* @param type The type of objective to check for
* @return true if stage contains specified objective
*/
boolean containsObjective(final ObjectiveType type);
}

View File

@ -1,120 +1,125 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.storage;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.storage.implementation.StorageImplementation;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
public class Storage {
private final Quests plugin;
private final StorageImplementation implementation;
public Storage(final Quests plugin, final StorageImplementation implementation) {
this.plugin = plugin;
this.implementation = implementation;
}
public StorageImplementation getImplementation() {
return implementation;
}
public Collection<StorageImplementation> getImplementations() {
return Collections.singleton(implementation);
}
private <T> CompletableFuture<T> makeFuture(final Callable<T> supplier) {
return CompletableFuture.supplyAsync(() -> {
try {
return supplier.call();
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new CompletionException(e);
}
});
}
private CompletableFuture<Void> makeFuture(final Runnable runnable) {
return CompletableFuture.runAsync(() -> {
try {
runnable.run();
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new CompletionException(e);
}
});
}
public String getName() {
return implementation.getImplementationName();
}
public void init() {
try {
implementation.init();
} catch (final Exception e) {
plugin.getLogger().severe("Failed to initialize storage implementation");
e.printStackTrace();
}
}
public void close() {
try {
implementation.close();
} catch (final Exception e) {
plugin.getLogger().severe("Failed to close storage implementation");
e.printStackTrace();
}
}
public CompletableFuture<Quester> loadQuester(final UUID uniqueId) {
return makeFuture(() -> {
return implementation.loadQuester(uniqueId);
});
}
public CompletableFuture<Void> saveQuester(final Quester quester) {
return makeFuture(() -> {
try {
implementation.saveQuester(quester);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
public CompletableFuture<Void> deleteQuester(final UUID uniqueId) {
return makeFuture(() -> {
try {
implementation.deleteQuester(uniqueId);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
public CompletableFuture<String> getQuesterLastKnownName(final UUID uniqueId) {
return makeFuture(() -> implementation.getQuesterLastKnownName(uniqueId));
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage;
import me.pikamug.quests.Quests;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.storage.implementation.QuesterStorageImpl;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
public class QuesterStorage {
private final Quests plugin;
private final QuesterStorageImpl implementation;
public QuesterStorage(final Quests plugin, final QuesterStorageImpl implementation) {
this.plugin = plugin;
this.implementation = implementation;
}
public QuesterStorageImpl getImplementation() {
return implementation;
}
public Collection<QuesterStorageImpl> getImplementations() {
return Collections.singleton(implementation);
}
private <T> CompletableFuture<T> makeFuture(final Callable<T> supplier) {
return CompletableFuture.supplyAsync(() -> {
try {
return supplier.call();
} catch (final Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new CompletionException(e);
}
});
}
private CompletableFuture<Void> makeFuture(final Runnable runnable) {
return CompletableFuture.runAsync(() -> {
try {
runnable.run();
} catch (final Exception e) {
throw (RuntimeException) e;
}
});
}
public String getName() {
return implementation.getImplementationName();
}
public void init() {
try {
implementation.init();
} catch (final Exception e) {
// Failed to initialize storage implementation
e.printStackTrace();
}
}
public void close() {
try {
implementation.close();
} catch (final Exception e) {
// Failed to close storage implementation
e.printStackTrace();
}
}
public CompletableFuture<Quester> loadQuester(final UUID uniqueId) {
return makeFuture(() -> implementation.loadQuester(uniqueId));
}
public CompletableFuture<Void> saveQuester(final Quester quester) {
return makeFuture(() -> {
try {
implementation.saveQuester(quester);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
public CompletableFuture<Void> saveOfflineQuesters() {
return makeFuture(() -> {
try {
for (Quester quester : plugin.getOfflineQuesters()) {
implementation.saveQuester(quester);
}
} catch (final Exception e) {
e.printStackTrace();
}
});
}
public CompletableFuture<Void> deleteQuester(final UUID uniqueId) {
return makeFuture(() -> {
try {
implementation.deleteQuester(uniqueId);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
public CompletableFuture<String> getQuesterLastKnownName(final UUID uniqueId) {
return makeFuture(() -> implementation.getQuesterLastKnownName(uniqueId));
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation;
import me.pikamug.quests.Quests;
import me.pikamug.quests.actions.Action;
import me.pikamug.quests.exceptions.ActionFormatException;
public interface ActionStorageImpl {
Quests getPlugin();
String getImplementationName();
void init() throws Exception;
void close();
Action loadAction(final String name) throws ActionFormatException;
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation;
import me.pikamug.quests.Quests;
import me.pikamug.quests.conditions.Condition;
import me.pikamug.quests.exceptions.ConditionFormatException;
public interface ConditionStorageImpl {
Quests getPlugin();
String getImplementationName();
void init() throws Exception;
void close();
Condition loadCondition(final String name) throws ConditionFormatException;
}

View File

@ -0,0 +1,17 @@
package me.pikamug.quests.storage.implementation;
import me.pikamug.quests.Quests;
import java.io.File;
public interface ModuleStorageImpl {
Quests getPlugin();
String getImplementationName();
void init();
void close();
void loadModule(final File jar);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation;
import me.pikamug.quests.Quests;
import me.pikamug.quests.exceptions.QuestFormatException;
import me.pikamug.quests.quests.Quest;
public interface QuestStorageImpl {
Quests getPlugin();
String getImplementationName();
void init() throws Exception;
void close();
Quest loadQuest(final String name) throws QuestFormatException;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation;
import me.pikamug.quests.Quests;
import me.pikamug.quests.player.Quester;
import java.util.Collection;
import java.util.UUID;
public interface QuesterStorageImpl {
Quests getPlugin();
String getImplementationName();
void init() throws Exception;
void close();
Quester loadQuester(final UUID uniqueId) throws Exception;
void saveQuester(final Quester quester) throws Exception;
void deleteQuester(final UUID uniqueId) throws Exception;
String getQuesterLastKnownName(final UUID uniqueId) throws Exception;
Collection<UUID> getSavedUniqueIds() throws Exception;
}

View File

@ -0,0 +1,18 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation.custom;
import me.pikamug.quests.Quests;
import me.pikamug.quests.storage.implementation.QuesterStorageImpl;
public interface CustomStorageProvider {
QuesterStorageImpl provide(Quests plugin);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation.custom;
public final class CustomStorageProviders {
private CustomStorageProviders() {}
private static CustomStorageProvider provider = null;
public static void register(final CustomStorageProvider provider) {
CustomStorageProviders.provider = provider;
}
public static CustomStorageProvider getProvider() {
if (provider == null) {
throw new IllegalStateException("Provider not found.");
}
return provider;
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation.sql.connection;
import me.pikamug.quests.Quests;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
public interface ConnectionFactory {
String getImplementationName();
void init(Quests plugin);
void close() throws Exception;
default Map<String, String> getMeta() {
return Collections.emptyMap();
}
Function<String, String> getStatementProcessor();
Connection getConnection() throws SQLException;
}

View File

@ -1,141 +1,136 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.storage.implementation.sql.connection.hikari;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.bukkit.plugin.java.JavaPlugin;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import me.blackvein.quests.Quests;
import me.blackvein.quests.storage.implementation.sql.connection.ConnectionFactory;
import me.blackvein.quests.storage.misc.StorageCredentials;
public abstract class HikariConnectionFactory implements ConnectionFactory {
private final StorageCredentials configuration;
private HikariDataSource hikari;
public HikariConnectionFactory(final StorageCredentials configuration) {
this.configuration = configuration;
}
/**
* Gets the default port used by the database
*
* @return the default port
*/
protected abstract String defaultPort();
/**
* Configures the {@link HikariConfig} with the relevant database properties.
*
* <p>Each driver does this slightly differently.</p>
*
* @param config the hikari config
* @param address the database address
* @param port the database port
* @param databaseName the database name
* @param username the database username
* @param password the database password
*/
protected abstract void configureDatabase(HikariConfig config, String address, String port, String databaseName,
String username, String password);
/**
* Allows the connection factory instance to override certain properties before they are set.
*
* @param properties the current properties
*/
protected void overrideProperties(final Map<String, String> properties) {
// https://github.com/brettwooldridge/HikariCP/wiki/Rapid-Recovery
properties.putIfAbsent("socketTimeout", String.valueOf(TimeUnit.SECONDS.toMillis(30)));
}
/**
* Sets the given connection properties onto the config.
*
* @param config the hikari config
* @param properties the properties
*/
protected void setProperties(final HikariConfig config, final Map<String, String> properties) {
for (final Map.Entry<String, String> property : properties.entrySet()) {
config.addDataSourceProperty(property.getKey(), property.getValue());
}
}
@Override
public void init(final Quests plugin) {
final HikariConfig config = new HikariConfig();
config.setPoolName("quests-hikari");
final String[] addressSplit = configuration.getAddress().split(":");
final String address = addressSplit[0];
final String port = addressSplit.length > 1 ? addressSplit[1] : defaultPort();
configureDatabase(config, address, port, configuration.getDatabase(), configuration.getUsername(),
configuration.getPassword());
final Map<String, String> properties = new HashMap<>(this.configuration.getProperties());
overrideProperties(properties);
setProperties(config, properties);
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
config.setMinimumIdle(this.configuration.getMinIdleConnections());
config.setMaxLifetime(this.configuration.getMaxLifetime());
config.setConnectionTimeout(this.configuration.getConnectionTimeout());
hikari = new HikariDataSource(config);
}
@Override
public void close() {
if (hikari != null) {
hikari.close();
}
}
@Override
public Connection getConnection() throws SQLException {
if (hikari == null) {
throw new SQLException("Unable to get a connection from the pool because hikari is null");
}
final Connection connection = hikari.getConnection();
if (connection == null) {
throw new SQLException("Unable to get a connection from the pool because getConnection returned null");
}
return connection;
}
public static String identifyClassLoader(final ClassLoader classLoader) throws ReflectiveOperationException {
final Class<?> pluginClassLoaderClass = Class.forName("org.bukkit.plugin.java.PluginClassLoader");
if (pluginClassLoaderClass.isInstance(classLoader)) {
final Method getPluginMethod = pluginClassLoaderClass.getDeclaredMethod("getPlugin");
getPluginMethod.setAccessible(true);
final JavaPlugin plugin = (JavaPlugin) getPluginMethod.invoke(classLoader);
return plugin.getName();
}
return null;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation.sql.connection.hikari;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import me.pikamug.quests.Quests;
import me.pikamug.quests.storage.implementation.sql.connection.ConnectionFactory;
import me.pikamug.quests.storage.misc.StorageCredentials;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public abstract class HikariConnectionFactory implements ConnectionFactory {
private final StorageCredentials configuration;
private HikariDataSource hikari;
public HikariConnectionFactory(final StorageCredentials configuration) {
this.configuration = configuration;
}
/**
* Gets the default port used by the database
*
* @return the default port
*/
protected abstract String defaultPort();
/**
* Configures the {@link HikariConfig} with the relevant database properties.
*
* <p>Each driver does this slightly differently.</p>
*
* @param config the hikari config
* @param address the database address
* @param port the database port
* @param databaseName the database name
* @param username the database username
* @param password the database password
*/
protected abstract void configureDatabase(HikariConfig config, String address, String port, String databaseName,
String username, String password);
/**
* Allows the connection factory instance to override certain properties before they are set.
*
* @param properties the current properties
*/
protected void overrideProperties(final Map<String, String> properties) {
// https://github.com/brettwooldridge/HikariCP/wiki/Rapid-Recovery
properties.putIfAbsent("socketTimeout", String.valueOf(TimeUnit.SECONDS.toMillis(30)));
}
/**
* Sets the given connection properties onto the config.
*
* @param config the hikari config
* @param properties the properties
*/
protected void setProperties(final HikariConfig config, final Map<String, String> properties) {
for (final Map.Entry<String, String> property : properties.entrySet()) {
config.addDataSourceProperty(property.getKey(), property.getValue());
}
}
@Override
public void init(final Quests plugin) {
final HikariConfig config = new HikariConfig();
config.setPoolName("quests-hikari");
final String[] addressSplit = configuration.getAddress().split(":");
final String address = addressSplit[0];
final String port = addressSplit.length > 1 ? addressSplit[1] : defaultPort();
configureDatabase(config, address, port, configuration.getDatabase(), configuration.getUsername(),
configuration.getPassword());
final Map<String, String> properties = new HashMap<>(this.configuration.getProperties());
overrideProperties(properties);
setProperties(config, properties);
config.setMaximumPoolSize(this.configuration.getMaxPoolSize());
config.setMinimumIdle(this.configuration.getMinIdleConnections());
config.setMaxLifetime(this.configuration.getMaxLifetime());
//config.setKeepaliveTime(this.configuration.getKeepAliveTime());
config.setConnectionTimeout(this.configuration.getConnectionTimeout());
hikari = new HikariDataSource(config);
}
@Override
public void close() {
if (hikari != null) {
hikari.close();
}
}
@Override
public Connection getConnection() throws SQLException {
if (hikari == null) {
throw new SQLException("Unable to get a connection from the pool because hikari is null");
}
final Connection connection = hikari.getConnection();
if (connection == null) {
throw new SQLException("Unable to get a connection from the pool because getConnection returned null");
}
return connection;
}
/*public static String identifyClassLoader(final ClassLoader classLoader) throws ReflectiveOperationException {
final Class<?> pluginClassLoaderClass = Class.forName("org.bukkit.plugin.java.PluginClassLoader");
if (pluginClassLoaderClass.isInstance(classLoader)) {
final Method getPluginMethod = pluginClassLoaderClass.getDeclaredMethod("getPlugin");
getPluginMethod.setAccessible(true);
final JavaPlugin plugin = (JavaPlugin) getPluginMethod.invoke(classLoader);
return plugin.getName();
}
return null;
}*/
}

View File

@ -1,72 +1,69 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.storage.implementation.sql.connection.hikari;
import java.util.Map;
import java.util.function.Function;
import com.zaxxer.hikari.HikariConfig;
import me.blackvein.quests.storage.misc.StorageCredentials;
public class MySqlConnectionFactory extends HikariConnectionFactory {
public MySqlConnectionFactory(final StorageCredentials configuration) {
super(configuration);
}
@Override
public String getImplementationName() {
return "MySQL";
}
@Override
protected String defaultPort() {
return "3306";
}
@Override
protected void configureDatabase(final HikariConfig config, final String address, final String port,
final String databaseName, final String username, final String password) {
config.setDriverClassName("com.mysql.cj.jdbc.Driver");
config.setJdbcUrl("jdbc:mysql://" + address + ":" + port + "/" + databaseName);
config.setUsername(username);
config.setPassword(password);
}
@Override
protected void overrideProperties(final Map<String, String> properties) {
// https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
properties.putIfAbsent("cachePrepStmts", "true");
properties.putIfAbsent("prepStmtCacheSize", "250");
properties.putIfAbsent("prepStmtCacheSqlLimit", "2048");
properties.putIfAbsent("useServerPrepStmts", "true");
properties.putIfAbsent("useLocalSessionState", "true");
properties.putIfAbsent("rewriteBatchedStatements", "true");
properties.putIfAbsent("cacheResultSetMetadata", "true");
properties.putIfAbsent("cacheServerConfiguration", "true");
properties.putIfAbsent("elideSetAutoCommits", "true");
properties.putIfAbsent("maintainTimeStats", "false");
properties.putIfAbsent("alwaysSendSetIsolation", "false");
properties.putIfAbsent("cacheCallableStmts", "true");
// https://stackoverflow.com/a/54256150
properties.putIfAbsent("serverTimezone", "UTC");
super.overrideProperties(properties);
}
@Override
public Function<String, String> getStatementProcessor() {
return s -> s.replace("'", "`");
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.implementation.sql.connection.hikari;
import com.zaxxer.hikari.HikariConfig;
import me.pikamug.quests.storage.misc.StorageCredentials;
import java.util.Map;
import java.util.function.Function;
public class MySqlConnectionFactory extends HikariConnectionFactory {
public MySqlConnectionFactory(final StorageCredentials configuration) {
super(configuration);
}
@Override
public String getImplementationName() {
return "MySQL";
}
@Override
protected String defaultPort() {
return "3306";
}
@Override
protected void configureDatabase(final HikariConfig config, final String address, final String port,
final String databaseName, final String username, final String password) {
config.setDriverClassName("com.mysql.cj.jdbc.Driver");
config.setJdbcUrl("jdbc:mysql://" + address + ":" + port + "/" + databaseName);
config.setUsername(username);
config.setPassword(password);
}
@Override
protected void overrideProperties(final Map<String, String> properties) {
// https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration
properties.putIfAbsent("cachePrepStmts", "true");
properties.putIfAbsent("prepStmtCacheSize", "250");
properties.putIfAbsent("prepStmtCacheSqlLimit", "2048");
properties.putIfAbsent("useServerPrepStmts", "true");
properties.putIfAbsent("useLocalSessionState", "true");
properties.putIfAbsent("rewriteBatchedStatements", "true");
properties.putIfAbsent("cacheResultSetMetadata", "true");
properties.putIfAbsent("cacheServerConfiguration", "true");
properties.putIfAbsent("elideSetAutoCommits", "true");
properties.putIfAbsent("maintainTimeStats", "false");
properties.putIfAbsent("alwaysSendSetIsolation", "false");
properties.putIfAbsent("cacheCallableStmts", "true");
// https://stackoverflow.com/a/54256150
properties.putIfAbsent("serverTimezone", "UTC");
super.overrideProperties(properties);
}
@Override
public Function<String, String> getStatementProcessor() {
return s -> s.replace('\'', '`');
}
}

View File

@ -1,79 +1,83 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.storage.misc;
import java.util.Map;
import java.util.Objects;
public class StorageCredentials {
private final String address;
private final String database;
private final String username;
private final String password;
private final int maxPoolSize;
private final int minIdleConnections;
private final int maxLifetime;
private final int connectionTimeout;
private final Map<String, String> properties;
public StorageCredentials(final String address, final String database, final String username, final String password,
final int maxPoolSize, final int minIdleConnections, final int maxLifetime, final int connectionTimeout,
final Map<String, String> properties) {
this.address = address;
this.database = database;
this.username = username;
this.password = password;
this.maxPoolSize = maxPoolSize;
this.minIdleConnections = minIdleConnections;
this.maxLifetime = maxLifetime;
this.connectionTimeout = connectionTimeout;
this.properties = properties;
}
public String getAddress() {
return Objects.requireNonNull(address, "address");
}
public String getDatabase() {
return Objects.requireNonNull(database, "database");
}
public String getUsername() {
return Objects.requireNonNull(username, "username");
}
public String getPassword() {
return Objects.requireNonNull(password, "password");
}
public int getMaxPoolSize() {
return maxPoolSize;
}
public int getMinIdleConnections() {
return minIdleConnections;
}
public int getMaxLifetime() {
return maxLifetime;
}
public int getConnectionTimeout() {
return connectionTimeout;
}
public Map<String, String> getProperties() {
return properties;
}
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.storage.misc;
import java.util.Map;
import java.util.Objects;
public class StorageCredentials {
private final String address;
private final String database;
private final String username;
private final String password;
private final int maxPoolSize;
private final int minIdleConnections;
private final int maxLifetime;
private final int keepAliveTime;
private final int connectionTimeout;
private final Map<String, String> properties;
public StorageCredentials(final String address, final String database, final String username, final String password,
final int maxPoolSize, final int minIdleConnections, final int maxLifetime, final int keepAliveTime,
final int connectionTimeout, final Map<String, String> properties) {
this.address = address;
this.database = database;
this.username = username;
this.password = password;
this.maxPoolSize = maxPoolSize;
this.minIdleConnections = minIdleConnections;
this.maxLifetime = maxLifetime;
this.keepAliveTime = keepAliveTime;
this.connectionTimeout = connectionTimeout;
this.properties = properties;
}
public String getAddress() {
return Objects.requireNonNull(address, "address");
}
public String getDatabase() {
return Objects.requireNonNull(database, "database");
}
public String getUsername() {
return Objects.requireNonNull(username, "username");
}
public String getPassword() {
return Objects.requireNonNull(password, "password");
}
public int getMaxPoolSize() {
return maxPoolSize;
}
public int getMinIdleConnections() {
return minIdleConnections;
}
public int getMaxLifetime() {
return maxLifetime;
}
public int getKeepAliveTime() {
return keepAliveTime;
}
public int getConnectionTimeout() {
return connectionTimeout;
}
public Map<String, String> getProperties() {
return properties;
}
}

View File

@ -1,193 +1,198 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.util;
public class CK {
// Temporary data storage for prompts and factories
public static final String ED_QUEST_EDIT = "edit";
public static final String ED_QUEST_DELETE = "delQuest";
public static final String ED_EVENT_DELETE = "delEvent";
public static final String ED_CONDITION_DELETE = "delCondition";
// Quests
public static final String Q_ID = "questId";
public static final String Q_NAME = "questName";
public static final String Q_ASK_MESSAGE = "askMessage";
public static final String Q_FINISH_MESSAGE = "finishMessage";
public static final String Q_START_NPC = "npcStart";
public static final String Q_START_BLOCK = "blockStart";
public static final String Q_INITIAL_EVENT = "initialEvent";
public static final String Q_REGION = "region";
public static final String Q_GUIDISPLAY = "guiDisplay";
// Requirements
public static final String REQ_MONEY = "moneyReq";
public static final String REQ_QUEST_POINTS = "questPointsReq";
public static final String REQ_ITEMS = "itemReqs";
public static final String REQ_ITEMS_REMOVE = "removeItemReqs";
public static final String REQ_PERMISSION = "permissionReqs";
public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
public static final String REQ_QUEST = "questReqs";
public static final String REQ_QUEST_BLOCK = "questBlocks";
public static final String REQ_CUSTOM = "customReqs";
public static final String REQ_CUSTOM_DATA = "customReqData";
public static final String REQ_CUSTOM_DATA_DESCRIPTIONS = "customReqDataDesc";
public static final String REQ_CUSTOM_DATA_TEMP = "customReqDataTemp";
public static final String REQ_FAIL_MESSAGE = "failMessage";
// Stages
public static final String S_BREAK_NAMES = "breakNames";
public static final String S_BREAK_AMOUNTS = "breakAmounts";
public static final String S_BREAK_DURABILITY = "breakDurability";
public static final String S_DAMAGE_NAMES = "damageNames";
public static final String S_DAMAGE_AMOUNTS = "damageAmounts";
public static final String S_DAMAGE_DURABILITY = "damageDurability";
public static final String S_PLACE_NAMES = "placeNames";
public static final String S_PLACE_AMOUNTS = "placeAmounts";
public static final String S_PLACE_DURABILITY = "placeDurability";
public static final String S_USE_NAMES = "useNames";
public static final String S_USE_AMOUNTS = "useAmounts";
public static final String S_USE_DURABILITY = "useDurability";
public static final String S_CUT_NAMES = "cutNames";
public static final String S_CUT_AMOUNTS = "cutAmounts";
public static final String S_CUT_DURABILITY = "cutDurability";
public static final String S_COW_MILK = "cowMilk";
public static final String S_FISH = "fish";
public static final String S_PLAYER_KILL = "playerKill";
public static final String S_CRAFT_ITEMS = "craftItems";
public static final String S_SMELT_ITEMS = "smeltItems";
public static final String S_CONSUME_ITEMS = "consumeItems";
public static final String S_ENCHANT_ITEMS = "enchantItems";
public static final String S_BREW_ITEMS = "brewItems";
public static final String S_DELIVERY_ITEMS = "deliveryItems";
public static final String S_DELIVERY_NPCS = "deliveryNPCs";
public static final String S_DELIVERY_MESSAGES = "deliveryMessages";
public static final String S_NPCS_TO_TALK_TO = "npcIdsToTalkTo";
public static final String S_NPCS_TO_KILL = "npcIdsToKill";
public static final String S_NPCS_TO_KILL_AMOUNTS = "npcAmountsToKill";
public static final String S_MOB_TYPES = "mobTypes";
public static final String S_MOB_AMOUNTS = "mobAmounts";
public static final String S_MOB_KILL_LOCATIONS = "killLocations";
public static final String S_MOB_KILL_LOCATIONS_RADIUS = "killLocationRadii";
public static final String S_MOB_KILL_LOCATIONS_NAMES = "killLocationNames";
public static final String S_REACH_LOCATIONS = "reachLocations";
public static final String S_REACH_LOCATIONS_RADIUS = "reachLocationRadii";
public static final String S_REACH_LOCATIONS_NAMES = "reachLocationNames";
public static final String S_TAME_TYPES = "tameTypes";
public static final String S_TAME_AMOUNTS = "tameAmounts";
public static final String S_SHEAR_COLORS = "shearColors";
public static final String S_SHEAR_AMOUNTS = "shearAmounts";
public static final String S_START_EVENT = "startEvent";
public static final String S_FINISH_EVENT = "finishEvent";
public static final String S_FAIL_EVENT = "failEvent";
public static final String S_CHAT_EVENTS = "chatEvents";
public static final String S_CHAT_EVENT_TRIGGERS = "chatEventTriggers";
public static final String S_CHAT_TEMP_EVENT = "chatTempEvent";
public static final String S_COMMAND_EVENTS = "commandEvents";
public static final String S_COMMAND_EVENT_TRIGGERS = "commandEventTriggers";
public static final String S_COMMAND_TEMP_EVENT = "commandTempEvent";
public static final String S_DEATH_EVENT = "deathEvent";
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
public static final String S_CONDITION = "condition";
public static final String S_DELAY = "delay";
public static final String S_DELAY_MESSAGE = "delayMessage";
public static final String S_DENIZEN = "denizen"; // Legacy
public static final String S_COMPLETE_MESSAGE = "completeMessage";
public static final String S_START_MESSAGE = "startMessage";
public static final String S_PASSWORD_DISPLAYS = "passwordDisplays";
public static final String S_PASSWORD_PHRASES = "passwordPhrases";
public static final String S_CUSTOM_OBJECTIVES = "customObjectives";
public static final String S_CUSTOM_OBJECTIVES_COUNT = "customObjectiveCounts";
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
public static final String S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS = "customObjectiveDataDescriptions";
public static final String S_CUSTOM_OBJECTIVES_DATA_TEMP = "customObjectiveDataTemp";
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
// Rewards
public static final String REW_MONEY = "moneyRew";
public static final String REW_QUEST_POINTS = "questPointsRew";
public static final String REW_ITEMS = "itemRews";
public static final String REW_EXP = "expRew";
public static final String REW_COMMAND = "commandRews";
public static final String REW_COMMAND_OVERRIDE_DISPLAY = "commandOverrideDisplay";
public static final String REW_PERMISSION = "permissionRews";
public static final String REW_PERMISSION_WORLDS = "permissionWorlds";
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
public static final String REW_HEROES_CLASSES = "heroesClassRews";
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
public static final String REW_PARTIES_EXPERIENCE = "partiesExperienceRews";
public static final String REW_PHAT_LOOTS = "phatLootRews";
public static final String REW_CUSTOM = "customRews";
public static final String REW_CUSTOM_DATA = "customRewData";
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
public static final String REW_DETAILS_OVERRIDE = "detailsOverrideRew";
// Planner
public static final String PLN_START_DATE = "startDatePln";
public static final String PLN_END_DATE = "endDatePln";
public static final String PLN_REPEAT_CYCLE = "repeatCyclePln";
public static final String PLN_COOLDOWN = "cooldownPln";
public static final String PLN_OVERRIDE = "overridePln";
// Options
public static final String OPT_ALLOW_COMMANDS = "allowCommandsOpt";
public static final String OPT_ALLOW_QUITTING = "allowQuittingOpt";
public static final String OPT_IGNORE_SILK_TOUCH = "ignoreSilkTouchOpt";
public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt";
public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt";
public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt";
public static final String OPT_SHARE_SAME_QUEST_ONLY = "shareSameQuestOnlyOpt";
public static final String OPT_SHARE_DISTANCE = "shareDistance";
public static final String OPT_HANDLE_OFFLINE_PLAYERS = "handleOfflinePlayers";
// Actions
public static final String E_OLD_EVENT = "oldEvent";
public static final String E_NAME = "evtName";
public static final String E_MESSAGE = "evtMessage";
public static final String E_CLEAR_INVENTORY = "evtClearInv";
public static final String E_FAIL_QUEST = "evtFailQuest";
public static final String E_ITEMS = "evtItems";
public static final String E_ITEMS_AMOUNTS = "evtItemAmounts";
public static final String E_EXPLOSIONS = "evtExplosions";
public static final String E_EFFECTS = "evtEffects";
public static final String E_EFFECTS_LOCATIONS = "evtEffectLocations";
public static final String E_WORLD_STORM = "evtStormWorld";
public static final String E_WORLD_STORM_DURATION = "evtStormDuration";
public static final String E_WORLD_THUNDER = "evtThunderWorld";
public static final String E_WORLD_THUNDER_DURATION = "evtThunderDuration";
public static final String E_MOB_TYPES = "evtMobTypes";
public static final String E_LIGHTNING = "evtLightningStrikes";
public static final String E_POTION_TYPES = "evtPotionTypes";
public static final String E_POTION_DURATIONS = "evtPotionDurations";
public static final String E_POTION_STRENGTH = "evtPotionMagnitudes";
public static final String E_HUNGER = "evtHunger";
public static final String E_SATURATION = "evtSaturation";
public static final String E_HEALTH = "evtHealth";
public static final String E_TELEPORT = "evtTeleportLocation";
public static final String E_COMMANDS = "evtCommands";
public static final String E_TIMER = "evtTimer";
public static final String E_CANCEL_TIMER = "evtCancelTimer";
public static final String E_DENIZEN = "evtDenizen";
// Conditions
public static final String C_OLD_CONDITION = "oldCondition";
public static final String C_NAME = "conName";
public static final String C_FAIL_QUEST = "conFailQuest";
public static final String C_WHILE_RIDING_ENTITY = "conRidingEntity";
public static final String C_WHILE_RIDING_NPC = "conRidingNpc";
public static final String C_WHILE_PERMISSION = "conPermission";
public static final String C_WHILE_HOLDING_MAIN_HAND = "conHoldingMainHand";
public static final String C_WHILE_WITHIN_WORLD = "conWithinWorld";
public static final String C_WHILE_WITHIN_BIOME = "conWithinBiome";
public static final String C_WHILE_WITHIN_REGION = "conWithinRegion";
public static final String C_WHILE_PLACEHOLDER_ID = "conPlaceholderId";
public static final String C_WHILE_PLACEHOLDER_VAL = "conPlaceholderVal";
}
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.util;
/**
* Human-readable keys for session data of prompts and factories
*/
public class Key {
public static final String ED_QUEST_EDIT = "edit";
public static final String ED_QUEST_DELETE = "delQuest";
public static final String ED_EVENT_DELETE = "delEvent";
public static final String ED_CONDITION_DELETE = "delCondition";
// Quests
public static final String Q_ID = "questId";
public static final String Q_NAME = "questName";
public static final String Q_ASK_MESSAGE = "askMessage";
public static final String Q_FINISH_MESSAGE = "finishMessage";
public static final String Q_START_NPC = "npcStart";
public static final String Q_START_BLOCK = "blockStart";
public static final String Q_INITIAL_EVENT = "initialEvent";
public static final String Q_REGION = "region";
public static final String Q_GUIDISPLAY = "guiDisplay";
// Requirements
public static final String REQ_MONEY = "moneyReq";
public static final String REQ_QUEST_POINTS = "questPointsReq";
public static final String REQ_ITEMS = "itemReqs";
public static final String REQ_ITEMS_REMOVE = "removeItemReqs";
public static final String REQ_EXP = "expReq";
public static final String REQ_PERMISSION = "permissionReqs";
public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
public static final String REQ_QUEST = "questReqs";
public static final String REQ_QUEST_BLOCK = "questBlocks";
public static final String REQ_CUSTOM = "customReqs";
public static final String REQ_CUSTOM_DATA = "customReqData";
public static final String REQ_CUSTOM_DATA_DESCRIPTIONS = "customReqDataDesc";
public static final String REQ_CUSTOM_DATA_TEMP = "customReqDataTemp";
public static final String REQ_FAIL_MESSAGE = "failMessage";
// Stages
public static final String S_BREAK_NAMES = "breakNames";
public static final String S_BREAK_AMOUNTS = "breakAmounts";
public static final String S_BREAK_DURABILITY = "breakDurability";
public static final String S_DAMAGE_NAMES = "damageNames";
public static final String S_DAMAGE_AMOUNTS = "damageAmounts";
public static final String S_DAMAGE_DURABILITY = "damageDurability";
public static final String S_PLACE_NAMES = "placeNames";
public static final String S_PLACE_AMOUNTS = "placeAmounts";
public static final String S_PLACE_DURABILITY = "placeDurability";
public static final String S_USE_NAMES = "useNames";
public static final String S_USE_AMOUNTS = "useAmounts";
public static final String S_USE_DURABILITY = "useDurability";
public static final String S_CUT_NAMES = "cutNames";
public static final String S_CUT_AMOUNTS = "cutAmounts";
public static final String S_CUT_DURABILITY = "cutDurability";
public static final String S_COW_MILK = "cowMilk";
public static final String S_FISH = "fish";
public static final String S_PLAYER_KILL = "playerKill";
public static final String S_CRAFT_ITEMS = "craftItems";
public static final String S_SMELT_ITEMS = "smeltItems";
public static final String S_CONSUME_ITEMS = "consumeItems";
public static final String S_ENCHANT_ITEMS = "enchantItems";
public static final String S_BREW_ITEMS = "brewItems";
public static final String S_DELIVERY_ITEMS = "deliveryItems";
public static final String S_DELIVERY_NPCS = "deliveryNPCs";
public static final String S_DELIVERY_MESSAGES = "deliveryMessages";
public static final String S_NPCS_TO_TALK_TO = "npcIdsToTalkTo";
public static final String S_NPCS_TO_KILL = "npcIdsToKill";
public static final String S_NPCS_TO_KILL_AMOUNTS = "npcAmountsToKill";
public static final String S_MOB_TYPES = "mobTypes";
public static final String S_MOB_AMOUNTS = "mobAmounts";
public static final String S_MOB_KILL_LOCATIONS = "killLocations";
public static final String S_MOB_KILL_LOCATIONS_RADIUS = "killLocationRadii";
public static final String S_MOB_KILL_LOCATIONS_NAMES = "killLocationNames";
public static final String S_REACH_LOCATIONS = "reachLocations";
public static final String S_REACH_LOCATIONS_RADIUS = "reachLocationRadii";
public static final String S_REACH_LOCATIONS_NAMES = "reachLocationNames";
public static final String S_TAME_TYPES = "tameTypes";
public static final String S_TAME_AMOUNTS = "tameAmounts";
public static final String S_SHEAR_COLORS = "shearColors";
public static final String S_SHEAR_AMOUNTS = "shearAmounts";
public static final String S_START_EVENT = "startEvent";
public static final String S_FINISH_EVENT = "finishEvent";
public static final String S_FAIL_EVENT = "failEvent";
public static final String S_CHAT_EVENTS = "chatEvents";
public static final String S_CHAT_EVENT_TRIGGERS = "chatEventTriggers";
public static final String S_CHAT_TEMP_EVENT = "chatTempEvent";
public static final String S_COMMAND_EVENTS = "commandEvents";
public static final String S_COMMAND_EVENT_TRIGGERS = "commandEventTriggers";
public static final String S_COMMAND_TEMP_EVENT = "commandTempEvent";
public static final String S_DEATH_EVENT = "deathEvent";
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
public static final String S_CONDITION = "condition";
public static final String S_DELAY = "delay";
public static final String S_DELAY_MESSAGE = "delayMessage";
public static final String S_DENIZEN = "denizen"; // Legacy
public static final String S_COMPLETE_MESSAGE = "completeMessage";
public static final String S_START_MESSAGE = "startMessage";
public static final String S_PASSWORD_DISPLAYS = "passwordDisplays";
public static final String S_PASSWORD_PHRASES = "passwordPhrases";
public static final String S_CUSTOM_OBJECTIVES = "customObjectives";
public static final String S_CUSTOM_OBJECTIVES_COUNT = "customObjectiveCounts";
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
public static final String S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS = "customObjectiveDataDescriptions";
public static final String S_CUSTOM_OBJECTIVES_DATA_TEMP = "customObjectiveDataTemp";
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
// Rewards
public static final String REW_MONEY = "moneyRew";
public static final String REW_QUEST_POINTS = "questPointsRew";
public static final String REW_ITEMS = "itemRews";
public static final String REW_EXP = "expRew";
public static final String REW_COMMAND = "commandRews";
public static final String REW_COMMAND_OVERRIDE_DISPLAY = "commandOverrideDisplay";
public static final String REW_PERMISSION = "permissionRews";
public static final String REW_PERMISSION_WORLDS = "permissionWorlds";
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
public static final String REW_HEROES_CLASSES = "heroesClassRews";
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
public static final String REW_PARTIES_EXPERIENCE = "partiesExperienceRews";
public static final String REW_PHAT_LOOTS = "phatLootRews";
public static final String REW_CUSTOM = "customRews";
public static final String REW_CUSTOM_DATA = "customRewData";
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
public static final String REW_DETAILS_OVERRIDE = "detailsOverrideRew";
// Planner
public static final String PLN_START_DATE = "startDatePln";
public static final String PLN_END_DATE = "endDatePln";
public static final String PLN_REPEAT_CYCLE = "repeatCyclePln";
public static final String PLN_COOLDOWN = "cooldownPln";
public static final String PLN_OVERRIDE = "overridePln";
// Options
public static final String OPT_ALLOW_COMMANDS = "allowCommandsOpt";
public static final String OPT_ALLOW_QUITTING = "allowQuittingOpt";
public static final String OPT_IGNORE_SILK_TOUCH = "ignoreSilkTouchOpt";
public static final String OPT_EXTERNAL_PARTY_PLUGIN = "externalPartyPluginOpt";
public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt";
public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt";
public static final String OPT_SHARE_SAME_QUEST_ONLY = "shareSameQuestOnlyOpt";
public static final String OPT_SHARE_DISTANCE = "shareDistance";
public static final String OPT_HANDLE_OFFLINE_PLAYERS = "handleOfflinePlayers";
public static final String OPT_IGNORE_BLOCK_REPLACE = "ignoreBlockReplace";
// Actions
public static final String A_OLD_ACTION = "oldAction";
public static final String A_NAME = "actName";
public static final String A_MESSAGE = "actMessage";
public static final String A_CLEAR_INVENTORY = "actClearInv";
public static final String A_FAIL_QUEST = "actFailQuest";
public static final String A_ITEMS = "actItems";
public static final String A_ITEMS_AMOUNTS = "actItemAmounts";
public static final String A_EXPLOSIONS = "actExplosions";
public static final String A_EFFECTS = "actEffects";
public static final String A_EFFECTS_LOCATIONS = "actEffectLocations";
public static final String A_WORLD_STORM = "actStormWorld";
public static final String A_WORLD_STORM_DURATION = "actStormDuration";
public static final String A_WORLD_THUNDER = "actThunderWorld";
public static final String A_WORLD_THUNDER_DURATION = "actThunderDuration";
public static final String A_MOBS = "actMobs";
public static final String A_LIGHTNING = "actLightningStrikes";
public static final String A_POTION_TYPES = "actPotionTypes";
public static final String A_POTION_DURATIONS = "actPotionDurations";
public static final String A_POTION_STRENGTH = "actPotionMagnitudes";
public static final String A_HUNGER = "actHunger";
public static final String A_SATURATION = "actSaturation";
public static final String A_HEALTH = "actHealth";
public static final String A_TELEPORT = "actTeleportLocation";
public static final String A_COMMANDS = "actCommands";
public static final String A_TIMER = "actTimer";
public static final String A_CANCEL_TIMER = "actCancelTimer";
public static final String A_DENIZEN = "actDenizen";
// Conditions
public static final String C_OLD_CONDITION = "oldCondition";
public static final String C_NAME = "conName";
public static final String C_FAIL_QUEST = "conFailQuest";
public static final String C_WHILE_RIDING_ENTITY = "conRidingEntity";
public static final String C_WHILE_RIDING_NPC = "conRidingNpc";
public static final String C_WHILE_PERMISSION = "conPermission";
public static final String C_WHILE_HOLDING_MAIN_HAND = "conHoldingMainHand";
public static final String C_WHILE_WEARING = "conWearing";
public static final String C_WHILE_WITHIN_WORLD = "conWithinWorld";
public static final String C_WHILE_WITHIN_TICKS_START = "conWithinTicksStart";
public static final String C_WHILE_WITHIN_TICKS_END = "conWithinTicksEnd";
public static final String C_WHILE_WITHIN_BIOME = "conWithinBiome";
public static final String C_WHILE_WITHIN_REGION = "conWithinRegion";
public static final String C_WHILE_PLACEHOLDER_ID = "conPlaceholderId";
public static final String C_WHILE_PLACEHOLDER_VAL = "conPlaceholderVal";
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.util;
import java.util.TreeMap;
public class RomanNumeral {
private final static TreeMap<Integer, String> map = new TreeMap<>();
static {
map.put(1000, "M");
map.put(900, "CM");
map.put(500, "D");
map.put(400, "CD");
map.put(100, "C");
map.put(90, "XC");
map.put(50, "L");
map.put(40, "XL");
map.put(10, "X");
map.put(9, "IX");
map.put(5, "V");
map.put(4, "IV");
map.put(1, "I");
}
public static String getNumeral(final int number) {
final int l = map.floorKey(number);
if ( number == l ) {
return map.get(number);
}
return map.get(l) + getNumeral(number-l);
}
}

View File

@ -1,20 +1,22 @@
<?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/xsd/maven-4.0.0.xsd">
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>
<parent>
<groupId>me.blackvein.quests</groupId>
<groupId>me.pikamug.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>4.0.6</version>
<version>${revision}</version>
</parent>
<artifactId>quests-main</artifactId>
<artifactId>quests-core</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- CitizensBooks, DungeonsXL, GPS, LocaleLib, mcMMO Classic, PhatLoots -->
<!-- LocaleLib, mcMMO Classic, PhatLoots, Unite, ZNPCsPlus -->
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
@ -23,14 +25,19 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<!-- Citizens, Denizen -->
<id>citizens-repo</id>
<url>http://repo.citizensnpcs.co/</url>
<!-- NBT API -->
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<!-- WorldEdit -->
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
<!-- Citizens, Denizen -->
<id>citizens-repo</id>
<url>https://repo.citizensnpcs.co/</url>
</repository>
<repository>
<!-- WorldEdit, WorldGuard -->
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<!-- Parties -->
@ -40,32 +47,48 @@
<repository>
<!-- PlaceholderAPI -->
<id>papi-repo</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<!-- Heroes, Vault -->
<id>hc-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
<url>https://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
<repository>
<!-- AstralBooks -->
<id>repsy-release</id>
<url>https://repo.repsy.io/mvn/niconeko/release</url>
</repository>
<repository>
<!-- PacketEvents for ZNPCsPlus -->
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
<repository>
<!-- Pyr's Repo (ZNPCsPlus 2.X) -->
<id>pyr-snapshots</id>
<name>Pyr's Repo</name>
<url>https://repo.pyr.lol/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId>
<version>2.0.21-SNAPSHOT</version>
<artifactId>citizensapi</artifactId>
<version>2.0.30-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.denizenscript</groupId>
<artifactId>denizen</artifactId>
<version>1.1.3-SNAPSHOT</version>
<version>1.2.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -82,14 +105,14 @@
</dependency>
<dependency>
<groupId>com.herocraftonline.heroes</groupId>
<artifactId>heroes-stripped</artifactId>
<version>4dd3dd85</version>
<artifactId>Heroes</artifactId>
<version>1.9.26-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.5-SNAPSHOT</version>
<version>7.2.8</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -101,71 +124,82 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<version>2.11.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.nicuch</groupId>
<artifactId>CitizensBooks</artifactId>
<version>2.5.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.RednedEpic</groupId>
<artifactId>PhatLoots</artifactId>
<version>e55d0ba1f6</version>
<groupId>ro.niconeko</groupId>
<artifactId>astralbooks-api</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alessiodp.parties</groupId>
<artifactId>parties-api</artifactId>
<version>3.1.6</version>
<version>3.2.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.retrooper.packetevents</groupId>
<artifactId>spigot</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Pyrbu</groupId>
<artifactId>ZNPCsPlus</artifactId>
<version>271b087586</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>lol.pyr</groupId>
<artifactId>znpcsplus-api</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.PikaMug</groupId>
<artifactId>Unite</artifactId>
<version>1.0.0</version>
<version>d0c4de0ca1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.PikaMug</groupId>
<artifactId>LocaleLib</artifactId>
<version>2.2</version>
<version>3.9</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
<groupId>xyz.upperlevel.spigot.book</groupId>
<artifactId>spigot-book-api</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<version>1.7.33</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>me.pikamug.quests</groupId>
<artifactId>quests-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
@ -183,19 +217,20 @@
</resource>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/</directory>
<directory>${basedir}</directory>
<filtering>false</filtering>
<includes>
<include>README.md</include>
<include>LICENSE.txt</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -211,7 +246,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
@ -224,34 +259,49 @@
</configuration>
</execution>
</executions>
<configuration>
<artifactSet>
<includes>
<include>me.*</include>
<include>com.github.PikaMug:LocaleLib</include>
<include>com.zaxxer:HikariCP</include>
<include>de.tr7zw:item-nbt-api-plugin</include>
<include>org.slf4j:slf4j-simple</include>
<include>org.slf4j:slf4j-api</include>
<include>mysql</include>
<include>xyz.upperlevel.spigot.book:spigot-book-api</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
<exclude>LICENSE</exclude>
</excludes>
</filter>
<filter>
<artifact>com.github.PikaMug:LocaleLib</artifact>
<excludes>
<exclude>plugin.yml</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>me.pikamug.localelib</pattern>
<shadedPattern>me.blackvein.quests.libs.localelib</shadedPattern>
<shadedPattern>me.pikamug.quests.libs.localelib</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>me.blackvein.quests.libs.hikari</shadedPattern>
<pattern>de.tr7zw</pattern>
<shadedPattern>me.pikamug.quests.libs.nbtapi</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>me.blackvein.quests.libs.slf4j</shadedPattern>
<shadedPattern>me.pikamug.quests.libs.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>com.mysql</pattern>
<shadedPattern>me.blackvein.quests.libs.mysql</shadedPattern>
<pattern>xyz.upperlevel.spigot.book</pattern>
<shadedPattern>me.pikamug.quests.libs.bookutil</shadedPattern>
</relocation>
</relocations>
</configuration>

View File

@ -0,0 +1,895 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests;
import me.pikamug.localelib.LocaleManager;
import me.pikamug.quests.actions.Action;
import me.pikamug.quests.actions.BukkitActionFactory;
import me.pikamug.quests.conditions.BukkitConditionFactory;
import me.pikamug.quests.conditions.Condition;
import me.pikamug.quests.config.BukkitConfigSettings;
import me.pikamug.quests.config.ConfigSettings;
import me.pikamug.quests.convo.misc.NpcOfferQuestPrompt;
import me.pikamug.quests.convo.misc.QuestAcceptPrompt;
import me.pikamug.quests.dependencies.BukkitDenizenTrigger;
import me.pikamug.quests.dependencies.BukkitDependencies;
import me.pikamug.quests.interfaces.ReloadCallback;
import me.pikamug.quests.listeners.*;
import me.pikamug.quests.logging.BukkitQuestsLog4JFilter;
import me.pikamug.quests.storage.implementation.jar.BukkitModuleJarStorage;
import me.pikamug.quests.storage.implementation.ModuleStorageImpl;
import me.pikamug.quests.module.CustomObjective;
import me.pikamug.quests.module.CustomRequirement;
import me.pikamug.quests.module.CustomReward;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.BukkitQuestFactory;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.statistics.BukkitMetrics;
import me.pikamug.quests.storage.BukkitStorageFactory;
import me.pikamug.quests.storage.QuesterStorage;
import me.pikamug.quests.storage.implementation.file.BukkitActionYamlStorage;
import me.pikamug.quests.storage.implementation.file.BukkitConditionYamlStorage;
import me.pikamug.quests.storage.implementation.file.BukkitQuestYamlStorage;
import me.pikamug.quests.tasks.BukkitNpcEffectThread;
import me.pikamug.quests.tasks.BukkitPlayerMoveThread;
import me.pikamug.quests.util.BukkitLang;
import me.pikamug.quests.util.BukkitUpdateChecker;
import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.TabExecutor;
import org.bukkit.conversations.Conversable;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class BukkitQuestsPlugin extends JavaPlugin implements Quests {
private boolean loading = true;
private String bukkitVersion = "0";
private BukkitDependencies depends;
private BukkitActionYamlStorage actionLoader;
private BukkitConditionYamlStorage conditionLoader;
private ConfigSettings configSettings;
private ModuleStorageImpl customLoader;
private BukkitQuestYamlStorage questLoader;
private List<CustomObjective> customObjectives = new LinkedList<>();
private List<CustomRequirement> customRequirements = new LinkedList<>();
private List<CustomReward> customRewards = new LinkedList<>();
private Collection<Quester> questers = new ConcurrentSkipListSet<>();
private Collection<Quest> quests = new ConcurrentSkipListSet<>();
private Collection<Action> actions = new ConcurrentSkipListSet<>();
private Collection<Condition> conditions = new ConcurrentSkipListSet<>();
private Collection<UUID> questNpcUuids = new ConcurrentSkipListSet<>();
private TabExecutor cmdExecutor;
private ConversationFactory conversationFactory;
private ConversationFactory npcConversationFactory;
private BukkitQuestFactory questFactory;
private BukkitActionFactory actionFactory;
private BukkitConditionFactory conditionFactory;
private BukkitConvoListener convoListener;
private BukkitBlockListener blockListener;
private BukkitItemListener itemListener;
private BukkitCitizensListener citizensListener;
private BukkitZnpcsListener znpcsListener;
private BukkitZnpcsApiListener znpcsPlusListener;
private BukkitPlayerListener playerListener;
private BukkitNpcEffectThread effectThread;
private BukkitPlayerMoveThread moveThread;
private BukkitUniteListener uniteListener;
private BukkitPartiesListener partiesListener;
private BukkitDenizenTrigger trigger;
private LocaleManager localeManager;
private QuesterStorage storage;
@Override
public void onEnable() {
/*----> WARNING: ORDER OF STEPS MATTERS <----*/
// 1 - Trigger server to initialize Legacy Material Support
try {
Material.matchMaterial("STONE", true);
} catch (final NoSuchMethodError ignored) {
}
((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addFilter(new BukkitQuestsLog4JFilter());
// 2 - Initialize variables
bukkitVersion = Bukkit.getServer().getBukkitVersion().split("-")[0];
actionLoader = new BukkitActionYamlStorage(this);
conditionLoader = new BukkitConditionYamlStorage(this);
configSettings = new BukkitConfigSettings(this);
customLoader = new BukkitModuleJarStorage(this);
questLoader = new BukkitQuestYamlStorage(this);
try {
Class.forName("me.pikamug.quests.libs.localelib.LocaleManager");
localeManager = new LocaleManager();
} catch (final Exception ignored) {
getLogger().warning("LocaleLib not present! Is this a debug environment?");
}
convoListener = new BukkitConvoListener();
blockListener = new BukkitBlockListener(this);
itemListener = new BukkitItemListener(this);
citizensListener = new BukkitCitizensListener(this);
znpcsListener = new BukkitZnpcsListener(this);
znpcsPlusListener = new BukkitZnpcsApiListener(this);
playerListener = new BukkitPlayerListener(this);
uniteListener = new BukkitUniteListener();
partiesListener = new BukkitPartiesListener();
effectThread = new BukkitNpcEffectThread(this);
moveThread = new BukkitPlayerMoveThread(this);
questFactory = new BukkitQuestFactory(this);
actionFactory = new BukkitActionFactory(this);
conditionFactory = new BukkitConditionFactory(this);
depends = new BukkitDependencies(this);
trigger = new BukkitDenizenTrigger(this);
// 3 - Load main config
configSettings.init();
if (configSettings.getLanguage().contains("-")) {
final BukkitMetrics metrics = new BukkitMetrics(this);
metrics.addCustomChart(new BukkitMetrics.SimplePie("language", () -> configSettings.getLanguage()));
}
// 4 - Setup language files
try {
BukkitLang.init(this);
} catch (final IOException | URISyntaxException e) {
e.printStackTrace();
}
// 5 - Load command executor
cmdExecutor = new BukkitCommandManager(this);
// 6 - Load soft-depends
depends.init();
// 7 - Transfer resources from jar
moveStorageResource("quests.yml");
moveStorageResource("actions.yml");
moveStorageResource("conditions.yml");
saveResourceAs("quests.yml", "storage/quests.yml", false);
saveResourceAs("actions.yml", "storage/actions.yml", false);
saveResourceAs("conditions.yml", "storage/conditions.yml", false);
// 8 - Save config with any new options
getConfig().options().copyDefaults(true);
getConfig().options().header("See https://pikamug.gitbook.io/quests/setup/configuration");
saveConfig();
final BukkitStorageFactory storageFactory = new BukkitStorageFactory(this);
storage = storageFactory.getInstance();
// 9 - Setup commands
if (getCommand("quests") != null) {
Objects.requireNonNull(getCommand("quests")).setExecutor(getTabExecutor());
Objects.requireNonNull(getCommand("quests")).setTabCompleter(getTabExecutor());
}
if (getCommand("questadmin") != null) {
Objects.requireNonNull(getCommand("questadmin")).setExecutor(getTabExecutor());
Objects.requireNonNull(getCommand("questadmin")).setTabCompleter(getTabExecutor());
}
if (getCommand("quest") != null) {
Objects.requireNonNull(getCommand("quest")).setExecutor(getTabExecutor());
Objects.requireNonNull(getCommand("quest")).setTabCompleter(getTabExecutor());
}
// 10 - Build conversation factories
this.conversationFactory = new ConversationFactory(this).withModality(false)
.withPrefix(context -> ChatColor.GRAY.toString())
.withFirstPrompt(new QuestAcceptPrompt(this)).withTimeout(configSettings.getAcceptTimeout())
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
.addConversationAbandonedListener(convoListener);
this.npcConversationFactory = new ConversationFactory(this).withModality(false)
.withFirstPrompt(new NpcOfferQuestPrompt(this)).withTimeout(configSettings.getAcceptTimeout())
.withLocalEcho(false).addConversationAbandonedListener(convoListener);
// 11 - Register listeners
getServer().getPluginManager().registerEvents(getBlockListener(), this);
getServer().getPluginManager().registerEvents(getItemListener(), this);
depends.linkCitizens();
if (depends.getZnpcsPlus() != null) {
getServer().getPluginManager().registerEvents(getZnpcsListener(), this);
}
depends.linkZnpcsPlusApi();
getServer().getPluginManager().registerEvents(getPlayerListener(), this);
if (configSettings.getStrictPlayerMovement() > 0) {
final long ticks = configSettings.getStrictPlayerMovement() * 20L;
getServer().getScheduler().scheduleSyncRepeatingTask(this, getPlayerMoveThread(), ticks, ticks);
}
if (depends.getPartyProvider() != null) {
getServer().getPluginManager().registerEvents(getUniteListener(), this);
} else if (depends.getPartiesApi() != null) {
getServer().getPluginManager().registerEvents(getPartiesListener(), this);
}
// 12 - Attempt to check for updates
new BukkitUpdateChecker(this, 3711).getVersion(version -> {
if (!getDescription().getVersion().split("-")[0].equalsIgnoreCase(version)) {
getLogger().info(ChatColor.DARK_GREEN + BukkitLang.get("updateTo").replace("<version>",
version).replace("<url>", ChatColor.AQUA + getDescription().getWebsite()));
}
});
// 13 - Delay loading of quests, actions and modules
delayLoadQuestInfo();
}
@Override
public void onDisable() {
getLogger().info("Saving Quester data...");
for (final Player p : getServer().getOnlinePlayers()) {
getQuester(p.getUniqueId()).saveData();
}
Bukkit.getScheduler().cancelTasks(this);
getLogger().info("Closing storage...");
if (storage != null) {
storage.close();
}
}
public boolean isProVersion() {
return false;
}
public boolean isLoading() {
return loading;
}
public File getPluginDataFolder() {
return getDataFolder();
}
public Logger getPluginLogger() {
return getLogger();
}
public InputStream getPluginResource(String filename) {
return getResource(filename);
}
public String getDetectedServerSoftwareVersion() {
return bukkitVersion;
}
public BukkitDependencies getDependencies() {
return depends;
}
public BukkitConfigSettings getConfigSettings() {
return (BukkitConfigSettings) configSettings;
}
@Override
public List<CustomObjective> getCustomObjectives() {
return customObjectives;
}
public Optional<CustomObjective> getCustomObjective(final String className) {
for (final CustomObjective co : customObjectives) {
if (co.getClass().getName().equals(className)) {
return Optional.of(co);
}
}
return Optional.empty();
}
public void setCustomObjectives(List<CustomObjective> customObjectives) {
this.customObjectives = customObjectives;
}
@Override
public List<CustomRequirement> getCustomRequirements() {
return customRequirements;
}
public Optional<CustomRequirement> getCustomRequirement(final String className) {
for (final CustomRequirement cr : customRequirements) {
if (cr.getClass().getName().equals(className)) {
return Optional.of(cr);
}
}
return Optional.empty();
}
public void setCustomRequirements(List<CustomRequirement> customRequirements) {
this.customRequirements = customRequirements;
}
@Override
public List<CustomReward> getCustomRewards() {
return customRewards;
}
public Optional<CustomReward> getCustomReward(final String className) {
for (final CustomReward cr : customRewards) {
if (cr.getClass().getName().equals(className)) {
return Optional.of(cr);
}
}
return Optional.empty();
}
public void setCustomRewards(List<CustomReward> customRewards) {
this.customRewards = customRewards;
}
/**
* Get every Quest loaded in memory
*
* @return a collection of all Quests
*/
public Collection<Quest> getLoadedQuests() {
return quests;
}
/**
* Set every Quest loaded in memory
*
*/
public void setLoadedQuests(final Collection<Quest> quests) {
this.quests = quests;
}
/**
* Get every Action loaded in memory
*
* @return a collection of all Actions
*/
public Collection<Action> getLoadedActions() {
return actions;
}
/**
* Set every Action loaded in memory
*
*/
public void setLoadedActions(final Collection<Action> actions) {
this.actions = actions;
}
/**
* Get every Condition loaded in memory
*
* @return a collection of all Conditions
*/
public Collection<Condition> getLoadedConditions() {
return conditions;
}
/**
* Set every Condition loaded in memory
*
*/
public void setLoadedConditions(final Collection<Condition> conditions) {
this.conditions = conditions;
}
/**
* Get Quester from player UUID
*
* @param id Player UUID
* @return new or existing Quester
*/
public BukkitQuester getQuester(final @NotNull UUID id) {
final ConcurrentSkipListSet<Quester> set = (ConcurrentSkipListSet<Quester>) questers;
for (final Quester q : set) {
if (q != null && q.getUUID().equals(id)) {
return (BukkitQuester) q;
}
}
final BukkitQuester quester = new BukkitQuester(this, id);
if (depends.getCitizens() != null) {
if (depends.getCitizens().getNPCRegistry().getByUniqueId(id) != null) {
return quester;
}
}
final BukkitQuester q = new BukkitQuester(this, id);
questers.add(q);
return q;
}
/**
* Get every online Quester playing on this server
*
* @return a collection of all online Questers
*/
public Collection<Quester> getOnlineQuesters() {
final Collection<Quester> questers = new ConcurrentSkipListSet<>();
for (final Quester q : getOfflineQuesters()) {
if (q.getOfflinePlayer().isOnline()) {
// Workaround for issues with the compass on fast join
q.findCompassTarget();
questers.add(q);
}
}
return questers;
}
/**
* Get every Quester that has ever played on this server
*
* @return a collection of all Questers
*/
public Collection<Quester> getOfflineQuesters() {
return questers;
}
/**
* Set every Quester that has ever played on this server
*
* @param questers a collection of Questers
*/
public void setOfflineQuesters(final Collection<Quester> questers) {
this.questers = new ConcurrentSkipListSet<>(questers);
}
/**
* Get every NPC UUID which sees use a quest giver, talk target, or kill target
*
* @return a collection of all UUIDs
*/
public Collection<UUID> getQuestNpcUuids() {
return questNpcUuids;
}
/**
* Set every NPC UUID which sees use a quest giver, talk target, or kill target
*
* @param questNpcUuids a collection of UUIDs
*/
@SuppressWarnings("unused")
public void setQuestNpcUuids(final Collection<UUID> questNpcUuids) {
this.questNpcUuids = new ConcurrentSkipListSet<>(questNpcUuids);
}
@SuppressWarnings("unused")
public CommandExecutor getCommandExecutor() {
return cmdExecutor;
}
public TabExecutor getTabExecutor() {
return cmdExecutor;
}
public ConversationFactory getConversationFactory() {
return conversationFactory;
}
public ConversationFactory getNpcConversationFactory() {
return npcConversationFactory;
}
public BukkitQuestFactory getQuestFactory() {
return questFactory;
}
public BukkitActionFactory getActionFactory() {
return actionFactory;
}
public BukkitConditionFactory getConditionFactory() {
return conditionFactory;
}
public BukkitConvoListener getConvoListener() {
return convoListener;
}
public BukkitBlockListener getBlockListener() {
return blockListener;
}
public BukkitItemListener getItemListener() {
return itemListener;
}
public BukkitCitizensListener getCitizensListener() {
return citizensListener;
}
public BukkitZnpcsListener getZnpcsListener() {
return znpcsListener;
}
public BukkitZnpcsApiListener getZNpcsPlusListener() {
return znpcsPlusListener;
}
public BukkitPlayerListener getPlayerListener() {
return playerListener;
}
public BukkitUniteListener getUniteListener() {
return uniteListener;
}
public BukkitNpcEffectThread getNpcEffectThread() {
return effectThread;
}
public BukkitPlayerMoveThread getPlayerMoveThread() {
return moveThread;
}
public BukkitPartiesListener getPartiesListener() {
return partiesListener;
}
public BukkitDenizenTrigger getDenizenTrigger() {
return trigger;
}
public LocaleManager getLocaleManager() {
return localeManager;
}
public QuesterStorage getStorage() {
return storage;
}
/**
* Move a storage file from legacy location, if present
*
* @param fileName Name of file to attempt move
*/
private void moveStorageResource(String fileName) {
final File storageFile = new File(getDataFolder(), fileName);
if (!storageFile.isFile()) {
return;
}
final File outFile = new File(getDataFolder(), "storage" + File.separatorChar + fileName);
final File outDir = new File(outFile.getPath().replace(fileName, ""));
if (!outDir.exists()) {
if (!outDir.mkdirs()) {
getLogger().log(Level.SEVERE, "Failed to make directories for " + fileName + " (canWrite= "
+ outDir.canWrite() + ")");
}
}
final boolean moved = storageFile.renameTo(outFile);
if (!moved) {
getLogger().severe("Unable to move " + fileName + " file. Check folder permissions and restart server.");
getServer().getPluginManager().disablePlugin(this);
setEnabled(false);
}
}
/**
* Save a Quests plugin resource to a specific path in the filesystem
*
* @param resourcePath jar file location starting from resource folder, i.e. "lang/el-GR/strings.yml"
* @param outputPath file destination starting from Quests folder, i.e. "lang/el-GR/strings.yml"
* @param replace whether or not to replace the destination file
*/
@Override
public void saveResourceAs(String resourcePath, final String outputPath, final boolean replace) {
if (resourcePath == null || resourcePath.isEmpty()) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace('\\', '/');
final InputStream in = getResource(resourcePath);
if (in == null) {
throw new IllegalArgumentException("The embedded resource '" + resourcePath
+ "' cannot be found in Quests jar");
}
final String outPath = outputPath.replace('/', File.separatorChar).replace('\\', File.separatorChar);
final File outFile = new File(getDataFolder(), outPath);
final File outDir = new File(outFile.getPath().replace(outFile.getName(), ""));
if (!outDir.exists()) {
if (!outDir.mkdirs()) {
getLogger().log(Level.SEVERE, "Failed to make directories for " + outFile.getName() + " (canWrite= "
+ outDir.canWrite() + ")");
}
}
try {
if (!outFile.exists() || replace) {
final OutputStream out = new FileOutputStream(outFile);
final byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
in.close();
if (!outFile.exists()) {
getLogger().severe("Unable to copy " + outFile.getName() + " (canWrite= " + outFile.canWrite()
+ ")");
}
}
} catch (final IOException ex) {
getLogger().log(Level.SEVERE, "Could not save " + outFile.getName() + " to " + outFile, ex);
}
}
/**
* Load quests, actions, conditions, and modules<br>
* At startup, this lets soft-depends (namely Citizens) fully load first
*/
private void delayLoadQuestInfo() {
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
conditionLoader.init();
actionLoader.init();
questLoader.init();
getLogger().log(Level.INFO, "Loaded " + quests.size() + " Quest(s), " + actions.size() + " Action(s), "
+ conditions.size() + " Condition(s) and " + BukkitLang.size() + " Phrase(s)");
for (final Player p : getServer().getOnlinePlayers()) {
final Quester quester = new BukkitQuester(BukkitQuestsPlugin.this, p.getUniqueId());
if (!quester.hasData()) {
quester.saveData();
}
// Workaround for issues with the compass on fast join
quester.findCompassTarget();
questers.add(quester);
}
if (depends.getCitizens() != null) {
if (depends.getCitizens().getNPCRegistry() == null) {
getLogger().log(Level.SEVERE,
"Citizens was enabled but NPCRegistry was null. Disabling linkage.");
depends.unlinkCitizens();
}
}
if (depends.getZnpcsPlusApi() != null) {
if (depends.getZnpcsPlusApi().getNpcRegistry() == null) {
getLogger().log(Level.SEVERE,
"ZNPCsPlus was enabled but NpcRegistry was null. Disabling linkage.");
depends.unlinkZnpcsPlusApi();
}
}
customLoader.init();
questLoader.importQuests();
if (getConfigSettings().canDisableCommandFeedback()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
}
loading = false;
}, 5L);
}
/**
* Reload quests, actions, conditions, config settings, lang, modules, and player data
*/
public void reload(final ReloadCallback<Boolean> callback) {
if (loading) {
getLogger().warning(ChatColor.YELLOW + BukkitLang.get("errorLoading"));
return;
}
loading = true;
reloadConfig();
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
try {
getStorage().saveOfflineQuesters().get();
BukkitLang.clear();
configSettings.init();
BukkitLang.load(BukkitQuestsPlugin.this, configSettings.getLanguage());
quests.clear();
actions.clear();
conditions.clear();
conditionLoader.init();
actionLoader.init();
questLoader.init();
for (final Quester quester : questers) {
final Quester loaded = getStorage().loadQuester(quester.getUUID()).get();
for (final Quest quest : loaded.getCurrentQuests().keySet()) {
loaded.checkQuest(quest);
}
}
customLoader.init();
questLoader.importQuests();
finishLoading(callback, true, null);
} catch (final Exception e) {
finishLoading(callback, false, e);
}
loading = false;
});
}
/**
* Execute finishing task and print provided exception
*
* @param callback Callback to execute
* @param result Result to pass through callback
* @param exception Exception to print, or null
*/
private void finishLoading(final ReloadCallback<Boolean> callback, boolean result, final Exception exception) {
if (exception != null) {
exception.printStackTrace();
}
if (callback != null) {
Bukkit.getScheduler().runTask(BukkitQuestsPlugin.this, () -> {
loading = false;
callback.execute(result);
});
}
}
/**
* Checks if player can use the Quests plugin
*
* @param uuid the entity UUID to be checked
* @return {@code true} if entity is a Player that has permission
*/
public boolean canUseQuests(final UUID uuid) {
final Player p = Bukkit.getPlayer(uuid);
if (p != null) {
for (final Permission perm : getDescription().getPermissions()) {
if (p.hasPermission(perm.getName())) {
return true;
}
}
}
return false;
}
/**
* Checks if conversable is non-op, non-* player in Trial Mode
*
* @param conversable the editor user to be checked
* @return {@code true} if user is a Player with quests.mode.trial permission
*/
public boolean hasLimitedAccess(final Conversable conversable) {
if (!(conversable instanceof Player)) {
return false;
}
final Player player = ((Player)conversable);
if (player.isOp() || player.hasPermission("*")) {
return false;
}
return player.hasPermission("quests.mode.trial");
}
/**
* Get a Quest by ID
*
* @param id ID of the quest
* @return Exact match or null if not found
* @since 3.8.6
*/
public Quest getQuestById(final String id) {
if (id == null) {
return null;
}
for (final Quest q : quests) {
if (q.getId().equals(id)) {
return q;
}
}
return null;
}
/**
* Get a Quest by name
*
* @param name Name of the quest
* @return Closest match or null if not found
*/
public Quest getQuest(final String name) {
if (name == null) {
return null;
}
for (final Quest q : quests) {
if (q.getName().equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', name))) {
return q;
}
}
for (final Quest q : quests) {
if (q.getName().toLowerCase().startsWith(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return q;
}
}
for (final Quest q : quests) {
if (q.getName().toLowerCase().contains(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return q;
}
}
for (final Quest q : quests) {
// For tab completion
if (ChatColor.stripColor(q.getName()).equals(ChatColor.stripColor(ChatColor
.translateAlternateColorCodes('&', name)))) {
return q;
}
}
return null;
}
/**
* Get an Action by name
*
* @param name Name of the action
* @return Closest match or null if not found
*/
public Action getAction(final String name) {
if (name == null) {
return null;
}
for (final Action a : actions) {
if (a.getName().equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', name))) {
return a;
}
}
for (final Action a : actions) {
if (a.getName().toLowerCase().startsWith(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return a;
}
}
for (final Action a : actions) {
if (a.getName().toLowerCase().contains(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return a;
}
}
for (final Action a : actions) {
// For tab completion
if (ChatColor.stripColor(a.getName()).equals(ChatColor.stripColor(ChatColor.
translateAlternateColorCodes('&', name)))) {
return a;
}
}
return null;
}
/**
* Get a Condition by name
*
* @param name Name of the condition
* @return Closest match or null if not found
*/
public Condition getCondition(final String name) {
if (name == null) {
return null;
}
for (final Condition c : conditions) {
if (c.getName().equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', name))) {
return c;
}
}
for (final Condition c : conditions) {
if (c.getName().toLowerCase().startsWith(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return c;
}
}
for (final Condition c : conditions) {
if (c.getName().toLowerCase().contains(ChatColor.translateAlternateColorCodes('&', name).toLowerCase())) {
return c;
}
}
for (final Condition c : conditions) {
// For tab completion
if (ChatColor.stripColor(c.getName()).equals(ChatColor.stripColor(ChatColor
.translateAlternateColorCodes('&', name)))) {
return c;
}
}
return null;
}
}

View File

@ -1,20 +1,24 @@
/*******************************************************************************************************
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.actions;
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
package me.pikamug.quests.actions;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.entity.QuestMob;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.tasks.BukkitActionTimer;
import me.pikamug.quests.util.BukkitConfigUtil;
import me.pikamug.quests.util.BukkitInventoryUtil;
import me.pikamug.quests.util.BukkitLang;
import me.pikamug.quests.util.BukkitMiscUtil;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -23,25 +27,22 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import me.blackvein.quests.Quest;
import me.blackvein.quests.QuestMob;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.tasks.ActionTimer;
import me.blackvein.quests.util.ConfigUtil;
import me.blackvein.quests.util.InventoryUtil;
import me.blackvein.quests.util.Lang;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class Action implements Comparable<Action> {
public class BukkitAction implements Action {
private final Quests plugin;
private final BukkitQuestsPlugin plugin;
private String name = "";
protected String message = null;
protected boolean clearInv = false;
protected boolean failQuest = false;
protected LinkedList<Location> explosions = new LinkedList<Location>();
protected Map<Location, Effect> effects = new HashMap<Location, Effect>();
protected LinkedList<ItemStack> items = new LinkedList<ItemStack>();
protected LinkedList<Location> explosions = new LinkedList<>();
protected Map<Location, Effect> effects = new HashMap<>();
protected LinkedList<ItemStack> items = new LinkedList<>();
protected World stormWorld = null;
protected int stormDuration = 0;
protected World thunderWorld = null;
@ -62,7 +63,7 @@ public class Action implements Comparable<Action> {
return false;
}
for (int i = 0; i < size(); i++) {
if (get(i).equals(other.get(i)) == false) {
if (!get(i).equals(other.get(i))) {
return false;
}
}
@ -70,9 +71,9 @@ public class Action implements Comparable<Action> {
return false;
}
};
protected LinkedList<Location> lightningStrikes = new LinkedList<Location>();
protected LinkedList<String> commands = new LinkedList<String>();
protected LinkedList<PotionEffect> potionEffects = new LinkedList<PotionEffect>();
protected LinkedList<Location> lightningStrikes = new LinkedList<>();
protected LinkedList<String> commands = new LinkedList<>();
protected LinkedList<PotionEffect> potionEffects = new LinkedList<>();
protected int hunger = -1;
protected int saturation = -1;
protected float health = -1;
@ -80,43 +81,51 @@ public class Action implements Comparable<Action> {
protected String book = "";
protected String denizenScript;
public Action(final Quests plugin) {
public BukkitAction(final BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public int compareTo(final Action action) {
return name.compareTo(action.getName());
}
@Override
public String getName() {
return name;
}
@Override
public void setName(final String name) {
this.name = name;
}
@Override
public String getMessage() {
return message;
}
@Override
public void setMessage(final String message) {
this.message = message;
}
@Override
public boolean isClearInv() {
return clearInv;
}
@Override
public void setClearInv(final boolean clearInv) {
this.clearInv = clearInv;
}
@Override
public boolean isFailQuest() {
return failQuest;
}
@Override
public void setFailQuest(final boolean failQuest) {
this.failQuest = failQuest;
}
@ -153,10 +162,12 @@ public class Action implements Comparable<Action> {
this.stormWorld = stormWorld;
}
@Override
public int getStormDuration() {
return stormDuration;
}
@Override
public void setStormDuration(final int stormDuration) {
this.stormDuration = stormDuration;
}
@ -169,34 +180,42 @@ public class Action implements Comparable<Action> {
this.thunderWorld = thunderWorld;
}
@Override
public int getThunderDuration() {
return thunderDuration;
}
@Override
public void setThunderDuration(final int thunderDuration) {
this.thunderDuration = thunderDuration;
}
@Override
public int getTimer() {
return timer;
}
@Override
public void setTimer(final int timer) {
this.timer = timer;
}
@Override
public boolean isCancelTimer() {
return cancelTimer;
}
@Override
public void setCancelTimer(final boolean cancelTimer) {
this.cancelTimer = cancelTimer;
}
@Override
public LinkedList<QuestMob> getMobSpawns() {
return mobSpawns;
}
@Override
public void setMobSpawns(final LinkedList<QuestMob> mobSpawns) {
this.mobSpawns = mobSpawns;
}
@ -209,10 +228,12 @@ public class Action implements Comparable<Action> {
this.lightningStrikes = lightningStrikes;
}
@Override
public LinkedList<String> getCommands() {
return commands;
}
@Override
public void setCommands(final LinkedList<String> commands) {
this.commands = commands;
}
@ -225,26 +246,32 @@ public class Action implements Comparable<Action> {
this.potionEffects = potionEffects;
}
@Override
public int getHunger() {
return hunger;
}
@Override
public void setHunger(final int hunger) {
this.hunger = hunger;
}
@Override
public int getSaturation() {
return saturation;
}
@Override
public void setSaturation(final int saturation) {
this.saturation = saturation;
}
@Override
public float getHealth() {
return health;
}
@Override
public void setHealth(final float health) {
this.health = health;
}
@ -257,18 +284,22 @@ public class Action implements Comparable<Action> {
this.teleport = teleport;
}
@Override
public String getBook() {
return book;
}
@Override
public void setBook(final String book) {
this.book = book;
}
@Override
public String getDenizenScript() {
return book;
}
@Override
public void setDenizenScript(final String scriptName) {
this.denizenScript = scriptName;
}
@ -276,25 +307,29 @@ public class Action implements Comparable<Action> {
public void fire(final Quester quester, final Quest quest) {
final Player player = quester.getPlayer();
if (message != null) {
player.sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(message, quest, player));
player.sendMessage(BukkitConfigUtil.parseStringWithPossibleLineBreaks(message, quest, player));
}
if (clearInv == true) {
if (clearInv) {
player.getInventory().clear();
}
if (explosions.isEmpty() == false) {
if (!explosions.isEmpty()) {
for (final Location l : explosions) {
l.getWorld().createExplosion(l, 4F, false);
if (l.getWorld() != null) {
l.getWorld().createExplosion(l, 4F, false);
}
}
}
if (effects.isEmpty() == false) {
if (!effects.isEmpty()) {
for (final Location l : effects.keySet()) {
l.getWorld().playEffect(l, effects.get(l), 1);
if (l.getWorld() != null) {
l.getWorld().playEffect(l, effects.get(l), 1);
}
}
}
if (items.isEmpty() == false) {
if (!items.isEmpty()) {
for (final ItemStack is : items) {
try {
InventoryUtil.addItem(player, is);
BukkitInventoryUtil.addItem(player, is);
} catch (final Exception e) {
plugin.getLogger().severe("Unable to add null item to inventory of "
+ player.getName() + " during quest " + quest.getName() + " event " + name);
@ -311,23 +346,25 @@ public class Action implements Comparable<Action> {
thunderWorld.setThundering(true);
thunderWorld.setThunderDuration(thunderDuration);
}
if (mobSpawns.isEmpty() == false) {
if (!mobSpawns.isEmpty()) {
for (final QuestMob questMob : mobSpawns) {
questMob.spawn();
}
}
if (lightningStrikes.isEmpty() == false) {
if (!lightningStrikes.isEmpty()) {
for (final Location l : lightningStrikes) {
l.getWorld().strikeLightning(l);
if (l.getWorld() != null) {
l.getWorld().strikeLightning(l);
}
}
}
if (commands.isEmpty() == false) {
if (!commands.isEmpty()) {
for (final String s : commands) {
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),
s.replace("<player>", quester.getPlayer().getName()));
}
}
if (potionEffects.isEmpty() == false) {
if (!potionEffects.isEmpty()) {
for (final PotionEffect p : potionEffects) {
player.addPotionEffect(p);
}
@ -343,7 +380,7 @@ public class Action implements Comparable<Action> {
}
if (teleport != null) {
if (player.isDead()) {
plugin.getLogger().warning("Tried to fire Action " + name + " but player " + player.getUniqueId()
plugin.getLogger().warning("Tried to fire Action " + name + " but player " + player.getUniqueId()
+ " was dead (known Bukkit limitation).");
} else {
player.teleport(teleport);
@ -351,65 +388,40 @@ public class Action implements Comparable<Action> {
}
if (book != null) {
if (!book.isEmpty()) {
if (plugin.getDependencies().getCitizensBooksApi() != null) {
if (plugin.getDependencies().getCitizensBooksApi().hasFilter(book)) {
plugin.getDependencies().getCitizensBooksApi().openBook(player, plugin.getDependencies()
.getCitizensBooksApi().getFilter(book));
if (plugin.getDependencies().getAstralBooksApi() != null) {
if (plugin.getDependencies().getAstralBooksApi().hasFilterBook(book)) {
plugin.getDependencies().getAstralBooksApi().openBook(player, plugin.getDependencies()
.getAstralBooksApi().getFilterBook(book));
}
}
}
}
if (failQuest == true) {
if (failQuest) {
quest.failQuest(quester, true);
}
if (timer > 0) {
player.sendMessage(ChatColor.GREEN + Lang.get(player, "timerStart")
.replace("<time>", ChatColor.RED + String.valueOf(timer) + ChatColor.GREEN));
if (timer > 60) {
quester.getTimers().put(new ActionTimer(quester, quest, 60, false)
.runTaskLater(plugin, (timer-60)*20).getTaskId(), quest);
player.sendMessage(ChatColor.GREEN + BukkitLang.get(player, "timerStart")
.replace("<time>", BukkitMiscUtil.getTime(timer * 1000L)).replace("<quest>", quest.getName()));
final List<Integer> toNotify = Arrays.asList(60, 30, 10, 5, 4, 3, 2, 1);
for (final int seconds : toNotify) {
if (timer > seconds) {
quester.getTimers().put(new BukkitActionTimer(quester, quest, seconds)
.runTaskLater(plugin, (timer - seconds) * 20L).getTaskId(), quest);
}
}
if (timer > 30) {
quester.getTimers().put(new ActionTimer(quester, quest, 30, false)
.runTaskLater(plugin, (timer-30)*20).getTaskId(), quest);
}
if (timer > 10) {
quester.getTimers().put(new ActionTimer(quester, quest, 10, false)
.runTaskLater(plugin, (timer-10)*20).getTaskId(), quest);
}
if (timer > 5) {
quester.getTimers().put(new ActionTimer(quester, quest, 5, false)
.runTaskLater(plugin, (timer-5)*20).getTaskId(), quest);
}
if (timer > 4) {
quester.getTimers().put(new ActionTimer(quester, quest, 4, false)
.runTaskLater(plugin, (timer-4)*20).getTaskId(), quest);
}
if (timer > 3) {
quester.getTimers().put(new ActionTimer(quester, quest, 3, false)
.runTaskLater(plugin, (timer-3)*20).getTaskId(), quest);
}
if (timer > 2) {
quester.getTimers().put(new ActionTimer(quester, quest, 2, false)
.runTaskLater(plugin, (timer-2)*20).getTaskId(), quest);
}
if (timer > 1) {
quester.getTimers().put(new ActionTimer(quester, quest, 1, false)
.runTaskLater(plugin, (timer-1)*20).getTaskId(), quest);
}
quester.getTimers().put(new ActionTimer(quester, quest, 0, true)
.runTaskLater(plugin, timer*20).getTaskId(), quest);
quester.getTimers().put(new BukkitActionTimer(quester, quest, 0)
.runTaskLater(plugin, timer * 20L).getTaskId(), quest);
}
if (cancelTimer) {
for (final Map.Entry<Integer, Quest> entry : quester.getTimers().entrySet()) {
if (entry.getValue().getName().equals(quest.getName())) {
if (entry.getValue().getId().equals(quest.getId())) {
plugin.getServer().getScheduler().cancelTask(entry.getKey());
quester.getTimers().remove(entry.getKey());
}
}
}
if (denizenScript != null) {
plugin.getDenizenTrigger().runDenizenScript(denizenScript, quester);
plugin.getDenizenTrigger().runDenizenScript(denizenScript, quester, null);
}
}
}

View File

@ -0,0 +1,471 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.actions;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.convo.actions.main.ActionMainPrompt;
import me.pikamug.quests.convo.actions.menu.ActionMenuPrompt;
import me.pikamug.quests.entity.BukkitQuestMob;
import me.pikamug.quests.entity.QuestMob;
import me.pikamug.quests.interfaces.ReloadCallback;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitConfigUtil;
import me.pikamug.quests.util.BukkitFakeConversable;
import me.pikamug.quests.util.BukkitLang;
import me.pikamug.quests.util.Key;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.ConversationPrefix;
import org.bukkit.conversations.Prompt;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public class BukkitActionFactory implements ActionFactory, ConversationAbandonedListener {
private final BukkitQuestsPlugin plugin;
private final ConversationFactory conversationFactory;
private ConcurrentHashMap<UUID, Block> selectedExplosionLocations = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, Block> selectedEffectLocations = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, Block> selectedMobLocations = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, Block> selectedLightningLocations = new ConcurrentHashMap<>();
private ConcurrentHashMap<UUID, Block> selectedTeleportLocations = new ConcurrentHashMap<>();
private List<String> editingActionNames = new LinkedList<>();
public BukkitActionFactory(final BukkitQuestsPlugin plugin) {
this.plugin = plugin;
// Ensure to initialize factory last so that 'this' is fully initialized before it is passed
this.conversationFactory = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withFirstPrompt(new ActionMenuPrompt(new ConversationContext(plugin, new BukkitFakeConversable(),
new HashMap<>()))).withTimeout(3600)
.withPrefix(new LineBreakPrefix()).addConversationAbandonedListener(this);
}
public static class LineBreakPrefix implements ConversationPrefix {
@Override
public @NotNull String getPrefix(final @NotNull ConversationContext context) {
return "\n";
}
}
public ConcurrentHashMap<UUID, Block> getSelectedExplosionLocations() {
return selectedExplosionLocations;
}
public void setSelectedExplosionLocations(final ConcurrentHashMap<UUID, Block> selectedExplosionLocations) {
this.selectedExplosionLocations = selectedExplosionLocations;
}
public ConcurrentHashMap<UUID, Block> getSelectedEffectLocations() {
return selectedEffectLocations;
}
public void setSelectedEffectLocations(final ConcurrentHashMap<UUID, Block> selectedEffectLocations) {
this.selectedEffectLocations = selectedEffectLocations;
}
public ConcurrentHashMap<UUID, Block> getSelectedMobLocations() {
return selectedMobLocations;
}
public void setSelectedMobLocations(final ConcurrentHashMap<UUID, Block> selectedMobLocations) {
this.selectedMobLocations = selectedMobLocations;
}
public ConcurrentHashMap<UUID, Block> getSelectedLightningLocations() {
return selectedLightningLocations;
}
public void setSelectedLightningLocations(final ConcurrentHashMap<UUID, Block> selectedLightningLocations) {
this.selectedLightningLocations = selectedLightningLocations;
}
public ConcurrentHashMap<UUID, Block> getSelectedTeleportLocations() {
return selectedTeleportLocations;
}
public void setSelectedTeleportLocations(final ConcurrentHashMap<UUID, Block> selectedTeleportLocations) {
this.selectedTeleportLocations = selectedTeleportLocations;
}
public ConversationFactory getConversationFactory() {
return conversationFactory;
}
public List<String> getNamesOfActionsBeingEdited() {
return editingActionNames;
}
public void setNamesOfActionsBeingEdited(final List<String> actionNames) {
this.editingActionNames = actionNames;
}
@Override
public void conversationAbandoned(final ConversationAbandonedEvent abandonedEvent) {
if (abandonedEvent.getContext().getForWhom() instanceof Player) {
final UUID uuid = ((Player) abandonedEvent.getContext().getForWhom()).getUniqueId();
selectedExplosionLocations.remove(uuid);
selectedEffectLocations.remove(uuid);
selectedMobLocations.remove(uuid);
selectedLightningLocations.remove(uuid);
selectedTeleportLocations.remove(uuid);
}
}
public Prompt returnToMenu(final ConversationContext context) {
return new ActionMainPrompt(context);
}
public void loadData(final ConversationContext context, final Action action) {
BukkitAction bukkitAction = (BukkitAction) action;
if (bukkitAction.getMessage() != null) {
context.setSessionData(Key.A_MESSAGE, bukkitAction.getMessage());
}
if (bukkitAction.isClearInv()) {
context.setSessionData(Key.A_CLEAR_INVENTORY, true);
} else {
context.setSessionData(Key.A_CLEAR_INVENTORY, false);
}
if (bukkitAction.isFailQuest()) {
context.setSessionData(Key.A_FAIL_QUEST, true);
} else {
context.setSessionData(Key.A_FAIL_QUEST, false);
}
if (bukkitAction.getItems() != null && !bukkitAction.getItems().isEmpty()) {
final LinkedList<ItemStack> items = new LinkedList<>(bukkitAction.getItems());
context.setSessionData(Key.A_ITEMS, items);
}
if (bukkitAction.getExplosions() != null && !bukkitAction.getExplosions().isEmpty()) {
final LinkedList<String> locs = new LinkedList<>();
for (final Location loc : bukkitAction.getExplosions()) {
locs.add(BukkitConfigUtil.getLocationInfo(loc));
}
context.setSessionData(Key.A_EXPLOSIONS, locs);
}
if (bukkitAction.getEffects() != null && !bukkitAction.getEffects().isEmpty()) {
final LinkedList<String> locs = new LinkedList<>();
final LinkedList<String> effs = new LinkedList<>();
for (final Entry<Location, Effect> e : bukkitAction.getEffects().entrySet()) {
locs.add(BukkitConfigUtil.getLocationInfo(e.getKey()));
effs.add(e.getValue().toString());
}
context.setSessionData(Key.A_EFFECTS, effs);
context.setSessionData(Key.A_EFFECTS_LOCATIONS, locs);
}
if (bukkitAction.getStormWorld() != null) {
context.setSessionData(Key.A_WORLD_STORM, bukkitAction.getStormWorld().getName());
context.setSessionData(Key.A_WORLD_STORM_DURATION, bukkitAction.getStormDuration());
}
if (bukkitAction.getThunderWorld() != null) {
context.setSessionData(Key.A_WORLD_THUNDER, bukkitAction.getThunderWorld().getName());
context.setSessionData(Key.A_WORLD_THUNDER_DURATION, bukkitAction.getThunderDuration());
}
if (bukkitAction.getMobSpawns() != null && !bukkitAction.getMobSpawns().isEmpty()) {
context.setSessionData(Key.A_MOBS, bukkitAction.getMobSpawns());
}
if (bukkitAction.getLightningStrikes() != null && !bukkitAction.getLightningStrikes().isEmpty()) {
final LinkedList<String> locs = new LinkedList<>();
for (final Location loc : bukkitAction.getLightningStrikes()) {
locs.add(BukkitConfigUtil.getLocationInfo(loc));
}
context.setSessionData(Key.A_LIGHTNING, locs);
}
if (bukkitAction.getPotionEffects() != null && !bukkitAction.getPotionEffects().isEmpty()) {
final LinkedList<String> types = new LinkedList<>();
final LinkedList<Long> durations = new LinkedList<>();
final LinkedList<Integer> mags = new LinkedList<>();
for (final PotionEffect pe : bukkitAction.getPotionEffects()) {
types.add(pe.getType().getName());
durations.add((long) pe.getDuration());
mags.add(pe.getAmplifier());
}
context.setSessionData(Key.A_POTION_TYPES, types);
context.setSessionData(Key.A_POTION_DURATIONS, durations);
context.setSessionData(Key.A_POTION_STRENGTH, mags);
}
if (bukkitAction.getHunger() > -1) {
context.setSessionData(Key.A_HUNGER, bukkitAction.getHunger());
}
if (bukkitAction.getSaturation() > -1) {
context.setSessionData(Key.A_SATURATION, bukkitAction.getSaturation());
}
if (bukkitAction.getHealth() > -1) {
context.setSessionData(Key.A_HEALTH, bukkitAction.getHealth());
}
if (bukkitAction.getTeleport() != null) {
context.setSessionData(Key.A_TELEPORT, BukkitConfigUtil.getLocationInfo(bukkitAction.getTeleport()));
}
if (bukkitAction.getCommands() != null) {
context.setSessionData(Key.A_COMMANDS, bukkitAction.getCommands());
}
if (bukkitAction.getTimer() > 0) {
context.setSessionData(Key.A_TIMER, bukkitAction.getTimer());
}
if (bukkitAction.isCancelTimer()) {
context.setSessionData(Key.A_CANCEL_TIMER, true);
}
}
public void clearData(final ConversationContext context) {
context.setSessionData(Key.A_OLD_ACTION, null);
context.setSessionData(Key.A_NAME, null);
context.setSessionData(Key.A_MESSAGE, null);
context.setSessionData(Key.A_CLEAR_INVENTORY, null);
context.setSessionData(Key.A_FAIL_QUEST, null);
context.setSessionData(Key.A_ITEMS, null);
context.setSessionData(Key.A_ITEMS_AMOUNTS, null);
context.setSessionData(Key.A_EXPLOSIONS, null);
context.setSessionData(Key.A_EFFECTS, null);
context.setSessionData(Key.A_EFFECTS_LOCATIONS, null);
context.setSessionData(Key.A_WORLD_STORM, null);
context.setSessionData(Key.A_WORLD_STORM_DURATION, null);
context.setSessionData(Key.A_WORLD_THUNDER, null);
context.setSessionData(Key.A_WORLD_THUNDER_DURATION, null);
context.setSessionData(Key.A_MOBS, null);
context.setSessionData(Key.A_LIGHTNING, null);
context.setSessionData(Key.A_POTION_TYPES, null);
context.setSessionData(Key.A_POTION_DURATIONS, null);
context.setSessionData(Key.A_POTION_STRENGTH, null);
context.setSessionData(Key.A_HUNGER, null);
context.setSessionData(Key.A_SATURATION, null);
context.setSessionData(Key.A_HEALTH, null);
context.setSessionData(Key.A_TELEPORT, null);
context.setSessionData(Key.A_COMMANDS, null);
context.setSessionData(Key.A_TIMER, null);
context.setSessionData(Key.A_CANCEL_TIMER, null);
}
public void deleteAction(final ConversationContext context) {
final YamlConfiguration data = new YamlConfiguration();
final File actionsFile = new File(plugin.getDataFolder(), "storage" + File.separatorChar + "actions.yml");
try {
data.load(actionsFile);
} catch (final IOException | InvalidConfigurationException e) {
e.printStackTrace();
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questErrorReadingFile")
.replace("<file>", actionsFile.getName()));
return;
}
final String action = (String) context.getSessionData(Key.ED_EVENT_DELETE);
String key = "actions";
ConfigurationSection sec = data.getConfigurationSection(key);
if (sec == null) {
key = "events";
sec = data.getConfigurationSection(key);
}
if (sec != null && action != null) {
sec.set(action, null);
}
try {
data.save(actionsFile);
} catch (final IOException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questSaveError"));
return;
}
final ReloadCallback<Boolean> callback = response -> {
if (!response) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("unknownError"));
}
};
plugin.reload(callback);
context.getForWhom().sendRawMessage(ChatColor.YELLOW + BukkitLang.get("eventEditorDeleted"));
if (plugin.getConfigSettings().getConsoleLogging() > 0) {
final String identifier = context.getForWhom() instanceof Player ?
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
plugin.getLogger().info(identifier + " deleted action " + action);
}
for (final Quester q : plugin.getOfflineQuesters()) {
for (final Quest quest : q.getCurrentQuests().keySet()) {
q.checkQuest(quest);
}
}
clearData(context);
}
@SuppressWarnings("unchecked")
public void saveAction(final ConversationContext context) {
final YamlConfiguration data = new YamlConfiguration();
final File actionsFile = new File(plugin.getDataFolder(), "storage" + File.separatorChar + "actions.yml");
try {
data.load(actionsFile);
} catch (final IOException | InvalidConfigurationException e) {
e.printStackTrace();
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questErrorReadingFile")
.replace("<file>", actionsFile.getName()));
return;
}
String key = "actions";
if (data.getConfigurationSection(key) == null) {
key = "events";
}
if (context.getSessionData(Key.A_OLD_ACTION) != null
&& !((String) Objects.requireNonNull(context.getSessionData(Key.A_OLD_ACTION))).isEmpty()) {
data.set(key + "." + context.getSessionData(Key.A_OLD_ACTION), null);
final Collection<Action> temp = plugin.getLoadedActions();
temp.remove(plugin.getAction((String) context.getSessionData(Key.A_OLD_ACTION)));
plugin.setLoadedActions(temp);
}
final ConfigurationSection section = data.createSection(key + "." + context.getSessionData(Key.A_NAME));
editingActionNames.remove((String) context.getSessionData(Key.A_NAME));
if (context.getSessionData(Key.A_MESSAGE) != null) {
section.set("message", context.getSessionData(Key.A_MESSAGE));
}
if (context.getSessionData(Key.A_CLEAR_INVENTORY) != null) {
final Boolean b = (Boolean) context.getSessionData(Key.A_CLEAR_INVENTORY);
if (b != null) {
section.set("clear-inventory", b);
}
}
if (context.getSessionData(Key.A_FAIL_QUEST) != null) {
final Boolean b = (Boolean) context.getSessionData(Key.A_FAIL_QUEST);
if (b != null) {
section.set("fail-quest", b);
}
}
if (context.getSessionData(Key.A_ITEMS) != null) {
section.set("items", context.getSessionData(Key.A_ITEMS));
}
if (context.getSessionData(Key.A_EXPLOSIONS) != null) {
section.set("explosions", context.getSessionData(Key.A_EXPLOSIONS));
}
if (context.getSessionData(Key.A_EFFECTS) != null) {
section.set("effects", context.getSessionData(Key.A_EFFECTS));
section.set("effect-locations", context.getSessionData(Key.A_EFFECTS_LOCATIONS));
}
if (context.getSessionData(Key.A_WORLD_STORM) != null) {
section.set("storm-world", context.getSessionData(Key.A_WORLD_STORM));
section.set("storm-duration", context.getSessionData(Key.A_WORLD_STORM_DURATION));
}
if (context.getSessionData(Key.A_WORLD_THUNDER) != null) {
section.set("thunder-world", context.getSessionData(Key.A_WORLD_THUNDER));
section.set("thunder-duration", context.getSessionData(Key.A_WORLD_THUNDER_DURATION));
}
try {
if (context.getSessionData(Key.A_MOBS) != null) {
int count = 0;
for (final QuestMob mob : (LinkedList<QuestMob>) Objects.requireNonNull(context
.getSessionData(Key.A_MOBS))) {
ConfigurationSection cs = section.getConfigurationSection("mob-spawns." + count);
if (cs == null) {
cs = section.createSection("mob-spawns." + count);
}
final BukkitQuestMob questMob = (BukkitQuestMob) mob;
if (questMob.getName() != null) {
cs.set("name", questMob.getName());
}
cs.set("spawn-location", BukkitConfigUtil.getLocationInfo(questMob.getSpawnLocation()));
cs.set("mob-type", questMob.getType().name());
cs.set("spawn-amounts", questMob.getSpawnAmounts());
cs.set("held-item", questMob.getInventory()[0]);
cs.set("held-item-drop-chance", questMob.getDropChances()[0]);
cs.set("boots", questMob.getInventory()[1]);
cs.set("boots-drop-chance", questMob.getDropChances()[1]);
cs.set("leggings", questMob.getInventory()[2]);
cs.set("leggings-drop-chance", questMob.getDropChances()[2]);
cs.set("chest-plate", questMob.getInventory()[3]);
cs.set("chest-plate-drop-chance", questMob.getDropChances()[3]);
cs.set("helmet", questMob.getInventory()[4]);
cs.set("helmet-drop-chance", questMob.getDropChances()[4]);
count++;
}
}
} catch (final Exception e) {
e.printStackTrace();
}
if (context.getSessionData(Key.A_LIGHTNING) != null) {
section.set("lightning-strikes", context.getSessionData(Key.A_LIGHTNING));
}
if (context.getSessionData(Key.A_COMMANDS) != null) {
final LinkedList<String> commands = (LinkedList<String>) context.getSessionData(Key.A_COMMANDS);
if (commands != null && !commands.isEmpty()) {
section.set("commands", commands);
}
}
if (context.getSessionData(Key.A_POTION_TYPES) != null) {
section.set("potion-effect-types", context.getSessionData(Key.A_POTION_TYPES));
section.set("potion-effect-durations", context.getSessionData(Key.A_POTION_DURATIONS));
section.set("potion-effect-amplifiers", context.getSessionData(Key.A_POTION_STRENGTH));
}
if (context.getSessionData(Key.A_HUNGER) != null) {
section.set("hunger", context.getSessionData(Key.A_HUNGER));
}
if (context.getSessionData(Key.A_SATURATION) != null) {
section.set("saturation", context.getSessionData(Key.A_SATURATION));
}
if (context.getSessionData(Key.A_HEALTH) != null) {
section.set("health", context.getSessionData(Key.A_HEALTH));
}
if (context.getSessionData(Key.A_TELEPORT) != null) {
section.set("teleport-location", context.getSessionData(Key.A_TELEPORT));
}
if (context.getSessionData(Key.A_TIMER) != null) {
final Integer i = (Integer) context.getSessionData(Key.A_TIMER);
if (i != null && i > 0) {
section.set("timer", context.getSessionData(Key.A_TIMER));
}
}
if (context.getSessionData(Key.A_CANCEL_TIMER) != null) {
final Boolean b = (Boolean) context.getSessionData(Key.A_CANCEL_TIMER);
if (b != null) {
section.set("cancel-timer", b);
}
}
if (context.getSessionData(Key.A_DENIZEN) != null) {
section.set("denizen-script", context.getSessionData(Key.A_DENIZEN));
}
try {
data.save(actionsFile);
} catch (final IOException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("questSaveError"));
return;
}
final ReloadCallback<Boolean> callback = response -> {
if (!response) {
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("unknownError"));
}
};
plugin.reload(callback);
context.getForWhom().sendRawMessage(ChatColor.YELLOW + BukkitLang.get("eventEditorSaved"));
if (plugin.getConfigSettings().getConsoleLogging() > 0) {
final String identifier = context.getForWhom() instanceof Player ?
"Player " + ((Player)context.getForWhom()).getUniqueId() : "CONSOLE";
plugin.getLogger().info(identifier + " saved action " + context.getSessionData(Key.A_NAME));
}
for (final Quester q : plugin.getOfflineQuesters()) {
for (final Quest quest : q.getCurrentQuests().keySet()) {
q.checkQuest(quest);
}
}
clearData(context);
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public abstract class BukkitQuestsSubCommand {
public abstract String getName();
public abstract String getNameI18N();
public abstract String getDescription();
public abstract String getPermission();
public abstract String getSyntax();
public abstract int getMaxArguments();
public abstract void execute(CommandSender commandSender, String[] args);
public List<String> tabComplete(CommandSender commandSender, String[] args) {
return Collections.emptyList();
}
public static boolean assertNonPlayer(CommandSender commandSender) {
if (!(commandSender instanceof Player)) {
commandSender.sendMessage(ChatColor.YELLOW + BukkitLang.get("consoleError"));
return true;
}
return false;
}
/**
* Get an online Player by name
*
* @param name Name of the player
* @return Player or null if not found
*/
public static Player getOnlinePlayer(final String name) {
if (name == null) {
return null;
}
for (final Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.getName().equalsIgnoreCase(name)) {
return p;
}
}
for (final Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.getName().toLowerCase().startsWith(name)) {
return p;
}
}
for (final Player p : Bukkit.getServer().getOnlinePlayers()) {
if (p.getName().toLowerCase().contains(name)) {
return p;
}
}
return null;
}
/**
* Get a potentially offline Player by name
*
* @param name Name of the player
* @return Player or null if not found
*/
public static OfflinePlayer getOfflinePlayer(final String name) {
if (name == null) {
return null;
}
final Player player = getOnlinePlayer(name);
if (player != null) {
return player;
}
for (final OfflinePlayer p : Bukkit.getServer().getOfflinePlayers()) {
if (p != null && p.getName() != null && p.getName().equalsIgnoreCase(name)) {
return p;
}
}
for (final OfflinePlayer p : Bukkit.getServer().getOfflinePlayers()) {
if (p != null && p.getName() != null && p.getName().toLowerCase().startsWith(name)) {
return p;
}
}
for (final OfflinePlayer p : Bukkit.getServer().getOfflinePlayers()) {
if (p != null && p.getName() != null && p.getName().toLowerCase().contains(name)) {
return p;
}
}
return null;
}
/**
* Used to get quest names that contain spaces from command input
*
* @param args an array of Strings
* @param startingIndex the index to start combining at
* @param endingIndex the index to stop combining at
* @param delimiter the character for which the array was split
* @return a String or null
*/
public static String concatArgArray(final String[] args, final int startingIndex, final int endingIndex,
final char delimiter) {
StringBuilder s = new StringBuilder();
for (int i = startingIndex; i <= endingIndex; i++) {
s.append(args[i]).append(delimiter);
}
s = new StringBuilder(s.substring(0, s.length()));
return s.toString().trim().isEmpty() ? null : s.toString().trim();
}
public static Map<String, Integer> sort(final Map<String, Integer> unsortedMap) {
final List<Map.Entry<String, Integer>> list = new LinkedList<>(unsortedMap.entrySet());
list.sort((o1, o2) -> {
final int i = o1.getValue();
final int i2 = o2.getValue();
return Integer.compare(i2, i);
});
final Map<String, Integer> sortedMap = new LinkedHashMap<>();
for (final Map.Entry<String, Integer> entry : list) {
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}
}

View File

@ -0,0 +1,230 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.quest;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.components.BukkitRequirements;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.quests.components.Stage;
import me.pikamug.quests.util.BukkitItemUtil;
import me.pikamug.quests.util.BukkitMiscUtil;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class BukkitQuestCommandHandler {
private final BukkitQuestsPlugin plugin;
public BukkitQuestCommandHandler(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
public boolean check(final CommandSender cs, final String[] args) {
if (cs instanceof Player) {
if (cs.hasPermission("quests.quest")) {
if (args.length == 0) {
final Player player = (Player) cs;
final Quester quester = plugin.getQuester(player.getUniqueId());
if (!quester.getCurrentQuests().isEmpty()) {
for (final Quest q : quester.getCurrentQuests().keySet()) {
final Stage stage = quester.getCurrentStage(q);
q.updateCompass(quester, stage);
if (plugin.getQuester(player.getUniqueId()).getQuestDataOrDefault(q).getDelayStartTime() == 0
|| plugin.getQuester(player.getUniqueId()).getStageTime(q) < 0L) {
final String msg = BukkitLang.get(player, "questObjectivesTitle")
.replace("<quest>", q.getName());
BukkitLang.send(player, ChatColor.GOLD + msg);
quester.showCurrentObjectives(q, quester, false);
} else {
final long time = plugin.getQuester(player.getUniqueId()).getStageTime(q);
String msg = ChatColor.YELLOW + "(" + BukkitLang.get(player, "delay") + ") " + ChatColor.RED
+ BukkitLang.get(player, "plnTooEarly");
msg = msg.replace("<quest>", q.getName());
msg = msg.replace("<time>", BukkitMiscUtil.getTime(time));
BukkitLang.send(player, msg);
}
}
} else {
BukkitLang.send(player, ChatColor.YELLOW + BukkitLang.get(player, "noActiveQuest"));
}
} else {
showQuestDetails(cs, args);
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
return true;
}
} else {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("consoleError"));
return true;
}
return true;
}
public List<String> suggest(final CommandSender cs, final String[] args) {
if (args.length != 1) {
return Collections.emptyList();
}
final List<String> results = new ArrayList<>();
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[0].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
return results;
}
private void showQuestDetails(final CommandSender cs, final String[] args) {
if (cs.hasPermission("quests.questinfo")) {
StringBuilder name = new StringBuilder();
if (args.length == 1) {
name = new StringBuilder(args[0].toLowerCase());
} else {
int index = 0;
for (final String s : args) {
if (index == (args.length - 1)) {
name.append(s.toLowerCase());
} else {
name.append(s.toLowerCase()).append(" ");
}
index++;
}
}
final Quest q = plugin.getQuest(name.toString());
if (q != null) {
final Player player = (Player) cs;
final Quester quester = plugin.getQuester(player.getUniqueId());
cs.sendMessage(ChatColor.GOLD + "- " + q.getName() + " -");
cs.sendMessage(" ");
if (q.getNpcStart() != null) {
String msg = BukkitLang.get("speakTo");
msg = msg.replace("<npc>", q.getNpcStartName());
cs.sendMessage(ChatColor.YELLOW + msg);
} else {
cs.sendMessage(ChatColor.YELLOW + q.getDescription());
}
cs.sendMessage(" ");
if (plugin.getConfigSettings().canShowQuestReqs()) {
final BukkitRequirements reqs = (BukkitRequirements) q.getRequirements();
if (reqs.hasRequirement()) {
cs.sendMessage(ChatColor.GOLD + BukkitLang.get("requirements"));
if (!reqs.getPermissions().isEmpty()) {
for (final String perm : reqs.getPermissions()) {
if (plugin.getDependencies().getVaultPermission().has(player, perm)) {
cs.sendMessage(ChatColor.GREEN + BukkitLang.get("permissionDisplay") + " " + perm);
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("permissionDisplay") + " " + perm);
}
}
}
if (reqs.getHeroesPrimaryClass() != null) {
if (plugin.getDependencies()
.testPrimaryHeroesClass(reqs.getHeroesPrimaryClass(), player.getUniqueId())) {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesPrimaryClass()
+ ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + BukkitLang.get("heroesClass"));
} else {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesPrimaryClass()
+ ChatColor.RESET + "" + ChatColor.RED + " " + BukkitLang.get("heroesClass"));
}
}
if (reqs.getHeroesSecondaryClass() != null) {
if (plugin.getDependencies()
.testSecondaryHeroesClass(reqs.getHeroesSecondaryClass(), player.getUniqueId())) {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.DARK_RED + reqs.getHeroesSecondaryClass()
+ ChatColor.RESET + "" + ChatColor.RED + " " + BukkitLang.get("heroesClass"));
} else {
cs.sendMessage(ChatColor.BOLD + "" + ChatColor.GREEN + reqs.getHeroesSecondaryClass()
+ ChatColor.RESET + "" + ChatColor.DARK_GREEN + " " + BukkitLang.get("heroesClass"));
}
}
for (final String skill : reqs.getMcmmoSkills()) {
final int level = plugin.getDependencies().getMcmmoSkillLevel(plugin.getDependencies()
.getMcMMOSkill(skill), player.getName());
final int req = reqs.getMcmmoAmounts().get(reqs.getMcmmoSkills().indexOf(skill));
final String skillName = BukkitMiscUtil.getCapitalized(skill);
if (level >= req) {
cs.sendMessage(ChatColor.GREEN + skillName + " " + BukkitLang.get("mcMMOLevel") + " " + req);
} else {
cs.sendMessage(ChatColor.RED + skillName + " " + BukkitLang.get("mcMMOLevel") + " " + req);
}
}
if (reqs.getQuestPoints() != 0) {
if (quester.getQuestPoints() >= reqs.getQuestPoints()) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getQuestPoints() + " "
+ BukkitLang.get("questPoints"));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getQuestPoints() + " "
+ BukkitLang.get("questPoints"));
}
}
if (reqs.getMoney() != 0) {
if (plugin.getDependencies().getVaultEconomy() != null && plugin.getDependencies()
.getVaultEconomy().getBalance(quester.getOfflinePlayer()) >= reqs.getMoney()) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + reqs.getMoney() + " "
+ (reqs.getMoney() > 1 ? plugin.getDependencies().getVaultEconomy()
.currencyNamePlural() : plugin.getDependencies().getVaultEconomy()
.currencyNameSingular()));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + reqs.getMoney() + " "
+ (reqs.getMoney() > 1 ? plugin.getDependencies().getVaultEconomy()
.currencyNamePlural() : plugin.getDependencies().getVaultEconomy()
.currencyNameSingular()));
}
}
for (final ItemStack is : reqs.getItems()) {
if (plugin.getQuester(player.getUniqueId()).hasItem(is)) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + BukkitItemUtil.getString(is));
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + BukkitItemUtil.getString(is));
}
}
for (Quest quest : quester.getCompletedQuests()) {
if (reqs.getNeededQuestIds().contains(quest.getId())) {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + BukkitLang.get("complete") + " "
+ ChatColor.ITALIC + quest.getName());
} else {
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + BukkitLang.get("complete") + " "
+ ChatColor.ITALIC + quest.getName());
}
}
final Map<String, String> completed = quester.getCompletedQuests().stream()
.collect(Collectors.toMap(Quest::getId, Quest::getName));
for (final String questId : reqs.getBlockQuestIds()) {
if (completed.containsKey(questId)) {
String msg = BukkitLang.get("haveCompleted");
msg = msg.replace("<quest>", completed.get(questId));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + msg);
} else {
String msg = BukkitLang.get("cannotComplete");
msg = msg.replace("<quest>", plugin.getQuestById(questId).getName());
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + msg);
}
}
}
}
} else {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("questNotFound").replace("<input>", name.toString()));
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
}

View File

@ -0,0 +1,171 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminFinishCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminGiveCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminGivepointsCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminNextstageCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminPointsCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminQuitCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminReloadCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminRemoveCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminResetCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminSetstageCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminStatsCommand;
import me.pikamug.quests.commands.questadmin.subcommands.BukkitQuestadminTakepointsCommand;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class BukkitQuestadminCommandHandler {
private final BukkitQuestsPlugin plugin;
private final Map<String, BukkitQuestsSubCommand> subCommands;
public BukkitQuestadminCommandHandler(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
subCommands = Stream.of(new BukkitQuestadminStatsCommand(plugin),
new BukkitQuestadminGiveCommand(plugin),
new BukkitQuestadminQuitCommand(plugin),
new BukkitQuestadminPointsCommand(plugin),
new BukkitQuestadminTakepointsCommand(plugin),
new BukkitQuestadminGivepointsCommand(plugin),
new BukkitQuestadminFinishCommand(plugin),
new BukkitQuestadminNextstageCommand(plugin),
new BukkitQuestadminSetstageCommand(plugin),
new BukkitQuestadminResetCommand(plugin),
new BukkitQuestadminRemoveCommand(plugin),
new BukkitQuestadminReloadCommand(plugin))
.collect(Collectors.toMap(BukkitQuestsSubCommand::getName, Function.identity()));
}
public boolean check(final CommandSender cs, final String[] args) {
if (args.length == 0) {
printAdminHelp(cs);
return true;
}
for (Map.Entry<String, BukkitQuestsSubCommand> cmd : subCommands.entrySet()) {
if (args[0].equalsIgnoreCase(cmd.getKey()) || args[0].equalsIgnoreCase(cmd.getValue().getNameI18N())) {
if (args.length < cmd.getValue().getMaxArguments()) {
cs.sendMessage(getAdminCommandUsage(cs, args[0]));
}
cmd.getValue().execute(cs, args);
return true;
}
}
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("questsUnknownAdminCommand"));
return true;
}
public List<String> suggest(final CommandSender cs, final String[] args) {
if (args.length == 1) {
final List<String> results = new ArrayList<>();
for (Map.Entry<String, BukkitQuestsSubCommand> cmd : subCommands.entrySet()) {
if (cmd.getKey().startsWith(args[0]) || cmd.getValue().getNameI18N().startsWith(args[0])) {
results.add(cmd.getValue().getNameI18N());
}
}
return results;
}
for (Map.Entry<String, BukkitQuestsSubCommand> cmd : subCommands.entrySet()) {
if (args[0].equalsIgnoreCase(cmd.getKey()) || args[0].equalsIgnoreCase(cmd.getValue().getNameI18N())) {
return cmd.getValue().tabComplete(cs, args);
}
}
return Collections.emptyList();
}
private void printAdminHelp(final CommandSender cs) {
if (!(cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin"))) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
return;
}
cs.sendMessage(ChatColor.GOLD + BukkitLang.get("questAdminHelpTitle"));
cs.sendMessage(ChatColor.YELLOW + "/questadmin" + ChatColor.RED + " " + BukkitLang.get("COMMAND_QUESTADMIN_HELP"));
final boolean translateSubCommands = plugin.getConfigSettings().canTranslateSubCommands();
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.stats")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_STATS_HELP")
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.give")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_GIVE_HELP")
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.quit")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_QUIT_HELP")
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.points")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_POINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.takepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.givepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.finish")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_FINISH_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.nextstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.setstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reset")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED+ BukkitLang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.remove")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_REMOVE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reload")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_RELOAD_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
}
}
private String getAdminCommandUsage(final CommandSender cs, final String cmd) {
return ChatColor.RED + BukkitLang.get(cs, "usage") + ": " + ChatColor.YELLOW + "/questadmin "
+ BukkitLang.get(cs, BukkitLang.getKeyFromPrefix("COMMAND_QUESTADMIN_", cmd) + "_HELP")
.replace("<command>", cmd.toLowerCase());
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminFinishCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminFinishCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "finish";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_FINISH");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_FINISH_HELP");
}
@Override
public String getPermission() {
return "quests.admin.finish";
}
@Override
public String getSyntax() {
return "/questadmin finish";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.finish")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
String msg = BukkitLang.get("noCurrentQuest");
msg = msg.replace("<player>", target.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
} else {
final String questName = concatArgArray(args, 2, args.length - 1, ' ');
final Quest quest = plugin.getQuest(questName);
if (quest == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound")
.replace("<input>", questName != null ? questName : ""));
return;
}
String msg1 = BukkitLang.get("questForceFinish");
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedFinish");
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quest.completeQuest(quester);
quester.saveData();
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
final Player player = Bukkit.getPlayer(args[1]);
if (player != null) {
final BukkitQuester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) {
for (final Quest quest : quester.getCurrentQuests().keySet()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
} else {
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
return results;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,148 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminGiveCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminGiveCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "give";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_GIVE");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_GIVE_HELP");
}
@Override
public String getPermission() {
return "quests.admin.give";
}
@Override
public String getSyntax() {
return "/questadmin give";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.give")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quest questToGive;
StringBuilder name = new StringBuilder();
if (args.length == 3) {
name = new StringBuilder(args[2].toLowerCase());
} else {
for (int i = 2; i < args.length; i++) {
final int lastIndex = args.length - 1;
if (i == lastIndex) {
name.append(args[i].toLowerCase());
} else {
name.append(args[i].toLowerCase()).append(" ");
}
}
}
questToGive = plugin.getQuest(name.toString());
if (questToGive == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("questNotFound").replace("<input>", name.toString()));
} else {
final Quester quester = plugin.getQuester(target.getUniqueId());
for (final Quest q : quester.getCurrentQuests().keySet()) {
if (q.getName().equalsIgnoreCase(questToGive.getName())) {
String msg = BukkitLang.get("questsPlayerHasQuestAlready");
msg = msg.replace("<player>", target.getName());
msg = msg.replace("<quest>", questToGive.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
return;
}
}
quester.hardQuit(questToGive);
String msg1 = BukkitLang.get("questForceTake");
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", questToGive.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedTake");
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", questToGive.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.takeQuest(questToGive, true);
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
return results;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminGivepointsCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminGivepointsCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "givepoints";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP");
}
@Override
public String getPermission() {
return "quests.admin.givepoints";
}
@Override
public String getSyntax() {
return "/questadmin givepoints";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.givepoints")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final int points;
try {
points = Integer.parseInt(args[2]);
} catch (final NumberFormatException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("inputNum"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
quester.setQuestPoints(quester.getQuestPoints() + Math.abs(points));
String msg1 = BukkitLang.get("giveQuestPoints").replace("<points>", BukkitLang.get("questPoints"));
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<number>", String.valueOf(points));
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questPointsGiven").replace("<points>", BukkitLang.get("questPoints"));
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<number>", String.valueOf(points));
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.saveData();
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminNextstageCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminNextstageCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "nextstage";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP");
}
@Override
public String getPermission() {
return "quests.admin.nextstage";
}
@Override
public String getSyntax() {
return "/questadmin nextstage";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.nextstage")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty()) {
String msg = BukkitLang.get("noCurrentQuest");
msg = msg.replace("<player>", target.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
} else {
final String questName = concatArgArray(args, 2, args.length - 1, ' ');
final Quest quest = plugin.getQuest(questName);
if (quest == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound")
.replace("<input>", questName != null ? questName : ""));
return;
}
String msg1 = BukkitLang.get("questForceNextStage");
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedNextStage");
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quest.nextStage(quester, false);
quester.saveData();
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
final Player player = Bukkit.getPlayer(args[1]);
if (player != null) {
final BukkitQuester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) {
for (final Quest quest : quester.getCurrentQuests().keySet()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
} else {
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
return results;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminPointsCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminPointsCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "points";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_POINTS");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_POINTS_HELP");
}
@Override
public String getPermission() {
return "quests.admin.points";
}
@Override
public String getSyntax() {
return "/questadmin points";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.points")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final int points;
try {
points = Integer.parseInt(args[2]);
} catch (final NumberFormatException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("inputNum"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
quester.setQuestPoints(points);
String msg1 = BukkitLang.get("setQuestPoints").replace("<points>", BukkitLang.get("questPoints"));
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<number>", String.valueOf(points));
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questPointsSet").replace("<points>", BukkitLang.get("questPoints"));
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<number>", String.valueOf(points));
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.saveData();
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,141 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminQuitCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminQuitCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "quit";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_QUIT");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_QUIT_HELP");
}
@Override
public String getPermission() {
return "quests.admin.quit";
}
@Override
public String getSyntax() {
return "/questadmin quit";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.quit")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
String msg = BukkitLang.get("noCurrentQuest");
msg = msg.replace("<player>", target.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
} else {
final String questName = concatArgArray(args, 2, args.length - 1, ' ');
final Quest quest = plugin.getQuest(questName);
if (quest == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound")
.replace("<input>", questName != null ? questName : ""));
return;
}
String msg1 = BukkitLang.get("questForceQuit");
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = BukkitLang.get((Player) target, "questForcedQuit");
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
quester.quitQuest(quest, msg2);
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
final Player player = Bukkit.getPlayer(args[1]);
if (player != null) {
final BukkitQuester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) {
for (final Quest quest : quester.getCurrentQuests().keySet()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
} else {
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
return results;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.interfaces.ReloadCallback;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class BukkitQuestadminReloadCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminReloadCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "reload";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_RELOAD");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_RELOAD_HELP");
}
@Override
public String getPermission() {
return "quests.admin.reload";
}
@Override
public String getSyntax() {
return "/questadmin reload";
}
@Override
public int getMaxArguments() {
return 1;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reload")) {
final ReloadCallback<Boolean> callback = response -> {
if (response) {
cs.sendMessage(ChatColor.GOLD + BukkitLang.get("questsReloaded"));
String msg = BukkitLang.get("numQuestsLoaded");
msg = msg.replace("<number>", String.valueOf(plugin.getLoadedQuests().size()));
cs.sendMessage(ChatColor.GOLD + msg);
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("unknownError"));
}
};
plugin.reload(callback);
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
}

View File

@ -0,0 +1,139 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminRemoveCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminRemoveCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "remove";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_REMOVE");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_REMOVE_HELP");
}
@Override
public String getPermission() {
return "quests.admin.remove";
}
@Override
public String getSyntax() {
return "/questadmin remove";
}
@Override
public int getMaxArguments() {
return 3;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") && cs.hasPermission("quests.admin.remove")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final String questName = concatArgArray(args, 2, args.length - 1, ' ');
final Quest toRemove = plugin.getQuest(questName);
if (toRemove == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound")
.replace("<input>", questName != null ? questName : ""));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
String msg = BukkitLang.get("questRemoved");
if (target.getName() != null) {
msg = msg.replace("<player>", target.getName());
} else {
msg = msg.replace("<player>", args[1]);
}
msg = msg.replace("<quest>", toRemove.getName());
cs.sendMessage(ChatColor.GOLD + msg);
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + quester.getUUID().toString());
quester.hardRemove(toRemove);
quester.saveData();
quester.updateJournal();
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
final Player player = Bukkit.getPlayer(args[1]);
if (player != null) {
final BukkitQuester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) {
for (final Quest quest : quester.getCompletedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
} else {
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
return results;
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,126 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.storage.QuesterStorage;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
public class BukkitQuestadminResetCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminResetCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "reset";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_RESET");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_RESET_HELP");
}
@Override
public String getPermission() {
return "quests.admin.reset";
}
@Override
public String getSyntax() {
return "/questadmin reset";
}
@Override
public int getMaxArguments() {
return 2;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reset")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final UUID id = target.getUniqueId();
final ConcurrentSkipListSet<Quester> temp = (ConcurrentSkipListSet<Quester>) plugin.getOfflineQuesters();
temp.removeIf(quester -> quester.getUUID().equals(id));
plugin.setOfflineQuesters(temp);
Quester quester = plugin.getQuester(id);
try {
quester.resetCompass();
quester.hardClear();
quester.saveData();
quester.updateJournal();
final QuesterStorage storage = plugin.getStorage();
storage.deleteQuester(id);
String msg = BukkitLang.get("questReset");
if (target.getName() != null) {
msg = msg.replace("<player>", target.getName());
} else {
msg = msg.replace("<player>", args[1]);
}
cs.sendMessage(ChatColor.GOLD + msg);
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + id);
} catch (final Exception e) {
plugin.getLogger().info("Data file does not exist for " + id);
}
quester = new BukkitQuester(plugin, id);
quester.saveData();
final ConcurrentSkipListSet<Quester> temp2 = (ConcurrentSkipListSet<Quester>) plugin.getOfflineQuesters();
temp2.add(quester);
plugin.setOfflineQuesters(temp2);
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,171 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.BukkitQuester;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
public class BukkitQuestadminSetstageCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminSetstageCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "setstage";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP");
}
@Override
public String getPermission() {
return "quests.admin.setstage";
}
@Override
public String getSyntax() {
return "/questadmin setstage";
}
@Override
public int getMaxArguments() {
return 4;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.setstage")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
int stage;
try {
stage = Integer.parseInt(args[args.length - 1]);
} catch (final NumberFormatException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("inputNum"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
String msg = BukkitLang.get("noCurrentQuest");
msg = msg.replace("<player>", target.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
} else {
final String questName = concatArgArray(args, 2, args.length - 2, ' ');
final Quest quest = plugin.getQuest(concatArgArray(args, 2, args.length - 2, ' '));
if (quest == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound")
.replace("<input>", questName != null ? questName : ""));
return;
}
if (!quester.getCurrentQuests().containsKey(quest)) {
String msg1 = BukkitLang.get("questForceTake");
msg1 = msg1.replace("<player>", quester.getLastKnownName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (quester.getPlayer() != null && quester.getPlayer().isOnline()) {
String msg2 = BukkitLang.get("questForcedTake");
msg2 = msg2.replace("<player>", quester.getLastKnownName());
msg2 = msg2.replace("<quest>", quest.getName());
quester.sendMessage(ChatColor.GREEN + msg2);
}
quester.takeQuest(quest, true);
quester.saveData();
}
try {
quest.setStage(quester, stage - 1);
} catch (final IndexOutOfBoundsException e) {
String msg = BukkitLang.get("invalidRange");
msg = msg.replace("<least>", "1").replace("<greatest>", String.valueOf(quest.getStages().size()));
cs.sendMessage(ChatColor.RED + msg);
}
quester.saveData();
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
} else if (args.length == 3) {
final List<String> results = new ArrayList<>();
final Player player = Bukkit.getPlayer(args[1]);
if (player != null) {
final BukkitQuester quester = plugin.getQuester(player.getUniqueId());
if (quester != null) {
for (final Quest quest : quester.getCurrentQuests().keySet()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
} else {
for (final Quest quest : plugin.getLoadedQuests()) {
if (quest.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
results.add(ChatColor.stripColor(quest.getName()));
}
}
}
return results;
} else if (args.length > 3) {
final Quest quest = plugin.getQuest(args[2]);
if (quest != null) {
final List<String> results = new ArrayList<>();
for (int i = 1; i <= quest.getStages().size(); i++) {
results.add(String.valueOf(i));
}
return results;
}
}
return Collections.emptyList();
}
}

View File

@ -0,0 +1,132 @@
/*
* Copyright (c) PikaMug and contributors
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package me.pikamug.quests.commands.questadmin.subcommands;
import me.pikamug.quests.BukkitQuestsPlugin;
import me.pikamug.quests.commands.BukkitQuestsSubCommand;
import me.pikamug.quests.player.Quester;
import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitLang;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class BukkitQuestadminStatsCommand extends BukkitQuestsSubCommand {
private final BukkitQuestsPlugin plugin;
public BukkitQuestadminStatsCommand(BukkitQuestsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getName() {
return "stats";
}
@Override
public String getNameI18N() {
return BukkitLang.get("COMMAND_QUESTADMIN_STATS");
}
@Override
public String getDescription() {
return BukkitLang.get("COMMAND_QUESTADMIN_STATS_HELP");
}
@Override
public String getPermission() {
return "quests.admin.stats";
}
@Override
public String getSyntax() {
return "/questadmin stats";
}
@Override
public int getMaxArguments() {
return 2;
}
@Override
public void execute(CommandSender cs, String[] args) {
if (args.length == 1) {
// Shows command usage
return;
}
if (cs.hasPermission("quests.admin.*") && cs.hasPermission("quests.admin.stats")) {
OfflinePlayer target = getOfflinePlayer(args[1]);
if (target == null) {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
cs.sendMessage(ChatColor.GOLD + "- " + target.getName() + " -");
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("questPoints") + " - " + ChatColor.DARK_PURPLE
+ quester.getQuestPoints());
if (quester.getCurrentQuests().isEmpty()) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("currentQuest") + " " + ChatColor.DARK_PURPLE+ BukkitLang.get("none"));
} else {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("currentQuest"));
for (final Map.Entry<Quest, Integer> set : quester.getCurrentQuests().entrySet()) {
final Quest q = set.getKey();
final String msg = ChatColor.LIGHT_PURPLE + " - " + ChatColor.DARK_PURPLE + q.getName()
+ ChatColor.LIGHT_PURPLE + " (" + BukkitLang.get("stageEditorStage") + " " + (set.getValue() + 1) + ")";
cs.sendMessage(msg);
}
}
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("completedQuest"));
if (quester.getCompletedQuests().isEmpty()) {
cs.sendMessage(ChatColor.DARK_PURPLE + BukkitLang.get("none"));
} else {
final StringBuilder completed = new StringBuilder(" ");
int index = 1;
for (final Quest q : quester.getCompletedQuests()) {
completed.append(ChatColor.DARK_PURPLE).append(q.getName());
if (quester.getAmountsCompleted().containsKey(q) && quester.getAmountsCompleted().get(q) > 1) {
completed.append(ChatColor.LIGHT_PURPLE).append(" (x").append(quester.getAmountsCompleted()
.get(q)).append(")");
}
if (index < (quester.getCompletedQuests().size())) {
completed.append(", ");
}
index++;
}
cs.sendMessage(completed.toString());
}
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("noPermission"));
}
}
@Override
public List<String> tabComplete(CommandSender commandSender, String[] args) {
if (args.length == 2) {
return null; // Shows online players
}
return Collections.emptyList();
}
}

Some files were not shown because too many files have changed in this diff Show More