1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 01:42:32 +01:00

Compare commits

...

855 Commits

Author SHA1 Message Date
nossr50
25bdcdb075 async place store 2023-12-17 15:17:10 -08:00
nossr50
a522ab7b2f updata todo note 2023-12-16 17:59:40 -08:00
nossr50
a0923ad786 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-12-16 17:46:37 -08:00
nossr50
dd04ee48b9 2.1.226 2023-12-16 17:45:17 -08:00
PikaMug
89b895af81 Update pom.xml with WorldEdit (#4951) 2023-10-27 11:19:38 -07:00
nossr50
9e1f5b44a6 dev mode 2023-10-15 12:29:27 -07:00
nossr50
a54590576f 2.1.225 2023-10-15 12:18:12 -07:00
Spongecade
06160c6d04 Update Minecraft wiki link to new domain (#4944) 2023-10-15 10:47:21 -07:00
nossr50
12e5a7f054 Bamboo is now treated like a cactus/sugar cane 2023-10-08 16:51:59 -07:00
nossr50
1f20e6344b 2.1.224 2023-10-02 18:16:02 -07:00
nossr50
13ba51cdf1 Fixed some mistakes in shake config 2023-09-30 15:46:20 -07:00
nossr50
4f22391465 Spelling/Grammar 2023-09-30 15:44:56 -07:00
nossr50
5f1a545437 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-09-30 15:43:30 -07:00
nossr50
bad7023129 Shake has 8 ranks again 2023-09-30 15:43:19 -07:00
Huynh Tien
785f18c13a update FoliaLib (#4935)
- fix an issue with 0 ticks setting
- disable scheduler warning
2023-09-03 16:41:35 -07:00
nossr50
357995ecb0 2.1.223 Folia Support Added 2023-08-26 16:21:09 -07:00
nossr50
3e26eca48e Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-08-26 16:17:39 -07:00
nossr50
dd339c20ea Updated API 2023-08-26 16:17:31 -07:00
Yomamaeatstoes
c34230a82e mcMMO-Folia-PR (#4925)
Folia Support

---------

Co-authored-by: Rockyers <ethan@yocom.org>
Co-authored-by: TechnicallyCoded <technicallycoded@gmail.com>
Co-authored-by: HSGamer <huynhqtienvtag@gmail.com>
2023-08-26 16:16:18 -07:00
Greymagic27
192626f4da Fix packaging error on windows #4911 (#4919) 2023-08-19 14:23:05 -07:00
nossr50
24a57fab3d 2.1.222 2023-07-09 14:43:38 -07:00
nossr50
78596dc00e Glow Lichen nerf 2023-06-25 13:51:00 -07:00
nossr50
0b1b753d4c Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2023-06-25 13:47:25 -07:00
nossr50
3cbdcddcc1 Crossbows do not count as unarmed item with unarmed items setting 2023-06-25 13:47:04 -07:00
dependabot[bot]
25ecb6e1de Bump guava from 31.1-jre to 32.0.0-jre (#4903)
Bumps [guava](https://github.com/google/guava) from 31.1-jre to 32.0.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 18:46:30 -07:00
nossr50
019d22d92a Make mcMMO quieter by moving most log messages to debug only 2023-06-19 16:26:30 -07:00
nossr50
e39022cc64 2.1.221 2023-06-19 14:11:53 -07:00
nossr50
a41106ee30 Update changelog 2023-06-17 20:34:18 -07:00
nossr50
b2110d4e1c PAPI Support pt 2 2023-06-17 20:32:51 -07:00
nossr50
f22043ebb5 PAPI Support WIP 2023-06-17 20:22:49 -07:00
nossr50
cc1b511c02 Don't look up offline players by name 2023-06-17 15:56:36 -07:00
nossr50
e9a020565f Added fail safes against bonus drop meta not being cleaned up 2023-05-29 14:34:47 -07:00
nossr50
44ab8d93ab Dev mode 2023-05-29 14:15:04 -07:00
Warrior
78922ea337 Fix blast mining bonus drops option not working (#4895) 2023-05-29 13:58:24 -07:00
nossr50
db01b61371 2.1.220 2023-05-13 14:42:14 -07:00
Warrior
133a60c4bf Fix child skills counting towards power level in /inspect (#4889) 2023-04-23 11:08:06 -07:00
nossr50
684e96ff6b Fix RankConfig 2023-04-17 12:17:28 -07:00
nossr50
f40f68bdf0 Fix RankConfig not using the new updating config system 2023-04-17 12:07:59 -07:00
nossr50
640f4b0a9b Fix mcMMO attempting to copy out custom repair/salvage configs 2023-04-17 12:07:41 -07:00
nossr50
978ee4a9a3 Optimize the imports 2023-04-11 15:49:37 -07:00
nossr50
0ab93586fd Config files will update automatically again 2023-04-11 15:48:14 -07:00
nossr50
921a0228db Merge remote-tracking branch 'origin/master' 2023-04-07 17:00:13 -07:00
nossr50
ac68c4ebe6 2.1.219 2023-04-07 17:00:01 -07:00
Smudge
4553310bb9 Fixed fishing exploiting compatibility (#4859)
* Fixed fishing exploiting compatibility

* Moved same target to class variable
2023-04-03 17:52:00 -07:00
Warrior
9b0632d63c Make party loading more resilient (#4881) 2023-04-03 17:49:35 -07:00
Warrior
69ef484b86 Fix dots not being replaced when renaming party (#4882) 2023-04-03 17:48:53 -07:00
Warrior
606a92f1ef Fix /party teleport NPE (#4885) 2023-04-03 17:48:01 -07:00
nossr50
79730383ab Fixed wiki url being incorrect in various commands 2023-04-03 16:47:58 -07:00
nossr50
7264e1a8d6 Small tweaks 2023-04-03 12:07:34 -07:00
nossr50
e011f545a7 Added smithing_table to tool readiness blacklist 2023-04-02 20:44:00 -07:00
nossr50
283fa14380 Add Camel, Sniffer, and Snifflet to taming XP 2023-04-02 20:42:06 -07:00
nossr50
5f388a9906 Add support for torchflower replanting to herbalism 2023-04-02 20:38:05 -07:00
nossr50
cd96bc79d8 Change isHerbalismDrop to use strings.. this method still needs more work 2023-04-02 20:24:04 -07:00
nossr50
ae961caeab Added Torchflower to herbalism experience and bonus drops 2023-04-02 20:11:10 -07:00
nossr50
0b4d87aebc Add Sniffer and Snifflet to combat experience in experience.yml 2023-04-02 20:07:50 -07:00
nossr50
6106f70c24 Added Pitcher_Plants to bonus drops and herbalism experience 2023-04-02 20:05:52 -07:00
nossr50
100a7f8a8f Added pink_petals, cherry_wood, and cherry_log to bonus drops in config.yml 2023-04-02 20:02:32 -07:00
nossr50
4c792c4f2c Added Pink_Petals to experience.yml 2023-04-02 20:00:58 -07:00
nossr50
db4b820f80 Add new hanging signs to tool readiness blacklist 2023-04-02 19:58:16 -07:00
nossr50
ca710b4302 Add chiseled_bookshelf to tool readiness blacklist 2023-04-02 19:55:30 -07:00
nossr50
668cc0e4a3 Add support for upcoming Cherry trees 2023-04-02 19:53:13 -07:00
nossr50
6d0542b524 Merge remote-tracking branch 'origin/master' 2023-03-26 13:22:41 -07:00
nossr50
d84a5b37b7 Update kyori dependencies 2023-03-26 13:22:31 -07:00
optimizing-ci-builds
c072ae4990 disable xml report (#4880) 2023-03-21 22:05:40 -07:00
nossr50
2d78eaa495 Fixed Beetroots double drop issue #4667 2023-03-19 21:21:54 -07:00
Warrior
6bdc51be76 Fix missing return in notify command (#4870) 2023-02-25 15:20:45 -08:00
nossr50
af15617196 Add config toggle for Blast Mining bonus drops to advanced.yml 2023-02-19 13:40:14 -08:00
CuteLittleSky
643dff7915 Update locale_zh_CN.properties (#4858) 2023-02-09 18:16:26 -08:00
Justin
01fbfccc0d feat: Make power level display for offline players (#4861)
Fixes #4599
2023-02-09 18:12:46 -08:00
Jok
2362fe994a Don't call EntityDamageByEntityEvent with null damager (#4863)
Co-authored-by: Elioby <elioby@users.noreply.github.com>
2023-02-09 18:11:30 -08:00
nopeless
08b08b1285 Fix: player is no longer immune to projectiles shot by themselves (#4856) 2023-01-28 11:57:31 -08:00
nossr50
965540dfaf 2.1.218 2022-12-04 14:32:34 -08:00
destro174
75822472fc Add item in mainhand when spawning in lumber bonus blocks. (#4826) 2022-12-04 14:22:37 -08:00
Daniil Z
59aecb79a1 Update Russian locale (#4832)
Added/updated some lines
Fixed new-line characters
2022-12-04 14:21:44 -08:00
DarkKnights22
c865c2d2e3 Fix bug where players could know staff are invis (#4833)
* Fix bug where players could know staff are invis

* remove whitespace
2022-12-04 14:21:22 -08:00
MrPowerGamerBR
93c64a8770 Fix pt_BR ability on typo (#4837) 2022-12-04 14:19:48 -08:00
Greymagic27
30ac82181e Updated plugins to latest version (#4817) 2022-08-09 07:35:12 -07:00
nossr50
2b219f48ec Dev mode 2022-08-07 16:13:18 -07:00
nossr50
fed0483d40 2.1.217 2022-08-07 16:03:55 -07:00
nossr50
101c43a4bc Tree Feller now partially destroys trees if the whole tree is too big
Fixes #4811
2022-08-07 15:55:19 -07:00
nossr50
fb738d85f6 Mangrove trees are now properly marked natural from growth
Fixes #4810
2022-08-07 15:54:22 -07:00
nossr50
032a407c8a Update changelog and version 2022-08-07 14:27:42 -07:00
Greymagic27
33e615f0f1 Updated dependencies to fix hovering over subskills for 1.19.2 (#4814)
* Updated dependencies that should fix the issue

* Updated spigotmc version

* Updated rest of dependencies

* Updated dependencies that fix the issue. Investigating what dependency update breaks compiling.

* Found the dependency that caused the compile issue, so have not updated that one
2022-08-07 14:19:46 -07:00
dod0lp
8feba60e2c Update config.yml (#4809) 2022-08-03 07:43:03 -07:00
nossr50
8a4fe8ae5d 2.1.216 2022-07-24 10:09:48 -07:00
nossr50
45f96793a5 Revert "Players who used unarmed combat are still considered using unarmed while not holding weapons for a brief time period"
This reverts commit 993b418fbc.
2022-07-24 10:05:56 -07:00
nossr50
df0362bcba Allow mining benefits while using Hoe 2022-07-23 17:04:43 -07:00
nossr50
25d558a5fa Added Sculk blocks to Mining 2022-07-23 16:57:42 -07:00
nossr50
c0e4d7a43d 2.1.215 - Unarmed change + Bug Fixes 2022-07-23 16:22:02 -07:00
nossr50
993b418fbc Players who used unarmed combat are still considered using unarmed while not holding weapons for a brief time period 2022-07-23 16:13:49 -07:00
nossr50
9cf856221d update changelog 2022-07-23 14:47:32 -07:00
nossr50
4db6e03517 Hacky workaround for Spigot API bug not showing burntime to the client when burntime was too high 2022-07-23 14:43:24 -07:00
nossr50
eb1393c02c Fix burnTime debug prints on mmodebug players 2022-07-23 14:24:31 -07:00
nossr50
e1a54b72a9 update changelog 2022-07-23 13:34:38 -07:00
Greymagic27
b266c7ce5b Updated Dependencies (#4798)
* Updated Dependencies

* Fix spelling mistake in dependencies

* Fixed dependency error that would prevent the plugin from loading.

Turned out I put in the wrong acf-bukkit, preventing the plugin from working. Oops!
2022-07-17 14:59:19 -07:00
nossr50
38f937fa01 revert potential furnace animation bug fix 2022-07-17 14:56:44 -07:00
nossr50
6d7982c0cf Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2022-07-17 14:03:10 -07:00
nossr50
89fa26d0eb Potential fix for #3005 2022-07-17 14:00:03 -07:00
Greymagic27
edd85c2f19 Updated kyori adventure-platform dependencies (#4797) 2022-07-17 13:38:44 -07:00
Greymagic27
88b6517f88 Added Dripstone Block to experience.yml (#4796) 2022-07-15 15:07:19 -07:00
PikaMug
2c09a0fdb6 Switch to new sk89q repo (#4791) 2022-07-02 19:25:27 -07:00
nossr50
90721ee859 Add missing Mangrove_Log to experience.yml 2022-06-26 18:43:09 -07:00
destro174
aa4011a226 Use item in mainhand to get drops when using treefeller (#4781) 2022-06-11 16:41:27 -07:00
nossr50
fa82fe8e67 Level up broadcasts should be visible to the player of origin 2022-06-09 22:50:36 -07:00
nossr50
444e1532f2 2.1.214 2022-06-09 22:39:11 -07:00
Smudge
1a34d2f647 Added 25% xp boost permission (#4773) 2022-06-09 14:31:06 -07:00
abridgedcarp
d543843235 Fix Maven build failure (#4779) 2022-06-09 14:26:50 -07:00
nossr50
c40af913f4 mcMMO 2.1.213 2022-06-07 18:07:14 -07:00
nossr50
f6268fe291 Add in new 1.19 stuff and tweak treasures.yml 2022-06-07 18:00:32 -07:00
nossr50
27854720f0 Add some exploit prevention to fishing 2022-05-15 15:24:25 -07:00
nossr50
d19cf1e260 2.1.212 - Fixed herbalism exploit and added damage limit for XP
calculations used in combat
2022-04-28 18:31:10 -07:00
Warrior
4a8630262e Fix hanging plants searching up instead of down. (#4766) 2022-04-28 08:33:45 -07:00
Werner
c41d2d1f39 Bump shade-plugin to 3.3.1 (#4762)
fixes building
2022-04-10 13:09:03 -07:00
nossr50
8821fb0b2f 2.1.211 2022-03-18 15:07:02 -07:00
nossr50
5ab55c1653 mcMMO will no longer use the DamageModifier API (potentially fix immortal player bug) 2022-03-17 19:58:42 -07:00
nossr50
8066f7f7f2 Tweak damage debug info to show modifier values 2022-03-17 16:08:50 -07:00
nossr50
5ea18e8ba7 Add combat debug info for player versus player combat /mmodebug 2022-03-17 15:03:42 -07:00
nossr50
0bf3f98d95 2.1.210 2022-03-17 13:59:17 -07:00
nossr50
fa33fa3d32 Revert 3 commits (work will be continued in branch)
Revert "Disabling mcMMO when the config breaks is dumb"

This reverts commit 86e7bfbf89.

Revert "Config validation rewrite part 1"

This reverts commit 16e90da8fd.

Revert "Update changelog"

This reverts commit 0ccd89fad4.
2022-03-17 13:49:46 -07:00
Mads U. Jensen
8b6a4c1e5b Update doubledrops IDs (#4743) 2022-02-10 17:31:22 -08:00
nossr50
0ccd89fad4 Update changelog 2022-01-30 15:47:08 -08:00
nossr50
16e90da8fd Config validation rewrite part 1 2022-01-30 15:31:52 -08:00
nossr50
86e7bfbf89 Disabling mcMMO when the config breaks is dumb
Fixes #4732
2022-01-30 14:24:21 -08:00
nossr50
8f0fb76847 Silence API out of date warning on config load 2022-01-17 15:57:04 -08:00
nossr50
3be15d3f65 Rewrite how mob/item/block metadata is tracked/retrieved
Fixes #4720
2022-01-17 15:32:02 -08:00
nossr50
74ced18bd0 Dev mode 2022-01-15 11:51:44 -08:00
nossr50
2e0a371ed8 Update changelog 2022-01-14 16:50:19 -08:00
nossr50
68ffe31246 2.1.209 2022-01-14 16:41:33 -08:00
nossr50
405de477d3 (thanks chew) Fix older MC versions not loading config files
Fixes #4716
2022-01-11 19:28:18 -08:00
nossr50
db0ae36fa7 fixed bug where duplicate comments with leading whitespace were ignored 2022-01-11 19:22:28 -08:00
nossr50
5d2028b5dc Java 16 compile target 2022-01-10 22:36:37 -08:00
nossr50
3e645a022d 2.1.208 2022-01-10 22:34:21 -08:00
nossr50
c21a040ddb Huge changes to how config files are loaded/updated, fixes many issues
Fixes #4715
2022-01-10 22:29:22 -08:00
the456gamer
dd4a5a6b9a remove YAML parsing hacks in favor of native bukkit provided parsing (#4714)
* fix yaml config to use native comment handling.
fixes #4702
replaces #4713
2022-01-09 11:16:17 -08:00
nossr50
d5ce8fc6ff Dev mode 2022-01-09 11:14:11 -08:00
dexasz
829aaea5d4 add & translate missing strings & fix a typo that broke placeholders (#4707) 2022-01-09 11:07:18 -08:00
Olivia
c92ae16c7f Fix extra 0 in level for gunpowder in retro mode (#4701) 2021-12-30 14:21:46 -08:00
nossr50
40160498ca 2.1.207 2021-12-27 11:40:33 -08:00
nossr50
9d08d88f2a Add new repair setting to default file 2021-12-27 11:34:55 -08:00
JeBobs
2ca3544741 Added option to disallow using enchanted materials to repair items. (#4693) 2021-12-27 11:29:54 -08:00
nossr50
ef714f98c9 Fix parties at level cap gaining XP and thus spamming messages
Fixes #4686
2021-12-27 11:22:16 -08:00
nossr50
dd550feb65 Update BlockTracker to use Spigot API directly instead of compatibility
layer
Fixes #4692 Fixes #4698
2021-12-27 11:09:27 -08:00
nossr50
ddc9a69f4b Fix ScoreboardManager NPE and added locale messages relating to scoreboards 2021-12-27 10:46:56 -08:00
TheBusyBiscuit
61388f46f1 Fixed #4694 (#4695) 2021-12-27 09:27:13 -08:00
nossr50
341dc45202 Takeout this warning 2021-12-14 23:27:51 -08:00
nossr50
13f7482b39 Unicode support for locale files 2021-12-14 23:08:08 -08:00
nossr50
a78dcffde7 Temporarily roll back to Java 16 2021-12-14 22:26:40 -08:00
nossr50
3671d0b565 dev mode 2021-12-14 22:23:31 -08:00
lilac & gooseberries
1b11fd2369 lithuanian translation for mcmmo (#4676) 2021-12-14 22:22:58 -08:00
nossr50
c36ff85cbf 2.1.206 - Memory leaks fixed and other changes Fixes #4681 2021-12-11 22:27:54 -08:00
nossr50
77cefbdfab Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2021-12-11 22:22:37 -08:00
nossr50
fbe0cd1471 Fixing like 10 memory leaks Fixes #4670 2021-12-11 22:22:02 -08:00
Robert Alan Chapton
728ba512c3 Java 17 for GH actions 2021-12-11 21:21:22 -08:00
nossr50
10470dde13 Reduce default volume of level up sound 2021-12-11 21:19:30 -08:00
nossr50
11245e87ef squelch ChunkStoreTest log output 2021-12-11 20:57:25 -08:00
nossr50
b88d752f61 update dependencies 2021-12-11 20:56:10 -08:00
Enderaoe
09ce259288 fix issue #4667 (#4669) 2021-12-07 19:55:42 -08:00
PikaMug
519d469cb2 Add null check to XP gain handler, fixes #4663 (#4677)
* Add null check to XP gain handler, fixes #4663

Co-authored-by: Robert Alan Chapton <nossr50@gmail.com>
2021-12-07 19:54:48 -08:00
nossr50
cf67e3502a dev mode 2021-12-07 19:29:36 -08:00
nossr50
9ab4584dfe MOB_METADATA_KEYS should be immutable 2021-11-14 09:36:00 -08:00
nossr50
8d27e8fccf 2.1.205 2021-11-14 09:33:27 -08:00
NemuruYama
ba1f15b655 Fixed the alchemy properly (#4658) 2021-11-14 08:05:42 -08:00
nossr50
5b1a69b3f7 2.1.204 2021-11-10 14:55:54 -08:00
Enderaoe
d185c7538c Fix issue #4626 double smelting on raw copper (#4652) 2021-11-10 04:55:04 -08:00
gecko10000
2347fc294f Fix IndexOutOfBoundsException for fake brew event by adding to list instead of setting the index (which doesn't work) (#4655) 2021-11-10 04:54:31 -08:00
nossr50
7aaec5b707 2.1.203 2021-11-08 19:07:02 -08:00
nossr50
20a713e04d Update changelog 2021-11-08 19:02:37 -08:00
gecko10000
81faf93f31 Fix hex colors in broadcasts (#4651) 2021-11-08 19:01:14 -08:00
PikaMug
19c0f6757e Add deprecated constructor w/o startinglevel per d9e195f (#4647) 2021-11-08 19:00:00 -08:00
nossr50
ec0815043e Update changelog 2021-11-08 18:58:11 -08:00
Enderaoe
182717eacf Fix issue #4105 Fishing shake percentage seems off. (#4649) 2021-11-08 18:57:32 -08:00
Robert Alan Chapton
e287ad47d1 updating github actions
hope this works
2021-11-08 18:54:46 -08:00
nossr50
8eee39b88b mcMMO now requires the latest MC version (currently 1.17.1)
Fixed a few bugs from API breaks
2021-11-08 18:38:50 -08:00
nossr50
4bf2ad46ea Require Java 16 2021-11-08 18:15:33 -08:00
nossr50
def676d8d7 2.1.202 2021-10-05 12:41:25 -07:00
nossr50
f8433cdbcc Fixed Kelp not awarding XP
Fixed #4639 Fixed #4110
2021-10-05 12:39:56 -07:00
nossr50
a2e10dbd0c Azalea trees bone mealed into existence no longer get marked unnatural
Fixes #4640
2021-10-05 11:58:31 -07:00
nossr50
e55ce00d62 Update changelog 2021-10-05 10:13:07 -07:00
nossr50
73c465ee64 Fixed a bug where mcMMO didn't flag all blocks as natural appropriately
in some StructureGrowEvent(s)
2021-09-28 16:58:40 -07:00
nossr50
c30892a0a5 Add flowering azalea leaves to Tree Feller 2021-09-28 00:09:04 -07:00
nossr50
58e7323c3e Bring adventure-api and adventure-platform (and dependencies) up to date 2021-09-23 12:59:58 -07:00
tunagohan
7fc6577196 Propose: Add an option for Exploiting Fishing. (#4619)
* feat: Add exploiting option for fishing

* Update experience.yml

Let's change how this was named

* Update ExperienceConfig.java

Let's change how this was named

Co-authored-by: Robert Alan Chapton <nossr50@gmail.com>
2021-09-22 15:11:54 -07:00
PikaMug
162c605dac Trigger change event for party create/disband (#4620) 2021-09-22 15:05:41 -07:00
rosaage
280eb0ba51 Added support for allowPublicKeyRetrieval=true in the JDBC launch (#4635)
options for MySQL

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
2021-09-22 15:03:03 -07:00
GhostDC
8e5251ba66 update locale_zh_CN.properties (#4628) 2021-09-22 15:00:03 -07:00
Warrior
1e43e34547 Make /party kick case insensitive (#4630) 2021-09-22 14:59:39 -07:00
nossr50
5575309b79 Add amethyst block to experience.yml for Mining 2021-08-15 21:59:38 -07:00
nossr50
88dae5d5dd dev mode ( 2.1.202 ) 2021-08-10 14:59:13 -07:00
nossr50
da3909c08f 2.1.201 2021-08-10 14:44:13 -07:00
nossr50
6cad4993ed Tweaked Rupture's visual/audio effect 2021-08-10 14:42:08 -07:00
nossr50
af6e6b9545 Update changelog 2021-08-10 14:21:16 -07:00
emanondev
cd937a812d Fix for impact armor damage formula (#4425)
* Update SkillUtils.java

Add handleArmorDurabilityChange() to handle armor damage reduction correctly

* Update AxesManager.java

Changed method to handle impact damage calculation

* Update SkillUtils.java
2021-08-10 14:19:18 -07:00
Griffin Kubesa
264c0e2c78 Add /<skill> keep (#4512)
* Add /<skill> keep

* Add keep to tab completion

* Case insensitive
2021-08-10 14:17:37 -07:00
David
b42278932e Update locale_pt_BR.properties (#4566) 2021-08-10 14:15:56 -07:00
蘭蘭露 Flandre_tw
7fc7125ed3 Reupload new Chinese Traditional translation (#4584)
Hello, I have completed the Chinese Traditional translation. :)
2021-08-10 14:14:45 -07:00
nossr50
d3f012de27 Update changelog 2021-08-10 14:14:07 -07:00
Griffin Kubesa
dfa16c70a7 Set TNT source in blast mining (#4580)
* Set TNT source in blast mining

* Compatibility with older versions

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>
2021-08-10 14:13:25 -07:00
GhostDC
8805a25d85 update locale_zh_CN.properties (#4585)
Thank you
2021-08-10 14:09:32 -07:00
nossr50
f91a2217c8 Fixed plugin incompatibility and exploits regarding buffed tools remaining buffed
Fixes #4616
2021-08-10 14:04:59 -07:00
nossr50
64f1ae4af6 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-08-10 13:47:55 -07:00
nossr50
6d9a9d165d Blast Mining shouldn't drop Budding Amethyst
Fixes #4589
2021-08-10 13:46:33 -07:00
nossr50
5edc0d065d Add aliases to inspect command (mcinspect, mmoinspect) 2021-08-06 21:54:28 -07:00
Diablolend
a346fc3338 Fixed in every line of "\ \ " characters (#4588)
Where did they come from? 🤔
2021-07-29 15:16:07 -07:00
nossr50
dc94fedee1 Added member getPlayer to McMMOItemSpawnEvent
Fixes #4572
2021-07-20 18:47:25 -07:00
nossr50
93a6a73b4e Revert Woodcutting translation forortuguese
Fixes #4568
2021-07-20 18:32:34 -07:00
TheBusyBiscuit
2c849d9cb4 Added a Unit Test for mc version detection (#4560)
* Added a Unit Test for mc version detection

* Merge upstream and update server software string
2021-07-05 16:02:46 -07:00
nossr50
b79d452a6d 2.1.200 2021-07-01 21:02:59 -07:00
nossr50
fb94374e3c Update changelog 2021-07-01 16:14:13 -07:00
TheBusyBiscuit
5255ae846d Fixed #4556 (#4559) 2021-07-01 16:11:22 -07:00
stepech
e816310da8 Fix mcmmo picking wrong version on builds withou patch number (#4555)
* Fix server versioning

* Switch to regex when getting server version

* add comment

* Poor beginner mistakes

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>
2021-07-01 16:07:44 -07:00
nossr50
de6ba4fb6a Dodge no longer triggers while blocking
Fixes #4543
2021-06-22 14:59:40 -07:00
TheBusyBiscuit
e35bfe758c Update to Junit5 and allow for mcMMO to be compiled on Java 16 (#4552)
* Updated all unit tests to Junit5 and removed Powermock

* Some formatting

* I did not mean to commit this file

* Fixed file ending

* We don't need these extra dependencies

* Replaced delegate with Junit5 assertThrows

* Revert this change

* Re-add mockito-core

* A bit more refactoring

* Update surefire and remove failsafe

* Updated Mockito

* Add failsafe back

* Bump Mockito to 3.11.2

They literally just released that.
2021-06-21 09:21:55 -07:00
nossr50
fffbacd239 2.1.199 2021-06-15 14:30:16 -07:00
nossr50
f286af3fff update changelog 2021-06-15 14:25:02 -07:00
nossr50
7e28799f94 Fix SQL on 1.17 (hacky) and optimized CompatibilityManager 2021-06-15 14:19:30 -07:00
nossr50
78dc56d263 Update Deepslate Lapis Ore on MaterialMapStore 2021-06-11 14:47:11 -07:00
nossr50
e3dfdfc6ee Fixed Deesplate Lapis Ore not being recognized 2021-06-11 14:46:27 -07:00
nossr50
4819a45be9 2.1.198 2021-06-11 14:26:28 -07:00
nossr50
5e0f8a334d Update changelog 2021-06-11 14:23:24 -07:00
nossr50
5f0cc2b09a Fix Smelting not recognizing the new 1.17 smeltables (like raw ores) 2021-06-11 14:22:33 -07:00
nossr50
6ff37c8baa Update changelog 2021-06-11 09:10:43 -07:00
TheBusyBiscuit
f7dc72359b Bump adventure to 4.8.0 (#4546) 2021-06-11 09:09:47 -07:00
nossr50
1ab5b82b22 2.1.198 dev mode 2021-06-11 09:08:22 -07:00
nossr50
28c6c90f23 2.1.197 2021-06-06 21:00:27 -07:00
nossr50
9bb38e3193 Add more 1.17 blocks 2021-06-06 20:59:43 -07:00
nossr50
551fac84a5 Add Glow Berries to Farmer's Diet 2021-06-06 20:56:14 -07:00
nossr50
0bc25b263b Add support for Glow Berries / Cave Vines 2021-06-06 20:52:27 -07:00
nossr50
fa9a3ae766 Add support for Glow Lichen 2021-06-06 20:44:33 -07:00
nossr50
33df92ea3a Add tuff to super breaker 2021-06-06 20:42:07 -07:00
nossr50
c3d86ba6c5 Add support for Tuff 2021-06-06 20:41:59 -07:00
nossr50
b569b9456e Add support for Mossy Block and Azalea Leaves 2021-06-06 20:37:51 -07:00
nossr50
4e6e58d9ca Add more support for 1.17 (mining related) 2021-06-06 11:18:03 -07:00
nossr50
619eec7667 Add new 'raw' ores to experience values and bonus drops 2021-06-03 14:34:36 -07:00
nossr50
97cfb1cfc7 More 1.17 support 2021-06-03 14:23:19 -07:00
nossr50
c28c8d164a Adding more 1.17 support 2021-06-03 14:20:00 -07:00
nossr50
e74e1e6829 Add Amethyst related blocks to experience.yml and update Super Breaker 2021-06-03 14:04:08 -07:00
nossr50
6dbc7adf48 Add glow_squid, goat, and axolotl to experience.yml 2021-06-03 13:44:56 -07:00
nossr50
cbaef4a092 Update changelog 2021-05-31 09:09:45 -07:00
lexikiq
eb10bcbc96 Disable launching from Minecart Anti-AFK (#4508) 2021-05-31 09:08:06 -07:00
nossr50
2875545fa4 Update pt_BR locale 2021-05-31 08:55:10 -07:00
nossr50
be595f2568 Update changelog 2021-05-31 08:37:07 -07:00
snake
882f6197c6 Update locale_ja_JP.propaties (#4529)
* Update locale_ja_JP.propaties

* Escape non-ASCII characters
2021-05-31 08:34:18 -07:00
nossr50
0d2f370185 Update our dependencies to their latest versions (where possibly)
Also adds Guava as a dependency as version upgrading our dependencies resulted in the loss of the included Guava libraries
2021-04-23 15:08:57 -07:00
nossr50
da1fcfe30a 2.1.196 2021-04-23 11:26:35 -07:00
nossr50
f983f95961 Remove explosion from rupture, and rupture bug fixes and other tweaks 2021-04-23 11:13:59 -07:00
nossr50
d67c561fed Update changelog 2021-04-23 10:46:59 -07:00
nossr50
989f7fd51b Fix Serrated Strikes not processing Rupture for additional targets 2021-04-23 10:45:19 -07:00
nossr50
e4b8b74987 Optimize imports 2021-04-23 10:37:22 -07:00
nossr50
9e7bb12dc3 Also avoid issues in this test by mocking instead of implementing an ever changing interface 2021-04-23 10:34:00 -07:00
nossr50
95c291d630 Avoid the pitfalls of implementing an everchanging interface from a SNAPSHOT 2021-04-23 10:30:26 -07:00
nossr50
9b4070d971 Don't process null McMMOPlayer events
Fixes #4499
2021-04-23 10:20:20 -07:00
lexikiq
6d0fe4fb58 Add McMMOEntityDamageByRuptureEvent (#4498) 2021-04-20 14:51:57 -07:00
nossr50
394e9e5110 Update changelog 2021-04-19 12:45:51 -07:00
nossr50
5416d1b36e Add crossbows to enchantable items list 2021-04-19 12:43:21 -07:00
nossr50
9a4ec456ad 2.1.195 2021-04-19 12:26:15 -07:00
nossr50
71edf0e9f4 Update changelog 2021-04-19 12:22:25 -07:00
nossr50
c8b1a17194 this should fix null connection error with MySQL
Fixes #4497
2021-04-19 12:20:15 -07:00
nossr50
77a7b98659 Dev mode 2021-04-19 12:15:00 -07:00
nossr50
aa562a4710 2.1.194 2021-04-18 17:52:45 -07:00
nossr50
317f966f73 Fix comment
Fixes #4496
2021-04-18 17:31:20 -07:00
nossr50
a844f27093 Fix mistakes 2021-04-18 17:28:27 -07:00
nossr50
2c44590c52 world bounds tweak 2021-04-18 17:21:37 -07:00
nossr50
16f79b9fbc Locale override now uses a specific file instead of weird name matching 2021-04-16 13:50:41 -07:00
nossr50
c29f311f1e More proper fix 2021-04-16 12:24:02 -07:00
nossr50
81a3441d62 2.1.193 2021-04-16 10:07:36 -07:00
nossr50
cfe1fd2b26 Update changelog 2021-04-16 10:07:02 -07:00
nossr50
3d5c8e154a Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-04-16 10:06:42 -07:00
Mich3l3k
fee2b93b4b Update locale_pl.properties (#4486)
* Update locale_pl.properties

Lots of minor bugs fixed and the woodcut has a better translated name (as well as the ability to woodcut etc.)
And all guides have been translated :D

* Update locale_pl.properties

Guides.Salvage.* translated
Fixed few mistakes
And added support to the latest version of plugin (like swords update)
2021-04-16 10:06:30 -07:00
nossr50
76ebd85afa Update changelog 2021-04-16 10:05:21 -07:00
Warrior
7393421607 Some patches (#4494)
Fixed blocks being dropped from blast mining even if yield was set to 0.
Tree feller not working entirely if one fake block break event is cancelled. (Fixes #4189)
Fixes no woodcutting xp being rewarded if a tree is too big while using tree feller.
2021-04-16 10:03:57 -07:00
nossr50
04459f1ea7 Fix leaderboards & fix override locale bug
Fixes #4493 Fixes #4492
2021-04-16 09:55:44 -07:00
nossr50
8027b4741e 2.1.192 2021-04-15 14:48:54 -07:00
nossr50
8fdc611fb0 Add some code to a test to check for user names being updated 2021-04-15 14:48:24 -07:00
nossr50
48de5057a4 Fix another bug where usernames can be saved as null for FlatFileDB 2021-04-15 14:43:37 -07:00
nossr50
1269652e94 Dev mode 2021-04-15 11:59:27 -07:00
nossr50
522f40f0fe 2.1.191 2021-04-15 11:54:05 -07:00
nossr50
e42eeb1dc4 Fix FlatFile leaderboards not working in certain situations + added leaderboards unit test 2021-04-15 11:53:23 -07:00
nossr50
4f5f3aff80 Oops 2021-04-15 10:43:48 -07:00
nossr50
b9201b89b8 Fix block tracking logic 2021-04-15 09:38:30 -07:00
nossr50
f2357a04ae 2.1.190 2021-04-14 18:15:10 -07:00
nossr50
c9b0383600 Fix null error in BitSetChunkStore 2021-04-14 18:14:50 -07:00
nossr50
729a91443a 2.1.189 2021-04-14 16:50:06 -07:00
nossr50
bb57e6d464 actually a radius now.. although not really 2021-04-14 16:38:19 -07:00
nossr50
700a7f4d35 Fix ArrayIndexOutOfBounds for certain events due to spigot API bug
Fixes #4488
2021-04-14 16:34:43 -07:00
nossr50
22b24b4774 JUnit 5 time 2021-04-13 17:25:56 -07:00
nossr50
d9e195f63a Add a newUser test 2021-04-13 15:22:21 -07:00
nossr50
e6239936d2 Add lastlogin tests 2021-04-13 13:40:24 -07:00
nossr50
f7339277f8 Add more tests, fix null name bug 2021-04-13 12:41:23 -07:00
nossr50
5b4af3f9ce Add loadFromFile test 2021-04-12 16:59:35 -07:00
nossr50
9f22cef175 More tests 2021-04-12 13:18:41 -07:00
nossr50
85f3221a60 FlatFileDataProcessor will handle fixing and repairing the data 2021-04-12 12:55:31 -07:00
nossr50
60013c710b Add more tests to FlatFileDatabaseManagerTest 2021-04-12 09:33:43 -07:00
nossr50
aca1d6c0b1 Add test to find duplicate names - FlatFileDatabaseManagerTest 2021-04-12 09:02:50 -07:00
nossr50
834ccc946a FlatFileDatabaseManager refactor + adding tests part 1 2021-04-09 16:45:58 -07:00
nossr50
323f496420 Fix infinite loop 2021-04-09 11:15:07 -07:00
nossr50
be44c0e417 Update SkillTools 2021-04-09 11:13:27 -07:00
nossr50
cfdcc9dee5 Shorten notes 2021-04-09 10:48:08 -07:00
nossr50
29613bc324 Add back and deprecate most of the members of PrimarySkillType 2021-04-09 10:46:12 -07:00
nossr50
c1c32cb1fd Fix mcMMO saving copies of config files into the main server directory instead of the correct place 2021-04-09 10:19:34 -07:00
Anseba
6d057c577e Fixed minor mistakes in locale_de.properties (#4484)
* Update locale_de.properties
2021-04-09 09:37:21 -07:00
lexikiq
e7978a6ad9 Fix deaths from skeletons showing health bars (#4483)
* Fix deaths from skeletons showing health bars

* Ignore human attackers
2021-04-09 07:59:42 -07:00
nossr50
56f9341f8e Add mcMMO_Region_System.Enabled to persistent_data.yml (removed from hidden config) 2021-04-09 07:54:34 -07:00
nossr50
e76fb9ab1b Update changelog 2021-04-08 13:36:18 -07:00
nossr50
ccf5f30011 Add a test to FlatFileDatabaseManagerTest (more to come) 2021-04-08 13:31:07 -07:00
nossr50
483d23c04d Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-04-08 13:26:36 -07:00
nossr50
611705bce1 Update changelog 2021-04-08 13:26:22 -07:00
lexikiq
80aac93fd2 Fix death messages losing formatting (#4482) 2021-04-08 13:25:24 -07:00
nossr50
74d0d2c3f9 Comment these out for now 2021-04-08 13:22:46 -07:00
nossr50
241df06707 Don't need this anymore 2021-04-08 13:22:20 -07:00
nossr50
eec5feb2bf PrimarySkillType refactor and other refactors 2021-04-08 13:21:34 -07:00
nossr50
5080d86e44 Refactoring code part 1 to prep for adding a bunch of unit tests 2021-04-08 10:39:07 -07:00
nossr50
0636f578dd Update changelog 2021-04-07 16:16:04 -07:00
Mich3l3k
6336101992 Update locale_pl.properties (#4470)
You're welcome :D
I will translate Guides soon
2021-04-07 16:10:50 -07:00
nossr50
ef48fbee89 dev mode + update changelog 2021-04-06 15:01:51 -07:00
nossr50
10d9aa14f1 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-04-06 14:49:05 -07:00
nossr50
44c820089c remove UP warning 2021-04-06 14:48:53 -07:00
TheSummerGrinch
c526208da4 Various improvements to grammar and consistency. (#4479) 2021-04-05 15:50:14 -07:00
nossr50
eb8af69605 Update changelog 2021-04-05 13:56:16 -07:00
nossr50
2db7d83216 2.1.188 2021-04-05 13:50:59 -07:00
nossr50
4c237b2e9c Tweak UP msg, remove debug msg about unused keys 2021-04-05 13:50:27 -07:00
nossr50
2d11b7befc Fixed treasures only requiring level 0 2021-04-05 13:41:37 -07:00
nossr50
c5f4666525 Fixing Shake showing the wrong chance to succeed 2021-04-05 12:47:03 -07:00
nossr50
3b7f416ed9 Up default ShakeChance and remove useless entries 2021-04-05 12:39:49 -07:00
nossr50
db55635f0d Tweak UP warning 2021-04-04 18:23:13 -07:00
nossr50
fe713c9931 dev mode 2021-04-03 09:53:34 -07:00
nossr50
716272fefc 2.1.187 2021-04-03 09:46:41 -07:00
nossr50
e8577e4a9e Fix ClassCastException for Rupture
Fixes #4476
2021-04-03 09:46:01 -07:00
nossr50
3e60dfcf98 2.1.186 2021-04-02 20:37:05 -07:00
nossr50
d25784bf41 Give XP when sneaking for bushes 2021-04-02 20:33:48 -07:00
nossr50
a2ee4be86a Fix some bugs with Rupture and fix a small memory leak 2021-04-02 20:31:19 -07:00
TheBusyBiscuit
002887e244 Sanitize ability buffs when using Item Frames (#4475)
* Remove skill ability buffs from items when placed into Item Frames

* Ensure compatibility on versions before 1.16
2021-04-02 18:47:43 -07:00
nossr50
48afb81174 Another locale tweak 2021-04-02 12:16:40 -07:00
nossr50
a58a3d91dc tweak locale / command output 2021-04-02 12:13:54 -07:00
nossr50
affecfeeeb Added config options for Rupture and updated the Swords command 2021-04-02 12:02:21 -07:00
nossr50
48bf79055a Rupture has been reworked 2021-04-02 11:00:11 -07:00
nossr50
0cb3d91f0e dev mode 2021-04-02 08:55:04 -07:00
nossr50
1e91ba156d 2.1.185 2021-04-02 08:33:09 -07:00
nossr50
72958bb0f3 Herbalism XP exploit fix 2021-04-02 08:32:56 -07:00
nossr50
0ae83420e6 2.1.184 2021-03-31 15:53:21 -07:00
nossr50
a2ba406fe5 Removed April Fools event 2021-03-31 15:14:00 -07:00
nossr50
f01efd92f5 Correct bad default config files 2021-03-31 15:06:59 -07:00
nossr50
a3cc520005 Correct key for drop level in default file 2021-03-31 14:59:29 -07:00
nossr50
0d955c3a94 2.1.183 2021-03-30 16:11:26 -07:00
nossr50
aa734c8b1a Acrobatics XP from falling no longer requires the Roll subskill 2021-03-30 16:04:33 -07:00
nossr50
0577701fd7 Tweak mmoinfo 2021-03-30 15:54:25 -07:00
nossr50
6b309f628a Roll will not have an mmoinfo read out for now 2021-03-30 15:43:05 -07:00
nossr50
fdefea3235 treasures.yml now has specific entries for Standard/Retro 2021-03-30 15:37:01 -07:00
nossr50
ae538d8c72 Sweet berry bush exploit fix 2021-03-29 16:09:47 -07:00
nossr50
50eadb2e8d Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO 2021-03-29 15:24:10 -07:00
nossr50
f69c678f6c Update changelog 2021-03-29 15:23:48 -07:00
mldriscoll
d98bcea845 Correcting references to the Potion of Leaping being made with Red Mushrooms (#4290)
Co-authored-by: MLD <kuali@cethial.net>
Co-authored-by: Robert Alan Chapton <nossr50@gmail.com>
2021-03-29 15:22:24 -07:00
nossr50
fbd2eeb93d Avoid NPE on beast lore jump strength checks 2021-03-29 15:14:54 -07:00
nossr50
c27b8dbd66 Update changelog 2021-03-29 15:11:08 -07:00
Daniel Jarski
df56d93aaa Added Donkeys and Mules to the list of animals that display stats (#4282)
...in Beast Lore. I improperly assumed that donkeys and mules have fixed jump and movement speeds, but ones that are *bred* have variable stats just like horses.
2021-03-29 15:08:40 -07:00
Daniil Z
80e9111f78 Update Russian localization (#4465) 2021-03-29 15:02:48 -07:00
nossr50
b189614d8d 2.1.182 2021-03-25 14:51:28 -07:00
nossr50
7c8e14fd74 Featherboard compatibility 2021-03-25 14:49:36 -07:00
nossr50
fc3e580550 Fix NPE with Scoreboards when updating 2021-03-25 14:13:16 -07:00
nossr50
eea922c31f TODO: Look into double drops for berry bushes 2021-03-25 14:08:22 -07:00
nossr50
e40ab38bbd Sweet Berry bushes now grant XP when harvested and no longer activate tools 2021-03-25 13:42:20 -07:00
nossr50
2c5e11138b Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-03-23 13:21:16 -07:00
nossr50
317dc814a4 Add comment about power level cap issue 2021-03-23 13:20:55 -07:00
Pablo
f52effb0fb Add '.all' to all existing perk xp multipliers (#4460)
* Add '.all' to all existing perk xp multipliers 

Added '.all' usage for all existing perk xp mulipliers to enable use of mcmmo.perks.xp.<xpboost>.all

* Fixed a statement error
2021-03-22 13:13:51 -07:00
nossr50
71d1f42cf4 Tweak changelog 2021-03-18 15:28:42 -07:00
nossr50
49f1154e65 NPE fix for McMMOPlayerExperienceEvent 2021-03-18 15:15:43 -07:00
nossr50
4f08c69557 Add UltraPermission warning to mcMMO 2021-03-18 13:18:30 -07:00
nossr50
13a2d03444 Remove silent exceptions 2021-03-18 13:11:03 -07:00
nossr50
c7a8d74963 Add customboost 'mcmmo.perks.xp.customboost.all' perk permission node 2021-03-17 10:39:05 -07:00
nossr50
076d7a7f87 Remove hardcore and vampirism commands 2021-03-17 10:03:54 -07:00
nossr50
667b9a2226 Remove ChatControlRed warning pending further proof of bug 2021-03-17 09:59:18 -07:00
nossr50
312206eda5 Tweak save debug messages 2021-03-16 16:43:25 -07:00
nossr50
dc2c099231 Add warning about the plugin conflict between mcMMO and ChatControlRed 2021-03-16 16:36:16 -07:00
nossr50
49d4e97930 Some safety redundancy 2021-03-16 14:05:33 -07:00
nossr50
444d5edd66 Fixed double smelt not working if furnace was empty 2021-03-16 13:16:17 -07:00
nossr50
b181fb4568 Update changelog 2021-03-16 13:12:45 -07:00
w1tcherrr
06990c858e Fixed mistakes in german locale file (#4454)
* Fixed mistakes

* Update src/main/resources/locale/locale_de.properties

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>

* Update src/main/resources/locale/locale_de.properties

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>

* More Fixes

Co-authored-by: TheBusyBiscuit <TheBusyBiscuit@users.noreply.github.com>
2021-03-16 13:03:53 -07:00
nossr50
6cec253243 2.1.181 2021-03-12 17:07:14 -08:00
nossr50
75db0af01d More console spam reduction for database operations 2021-03-12 16:37:21 -08:00
nossr50
4a048b47cb Refactor DB code a bit and fix console spam when using the Plan plugin
Fixes #4450
2021-03-12 16:25:14 -08:00
nossr50
7d5bcf3ebf 2.1.180 2021-03-11 15:11:03 -08:00
nossr50
0979ef555b More tweaks to data recovery messages 2021-03-11 14:59:11 -08:00
nossr50
91204262f5 More tweaks to handling corrupt data for flat file 2021-03-11 14:48:21 -08:00
nossr50
eb1e657af1 Simplify data validation + listen to exceptions again 2021-03-11 14:10:29 -08:00
nossr50
2203d61c10 More safety against corrupt data when loading data for FlatFile 2021-03-11 13:11:11 -08:00
nossr50
d77c8c88a3 Less spammy corrupt data reporting 2021-03-11 12:16:33 -08:00
nossr50
7755875dbf Some refactoring of FlatFileDatabaseManager 2021-03-11 12:02:21 -08:00
nossr50
72116d809b Add another error message if mcMMO finds something unexpected in the database 2021-03-11 12:00:11 -08:00
nossr50
e95b7f72a7 Add some safety measures to loading a user from FlatFile 2021-03-11 11:58:27 -08:00
nossr50
e8a0e6e4a4 Don't upgrade old party DB schema from 8 years ago (band-aid fix, real fix coming later) 2021-03-09 19:47:35 -08:00
nossr50
6c69cd2aea Fixed several SQL bugs + SQL db is now fully UTF-8 compatible 2021-03-09 15:10:00 -08:00
nossr50
f4976e5ecb switch SQL from latin1 to utf8mb4 2021-03-09 13:56:03 -08:00
TheBusyBiscuit
4402484d47 Fixed NoClassDefFoundError caused by latest Adventure-platform snapshot. (#4446)
* Bumped adventure versions

* Added Unit Test to ensure Adventure being set up correctly
2021-03-09 08:15:11 -08:00
nossr50
935ab22477 2.1.179 2021-03-07 14:33:22 -08:00
nossr50
f9097087fe Fixed a bug where player levels were wiped on FlatFile database if players changed nicknames 2021-03-07 14:28:47 -08:00
nossr50
8e5f2b804b dev mode 2021-03-07 14:20:40 -08:00
nossr50
12d0a220da 2.1.178 2021-03-05 20:14:48 -08:00
nossr50
89c368e481 changelog tweaks 2021-03-05 15:39:23 -08:00
nossr50
5e35a65fbf 2.1.177 2021-03-05 15:17:41 -08:00
nossr50
92efd59760 Better compatibility with other fishing plugins
Fixes #4428
2021-03-05 15:13:14 -08:00
nossr50
31076e6ba9 Change PlayerFishEvent priority to HIGH instead of HIGHEST 2021-03-05 14:54:11 -08:00
nossr50
b59d1afdb4 Vanished players are treated as if they are offline for inspect command
Fixed #4444
2021-03-05 14:48:05 -08:00
nossr50
72264205d0 Update player names immediately when change is detected 2021-03-05 14:27:53 -08:00
nossr50
a425ebcd10 Add magma blocks to the things wolves avoid 2021-03-05 14:03:31 -08:00
nossr50
5baccd626f 2.1.176 - Small hotfix before bringing down endgame 2021-03-04 15:17:48 -08:00
Riley Park
37610f76ce Deploy to repository 2021-03-03 21:56:44 -08:00
nossr50
4bd9ee0aa5 Never expect bukkit API to be intuitive 2021-03-02 15:17:55 -08:00
nossr50
e38bc14e86 Sometimes I hate being dyslexic, fixing illegal stack sizes in smelting.. again 2021-03-02 13:54:20 -08:00
nossr50
afd2b50900 Remove unecessary comment 2021-03-02 11:24:44 -08:00
nossr50
ac618cf48a Add another measure to stop item stacks from becoming illegal sizes from double smelt 2021-03-02 11:15:52 -08:00
nossr50
4eecd34494 2.1.175 - Hotfix 2021-02-26 17:48:20 -08:00
nossr50
713b0619c3 You can now disable Green Thumb for specific crops (the auto replanting) in config.yml 2021-02-26 16:18:15 -08:00
nossr50
735a90fb35 Fix arrow dupe bug
Fixes #4430
2021-02-26 16:06:13 -08:00
nossr50
82b0304091 Don't set smelt stacks to above item's max stack size 2021-02-26 15:28:50 -08:00
TheBusyBiscuit
06e38c991a Updated dependencies (also fixes #4404) (#4440) 2021-02-24 18:03:07 -08:00
w1tcherrr
ef1a8f8194 Updated locale_de.properties language file (german) (#4423)
* Fixed various grammatical and spelling mistakes. Made some adjustments to the colour scheme to make the design more consistent.

* Changed mistakes in UTF-8 encoding
2021-02-23 12:29:24 -08:00
TheBusyBiscuit
db2c0e89e7 Fixed #4438 and also normalized some stuff (#4439) 2021-02-23 12:28:45 -08:00
TheBusyBiscuit
b8932802b7 Added Maven workflow to validate pull requests and commits (#4432)
* Create maven workflow

* Also run it when the workflow file was modified

* Added local Maven cache

* I know how to count 👀
2021-02-18 09:58:25 -08:00
t00thpick1
f9144e624a Prepare for negative Y values 2021-02-12 17:18:52 -05:00
nossr50
085c8dbf68 Dev mode 2021-02-03 15:19:34 -08:00
nossr50
890d270147 2.1.174 2021-02-03 15:14:18 -08:00
nossr50
369b34406e Green Thumb (Plants) now fires a SubSkillBlockEvent 2021-02-03 15:08:21 -08:00
nossr50
1c1abe9a2a Added SubSkillBlockEvent & GreenThumb + ShroomThumb now fire it 2021-02-03 15:01:32 -08:00
nossr50
2b4c84b1e8 Update changelog 2021-02-03 14:47:33 -08:00
Daniil
6eb894ba3a Update locale_ru.properties (#4411)
Almost fully re-translated and updated to latest versions
2021-02-02 14:58:13 -08:00
Elikill58
6ef0a36cb0 Translate missing messages into french (#4418) 2021-02-02 14:57:05 -08:00
nossr50
e63ce103a2 changelog adjustments 2021-01-26 16:56:02 -08:00
nossr50
68c7de16a8 Really should rewrite this whole thing at a later date 2021-01-26 16:00:08 -08:00
nossr50
9a5b1406b3 dev mode 2021-01-26 15:55:48 -08:00
András Marczinkó
e584697b69 Update locale_hu_HU.properties (#4409) 2021-01-26 15:53:57 -08:00
snake
46d69f2108 Replace old and wrong color codes with the correct color codes (#4408) 2021-01-26 15:53:30 -08:00
nossr50
998495f268 2.1.173 2021-01-25 17:27:37 -08:00
nossr50
b94b14a06c Add missing adventure-key library 2021-01-25 17:23:46 -08:00
nossr50
d9740bdfb8 kyori dependency 4.3.0 to 4.4.0 2021-01-25 15:09:51 -08:00
nossr50
85bf33fca0 Less XP orbs during Tree Feller + Knock on Wood Rank 2 2021-01-25 15:06:39 -08:00
nossr50
cf21a5a163 Fishing no longer damages rod or drains hunger 2021-01-25 15:02:58 -08:00
nossr50
ec35efbf1b Merge remote-tracking branch 'origin/master' 2021-01-25 14:38:06 -08:00
nossr50
c6d700c5a7 Fixed Luck permission showing incorrect percentages to players using commands
Fixed #4405
2021-01-25 14:37:23 -08:00
steve4744
a225d604ef only add/remove scoreboards when teleporting if scoreboards are enabled (#4400) 2021-01-25 14:14:35 -08:00
snake
52ac1cc522 Update ja_jp locale (#4406) 2021-01-25 14:12:57 -08:00
nossr50
bf9bb6ffd8 2.1.172 2021-01-21 15:38:31 -08:00
nossr50
27ae7ae1a7 Add Power Level broadcasts
Fixes #4388
2021-01-21 15:27:50 -08:00
nossr50
a85fd024b2 Have correct bStats data point to a new id 2021-01-21 15:00:42 -08:00
nossr50
6e63007068 Update changelog 2021-01-21 14:58:29 -08:00
nossr50
6c5eb72ab4 Fixed an error in bstats where Retro Mode was reported as Standard mode and vice versa
I might be the most dyslexic person ever
2021-01-21 14:56:45 -08:00
TheBusyBiscuit
67f29d52b3 Updated bStats (#4384)
Thank you
2021-01-21 14:54:51 -08:00
nossr50
8181743114 Fix compile issue 2021-01-21 14:44:13 -08:00
nossr50
f43f3a7fb1 Make ACF aware of the permission nodes for the commands it handles
Fixes #4396
2021-01-21 14:37:59 -08:00
nossr50
4b4643f510 Message about missing permissions on certain commands no longer hard coded 2021-01-21 14:34:58 -08:00
nossr50
1b5dd86796 Use locale instead of hard coded message for pending load on certain commands
Fixes #4391
2021-01-21 14:33:39 -08:00
nossr50
80a1b3949e Add permission node 'mcmmo.broadcast.levelup' for level up broadcasts 2021-01-21 14:31:11 -08:00
nossr50
4fea5438fe Move some permissions closer to the top 2021-01-21 14:26:08 -08:00
nossr50
ac57615383 Add setting to turn off knock on wood XP orb drops for Tree Feller 2021-01-21 14:19:50 -08:00
nossr50
c44e280773 oh wait cat was not really his nickname... 2021-01-21 14:08:14 -08:00
nossr50
2835c5fc5e update changelog 2021-01-21 14:07:58 -08:00
Shane Freeder
bd9794e744 Support calling SkillActivationPerkEvent off the main thread
This event was never considered as to if it would be called off the main thread,
this event should NOT be designed to signify that a skill activation is occuring,
just providing a means to manipulate those values by other plugins, etc
2021-01-21 12:09:26 +00:00
nossr50
f72497532f Fists should be fists 2021-01-11 10:34:14 -08:00
TheBusyBiscuit
fecaef8d96 Updated german translations (#4375)
* Updated german translations

* Fixed line endings

* Missed one
2021-01-11 10:30:08 -08:00
nossr50
cbbfcf655a 2.1.171 2021-01-07 13:48:15 -08:00
nossr50
c64e693861 Less capitals in broadcast msg 2021-01-07 13:39:28 -08:00
nossr50
ade6fb2c1d Arrow dupe fix 2021-01-07 13:36:54 -08:00
nossr50
f38d92497a Add broadcasting when players reach certain level milestones (defaults to every 100 levels) 2021-01-07 13:33:12 -08:00
nossr50
801c2c83e2 update pom and changelog 2021-01-06 10:25:58 -08:00
Enderaoe
3cd09b886f Issue #4343 Axe can replant Cocoa (#4373) 2021-01-06 10:24:16 -08:00
nossr50
ba7b6826b4 2.1.170 - papi fix 2021-01-05 15:25:39 -08:00
nossr50
0b8f4b4733 2.1.169 2021-01-05 12:20:33 -08:00
nossr50
1c9592aba3 Always emulate lure bonus to avoid vanilla bugs
Fixes #4359
2021-01-05 12:16:16 -08:00
nossr50
7bc01571ee Fix mctop on non-en_US locale
Fixes #4372
2021-01-05 12:13:44 -08:00
nossr50
dd07bcafc6 Disable random testing for now 2021-01-05 12:12:49 -08:00
nossr50
888205fd89 Memory leak fix for arrow metadata 2021-01-05 12:04:48 -08:00
nossr50
7ea6809fd3 2.1.168 2021-01-03 12:22:58 -08:00
nossr50
7931a095fe Add some tests for com.gmail.nossr50.util.random classes 2021-01-03 12:21:32 -08:00
nossr50
867d222062 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-01-03 09:53:12 -08:00
t00thpick1
a57e6d3bbe Add unit test for BlockLocationHistory
Move ChunkStoreTest to correct package
2021-01-02 20:53:25 -05:00
t00thpick1
9e2d5aada8 Whitespace fix 2021-01-02 20:39:39 -05:00
t00thpick1
4aa17e61fc More efficient acrobatics location memory class 2021-01-02 20:39:39 -05:00
nossr50
597eb7f8dd Tweaks to the random chance classes 2021-01-02 16:39:26 -08:00
nossr50
4fa3d913bf More annotations for blockmeta.. again 2021-01-02 16:15:04 -08:00
t00thpick1
00a6d52717 Refactor region file loading for better nullability analysis 2021-01-02 18:57:51 -05:00
nossr50
26ef4cc411 More nullability annotations 2021-01-02 15:55:37 -08:00
nossr50
05f07c174b Change readChunkStore to Nullable 2021-01-02 15:30:00 -08:00
nossr50
eff016c0a6 More nullability in blockmeta classes 2021-01-02 15:27:51 -08:00
nossr50
7ea3a2bf07 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2021-01-02 15:01:35 -08:00
nossr50
cddf619518 dev mode 2021-01-02 15:01:29 -08:00
t00thpick1
5b41b04777 Use @NotNull in methods rather than @Nullable
Separate safe external methods from internal only methods
Remove unnecessary methods
2021-01-02 17:29:15 -05:00
t00thpick1
10694042e9 Move legacy Serializable usage into a subclass. 2021-01-02 16:54:11 -05:00
nossr50
d08c9391b0 Add nullability annotations to blockmeta 2021-01-02 13:36:59 -08:00
nossr50
a39c7420b9 Add relocation for Kyori's examination library 2021-01-02 13:32:30 -08:00
t00thpick1
e0d85f842b Fix exception thrown when plants fake grow at max world height. 2021-01-02 11:18:32 -05:00
nossr50
0fa1d822d4 2.1.167 2021-01-01 22:16:52 -08:00
nossr50
bec54d93ac Fix dupe bug 2021-01-01 22:15:44 -08:00
Shane Freeder
1408065768 update changelog 2021-01-02 01:07:15 +00:00
Shane Freeder
67a4b6c7c1 Experience PreGain event 2021-01-02 01:05:28 +00:00
Shane Freeder
556515eefd Add SkillActivationPerkEvent 2021-01-02 01:05:27 +00:00
nossr50
0466a28a5f Update changelog 2021-01-01 14:08:52 -08:00
nossr50
9180879164 2.1.166 2021-01-01 14:06:15 -08:00
nossr50
fbecbc167a Optimizations and potentially fixing a ConcurrentModificationException involving the TransientEntityTracker
Fixes #4368
2021-01-01 14:04:36 -08:00
nossr50
959d1e4a05 Remove music discs from the default loot table 2021-01-01 12:46:08 -08:00
nossr50
0d4e1b3ba6 update changes 2020-12-31 17:13:56 -08:00
nossr50
a8d81a2080 2.1.165 2020-12-31 17:02:38 -08:00
nossr50
42d3dc3925 Master Angler now mentions it works better with a boat in its hover tip 2020-12-31 16:58:46 -08:00
nossr50
e4af53a535 Use boolean over Boolean 2020-12-31 16:46:49 -08:00
nossr50
9ba8af9f6e Forgot to register the intended tool set 2020-12-31 16:42:37 -08:00
nossr50
56b376eb54 SuperBreaker will always activate if the fastest tool for the block is a PickAxe
Fixes #4362
2020-12-31 16:41:08 -08:00
nossr50
c408c7d057 avoid concurrent exceptions on TransientEntityTracker 2020-12-31 16:26:37 -08:00
nossr50
c05c8e1b1d Fix init player in TransientyEntityTracker 2020-12-31 16:08:23 -08:00
nossr50
3f6de1c4ba Fix giving double treasures if the setting to give extra fish is on
Fixes #4363
2020-12-31 15:53:01 -08:00
nossr50
8ee405fbfd Ignore "fake player" npcs in EntityPickupItemEvent 2020-12-31 15:49:32 -08:00
nossr50
2664ae4bd6 Optimize ChunkUnloadEvent & Partial rewrite to COTW entity tracking + some tweaks to COTW entity removal 2020-12-31 15:25:21 -08:00
nossr50
aed4cb87be Fix enchanted books not being created with the proper data 2020-12-31 13:21:55 -08:00
nossr50
006a7bf277 Add back missing cooldown locale message
Fixes #4361
2020-12-30 15:41:14 -08:00
nossr50
d0d05a33f8 update changelog 2020-12-30 15:30:46 -08:00
nossr50
01f31e76f5 new chunkstore
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
2020-12-30 15:24:21 -08:00
nossr50
7802d54ebd 2.1.164
Closes #4358 #4342 #3812 #3643 #3540
2020-12-29 13:47:40 -08:00
nossr50
dd3d324415 update notes and default fishing treasures 2020-12-29 13:38:03 -08:00
nossr50
8ff345af38 fix array out of bounds 2020-12-29 13:20:10 -08:00
nossr50
bab13f32e7 update notes 2020-12-29 13:15:15 -08:00
nossr50
3c9c8556dd Allow vanilla block interaction with sneak if the block is set to be a mcMMO repair/salvage anvil 2020-12-29 12:58:39 -08:00
nossr50
d9f98b1aa9 Fix a bug where books weren't registered + tweaked how treasures were loaded 2020-12-29 12:39:06 -08:00
nossr50
0f4455d5a8 remove unused settings from fishing treasures and add enchantment section for mythic 2020-12-29 12:12:03 -08:00
nossr50
bdee0278a5 Fix Fishing using values from the wrong config 2020-12-29 12:03:57 -08:00
nossr50
ac31a3dc0e Fixing start up errors when loading treasures.yml 2020-12-28 17:37:14 -08:00
nossr50
2162c81b21 Add semi-important note to changelog 2020-12-28 17:00:50 -08:00
nossr50
8b62c0b693 Better message for items not found in current version of MC from Fishing Config 2020-12-28 16:58:57 -08:00
nossr50
31e0f1e4da less verbose enchantment book log 2020-12-28 16:47:33 -08:00
nossr50
14a6e5c603 Comment out whitelist in fishing_treasures.yml 2020-12-28 16:45:16 -08:00
nossr50
652a9519c1 Move fishing treasues to new file fishing_treasures.yml, replace Records rarity with Mythic, and allow for Enchanted_Book in the treasures list with new optional whitelist/blacklist parameters
read the changelog for information about this
2020-12-28 16:42:00 -08:00
nossr50
31134b38de updated changelog 2020-12-28 13:00:47 -08:00
nossr50
a4ef322fa5 Add ExploitFix.PreventPluginNPCInteraction to experience.yml
Read the changelog for why
2020-12-28 12:58:03 -08:00
nossr50
e8d51f42f3 dev mode 2020-12-28 12:44:21 -08:00
nossr50
4d386f2e61 update changelog 2020-12-16 16:43:08 -08:00
nossr50
1046007b7a 2.1.163 2020-12-16 16:41:24 -08:00
nossr50
2de52c7955 register new chunk listener 2020-12-16 16:30:05 -08:00
nossr50
8c52884ac6 Remove COTW entities on chunk unload
Fixes #4289
2020-12-16 16:29:05 -08:00
nossr50
22a738bace mcMMO no longer throws errors on below 0 xp gains
Fixes #4346
2020-12-16 16:15:19 -08:00
nossr50
dfc2691cd6 dev mode and changelog update 2020-12-16 15:55:54 -08:00
Robert Alan Chapton
16aa6d65ac Update McMMOUrl.java
fixed translate link, thanks chew
2020-12-16 12:46:17 -08:00
nossr50
58e634e53a dev mode 2020-12-14 15:22:09 -08:00
nossr50
bb37edaa7f update changelog 2020-12-14 15:21:48 -08:00
Wolf2323
0e09ac397d fix BrewingStand inventory is updated immediately instead of after firing the event. Now the event can be canceled correct. (#4351) 2020-12-10 13:24:08 -08:00
nossr50
c4072ee90d 2.1.161 - Messages fixed! 2020-12-09 19:58:20 -08:00
nossr50
b7cf84299a add missing adventure modules 2020-12-09 19:51:57 -08:00
nossr50
439a69cc5b normalize pom 2020-12-09 19:16:58 -08:00
nossr50
a114886454 2.1.160 2020-12-09 15:36:54 -08:00
nossr50
7f213ee305 exploit fix 2020-12-09 15:34:32 -08:00
nossr50
958fb6f044 Silenced a mostly harmless error that can happen when using plugins like crazyenchantments 2020-12-01 13:08:33 -08:00
nossr50
dacd846fe7 2.1.159 2020-11-27 16:59:37 -08:00
nossr50
0ce316e428 update adventure (used for chat) 2020-11-27 16:55:40 -08:00
nossr50
bcd260d9c1 Memory leak fix 2020-11-27 16:26:24 -08:00
nossr50
ab276ffe33 2.1.158 2020-11-16 16:55:55 -08:00
nossr50
c54161b7d1 update changes 2020-11-16 16:49:49 -08:00
nossr50
cf86e79e87 Updated changelog 2020-11-16 16:24:27 -08:00
nossr50
bc53714ac8 URL style adjust 2020-11-16 16:00:01 -08:00
nossr50
db8086d6ad Allow URLs in chat again 2020-11-16 14:56:48 -08:00
nossr50
915855363d Update changelog 2020-11-16 14:43:53 -08:00
Momshroom
c22a65f9f3 Adding crossbows, shields, elytra, and tridents to default repair.vanilla.yml and fixing minor typo. (#4308)
* Changed comment over netherite items to say "Netherite repairables" instead of "Diamond repairables"
Added Crossbow to string repairables
Added Shield to wood repairables, with oak planks as material
Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively.

* Changed comment over netherite items to say "Netherite repairables" instead of "Diamond repairables"
Added Crossbow to string repairables
Added Shield to wood repairables, with oak planks as material
Added Elytra and Trident to Other repairables, using phantom membrane and prismarine crystals respectively.
Added warped fungus on a stick as a string repairable.

Signed-off-by: Momshroom <Momshroom@gmail.com>

* Added warped fungus on a stick as a string repairable.

Signed-off-by: Momshroom <Momshroom@gmail.com>
2020-11-16 14:42:24 -08:00
nossr50
128ba88e64 Update changelog 2020-11-16 14:39:33 -08:00
Tim
4fd8f6d647 Update locale_nl.properties (#4336)
Fixed small translation errors
2020-11-16 14:39:07 -08:00
nossr50
cfcdcd1676 Fix Lure above 3 breaking fishing 2020-11-16 14:36:59 -08:00
nossr50
f346d3b758 2.1.157 2020-11-11 16:50:21 -08:00
nossr50
477d6932cd 2.1.156 2020-11-10 15:21:45 -08:00
nossr50
b31e1e533b New skill 'Knock On Wood', changes to axe readying messages 2020-11-10 15:17:52 -08:00
nossr50
8f6819edc5 Fix GT replant sometimes planting floating plants 2020-11-10 13:17:58 -08:00
nossr50
7887232d93 Update locales 2020-11-10 12:19:23 -08:00
nossr50
b0afdccfa5 skillranks.yml will automatically fix itself if it finds certain issues 2020-11-10 12:05:42 -08:00
nossr50
592851e80b Throw errors for child skill leaderboard requests 2020-11-10 11:22:02 -08:00
nossr50
c9b950d0c8 Fix chat.yml chat channel toggles 2020-11-10 11:07:07 -08:00
nossr50
d9e99b08db changelog stuff 2020-11-09 16:56:02 -08:00
nossr50
06334da7f8 2.1.155 2020-11-09 16:47:34 -08:00
nossr50
ba7e235e64 Master Angler reworked 2020-11-09 16:46:52 -08:00
nossr50
f4f6abd9d5 Fix Spec Arrow awarding too much XP 2020-11-09 13:54:01 -08:00
nossr50
da06d5c075 Fixed a bug where Spectral arrow awarded too much XP 2020-11-09 13:53:17 -08:00
nossr50
34d9f70ac0 Fixed a bug where party members didn't have properly colored names, added some optimization and removed some unnecessary API 2020-11-09 13:19:54 -08:00
nossr50
8c5123f494 2.1.154 2020-11-06 15:16:52 -08:00
nossr50
4abf64f625 Full hex color support in admin/party chat 2020-11-06 15:16:26 -08:00
nossr50
1383457eba Update javadocs 2020-11-06 14:16:24 -08:00
nossr50
bd48680125 Use legacy serializer instead 2020-11-06 14:13:46 -08:00
nossr50
0f15f234b5 Update changelog 2020-11-06 14:05:40 -08:00
nossr50
5b6a57d7a8 Tree Feller drops saplings again 2020-11-06 14:04:40 -08:00
nossr50
a4fd632d53 Fix Hex-Colored names in parties/admin chat 2020-11-06 14:01:07 -08:00
nossr50
b2cdffe965 2.1.153 2020-11-04 12:14:55 -08:00
nossr50
15578bb84e Some refactoring 2020-11-04 12:12:51 -08:00
nossr50
329de942b4 Update changelog 2020-11-04 12:06:30 -08:00
nossr50
96ed228d7c Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-11-04 12:05:45 -08:00
nossr50
cb9c7acceb Fixing a major bug with sub-skills not being shown when using commands 2020-11-04 12:05:29 -08:00
Vlammar
95c9daebe1 Update locale_fr.properties (#4324)
Fixed a small translation error
2020-11-04 09:59:56 -08:00
nossr50
5afaeb40a8 2.1.152 2020-11-02 15:12:29 -08:00
nossr50
1f3a2baa6b Some BlockMultiPlaceEvent optimization 2020-11-02 14:10:17 -08:00
nossr50
094d57bce0 more changelog tweaks 2020-11-02 14:06:02 -08:00
nossr50
28b6a457f2 Add back the pc and ac command aliases 2020-11-02 14:03:58 -08:00
nossr50
a945e2e6b3 update changelog 2020-11-02 14:01:45 -08:00
TheBusyBiscuit
01ebba4443 Two small fixes (#4321)
* Fixed armor counting in BleedTimerTask

* Key instead of Name for Piercing
2020-11-02 13:57:53 -08:00
nossr50
65fba3e20e Expanding McMMOItemSpawnEvent & Fixing a bug with Tree Feller drops 2020-11-02 13:51:43 -08:00
András Marczinkó
9529bbf898 Update locale_hu_HU.properties (#4322)
* Update locale_hu_HU.properties
2020-11-02 11:56:24 -08:00
nossr50
523d10ef29 dev mode 2.1.152-snapshot 2020-11-02 11:30:35 -08:00
nossr50
bae9783123 2.1.151 2020-10-29 14:38:09 -07:00
nossr50
5a8e607a39 party leader has unique chat style 2020-10-29 14:30:29 -07:00
nossr50
1f02d9a5a0 online leaders will be gold 2020-10-29 14:13:39 -07:00
nossr50
4e8f49db5b avoid null party names 2020-10-29 14:06:34 -07:00
nossr50
c6ecf30d1f new party member list format/style 2020-10-29 13:54:12 -07:00
nossr50
449407439a Added 'Chat.Channels.Party.Spies.Automatically_Enable_Spying' which allows chat spys to join servers with spying toggled on instead of off
its a QOL feature for people who are always spying on chat
2020-10-29 13:12:26 -07:00
nossr50
8856d2b071 move chat config options from config.yml -> chat.yml 2020-10-29 13:06:22 -07:00
nossr50
4bac586253 Add missing party chat permission check to the party chat command 2020-10-29 12:20:52 -07:00
nossr50
ca93dc02df Fix missing party chat permission node check 2020-10-28 10:53:47 -07:00
nossr50
8aff138954 import cleanup 2020-10-27 13:37:08 -07:00
nossr50
81bf0935e1 changelog tweaks 2020-10-27 13:35:01 -07:00
nossr50
3169cf9225 2.1.150 2020-10-27 13:19:00 -07:00
nossr50
2f506b72bb Better party chat logging in console, some style changes to admin/party chat as well 2020-10-27 13:09:01 -07:00
nossr50
d183d1217c Players & Console can now use color codes in party or admin chat (new permission node mcmmo.chat.colors) 2020-10-27 11:55:59 -07:00
nossr50
1d55c4c2bc fix message spam bug 2020-10-27 11:08:50 -07:00
nossr50
05f2763311 You can now silence mmoedit, addlevels, and addxp with -s 2020-10-27 11:03:47 -07:00
nossr50
33287b650f Add NMS definition for 1.16.4 2020-10-26 16:52:43 -07:00
nossr50
e6e9fdca31 Fix ArrayIndexOutOfBoundsException for Skill Reset command 2020-10-26 16:42:56 -07:00
nossr50
8372fae6f8 remove some unwanted code comments 2020-10-26 16:34:31 -07:00
nossr50
f976302cf0 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-10-26 16:33:15 -07:00
nossr50
749c83ac59 Complete rewrite of Admin & Party chat code
There are some API breaks as a result of these rewrites, I tried to keep it minimal, but I'm sure some plugins will need to update.
2020-10-26 16:31:02 -07:00
nossr50
cf6a2e9e97 Update all locale files to use & codes instead of [[color]] codes 2020-10-26 16:04:56 -07:00
TheBusyBiscuit
8240cff0d5 Some small optimizations (#4305)
some improvements to itemmeta calls and misc changes
2020-10-23 08:21:47 -07:00
怠惰
7e057792f5 Fix locale (#4275)
"1 is needed" is obvious mistranslation.
2020-10-22 13:56:36 -07:00
Patrick
5f0c4b1dd3 Update locale_pt_BR.properties (#4276)
add time left to use the skill again
2020-10-22 13:55:48 -07:00
nossr50
8c21891e6f Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-10-14 12:14:44 -07:00
nossr50
23f836de40 dev mode + changelog update 2020-10-14 12:14:32 -07:00
TheBusyBiscuit
f29370a1c8 Added Fake Event check (#4296)
Thanks you @TheBusyBiscuit
2020-10-14 12:11:15 -07:00
nossr50
8d6d0cf254 Spelling mistake in changelog 2020-10-13 13:22:36 -07:00
nossr50
e90f8f5b82 Slightly more readable changelog 2020-10-12 13:06:57 -07:00
nossr50
72feacfdfe update changelog 2020-10-12 13:01:53 -07:00
nossr50
508c256aa4 2.1.149 2020-10-12 12:57:15 -07:00
nossr50
bc71f586d7 Messy fix for now, code cleanup will happen later 2020-10-12 12:50:18 -07:00
nossr50
29722511b7 new config persistentdata.yml 2020-10-12 12:40:54 -07:00
nossr50
916eb76553 2.1.148 2020-10-08 19:30:36 -07:00
nossr50
80f910fc67 Add setting for enable/disable triple drops on super breaker 2020-10-08 19:21:39 -07:00
nossr50
d4699c0e20 Add player tamed experience multiplier 2020-10-08 19:14:44 -07:00
nossr50
80c89fe1e5 Revert this change for now 2020-10-08 19:07:42 -07:00
nossr50
f5294387b0 oopsy 2020-10-08 16:34:59 -07:00
nossr50
20c69b63af Memory leak fixes, optimizations, and persistence 2020-10-08 15:25:40 -07:00
nossr50
0767e62965 Only ignore 0 dmg if specific plugins are detected 2020-10-05 14:52:49 -07:00
nossr50
a6586e07cc final damage values of 0 are only ignored in certain circumstances, fixes a few bugs 2020-10-05 14:14:49 -07:00
nossr50
5d022b6f7c adding new and required kyori includes 2020-10-02 13:09:38 -07:00
nossr50
ee17707c6c Alchemy progression through ranks improved 2020-09-30 13:12:28 -07:00
nossr50
c675c36601 adventure api update 2020-09-30 11:34:01 -07:00
nossr50
4005c21810 2.1.147 2020-09-28 17:36:33 -07:00
nossr50
8451f84083 dev mode 2020-09-25 11:36:42 -07:00
nossr50
adbcf11c15 2.1.146 2020-09-25 11:01:47 -07:00
nossr50
6f99940540 Add missing includes 2020-09-25 10:40:26 -07:00
Riley Park
02fe8addb7 adventure 2020-09-24 17:57:04 -07:00
nossr50
0b20fc2c16 Some tweaks to tracking blocks as unnatural 2020-09-21 21:36:24 -07:00
nossr50
3fd5cd03ee Blocks that have double drops enabled are also worth marking 2020-09-21 21:29:21 -07:00
nossr50
959a74b139 Temporarily mark debarked wood as unnatural (will undo later) 2020-09-21 21:27:17 -07:00
nossr50
f496d795fb Always track blocks in BlockMultiPlaceEvent 2020-09-21 21:23:10 -07:00
nossr50
d4ab829812 Mark blocks always in BlockPlaceEvent 2020-09-21 21:20:53 -07:00
nossr50
3badc26806 Hardcore mode won't bring players below level threshold anymore 2020-09-16 20:09:59 -07:00
nossr50
621ccfed34 minor nms tweak 2020-09-08 19:38:35 -07:00
nossr50
2810d36e08 2.1.145 2020-08-26 10:45:53 -07:00
nossr50
973279cdb7 Revert listener behaviour for PlayerInteractEvent 2020-08-26 10:26:50 -07:00
nossr50
480f9afa80 2.1.144 2020-08-25 16:49:50 -07:00
nossr50
419a810a1e Steel Arm Style can now be customized in advanced.yml 2020-08-25 16:28:21 -07:00
nossr50
e4c5a3b8ee two deflect bugs down 2020-08-25 16:14:08 -07:00
nossr50
56abad5360 Fixed a bug where Roll didn't award XP at great heights 2020-08-25 14:53:06 -07:00
nossr50
bfa092a67c add fuel efficiency info for mmodebug 2020-08-25 14:33:31 -07:00
nossr50
e3f21195c8 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-08-25 14:13:06 -07:00
nossr50
f684b09276 brain no worky today 2020-08-25 14:11:43 -07:00
nossr50
8807d6c216 Fixed a taming NPE 2020-08-25 14:11:26 -07:00
nossr50
b0e8fedf6f Fixed a taming NPE 2020-08-25 14:10:53 -07:00
András Marczinkó
b35c58ec21 Update locale_hu_HU.properties (#4264) 2020-08-20 12:46:09 -07:00
nossr50
b8a38bf975 small tweak 2020-08-18 21:16:48 -07:00
nossr50
500ab628dd 2.1.143 2020-08-18 21:11:15 -07:00
nossr50
1feee7f312 1.13.2 fix round 3.. or 4 2020-08-18 20:38:56 -07:00
nossr50
7ea9ec5c2f Another 1.13.2 fix 2020-08-18 20:28:09 -07:00
nossr50
e5f1738168 1.13.2 related bugfixes for the new item tracking 2020-08-18 20:28:02 -07:00
nossr50
557cfe3944 Some bugfixes to the new ability tool tracking 2020-08-18 19:47:15 -07:00
nossr50
a7ded7e982 super boosted items are now tracked differently 2020-08-18 18:41:31 -07:00
nossr50
59f52f6e7e 2.1.142 2020-08-17 23:36:47 -07:00
nossr50
c6b2cba007 Reworked Iron Arm Style into Steel Arm Style which scales over 20 ranks 2020-08-17 23:32:13 -07:00
Frank van der Heijden
dca2661ccb Don't set double drop if result is already a full stack (#4263)
Thanks, merging because I can't think of anything bad that would result from this change.
2020-08-17 14:21:09 -07:00
nossr50
a2f2614b10 2.1.141 2020-08-11 16:13:28 -07:00
nossr50
e890d4bae6 2.1.140 2020-08-08 21:16:06 -07:00
nossr50
3a035e234a Scoreboards fixes 2020-08-08 15:56:53 -07:00
nossr50
771ed9a8b4 oopsie 2020-08-07 11:50:44 -07:00
nossr50
d6ff1348eb Polish locale woodcutting rename 2020-08-07 11:49:12 -07:00
nossr50
8df15a4e55 dev mode 2020-08-06 19:01:36 -07:00
nossr50
4a4fd9fb75 2.1.139 2020-08-06 18:50:24 -07:00
emanondev
38017cabe7 fixed /mmoinfo roll (#4088)
* acrobatics roll mmoinfo fixes

LocaleLoader#getString() accepts Object arrays no need to call getStats twice

Max skill level is now configurable and so halfMaxSkillValue is now a variable which should be used on locale too instead of "50"

* Updated locale_it

Acrobatics.SubSkill.Roll.Mechanics supports half level variable instead of static level 50

* Updated locale_en_US

Acrobatics.SubSkill.Roll.Mechanics supports half level variable instead of static level 50

* Updated Locale it

fixed value
2020-08-06 18:46:12 -07:00
Flannery Lue Moore
375292c0b3 PR for gilded blackstone and nether gold ore to the mining skill, and nether gold ore to the smelting skill. (#4253)
* Added gilded blackstone and nether gold ore.

* Added nether gold ore to smelting xp.
2020-08-06 15:22:48 -07:00
t00thpick1
01f111f78d Switch to countdown latch so we don't need to bother with synchronization blocks. Fixes #4248 2020-08-02 12:56:27 -04:00
nossr50
d1b7e88b7e Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-07-31 20:47:01 -07:00
nossr50
c85ca2e2ca Dev mode 2020-07-31 20:46:52 -07:00
Robert Alan Chapton
7828437414 Merge pull request #4235 from kn-km/patch-1
Fix McMMOPlayerSalvageCheckEvent Handling
2020-07-31 20:43:44 -07:00
Robert Alan Chapton
0dba450b5a Merge pull request #4236 from kn-km/patch-2
Fix McMMOPlayerRepairCheckEvent Handling
2020-07-31 20:43:01 -07:00
nossr50
d490f4fd60 2.1.138 2020-07-30 16:28:47 -07:00
nossr50
a05c015732 Fix Netherite not working for certain skills (like Skull Splitter) 2020-07-30 16:12:50 -07:00
nossr50
9f9518eea0 2.1.137 - avoid npe on armor iterating 2020-07-30 13:05:19 -07:00
nossr50
9266a54fce debug tweaks 2020-07-30 11:17:08 -07:00
nossr50
270298c265 2.1.136 2020-07-29 07:41:47 -07:00
nossr50
38122d8f17 Furnace ownership tweaks 2020-07-28 21:56:51 -07:00
nossr50
274a41f530 update changelog 2020-07-27 21:39:26 -07:00
nossr50
8e3d203594 only cleanup furnaces without a job 2020-07-27 21:34:47 -07:00
nossr50
4169dceca8 debug tweak for furnaces 2020-07-27 21:20:03 -07:00
nossr50
567a5461e1 Add some more mmodebug related to furnaces 2020-07-27 21:19:25 -07:00
Robert Alan Chapton
70c934fa69 Merge pull request #4233 from SrBedrock/patch-1
Update CommandRegistrationManager.java
2020-07-27 20:26:26 -07:00
kn-km
ed9521d4a0 Fix #4234 2020-07-27 23:18:55 +08:00
kn-km
5d294d6dc3 Fix #4234 2020-07-27 22:55:44 +08:00
srbedrock
2eb924d433 Update CommandRegistrationManager.java 2020-07-26 22:04:43 -03:00
srbedrock
c97dc4181d Update CommandRegistrationManager.java 2020-07-26 22:01:30 -03:00
nossr50
a28d1cd537 2.1.135 2020-07-25 14:27:31 -07:00
Robert Alan Chapton
65a95addb9 Merge pull request #4230 from Ineusia/AbilityNotificatioons
Add option to disable other-player ability notifications
2020-07-25 14:26:08 -07:00
Robert Alan Chapton
81b31e49b8 Merge pull request #4231 from Ineusia/issue-4221
Use localized names for SuperAbility names
2020-07-25 14:25:36 -07:00
Ineusia
353fb80957 Use localized names for SuperAbility names 2020-07-25 12:13:54 -05:00
Ineusia
5298472c90 Add option to disable other-player ability notifications 2020-07-25 11:10:01 -05:00
nossr50
36af6d2478 update changes 2020-07-25 08:40:20 -07:00
Robert Alan Chapton
1df2225aa2 Merge pull request #4229 from Ineusia/issue-4224
Handle Fishing Event even if FishingExploitFix is set to false
2020-07-25 08:38:04 -07:00
nossr50
3ae1b5e987 Don't simulate block breaks when assigning furnace ownership 2020-07-25 08:37:19 -07:00
Ineusia
054c023330 Handle Fishing Event even if FishingExploitFix is set to false 2020-07-25 10:36:34 -05:00
nossr50
2910240942 2.1.134 2020-07-23 21:16:58 -07:00
nossr50
3ed0bd6be4 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-07-23 20:59:56 -07:00
nossr50
35cde870ff Reworked a lot of stuff to do with Smelting 2020-07-23 20:59:34 -07:00
Robert Alan Chapton
efcb2d0c14 Merge pull request #4226 from Durburz/master
Fix brewing stand not consuming items
2020-07-22 13:39:41 -07:00
Ulrich Fink
16d7b51497 Fix brewing stand not consuming items
Fixes #4225
Negation in commit fdd951f1f1 is faulty.
2020-07-21 22:49:32 +02:00
nossr50
f6c7049cac Furnaces can now change owners during server lifespan for Smelting XP 2020-07-13 13:16:47 -07:00
nossr50
fdd951f1f1 Second Smelt makes use of its own section in Bonus Drops in config.yml
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
2020-07-13 12:31:30 -07:00
nossr50
7eae59a0b3 Misc code fixes 2020-07-13 11:39:03 -07:00
nossr50
428c093ae4 UUID updater changes + locale fixes
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
2020-07-13 11:18:16 -07:00
nossr50
ded7fd5bdf Potion NPE fix 2020-07-13 10:53:36 -07:00
nossr50
1d1736481c Dev mode 2020-07-13 10:19:04 -07:00
nossr50
c918f2b72f 2.1.133 2020-07-13 07:43:03 -07:00
nossr50
7eef87b2e0 Turn off unused NMS compatibility layers 2020-07-13 07:39:16 -07:00
Robert Alan Chapton
7258b0995d Merge pull request #4118 from JLLeitschuh/fix/JLL/use_https_to_resolve_dependencies
[SECURITY] Use HTTPS to resolve dependencies in Maven Build
2020-07-13 07:31:28 -07:00
nossr50
235fb937a2 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-07-13 07:29:07 -07:00
nossr50
039eb0ee9e Fix array out of bounds 2020-07-13 07:28:50 -07:00
Robert Alan Chapton
99f12fe0ed Merge pull request #4195 from Draycia/master
Don't ready hand when player can't use skill
2020-07-13 07:27:33 -07:00
Robert Alan Chapton
2dfd7fd5a4 Merge pull request #4220 from FrankHeijden/fix/deathmessages
Update regex to also match colorless healthbar instances
2020-07-13 07:26:04 -07:00
Frank van der Heijden
7f1944b61d Update regex to also match colorless healthbar instances 2020-07-13 15:33:22 +02:00
Robert Alan Chapton
d83e296401 Merge pull request #4219 from Elikill58/master
Update translation to french
2020-07-09 21:01:25 -07:00
Elikill58
59552f42d7 Update french translation - end of translation 2020-07-09 23:48:19 +02:00
Elikill58
005f8c5478 Update french translation - begin with skills 2020-07-07 15:50:47 +02:00
nossr50
919907f46a 2.1.132 2020-07-03 16:02:26 -07:00
nossr50
7267b1501b Why did I use contains() :thonk: 2020-07-03 13:16:17 -07:00
nossr50
f05c4121d2 Temporary Spigot bug fix 2020-07-03 13:14:33 -07:00
nossr50
2fc1ba44d8 Oopsie 2020-07-02 21:06:19 -07:00
nossr50
900a534edb Inventory NPE fix 2020-07-02 21:04:06 -07:00
nossr50
ce03e6613f Dev mode 2020-07-02 20:53:57 -07:00
nossr50
254e1a1071 2.1.131 2020-06-30 11:51:46 -07:00
nossr50
75f404f387 Wire missing NMS 2020-06-30 11:35:36 -07:00
nossr50
420477149e Add Piglin Brute XP 2020-06-30 11:15:10 -07:00
nossr50
6d6efa3442 add to changelog 2020-06-30 10:05:35 -07:00
nossr50
78eb367b86 Repair / Salvage fixes 2020-06-30 10:03:37 -07:00
nossr50
b0ce6fb170 Missing permission nodes + missing repair XP 2020-06-30 09:35:47 -07:00
nossr50
4638f22ade Missing 1.16 bonus drop entries 2020-06-30 09:17:48 -07:00
nossr50
6dd5510cd8 dev mode 2020-06-30 07:27:52 -07:00
nossr50
ed69f843aa 2.1.130 2020-06-26 15:04:03 -07:00
nossr50
6b340838ee Use the correct default repair material for netherite gear 2020-06-26 15:00:52 -07:00
nossr50
cf78b51052 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO 2020-06-26 14:45:52 -07:00
nossr50
dab255254c Automatic spelling mistake correction on repair/salvage configs for
previously misspelled netherite materials
2020-06-26 14:45:26 -07:00
nossr50
83617b73b7 Fix repair 2020-06-24 23:39:14 -07:00
Robert Alan Chapton
fba24fd910 Merge pull request #4202 from darbyjack/treefeller-changes
Implemented PlayerItemDamageEvent on TreeFeller
2020-06-22 15:32:35 -07:00
darbyjack
dd011c94c6 Implemented PlayerItemDamageEvent on TreeFeller 2020-06-22 17:10:29 -05:00
nossr50
c84c428fde dev mode 2020-06-22 03:31:00 -07:00
nossr50
7ba65499fe 2.1.129 2020-06-22 03:21:30 -07:00
nossr50
36d0df1c54 Add Redstone Dust to bonus drops 2020-06-22 03:01:28 -07:00
nossr50
41139e93f5 Tweak zoglin XP 2020-06-22 02:49:52 -07:00
nossr50
382a9a77a7 Add Bone Block mining xp 2020-06-22 02:49:26 -07:00
nossr50
c37a8e10d5 Add zoglin XP 2020-06-22 02:45:29 -07:00
nossr50
795b1ffff5 Ignore soul campfires when activating abilities 2020-06-22 02:32:45 -07:00
nossr50
369251fb6b Add shroomlight to herbalism XP tables 2020-06-22 02:30:46 -07:00
nossr50
3fe0b44ce8 Add respawn anchors to blacklist 2020-06-22 02:28:56 -07:00
nossr50
c60fbf1761 Add lodestone to ability / tool blacklists 2020-06-22 02:25:41 -07:00
nossr50
0a26f7122a Add hyphae to woodcutting xp 2020-06-22 02:23:29 -07:00
nossr50
2f650a4789 Tweak gilded blackstone XP 2020-06-22 02:19:23 -07:00
nossr50
4460d3df67 Add gilded blackstone XP 2020-06-20 22:21:27 -07:00
nossr50
d874b2df39 Add crying obsidian XP 2020-06-20 22:19:29 -07:00
nossr50
1f26d8e054 Add chiseled nether brick XP 2020-06-20 21:54:31 -07:00
nossr50
4025fd94cb Add cracked nether brick xp 2020-06-20 21:51:55 -07:00
nossr50
a159368a3d Add chain XP 2020-06-20 21:06:57 -07:00
nossr50
4b80303928 Add blackstone to mining XP 2020-06-20 21:01:49 -07:00
Draycia
23cf9edf9c Don't handle activation when player can't use skill 2020-05-27 01:17:10 -07:00
nossr50
899a0152ba Add /mmoxpbar disable 2020-05-06 09:19:17 -07:00
nossr50
f584783490 dev mode 2020-05-06 09:04:57 -07:00
nossr50
b63311596b 2.1.128 2020-05-05 20:31:49 -07:00
nossr50
dce9a3b58d More Blast Mining bugfixes 2020-05-05 20:28:37 -07:00
nossr50
ede5b3fd31 Blast Mining debris yield bugfix 2020-05-05 20:15:46 -07:00
nossr50
4a0d6bf2b7 add notes 2020-05-05 19:56:38 -07:00
nossr50
402283806d Database choice is now logged 2020-05-05 19:51:53 -07:00
nossr50
fe2b7a8d61 Add ExperienceAPI::addCombatXP 2020-05-05 19:45:56 -07:00
nossr50
15e4dbfd92 Another oopsie 2020-05-05 19:32:22 -07:00
nossr50
d1116418be whoops 2020-05-05 19:30:26 -07:00
nossr50
9f455f5a0d Fix some locale errors 2020-05-05 19:23:55 -07:00
nossr50
c5ce7bd23b Revert blast mining nerf 2020-05-05 19:19:20 -07:00
nossr50
74f8c2901d Iron Arm Rank 1 Nerf 2020-05-05 19:08:55 -07:00
nossr50
ca3509e509 Dev mode 2020-05-05 19:01:45 -07:00
nossr50
a3612b6ae3 2.1.127 2020-05-01 14:46:57 -07:00
nossr50
d023b89189 Declare p right away 2020-05-01 14:43:48 -07:00
nossr50
7114ff02e5 Fix compile issue 2020-05-01 14:38:58 -07:00
nossr50
7615ff472d Update changelog 2020-05-01 14:32:56 -07:00
Robert Alan Chapton
53c5fb7328 Merge pull request #4152 from FlXME/master
Fix various bugs
2020-05-01 14:29:35 -07:00
Robert Alan Chapton
e4a76e667d Merge pull request #4170 from andris155/patch-1
Update locale_hu_HU.properties
2020-05-01 14:28:33 -07:00
Robert Alan Chapton
f943331e53 Merge pull request #4163 from GwonHeeJun/translate/korean
[UPDATE] XpBar Translation in English to Korean
2020-05-01 14:28:19 -07:00
Robert Alan Chapton
e884b2b7f1 Merge pull request #4173 from Draycia/master
Use logger instead of sysout
2020-04-29 13:17:13 -07:00
draycia
25389429ae Don't use the Logger here 2020-04-29 01:14:55 -07:00
draycia
6c5f438099 Use logger instead of sysout 2020-04-29 01:06:53 -07:00
nossr50
239200a3d2 child skills can have their xp bars turned on 2020-04-28 13:47:33 -07:00
nossr50
e6289a0548 back to work 2020-04-27 19:47:50 -07:00
nossr50
07b838db0f 2.1.126 2020-04-27 19:31:22 -07:00
nossr50
4a7b43c560 update log 2020-04-27 19:15:53 -07:00
nossr50
666729cadc Localize more things 2020-04-27 19:13:24 -07:00
nossr50
92c4ddce87 NPE fix 2020-04-27 19:09:37 -07:00
nossr50
2325c4eb6b New Command mmoxpbar 2020-04-27 19:01:40 -07:00
nossr50
34fe19e35c Less verbose unsupported material warnings 2020-04-27 17:28:27 -07:00
nossr50
145b2432e0 Combat fix 2020-04-27 17:04:01 -07:00
András Marczinkó
9a3b261f07 Update locale_hu_HU.properties 2020-04-26 17:55:01 +02:00
Mads U. Jensen
76536f0a18 Update EntityListener.java (#4169)
Remove debug broadcasts
2020-04-25 18:32:39 +01:00
nossr50
5984230bf3 CompatibilityLayer framework 2020-04-24 20:21:21 -07:00
GwonHeeJun
401e3121e6 [UPDATE] Add Korean translations of phrases that appear during level-up 2020-04-18 03:22:57 +09:00
GwonHeeJun
0897aefbee [UPDATE] Add a phrase translation that appears when you first learn a skill 2020-04-18 03:03:57 +09:00
GwonHeeJun
6f79a43e15 [UPDATE] XpBar Translation in English to Korean
- Changes the top experience bar to Korean for easier use by Korean users
2020-04-18 02:37:57 +09:00
Robert Alan Chapton
f82ad99c82 Merge pull request #4162 from broccolai/master
Check to make sure correct item is being damaged in Fishing exploit prevention
2020-04-16 12:03:48 -07:00
Josh Taylor
4a5bcaa92d Fix fishing exploit prevention 2020-04-16 05:44:26 +01:00
Shane Freeder
3a4de97c9b Always use localized names for skills, vs just non-english 2020-04-14 02:53:44 +01:00
Felix Bergmann
69a4ec80cd Fix resource leak on exception
When an exception is hit in the try statement, the readers will never get closed and leak resources
2020-04-07 10:02:22 +02:00
Felix Bergmann
877ef15374 Close resources in UUIDFetcher
Resource leak by not closing the InputStreamReader
2020-04-07 09:54:57 +02:00
Felix Bergmann
8dc955542d Introduce buffering in HashChunkletManager
Improve the performance by introducing buffering. The current usage of FileInputStream and ObjectInputStream don't use buffering.
2020-04-07 09:45:18 +02:00
Felix Bergmann
bffabb4a05 Fix BlockStoreConversion bug on folder check
If dataDir.exists() is true, dataDir.isDirectory() will always also be true. You probably wanted to check whether it is a folder.
This bug could lead to a critical bug when a file with the name of the folder exists.
2020-04-07 09:27:28 +02:00
Shane Freeder
3c272a3e31 register a valid skill for AprilCommand (Fixes #4147) 2020-04-01 14:41:53 +01:00
Shane Freeder
9c342f24cd Fix NPE from unloaded profiles in HolidayManager 2020-04-01 14:40:29 +01:00
nossr50
e8021e81e6 move namefix to monitor 2020-03-21 20:24:40 -07:00
nossr50
8fc3643803 2.1.125 hotfix 2020-03-20 11:02:25 -07:00
nossr50
296d8ee7c1 nothing to see here Kappa Keepo 2020-03-19 19:04:15 -07:00
nossr50
8d7f1cb595 Fixed not being able to place blocks on top of certain repair/salvage
anvils
2020-03-19 19:00:50 -07:00
nossr50
280889e11a dev time 2020-03-19 17:00:07 -07:00
nossr50
988a8124ca 2.1.124 2020-03-18 19:58:15 -07:00
nossr50
9c0dbf84b7 changelog wording 2020-03-18 19:57:58 -07:00
nossr50
42952dc420 repair/salvage anvils will override vanilla functions of a block 2020-03-18 19:44:27 -07:00
nossr50
5bd45ae970 Add missing mobs to experience tables 2020-03-18 19:23:52 -07:00
nossr50
254a17f026 no one saw that 2020-03-18 19:14:16 -07:00
nossr50
3fdbdcafd6 Add gold nugget to bonus drops 2020-03-18 19:13:56 -07:00
nossr50
f8dbace9f0 add comment 2020-03-17 16:00:32 -07:00
nossr50
58174d3391 dev mode 2020-03-17 15:42:25 -07:00
nossr50
7865ad8934 2.1.123 2020-03-13 15:15:00 -07:00
nossr50
d525f754a7 Add nether gold ore 2020-03-11 17:53:36 -07:00
nossr50
fd1b1fe124 treat new vines as multi block plants 2020-03-11 17:52:35 -07:00
nossr50
de71c60d6b Weeping vines fix / twisted vines added 2020-03-11 17:47:00 -07:00
nossr50
5609f1cdde update changelog 2020-03-11 17:45:18 -07:00
Shane Freeder
1bd4454a6b Show correct minimum level in adept salvage message 2020-03-07 23:20:18 +00:00
nossr50
8f8dfcf556 Update ability black lists 2020-03-03 22:32:24 -08:00
nossr50
ce1051c364 2.1.122 2020-03-03 22:24:35 -08:00
nossr50
b9d05d8d67 Move roots to herbalism xp tables 2020-03-03 22:13:34 -08:00
nossr50
3aa9f385e5 Wart blocks are now treated like leaves 2020-03-03 22:09:57 -08:00
nossr50
ff8c94bf44 2.1.121 2020-03-03 18:14:56 -08:00
nossr50
51e80f40dd sigh 2020-03-03 17:57:51 -08:00
nossr50
a7d2c901df 2.1.120 2020-03-03 17:52:18 -08:00
nossr50
325cbcad9d 2.1.120 2020-03-03 17:52:02 -08:00
nossr50
2644de5ab4 2.1.119 - 1.16 Support 2020-03-03 17:19:46 -08:00
nossr50
3a81d94b32 1.16 support part 5 2020-03-03 17:14:57 -08:00
nossr50
89a990f0cb Another dupe fix + 1.16 support part 4 2020-03-03 16:37:13 -08:00
nossr50
d585b1c2f7 1.16 support part 3 2020-03-02 14:52:51 -08:00
nossr50
1101815f18 1.16 Support part 2 2020-02-28 16:44:37 -08:00
nossr50
efea1c5d33 1.16 Support part 1 2020-02-28 16:29:11 -08:00
Jonathan Leitschuh
3026dc8a28 Use HTTPS instead of HTTP to resolve dependencies
This fixes a security vulnerability in this project where the `pom.xml`
files were configuring Maven to resolve dependencies over HTTP instead of
HTTPS.

Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
2020-02-11 09:13:18 -05:00
537 changed files with 43100 additions and 28829 deletions

52
.github/workflows/maven.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
# This workflow automatically tests new commits and pull requests as they come in.
# Note that this does not upload any artifacts, you will need to compile mcMMO manually
# if you wish to create the actual jar.
name: Compile and test
on:
# We run our tests whenever the pom or a source file was touched.
# There is no need to run Maven when only the changelog was touched.
# We may also want to re-run this workflow when the workflow file itself
# was updated too.
push:
paths:
- 'src/**'
- 'pom.xml'
- '.github/workflows/maven.yml'
# Whenever someone submits a new pull request which modified the pom or a source file,
# we want to ensure it compiles successfully and that all tests will pass.
pull_request:
paths:
- 'src/**'
- 'pom.xml'
jobs:
compile:
name: Maven compiler
runs-on: ubuntu-latest
steps:
# 1. Check out the current working tree
- name: Checkout repository
uses: actions/checkout@v2
# 2. Setup Java 17 JDK (Adopt)
- name: Java 17 setup
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-package: jdk
java-version: '17'
# 3. Setup local Maven package cache to speed up building
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
# 4. Build via Maven
- name: Build via Maven
run: mvn verify -B --file pom.xml -DdisableXmlReport=true

1
.gitignore vendored
View File

@@ -55,3 +55,4 @@
# Atlassian Stuff
/atlassian-ide-plugin.xml
/nulllocale_override.properties

11
1
View File

@@ -1,11 +0,0 @@
SkillShot tweaks
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: src/main/java/com/gmail/nossr50/skills/archery/Archery.java
# modified: src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java
#

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,12 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
#### Classic Maintainer
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
#### Folia Inquisitors
[<img src="https://github.com/HSGamer.png" width=80 alt="HSGamer">](https://github.com/HSGamer)
[<img src="https://github.com/TechnicallyCoded.png" width=80 alt="TechnicallyCoded">](https://github.com/TechnicallyCoded)
[<img src="https://github.com/Yomamaeatstoes.png" width=80 alt="Yomamaeatstoes">](https://github.com/Yomamaeatstoes)
[<img src="https://github.com/Rockyers.png" width=80 alt="Rockyers">](https://github.com/Rockyers)
## Former Team Members
### Former Lead & Awesome guy

View File

@@ -99,10 +99,6 @@ Woodcutting:
Double_Drops_Enabled: true
Is_Log: true
# Fir Quarters
X2209|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
X2211|1:
XP_Gain: 100
Double_Drops_Enabled: true
@@ -116,10 +112,6 @@ Woodcutting:
Double_Drops_Enabled: true
Is_Log: true
# Oak Quarters
X2209|2:
XP_Gain: 70
Double_Drops_Enabled: true
Is_Log: true
X2211|2:
XP_Gain: 100
Double_Drops_Enabled: true
@@ -133,15 +125,7 @@ Woodcutting:
Double_Drops_Enabled: true
Is_Log: true
# Acacia
X2209|1:
XP_Gain: 80
Double_Drops_Enabled: true
Is_Log: true
# Cypress
X2209|2:
XP_Gain: 90
Double_Drops_Enabled: true
Is_Log: true
# Cypress
# Bald Cypress Quarter
X2225|0:
XP_Gain: 90

View File

@@ -366,25 +366,7 @@ Axes:
###
Bows:
#Bow_1
X999:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X99
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Durability: 9999
#Bow_2
X999:
XP_Modifer: 1.0
Ability_Enabled: true
Tier: 1
Repairable: true
Repair_Material: X99
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 9
Durability: 9999
#
# Settings for Hoes

View File

@@ -68,17 +68,7 @@ Chestplates:
Repair_Material_Quantity: 8
Durability: 320
# Knightmetal
X28035:
Repairable: true
Repair_Material: X28032
Repair_Material_Pretty_Name: "Knightmetal Ingot"
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 8
Durability: 320
# Phantom
X28035:
Repairable: false
Durability: 480
Helmets:
# Ironwood
@@ -106,17 +96,7 @@ Helmets:
Repair_Material_Quantity: 5
Durability: 220
# Knightmetal
X28034:
Repairable: true
Repair_Material: X28032
Repair_Material_Pretty_Name: "Knightmetal Ingot"
Repair_Material_Data_Value: 0
Repair_Material_Quantity: 5
Durability: 220
# Phantom
X28034:
Repairable: false
Durability: 330
Leggings:
# Ironwood

263
pom.xml Executable file → Normal file
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.119-SNAPSHOT</version>
<version>2.1.227-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>
@@ -11,11 +11,29 @@
<developerConnection>scm:git:git@github.com:mcMMO-Dev/mcMMO.git</developerConnection>
<tag>HEAD</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<java.version>16</java.version>
</properties>
<issueManagement>
<url>https://github.com/mcMMO-Dev/mcMMO/issues</url>
<system>GitHub</system>
</issueManagement>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>neetgames</id>
<url>https://nexus.neetgames.com/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>neetgames</id>
<url>https://nexus.neetgames.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
@@ -55,18 +73,39 @@
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<version>3.0.0-M6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>16</release>
<compilerArgs>
<arg>-parameters</arg> <!-- used for ACF syntax stuff -->
</compilerArgs>
<excludes>
</excludes>
</configuration>
@@ -91,32 +130,68 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.3.0</version>
<configuration>
<artifactSet>
<includes>
<include>commons-logging:commons-logging</include>
<include>org.apache.tomcat:tomcat-jdbc</include>
<include>org.apache.tomcat:tomcat-juli</include>
<include>org.bstats:bstats-base</include>
<include>org.bstats:bstats-bukkit</include>
<include>net.kyori:adventure-api</include>
<include>net.kyori:adventure-text-serializer-gson</include>
<include>net.kyori:adventure-platform-bukkit</include>
<include>net.kyori:adventure-platform-api</include>
<include>net.kyori:adventure-platform-viaversion</include>
<include>net.kyori:adventure-platform-facet</include>
<include>net.kyori:adventure-nbt</include>
<include>net.kyori:adventure-key</include>
<include>net.kyori:examination-api</include>
<include>net.kyori:examination-string</include>
<include>net.kyori:adventure-text-serializer-legacy</include>
<include>net.kyori:adventure-text-serializer-gson</include>
<include>net.kyori:adventure-text-serializer-json</include>
<include>net.kyori:adventure-text-serializer-bungeecord</include>
<include>net.kyori:adventure-text-serializer-craftbukkit</include>
<include>net.kyori:adventure-text-serializer-gson-legacy-impl</include>
<include>net.kyori:adventure-text-serializer-json-legacy-impl</include>
<include>co.aikar:acf-bukkit</include>
<include>com.tcoded:FoliaLib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.acf</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>co.aikar.locales</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.locales</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>com.gmail.nossr50.commons.logging</shadedPattern>
<shadedPattern>com.gmail.nossr50.mcmmo.commons.logging</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.juli</pattern>
<shadedPattern>com.gmail.nossr50.database.tomcat.juli</shadedPattern>
<shadedPattern>com.gmail.nossr50.mcmmo.database.tomcat.juli</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.tomcat</pattern>
<shadedPattern>com.gmail.nossr50.database.tomcat</shadedPattern>
<shadedPattern>com.gmail.nossr50.mcmmo.database.tomcat</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.gmail.nossr50.metrics.bstat</shadedPattern>
<shadedPattern>com.gmail.nossr50.mcmmo.metrics.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.folialib</shadedPattern>
</relocation>
</relocations>
</configuration>
@@ -134,10 +209,17 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>2.2</version>
<version>3.5.2</version>
</extension>
</extensions>
</build>
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>spigot-repo</id>
@@ -148,32 +230,139 @@
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository> <!-- for development builds -->
<id>sonatype-oss</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url>
</repository>
<!-- ... -->
<!-- ... -->
</repositories>
<dependencies>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-bungeecord</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.14.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-facet</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-viaversion</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
<version>2.0.0-M1</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.4</version>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-core</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.0.7</version>
<exclusions>
<exclusion>
<!-- We use jetbrains instead. Excluding this -->
<!-- prevents us from using inconsistent annotations -->
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
@@ -187,19 +376,45 @@
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.52</version>
<version>10.1.0-M17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -83,6 +83,12 @@ public final class AbilityAPI {
}
public static boolean isBleeding(LivingEntity entity) {
return BleedTimerTask.isBleeding(entity);
if(entity.isValid()) {
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
return true;
}
}
return false;
}
}

View File

@@ -1,72 +1,68 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public final class ChatAPI {
private ChatAPI() {}
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender
* @param displayName The display name of the sender
* @param party The name of the party to send to
* @param message The message to send
*/
public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
}
/**
* Send a message to all members of a party
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat
* @param party The name of the party to send to
* @param message The message to send
*/
public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
getPartyChatManager(plugin, party).handleChat(sender, message);
}
/**
* Send a message to administrators
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender
* @param displayName The display name of the sender
* @param message The message to send
*/
public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, displayName, message);
}
/**
* Send a message to administrators
* </br>
* This function is designed for API usage.
*
* @param plugin The plugin sending the message
* @param sender The name of the sender to display in the chat
* @param message The message to send
*/
public static void sendAdminChat(Plugin plugin, String sender, String message) {
ChatManagerFactory.getChatManager(plugin, ChatMode.ADMIN).handleChat(sender, message);
}
// /**
// * Send a message to all members of a party
// * </br>
// * This function is designed for API usage.
// *
// * @param plugin The plugin sending the message
// * @param sender The name of the sender
// * @param displayName The display name of the sender
// * @param party The name of the party to send to
// * @param message The message to send
// */
// public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
// getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
// }
//
// /**
// * Send a message to all members of a party
// * </br>
// * This function is designed for API usage.
// *
// * @param plugin The plugin sending the message
// * @param sender The name of the sender to display in the chat
// * @param party The name of the party to send to
// * @param message The message to send
// */
// public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
// getPartyChatManager(plugin, party).handleChat(sender, message);
// }
//
// /**
// * Send a message to administrators
// * </br>
// * This function is designed for API usage.
// *
// * @param plugin The plugin sending the message
// * @param sender The name of the sender
// * @param displayName The display name of the sender
// * @param message The message to send
// */
// public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, displayName, message);
// }
//
// /**
// * Send a message to administrators
// * </br>
// * This function is designed for API usage.
// *
// * @param plugin The plugin sending the message
// * @param sender The name of the sender to display in the chat
// * @param message The message to send
// */
// public static void sendAdminChat(Plugin plugin, String sender, String message) {
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, message);
// }
/**
* Check if a player is currently talking in party chat.
@@ -75,7 +71,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(Player player) {
return UserManager.getPlayer(player).isChatEnabled(ChatMode.PARTY);
return UserManager.getPlayer(player).getChatChannel() == ChatChannel.PARTY;
}
/**
@@ -85,7 +81,7 @@ public final class ChatAPI {
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(String playerName) {
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.PARTY);
return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.PARTY;
}
/**
@@ -95,7 +91,7 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(Player player) {
return UserManager.getPlayer(player).isChatEnabled(ChatMode.ADMIN);
return UserManager.getPlayer(player).getChatChannel() == ChatChannel.ADMIN;
}
/**
@@ -105,7 +101,7 @@ public final class ChatAPI {
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(String playerName) {
return UserManager.getPlayer(playerName).isChatEnabled(ChatMode.ADMIN);
return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.ADMIN;
}
/**
@@ -114,7 +110,7 @@ public final class ChatAPI {
* @param player The player to toggle party chat on.
*/
public static void togglePartyChat(Player player) {
UserManager.getPlayer(player).toggleChat(ChatMode.PARTY);
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.PARTY);
}
/**
@@ -123,7 +119,7 @@ public final class ChatAPI {
* @param playerName The name of the player to toggle party chat on.
*/
public static void togglePartyChat(String playerName) {
UserManager.getPlayer(playerName).toggleChat(ChatMode.PARTY);
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.PARTY);
}
/**
@@ -132,7 +128,7 @@ public final class ChatAPI {
* @param player The player to toggle admin chat on.
*/
public static void toggleAdminChat(Player player) {
UserManager.getPlayer(player).toggleChat(ChatMode.ADMIN);
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.ADMIN);
}
/**
@@ -141,13 +137,6 @@ public final class ChatAPI {
* @param playerName The name of the player to toggle party chat on.
*/
public static void toggleAdminChat(String playerName) {
UserManager.getPlayer(playerName).toggleChat(ChatMode.ADMIN);
}
private static ChatManager getPartyChatManager(Plugin plugin, String party) {
ChatManager chatManager = ChatManagerFactory.getChatManager(plugin, ChatMode.PARTY);
((PartyChatManager) chatManager).setParty(PartyManager.getParty(party));
return chatManager;
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.ADMIN);
}
}

View File

@@ -2,6 +2,8 @@ package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.mcMMO;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
@@ -9,20 +11,38 @@ public class DatabaseAPI {
/**
* Checks if a player exists in the mcMMO Database
* @param uuid player UUID
* @param offlinePlayer target player
* @return true if the player exists in the DB, false if they do not
*/
public boolean doesPlayerExistInDB(String uuid) {
return doesPlayerExistInDB(UUID.fromString(uuid));
public boolean doesPlayerExistInDB(@NotNull OfflinePlayer offlinePlayer) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(offlinePlayer);
return playerProfile.isLoaded();
}
/**
* Checks if a player exists in the mcMMO Database
* @param uuid player UUID
* @param uuid target player
* @return true if the player exists in the DB, false if they do not
*/
public boolean doesPlayerExistInDB(UUID uuid) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
public boolean doesPlayerExistInDB(@NotNull UUID uuid) {
PlayerProfile playerProfile = null;
try {
playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
} catch (Exception e) {
return false;
}
return playerProfile.isLoaded();
}
/**
* Checks if a player exists in the mcMMO Database
* @param playerName target player
* @return true if the player exists in the DB, false if they do not
*/
public boolean doesPlayerExistInDB(@NotNull String playerName) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
return playerProfile.isLoaded();
}

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.api.exceptions.*;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
@@ -12,8 +11,13 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillTools;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.BlockState;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Set;
@@ -31,8 +35,37 @@ public final class ExperienceAPI {
* @param skillType A string that may or may not be a skill
* @return true if this is a valid mcMMO skill
*/
public static boolean isValidSkillType(String skillType) {
return PrimarySkillType.getSkill(skillType) != null;
public static boolean isValidSkillType(@NotNull String skillType) {
return mcMMO.p.getSkillTools().matchSkill(skillType) != null;
}
/**
* Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
*
* @param mcMMOPlayer The attacking player
* @param target The defending entity
* @param primarySkillType The skill being used
* @param multiplier final XP result will be multiplied by this
* @deprecated Draft API
*/
@Deprecated
public static void addCombatXP(McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType, double multiplier) {
CombatUtils.processCombatXP(mcMMOPlayer, target, primarySkillType, multiplier);
}
/**
* Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
*
* @param mcMMOPlayer The attacking player
* @param target The defending entity
* @param primarySkillType The skill being used
* @deprecated Draft API
*/
@Deprecated
public static void addCombatXP(McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType) {
CombatUtils.processCombatXP(mcMMOPlayer, target, primarySkillType);
}
/**
@@ -46,9 +79,9 @@ public final class ExperienceAPI {
* @return true if this is a valid, non-child mcMMO skill
*/
public static boolean isNonChildSkill(String skillType) {
PrimarySkillType skill = PrimarySkillType.getSkill(skillType);
PrimarySkillType skill = mcMMO.p.getSkillTools().matchSkill(skillType);
return skill != null && !skill.isChildSkill();
return skill != null && !SkillTools.isChildSkill(skill);
}
@Deprecated
@@ -262,11 +295,12 @@ public final class ExperienceAPI {
PrimarySkillType skill = getSkillType(skillType);
if (isUnshared) {
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
getPlayer(player).beginUnsharedXpGain(skill,
(int) (XP / ExperienceConfig.getInstance().getFormulaSkillModifier(skill) * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
return;
}
getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
getPlayer(player).applyXpGain(skill, (int) (XP / ExperienceConfig.getInstance().getFormulaSkillModifier(skill) * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
}
/**
@@ -285,7 +319,7 @@ public final class ExperienceAPI {
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
PrimarySkillType skill = getSkillType(skillType);
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
addOfflineXP(playerName, skill, (int) (XP / ExperienceConfig.getInstance().getFormulaSkillModifier(skill) * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
}
/**
@@ -398,6 +432,23 @@ public final class ExperienceAPI {
return getOfflineProfile(uuid).getSkillXpLevel(getNonChildSkillType(skillType));
}
/**
* Get the amount of XP an offline player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param offlinePlayer The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXP(@NotNull OfflinePlayer offlinePlayer, @NotNull String skillType) throws InvalidPlayerException {
return getOfflineProfile(offlinePlayer).getSkillXpLevel(getNonChildSkillType(skillType));
}
/**
* Get the raw amount of XP a player has in a specific skill.
* </br>
@@ -449,6 +500,30 @@ public final class ExperienceAPI {
return getOfflineProfile(uuid).getSkillXpLevelRaw(getNonChildSkillType(skillType));
}
/**
* Get the raw amount of XP an offline player has in a specific skill.
* </br>
* This function is designed for API usage.
*
* @param offlinePlayer The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP in a given skill
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull String skillType) throws InvalidPlayerException, UnsupportedOperationException, InvalidSkillException {
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(getNonChildSkillType(skillType));
}
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
if(SkillTools.isChildSkill(skillType))
throw new UnsupportedOperationException();
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
}
/**
* Get the total amount of XP needed to reach the next level.
* </br>
@@ -496,10 +571,27 @@ public final class ExperienceAPI {
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXPToNextLevel(UUID uuid, String skillType) {
public static int getOfflineXPToNextLevel(@NotNull UUID uuid, @NotNull String skillType) {
return getOfflineProfile(uuid).getXpToLevel(getNonChildSkillType(skillType));
}
/**
* Get the total amount of XP an offline player needs to reach the next level.
* </br>
* This function is designed for API usage.
*
* @param offlinePlayer The player to get XP for
* @param skillType The skill to get XP for
* @return the total amount of XP needed to reach the next level
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static int getOfflineXPToNextLevel(@NotNull OfflinePlayer offlinePlayer, @NotNull String skillType) throws UnsupportedOperationException, InvalidSkillException, InvalidPlayerException {
return getOfflineProfile(offlinePlayer).getXpToLevel(getNonChildSkillType(skillType));
}
/**
* Get the amount of XP remaining until the next level.
* </br>
@@ -561,6 +653,26 @@ public final class ExperienceAPI {
return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
}
/**
* Get the amount of XP an offline player has left before leveling up.
* </br>
* This function is designed for API usage.
*
* @param offlinePlayer The player to get XP for
* @param skillType The skill to get XP for
* @return the amount of XP needed to reach the next level
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*/
public static float getOfflineXPRemaining(OfflinePlayer offlinePlayer, String skillType) throws InvalidSkillException, InvalidPlayerException, UnsupportedOperationException {
PrimarySkillType skill = getNonChildSkillType(skillType);
PlayerProfile profile = getOfflineProfile(offlinePlayer);
return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
}
/**
* Add levels to a skill.
* </br>
@@ -593,7 +705,7 @@ public final class ExperienceAPI {
PlayerProfile profile = getOfflineProfile(playerName);
PrimarySkillType skill = getSkillType(skillType);
if (skill.isChildSkill()) {
if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
for (PrimarySkillType parentSkill : parentSkills) {
@@ -624,7 +736,7 @@ public final class ExperienceAPI {
PlayerProfile profile = getOfflineProfile(uuid);
PrimarySkillType skill = getSkillType(skillType);
if (skill.isChildSkill()) {
if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
for (PrimarySkillType parentSkill : parentSkills) {
@@ -683,7 +795,6 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
*/
@Deprecated
public static int getLevelOffline(String playerName, String skillType) {
return getOfflineProfile(playerName).getSkillLevel(getSkillType(skillType));
}
@@ -731,7 +842,7 @@ public final class ExperienceAPI {
int powerLevel = 0;
PlayerProfile profile = getOfflineProfile(playerName);
for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) {
for (PrimarySkillType type : SkillTools.NON_CHILD_SKILLS) {
powerLevel += profile.getSkillLevel(type);
}
@@ -752,7 +863,7 @@ public final class ExperienceAPI {
int powerLevel = 0;
PlayerProfile profile = getOfflineProfile(uuid);
for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) {
for (PrimarySkillType type : SkillTools.NON_CHILD_SKILLS) {
powerLevel += profile.getSkillLevel(type);
}
@@ -770,7 +881,7 @@ public final class ExperienceAPI {
* @throws InvalidSkillException if the given skill is not valid
*/
public static int getLevelCap(String skillType) {
return Config.getInstance().getLevelCap(getSkillType(skillType));
return mcMMO.p.getSkillTools().getLevelCap(getSkillType(skillType));
}
/**
@@ -781,7 +892,7 @@ public final class ExperienceAPI {
* @return the overall power level cap
*/
public static int getPowerLevelCap() {
return Config.getInstance().getPowerLevelCap();
return mcMMO.p.getGeneralConfig().getPowerLevelCap();
}
/**
@@ -1095,25 +1206,22 @@ public final class ExperienceAPI {
}
}
// Utility methods follow.
private static void addOfflineXP(UUID playerUniqueId, PrimarySkillType skill, int XP) {
private static void addOfflineXP(@NotNull UUID playerUniqueId, @NotNull PrimarySkillType skill, int XP) {
PlayerProfile profile = getOfflineProfile(playerUniqueId);
profile.addXp(skill, XP);
profile.save(true);
}
@Deprecated
private static void addOfflineXP(String playerName, PrimarySkillType skill, int XP) {
private static void addOfflineXP(@NotNull String playerName, @NotNull PrimarySkillType skill, int XP) {
PlayerProfile profile = getOfflineProfile(playerName);
profile.addXp(skill, XP);
profile.scheduleAsyncSave();
}
private static PlayerProfile getOfflineProfile(UUID uuid) {
private static @NotNull PlayerProfile getOfflineProfile(@NotNull UUID uuid) throws InvalidPlayerException {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
if (!profile.isLoaded()) {
@@ -1123,10 +1231,18 @@ public final class ExperienceAPI {
return profile;
}
@Deprecated
private static PlayerProfile getOfflineProfile(String playerName) {
UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId();
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
private static @NotNull PlayerProfile getOfflineProfile(@NotNull OfflinePlayer offlinePlayer) throws InvalidPlayerException {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(offlinePlayer);
if (!profile.isLoaded()) {
throw new InvalidPlayerException();
}
return profile;
}
private static @NotNull PlayerProfile getOfflineProfile(@NotNull String playerName) throws InvalidPlayerException {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
if (!profile.isLoaded()) {
throw new InvalidPlayerException();
@@ -1136,7 +1252,7 @@ public final class ExperienceAPI {
}
private static PrimarySkillType getSkillType(String skillType) throws InvalidSkillException {
PrimarySkillType skill = PrimarySkillType.getSkill(skillType);
PrimarySkillType skill = mcMMO.p.getSkillTools().matchSkill(skillType);
if (skill == null) {
throw new InvalidSkillException();
@@ -1148,7 +1264,7 @@ public final class ExperienceAPI {
private static PrimarySkillType getNonChildSkillType(String skillType) throws InvalidSkillException, UnsupportedOperationException {
PrimarySkillType skill = getSkillType(skillType);
if (skill.isChildSkill()) {
if (SkillTools.isChildSkill(skill)) {
throw new UnsupportedOperationException("Child skills do not have XP");
}

View File

@@ -0,0 +1,6 @@
package com.gmail.nossr50.api;
public enum FakeBlockBreakEventType {
FAKE,
TREE_FELLER
}

View File

@@ -0,0 +1,17 @@
package com.gmail.nossr50.api;
public enum ItemSpawnReason {
ARROW_RETRIEVAL_ACTIVATED, //Players sometimes can retrieve arrows instead of losing them when hitting a mob
EXCAVATION_TREASURE, //Any drops when excavation treasures activate fall under this
FISHING_EXTRA_FISH, //A config setting allows more fish to be found when fishing, the extra fish are part of this
FISHING_SHAKE_TREASURE, //When using a fishing rod on a mob and finding a treasure via Shake
HYLIAN_LUCK_TREASURE, //When finding a treasure in grass via hylian luck
BLAST_MINING_DEBRIS_NON_ORES, //The non-ore debris that are dropped from blast mining
BLAST_MINING_ORES, //The ore(s) which may include player placed ores being dropped from blast mining
BLAST_MINING_ORES_BONUS_DROP, //Any bonus ores that drop from a result of a players Mining skills
UNARMED_DISARMED_ITEM, //When you disarm an opponent and they drop their weapon
SALVAGE_ENCHANTMENT_BOOK, //When you salvage an enchanted item and get the enchantment back in book form
SALVAGE_MATERIALS, //When you salvage an item and get materials back
TREE_FELLER_DISPLACED_BLOCK,
BONUS_DROPS, //Can be from Mining, Woodcutting, Herbalism, etc
}

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyLeader;
@@ -108,7 +107,7 @@ public final class PartyAPI {
*/
public static int getMaxPartySize()
{
return Config.getInstance().getPartyMaxSize();
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
}
/**
@@ -185,7 +184,7 @@ public final class PartyAPI {
*/
@Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
List<OfflinePlayer> members = new ArrayList<OfflinePlayer>();
List<OfflinePlayer> members = new ArrayList<>();
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);

View File

@@ -1,6 +1,8 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.skills.SkillTools;
import java.util.ArrayList;
import java.util.Arrays;
@@ -30,7 +32,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names
*/
public static List<String> getNonChildSkills() {
return getListFromEnum(PrimarySkillType.NON_CHILD_SKILLS);
return getListFromEnum(SkillTools.NON_CHILD_SKILLS);
}
/**
@@ -42,7 +44,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names
*/
public static List<String> getChildSkills() {
return getListFromEnum(PrimarySkillType.CHILD_SKILLS);
return getListFromEnum(mcMMO.p.getSkillTools().CHILD_SKILLS);
}
/**
@@ -54,7 +56,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names
*/
public static List<String> getCombatSkills() {
return getListFromEnum(PrimarySkillType.COMBAT_SKILLS);
return getListFromEnum(mcMMO.p.getSkillTools().COMBAT_SKILLS);
}
/**
@@ -66,7 +68,7 @@ public final class SkillAPI {
* @return a list of strings with valid skill names
*/
public static List<String> getGatheringSkills() {
return getListFromEnum(PrimarySkillType.GATHERING_SKILLS);
return getListFromEnum(mcMMO.p.getSkillTools().GATHERING_SKILLS);
}
/**
@@ -78,11 +80,11 @@ public final class SkillAPI {
* @return a list of strings with valid skill names
*/
public static List<String> getMiscSkills() {
return getListFromEnum(PrimarySkillType.MISC_SKILLS);
return getListFromEnum(mcMMO.p.getSkillTools().MISC_SKILLS);
}
private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) {
List<String> skills = new ArrayList<String>();
List<String> skills = new ArrayList<>();
for (PrimarySkillType primarySkillType : skillsTypes) {
skills.add(primarySkillType.name());

View File

@@ -0,0 +1,12 @@
package com.gmail.nossr50.api;
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {
public TreeFellerBlockBreakEvent(@NotNull Block theBlock, @NotNull Player player) {
super(theBlock, player);
}
}

View File

@@ -0,0 +1,11 @@
package com.gmail.nossr50.api.exceptions;
import org.jetbrains.annotations.NotNull;
public class IncompleteNamespacedKeyRegister extends RuntimeException {
private static final long serialVersionUID = -6905157273569301219L;
public IncompleteNamespacedKeyRegister(@NotNull String message) {
super(message);
}
}

View File

@@ -6,4 +6,8 @@ public class InvalidSkillException extends RuntimeException {
public InvalidSkillException() {
super("That is not a valid skill.");
}
public InvalidSkillException(String msg) {
super(msg);
}
}

View File

@@ -1,11 +1,12 @@
package com.gmail.nossr50.api.exceptions;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class McMMOPlayerNotFoundException extends RuntimeException {
private static final long serialVersionUID = 761917904993202836L;
public McMMOPlayerNotFoundException(Player player) {
super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
public McMMOPlayerNotFoundException(@NotNull Player player) {
super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet! : " + player.getName() + " " + player.getUniqueId());
}
}

View File

@@ -1,21 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import org.bukkit.plugin.Plugin;
public class AdminChatManager extends ChatManager {
protected AdminChatManager(Plugin plugin) {
super(plugin, Config.getInstance().getAdminDisplayNames(), Config.getInstance().getAdminChatPrefix());
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOAdminChatEvent(plugin, senderName, displayName, message, isAsync));
}
@Override
protected void sendMessage() {
plugin.getServer().broadcast(message, "mcmmo.chat.adminchat");
}
}

View File

@@ -1,88 +1,225 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.author.ConsoleAuthor;
import com.gmail.nossr50.chat.mailer.AdminChatMailer;
import com.gmail.nossr50.chat.mailer.PartyChatMailer;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.chat.McMMOChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.text.StringUtils;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.command.ConsoleCommandSender;
import org.jetbrains.annotations.NotNull;
public abstract class ChatManager {
protected Plugin plugin;
protected boolean useDisplayNames;
protected String chatPrefix;
//TODO: Micro optimization - Cache audiences and update cache when needed
public class ChatManager {
protected String senderName;
protected String displayName;
protected String message;
private final @NotNull AdminChatMailer adminChatMailer;
private final @NotNull PartyChatMailer partyChatMailer;
protected ChatManager(Plugin plugin, boolean useDisplayNames, String chatPrefix) {
this.plugin = plugin;
this.useDisplayNames = useDisplayNames;
this.chatPrefix = chatPrefix;
private final @NotNull ConsoleAuthor consoleAuthor;
private final @NotNull Audience consoleAudience;
private final boolean isChatEnabled;
public ChatManager(@NotNull mcMMO pluginRef) {
adminChatMailer = new AdminChatMailer(pluginRef);
partyChatMailer = new PartyChatMailer(pluginRef);
this.consoleAuthor = new ConsoleAuthor(LocaleLoader.getString("Chat.Identity.Console"));
this.consoleAudience = mcMMO.getAudiences().filter((cs) -> cs instanceof ConsoleCommandSender);
this.isChatEnabled = ChatConfig.getInstance().isChatEnabled();
}
protected void handleChat(McMMOChatEvent event) {
plugin.getServer().getPluginManager().callEvent(event);
/**
* Handles player messaging when they are either in party chat or admin chat modes
*
* @param mmoPlayer target player
* @param rawMessage the raw message from the player as it was typed
* @param isAsync whether this is getting processed via async
*/
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) {
processPlayerMessage(mmoPlayer, mmoPlayer.getChatChannel(), rawMessage, isAsync);
}
if (event.isCancelled()) {
return;
/**
* Handles player messaging for a specific chat channel
*
* @param mmoPlayer target player
* @param args the raw command arguments from the player
* @param chatChannel target channel
*/
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String[] args, @NotNull ChatChannel chatChannel) {
String chatMessageWithoutCommand = buildChatMessage(args);
//Commands are never async
processPlayerMessage(mmoPlayer, chatChannel, chatMessageWithoutCommand, false);
}
/**
* Handles player messaging for a specific chat channel
*
* @param mmoPlayer target player
* @param chatChannel target chat channel
* @param rawMessage raw chat message as it was typed
* @param isAsync whether this is getting processed via async
*/
private void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) {
switch (chatChannel) {
case ADMIN:
adminChatMailer.processChatMessage(mmoPlayer.getPlayerAuthor(), rawMessage, isAsync, Permissions.colorChat(mmoPlayer.getPlayer()));
break;
case PARTY:
partyChatMailer.processChatMessage(mmoPlayer.getPlayerAuthor(), rawMessage, mmoPlayer.getParty(), isAsync, Permissions.colorChat(mmoPlayer.getPlayer()), Misc.isPartyLeader(mmoPlayer));
break;
case PARTY_OFFICER:
case NONE:
break;
}
}
/**
* Handles console messaging to admins
* @param rawMessage raw message from the console
*/
public void processConsoleMessage(@NotNull String rawMessage) {
adminChatMailer.processChatMessage(getConsoleAuthor(), rawMessage, false, true);
}
/**
* Handles console messaging to admins
* @param args raw command args from the console
*/
public void processConsoleMessage(@NotNull String[] args) {
processConsoleMessage(buildChatMessage(args));
}
/**
* Handles console messaging to a specific party
* @param rawMessage raw message from the console
* @param party target party
*/
public void processConsoleMessage(@NotNull String rawMessage, @NotNull Party party) {
partyChatMailer.processChatMessage(getConsoleAuthor(), rawMessage, party, false, true, false);
}
/**
* Gets a console author
* @return a {@link ConsoleAuthor}
*/
private @NotNull Author getConsoleAuthor() {
return consoleAuthor;
}
/**
* Change the chat channel of a {@link McMMOPlayer}
* Targeting the channel a player is already in will remove that player from the chat channel
* @param mmoPlayer target player
* @param targetChatChannel target chat channel
*/
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
if(targetChatChannel == mmoPlayer.getChatChannel()) {
//Disabled message
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
mmoPlayer.setChatMode(ChatChannel.NONE);
} else {
mmoPlayer.setChatMode(targetChatChannel);
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.On", StringUtils.getCapitalized(targetChatChannel.toString())));
}
}
/**
* Create a chat message from an array of {@link String}
* @param args array of {@link String}
* @return a String built from the array
*/
private @NotNull String buildChatMessage(@NotNull String[] args) {
StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < args.length; i++) {
if(i + 1 >= args.length) {
stringBuilder.append(args[i]);
} else {
stringBuilder.append(args[i]).append(" ");
}
}
senderName = event.getSender();
displayName = useDisplayNames ? event.getDisplayName() : senderName;
message = LocaleLoader.formatString(chatPrefix, displayName) + " " + event.getMessage();
return stringBuilder.toString();
}
sendMessage();
/*
* Party Chat Spying
* Party messages will be copied to people with the mcmmo.admin.chatspy permission node
*/
if(event instanceof McMMOPartyChatEvent)
{
//We need to grab the party chat name
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
//Find the people with permissions
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers())
{
Player player = mcMMOPlayer.getPlayer();
//Check for toggled players
if(mcMMOPlayer.isPartyChatSpying())
{
Party adminParty = mcMMOPlayer.getParty();
//Only message admins not part of this party
if(adminParty != null)
{
//TODO: Incorporate JSON
if(!adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
} else {
player.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Chat", partyChatEvent.getParty(), message));
}
/**
* Whether the player is allowed to send a message to the chat channel they are targeting
* @param mmoPlayer target player
* @return true if the player can send messages to that chat channel
*/
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
switch (mmoPlayer.getChatChannel()) {
case ADMIN:
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
return true;
}
break;
case PARTY:
if(mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
return true;
}
break;
case PARTY_OFFICER:
case NONE:
return false;
}
return false;
}
/**
* Sends just the console a message
* @param author author of the message
* @param message message contents in component form
*/
public void sendConsoleMessage(@NotNull Author author, @NotNull TextComponent message) {
consoleAudience.sendMessage(author, message);
}
/**
* Whether the mcMMO chat system which handles party and admin chat is enabled or disabled
* @return true if mcMMO chat processing (for party/admin chat) is enabled
*/
public boolean isChatEnabled() {
return isChatEnabled;
}
/**
* Whether a specific chat channel is enabled
* ChatChannels are enabled/disabled via user config
*
* If chat is disabled, this always returns false
* If NONE is passed as a {@link ChatChannel} it will return true
* @param chatChannel target chat channel
* @return true if the chat channel is enabled
*/
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
if(!isChatEnabled) {
return false;
} else {
switch(chatChannel) {
case ADMIN:
case PARTY:
case PARTY_OFFICER:
return ChatConfig.getInstance().isChatChannelEnabled(chatChannel);
case NONE:
return true;
default:
return false;
}
}
}
public void handleChat(String senderName, String message) {
handleChat(senderName, senderName, message, false);
}
public void handleChat(Player player, String message, boolean isAsync) {
handleChat(player.getName(), player.getDisplayName(), message, isAsync);
}
public void handleChat(String senderName, String displayName, String message) {
handleChat(senderName, displayName, message, false);
}
public abstract void handleChat(String senderName, String displayName, String message, boolean isAsync);
protected abstract void sendMessage();
}
}

View File

@@ -1,30 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
public class ChatManagerFactory {
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<Plugin, AdminChatManager>();
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<Plugin, PartyChatManager>();
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
switch (mode) {
case ADMIN:
if (!adminChatManagers.containsKey(plugin)) {
adminChatManagers.put(plugin, new AdminChatManager(plugin));
}
return adminChatManagers.get(plugin);
case PARTY:
if (!partyChatManagers.containsKey(plugin)) {
partyChatManagers.put(plugin, new PartyChatManager(plugin));
}
return partyChatManagers.get(plugin);
default:
return null;
}
}
}

View File

@@ -1,29 +0,0 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.runnables.party.PartyChatTask;
import org.bukkit.plugin.Plugin;
public class PartyChatManager extends ChatManager {
private Party party;
protected PartyChatManager(Plugin plugin) {
super(plugin, Config.getInstance().getPartyDisplayNames(), Config.getInstance().getPartyChatPrefix());
}
public void setParty(Party party) {
this.party = party;
}
@Override
public void handleChat(String senderName, String displayName, String message, boolean isAsync) {
handleChat(new McMMOPartyChatEvent(plugin, senderName, displayName, party.getName(), message, isAsync));
}
@Override
protected void sendMessage() {
new PartyChatTask(plugin, party, senderName, displayName, message).runTask(plugin);
}
}

View File

@@ -0,0 +1,35 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import java.util.function.Predicate;
public class SamePartyPredicate<T extends CommandSender> implements Predicate<T> {
final Party party;
public SamePartyPredicate(Party party) {
this.party = party;
}
@Override
public boolean test(T t) {
//Include the console in the audience
if(t instanceof ConsoleCommandSender) {
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
} else {
if(t instanceof Player player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer != null) {
return mcMMOPlayer.getParty() == party;
}
}
}
return false;
}
}

View File

@@ -0,0 +1,120 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.util.text.TextUtils;
import com.google.common.base.Objects;
import org.bukkit.entity.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.UUID;
public abstract class AbstractPlayerAuthor implements Author {
private final @NotNull Player player;
private @NotNull String lastKnownDisplayName;
private final @NotNull HashMap<ChatChannel, String> sanitizedNameCache;
public AbstractPlayerAuthor(@NotNull Player player) {
this.player = player;
this.lastKnownDisplayName = player.getDisplayName();
this.sanitizedNameCache = new HashMap<>();
}
/**
* Returns true if a players display name has changed
*
* @return true if the players display name has changed
*/
private boolean hasPlayerDisplayNameChanged() {
return !player.getDisplayName().equals(lastKnownDisplayName);
}
/**
* Player display names can change and this method will update the last known display name of this player
*/
private void updateLastKnownDisplayName() {
lastKnownDisplayName = player.getDisplayName();
}
/**
* Gets a sanitized name for a channel
* Sanitized names are names that are friendly to the {@link net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer}
* Sanitized names for authors are cached by channel and are only created as needed
* Sanitized names will update if a players display name has updated
*
* @param chatChannel target chat channel
* @return the sanitized name for a player
*/
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
//Already in cache
if(sanitizedNameCache.containsKey(chatChannel)) {
//Update cache
if(useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName();
updateSanitizedNameCache(chatChannel, true);
}
} else {
//Update last known display name
if(useDisplayName && hasPlayerDisplayNameChanged()) {
updateLastKnownDisplayName();
}
//Add cache entry
updateSanitizedNameCache(chatChannel, useDisplayName);
}
return sanitizedNameCache.get(chatChannel);
}
/**
* Update the sanitized name cache
* This will add entries if one didn't exit
* Sanitized names are associated with a {@link ChatChannel} as different chat channels have different chat name settings
*
* @param chatChannel target chat channel
* @param useDisplayName whether to use this authors display name
*/
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
if(useDisplayName) {
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
} else {
//No need to sanitize a basic String
sanitizedNameCache.put(chatChannel, player.getName());
}
}
@Override
public boolean isConsole() {
return false;
}
@Override
public boolean isPlayer() {
return true;
}
public @NotNull Player getPlayer() {
return player;
}
@Override
public @NonNull UUID uuid() {
return player.getUniqueId();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractPlayerAuthor that = (AbstractPlayerAuthor) o;
return Objects.equal(player, that.player) &&
Objects.equal(lastKnownDisplayName, that.lastKnownDisplayName) &&
Objects.equal(sanitizedNameCache, that.sanitizedNameCache);
}
@Override
public int hashCode() {
return Objects.hashCode(player, lastKnownDisplayName, sanitizedNameCache);
}
}

View File

@@ -0,0 +1,31 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import net.kyori.adventure.identity.Identity;
import org.jetbrains.annotations.NotNull;
public interface Author extends Identity {
/**
* The name of this author as used in mcMMO chat
* This is the {@link String} representation of the users current chat username
* This can either be the player's display name or the player's official registered nickname with Mojang it depends on the servers chat settings for mcMMO
*
* @param chatChannel which chat channel this is going to
* @return The name of this author as used in mcMMO chat
*/
@NotNull String getAuthoredName(@NotNull ChatChannel chatChannel);
/**
* Whether this author is a {@link org.bukkit.command.ConsoleCommandSender}
*
* @return true if this author is the console
*/
boolean isConsole();
/**
* Whether this author is a {@link org.bukkit.entity.Player}
* @return true if this author is a player
*/
boolean isPlayer();
}

View File

@@ -0,0 +1,39 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.util.text.TextUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class ConsoleAuthor implements Author {
private final UUID uuid;
private final @NotNull String name;
public ConsoleAuthor(@NotNull String name) {
this.uuid = new UUID(0, 0);
this.name = TextUtils.sanitizeForSerializer(name);
}
//TODO: Think of a less clunky solution later
@Override
public @NotNull String getAuthoredName(@NotNull ChatChannel chatChannel) {
return name;
}
@Override
public boolean isConsole() {
return true;
}
@Override
public boolean isPlayer() {
return false;
}
@Override
public @NonNull UUID uuid() {
return uuid;
}
}

View File

@@ -0,0 +1,19 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PlayerAuthor extends AbstractPlayerAuthor {
public PlayerAuthor(@NotNull Player player) {
super(player);
}
@Override
public @NotNull String getAuthoredName(@NotNull ChatChannel chatChannel) {
return getSanitizedName(chatChannel, ChatConfig.getInstance().useDisplayNames(chatChannel));
}
}

View File

@@ -0,0 +1,13 @@
package com.gmail.nossr50.chat.mailer;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractChatMailer implements ChatMailer {
protected final @NotNull Plugin pluginRef;
public AbstractChatMailer(@NotNull Plugin pluginRef) {
this.pluginRef = pluginRef;
}
}

View File

@@ -0,0 +1,91 @@
package com.gmail.nossr50.chat.mailer;
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.message.AdminChatMessage;
import com.gmail.nossr50.chat.message.ChatMessage;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
import com.gmail.nossr50.events.chat.McMMOChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.TextUtils;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.function.Predicate;
public class AdminChatMailer extends AbstractChatMailer {
public AdminChatMailer(Plugin pluginRef) {
super(pluginRef);
}
public static final @NotNull String MCMMO_CHAT_ADMINCHAT_PERMISSION = "mcmmo.chat.adminchat";
/**
* Constructs an audience of admins
*
* @return an audience of admins
*/
public @NotNull Audience constructAudience() {
return mcMMO.getAudiences().filter(predicate());
}
/**
* Predicate used to filter the audience
*
* @return admin chat audience predicate
*/
public @NotNull Predicate<CommandSender> predicate() {
return (commandSender) -> commandSender.isOp()
|| commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION)
|| commandSender instanceof ConsoleCommandSender;
}
/**
* Styles a string using a locale entry
*
* @param author message author
* @param message message contents
* @param canColor whether to replace colors codes with colors in the raw message
* @return the styled string, based on a locale entry
*/
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
if(canColor) {
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
} else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
}
}
@Override
public void sendMail(@NotNull ChatMessage chatMessage) {
chatMessage.sendMessage();
}
/**
* Processes a chat message from an author to an audience of admins
*
* @param author the author
* @param rawString the raw message as the author typed it before any styling
* @param isAsync whether this is being processed asynchronously
* @param canColor whether the author can use colors in chat
*/
public void processChatMessage(@NotNull Author author, @NotNull String rawString, boolean isAsync, boolean canColor) {
AdminChatMessage chatMessage = new AdminChatMessage(pluginRef, author, constructAudience(), rawString, addStyle(author, rawString, canColor));
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) {
sendMail(chatMessage);
}
}
}

View File

@@ -0,0 +1,12 @@
package com.gmail.nossr50.chat.mailer;
import com.gmail.nossr50.chat.message.ChatMessage;
import org.jetbrains.annotations.NotNull;
public interface ChatMailer {
/**
* Send out a chat message
* @param chatMessage the {@link ChatMessage}
*/
void sendMail(@NotNull ChatMessage chatMessage);
}

View File

@@ -0,0 +1,82 @@
package com.gmail.nossr50.chat.mailer;
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.message.ChatMessage;
import com.gmail.nossr50.chat.message.PartyChatMessage;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.chat.McMMOChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.TextUtils;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public class PartyChatMailer extends AbstractChatMailer {
public PartyChatMailer(@NotNull Plugin pluginRef) {
super(pluginRef);
}
/**
* Processes a chat message from an author to an audience of party members
*
* @param author the author
* @param rawString the raw message as the author typed it before any styling
* @param isAsync whether this is being processed asynchronously
* @param canColor whether the author can use colors in chat
*/
public void processChatMessage(@NotNull Author author, @NotNull String rawString, @NotNull Party party, boolean isAsync, boolean canColor, boolean isLeader) {
PartyChatMessage chatMessage = new PartyChatMessage(pluginRef, author, constructPartyAudience(party), rawString, addStyle(author, rawString, canColor, isLeader), party);
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
Bukkit.getPluginManager().callEvent(chatEvent);
if(!chatEvent.isCancelled()) {
sendMail(chatMessage);
}
}
/**
* Constructs an {@link Audience} of party members
*
* @param party target party
* @return an {@link Audience} of party members
*/
public @NotNull Audience constructPartyAudience(@NotNull Party party) {
return mcMMO.getAudiences().filter(party.getSamePartyPredicate());
}
/**
* Styles a string using a locale entry
*
* @param author message author
* @param message message contents
* @param canColor whether to replace colors codes with colors in the raw message
* @return the styled string, based on a locale entry
*/
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
if(canColor) {
if(isLeader) {
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
} else {
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
}
} else {
if(isLeader) {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
} else {
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));
}
}
}
@Override
public void sendMail(@NotNull ChatMessage chatMessage) {
chatMessage.sendMessage();
}
}

View File

@@ -0,0 +1,72 @@
package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author;
import com.google.common.base.Objects;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public abstract class AbstractChatMessage implements ChatMessage {
protected final @NotNull Plugin pluginRef;
protected final @NotNull Author author;
protected final @NotNull String rawMessage;
protected @NotNull TextComponent componentMessage;
protected @NotNull Audience audience;
public AbstractChatMessage(@NotNull Plugin pluginRef, @NotNull Author author, @NotNull Audience audience, @NotNull String rawMessage, @NotNull TextComponent componentMessage) {
this.pluginRef = pluginRef;
this.author = author;
this.audience = audience;
this.rawMessage = rawMessage;
this.componentMessage = componentMessage;
}
@Override
public @NotNull String rawMessage() {
return rawMessage;
}
@Override
public @NotNull Author getAuthor() {
return author;
}
@Override
public @NotNull Audience getAudience() {
return audience;
}
@Override
public @NotNull TextComponent getChatMessage() {
return componentMessage;
}
@Override
public void setChatMessage(@NotNull TextComponent textComponent) {
this.componentMessage = textComponent;
}
@Override
public void setAudience(@NotNull Audience newAudience) {
audience = newAudience;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractChatMessage that = (AbstractChatMessage) o;
return Objects.equal(pluginRef, that.pluginRef) &&
Objects.equal(author, that.author) &&
Objects.equal(rawMessage, that.rawMessage) &&
Objects.equal(componentMessage, that.componentMessage) &&
Objects.equal(audience, that.audience);
}
@Override
public int hashCode() {
return Objects.hashCode(pluginRef, author, rawMessage, componentMessage, audience);
}
}

View File

@@ -0,0 +1,24 @@
package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public class AdminChatMessage extends AbstractChatMessage {
public AdminChatMessage(@NotNull Plugin pluginRef, @NotNull Author author, @NotNull Audience audience, @NotNull String rawMessage, @NotNull TextComponent componentMessage) {
super(pluginRef, author, audience, rawMessage, componentMessage);
}
@Override
public void sendMessage() {
audience.sendMessage(author, componentMessage);
}
@Override
public @NotNull String getAuthorDisplayName() {
return author.getAuthoredName(ChatChannel.ADMIN);
}
}

View File

@@ -0,0 +1,73 @@
package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.jetbrains.annotations.NotNull;
public interface ChatMessage {
/**
* The original message from the {@link Author}
* This is formatted and styled before being sent out to players by mcMMO
*
* @return the original message without any formatting or alterations
* @see #getChatMessage()
*/
@NotNull String rawMessage();
/**
* The {@link Author} from which this payload originated
*
* @see #getChatMessage()
* @return the source of the chat message
*/
@NotNull Author getAuthor();
/**
* The authors display name which is used in the initial creation of the message payload, it is provided for convenience.
*
* This is a name generated by mcMMO during the creation of the {@link ChatMessage}
*
* This is used by mcMMO when generating the message payload
*
* This method provides the display name for the convenience of plugins constructing their own {@link TextComponent payloads}
*
* @see #getChatMessage()
* @return the author display name as generated by mcMMO
*/
@NotNull String getAuthorDisplayName();
/**
* The target audience of this chat message
* Unless modified, this will include the {@link Author}
*
* @return target audience
*/
@NotNull Audience getAudience();
/**
* The {@link TextComponent message} being sent to the audience
*
* @return the {@link TextComponent message} that will be sent to the audience
*/
@NotNull TextComponent getChatMessage();
/**
* Change the value of the {@link TextComponent message}
*
* @param textComponent new message value
*/
void setChatMessage(@NotNull TextComponent textComponent);
/**
* Changes the audience
*
* @param newAudience the replacement audience
*/
void setAudience(@NotNull Audience newAudience);
/**
* Deliver the message to the audience
*/
void sendMessage();
}

View File

@@ -0,0 +1,94 @@
package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.base.Objects;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public class PartyChatMessage extends AbstractChatMessage {
private final @NotNull Party party;
public PartyChatMessage(@NotNull Plugin pluginRef, @NotNull Author author, @NotNull Audience audience, @NotNull String rawMessage, @NotNull TextComponent componentMessage, @NotNull Party party) {
super(pluginRef, author, audience, rawMessage, componentMessage);
this.party = party;
}
/**
* The party that this chat message was intended for
* @return the party that this message was intended for
*/
public @NotNull Party getParty() {
return party;
}
@Override
public @NotNull String getAuthorDisplayName() {
return author.getAuthoredName(ChatChannel.PARTY);
}
@Override
public void sendMessage() {
/*
* It should be noted that Party messages don't include console as part of the audience to avoid double messaging
* The console gets a message that has the party name included, player parties do not
*/
//Sends to everyone but console
audience.sendMessage(author, componentMessage);
TextComponent spyMessage = LocaleLoader.getTextComponent("Chat.Spy.Party", author.getAuthoredName(ChatChannel.PARTY), rawMessage, party.getName());
//Relay to spies
messagePartyChatSpies(spyMessage);
//Console message
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
}
/**
* Console and Party Chat Spies get a more verbose version of the message
* Party Chat Spies will get a copy of the message as well
* @param spyMessage the message to copy to spies
*/
private void messagePartyChatSpies(@NotNull TextComponent spyMessage) {
//Find the people with permissions
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
Player player = mcMMOPlayer.getPlayer();
//Check for toggled players
if(mcMMOPlayer.isPartyChatSpying()) {
Party adminParty = mcMMOPlayer.getParty();
//Only message admins not part of this party
if(adminParty == null || adminParty != getParty()) {
//TODO: Hacky, rewrite later
Audience audience = mcMMO.getAudiences().player(player);
audience.sendMessage(spyMessage);
}
}
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PartyChatMessage that = (PartyChatMessage) o;
return Objects.equal(party, that.party);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), party);
}
}

View File

@@ -0,0 +1,116 @@
package com.gmail.nossr50.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.BukkitCommandManager;
import co.aikar.commands.ConditionFailedException;
import com.gmail.nossr50.commands.chat.AdminChatCommand;
import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import org.jetbrains.annotations.NotNull;
/*
* For now this class will only handle ACF converted commands, all other commands will be handled elsewhere
*/
public class CommandManager {
public static final @NotNull String ADMIN_CONDITION = "adminCondition";
public static final @NotNull String PARTY_CONDITION = "partyCondition";
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
private final @NotNull mcMMO pluginRef;
private final @NotNull BukkitCommandManager bukkitCommandManager;
public CommandManager(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
bukkitCommandManager = new BukkitCommandManager(pluginRef);
registerConditions();
registerCommands();
}
private void registerCommands() {
registerChatCommands();
}
/**
* Registers chat commands if the chat system is enabled
*/
private void registerChatCommands() {
if(ChatConfig.getInstance().isChatEnabled()) {
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
}
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
}
}
}
public void registerConditions() {
// Method or Class based - Can only be used on methods
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
if(issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer());
validateAdmin(issuer.getPlayer());
}
});
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer());
}
});
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer());
validatePlayerParty(bukkitCommandIssuer.getPlayer());
validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer());
}
});
}
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
if(!permissible.hasPermission(permissionNode)) {
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
}
}
public void validateAdmin(@NotNull Player player) {
if(!player.isOp() && !Permissions.adminChat(player)) {
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
}
}
public void validateLoadedData(@NotNull Player player) {
if(UserManager.getPlayer(player) == null) {
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
}
}
public void validatePlayerParty(@NotNull Player player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer.getParty() == null) {
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
}
}
public @NotNull BukkitCommandManager getBukkitCommandManager() {
return bukkitCommandManager;
}
}

View File

@@ -1,45 +0,0 @@
package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.FlatfileDatabaseManager;
import com.gmail.nossr50.database.SQLDatabaseManager;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import java.util.List;
public class MHDCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
m.resetMobHealthSettings();
for (McMMOPlayer player : UserManager.getPlayers()) {
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
}
sender.sendMessage("Mob health reset");
return true;
}
if (mcMMO.getDatabaseManager() instanceof FlatfileDatabaseManager) {
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
m.resetMobHealthSettings();
for (McMMOPlayer player : UserManager.getPlayers()) {
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
}
sender.sendMessage("Mob health reset");
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -7,6 +7,7 @@ import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.util.ArrayList;
@@ -17,15 +18,12 @@ public class McImportCommand implements CommandExecutor {
int fileAmount;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
importModConfig();
return true;
default:
return false;
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
importModConfig();
return true;
}
return false;
}
public boolean importModConfig() {
@@ -34,7 +32,7 @@ public class McImportCommand implements CommandExecutor {
mcMMO.p.getLogger().info("Starting import of mod materials...");
fileAmount = 0;
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<ModConfigType, ArrayList<String>>();
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<>();
BufferedReader in = null;
@@ -66,11 +64,10 @@ public class McImportCommand implements CommandExecutor {
ModConfigType type = ModConfigType.getModConfigType(materialName);
if (!materialNames.containsKey(type)) {
materialNames.put(type, new ArrayList<String>());
materialNames.put(type, new ArrayList<>());
}
materialNames.get(type).add(materialName);
continue;
}
}
catch (FileNotFoundException e) {
@@ -94,13 +91,13 @@ public class McImportCommand implements CommandExecutor {
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
for (ModConfigType modConfigType : materialNames.keySet()) {
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<>();
for (String materialName : materialNames.get(modConfigType)) {
String modName = Misc.getModName(materialName);
if (!materialNamesType.containsKey(modName)) {
materialNamesType.put(modName, new ArrayList<String>());
materialNamesType.put(modName, new ArrayList<>());
}
materialNamesType.get(modName).add(materialName);
@@ -170,16 +167,10 @@ public class McImportCommand implements CommandExecutor {
out = new FileWriter(outputFile);
out.write(writer.toString());
}
catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
return;
}
catch (Exception e) {
e.printStackTrace();
return;
}
finally {
} finally {
tryClose(out);
fileAmount++;
}
@@ -202,7 +193,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a skill
for (String materialName : materialNames.get(modName)) {
@@ -213,7 +204,7 @@ public class McImportCommand implements CommandExecutor {
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
skillName = "Woodcutting";
}
else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
else if (materialName.contains("GRASS") || materialName.contains("SHORT_GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
skillName = "Herbalism";
}
else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
@@ -221,7 +212,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(skillName)) {
configSections.put(skillName, new ArrayList<String>());
configSections.put(skillName, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(skillName);
@@ -241,7 +232,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a tool type
for (String materialName : materialNames.get(modName)) {
@@ -266,7 +257,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<String>());
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
@@ -281,7 +272,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under an armor type
for (String materialName : materialNames.get(modName)) {
@@ -300,7 +291,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<String>());
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
@@ -326,14 +317,14 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and print them
for (String materialName : materialNames.get(modName)) {
String configKey = "UNIDENTIFIED";
if (!configSections.containsKey(configKey)) {
configSections.put(configKey, new ArrayList<String>());
configSections.put(configKey, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(configKey);

View File

@@ -12,6 +12,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
@@ -22,12 +23,12 @@ public class McconvertCommand implements TabExecutor {
private static final List<String> DATABASE_TYPES;
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
private final CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
private final CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
static {
ArrayList<String> formulaTypes = new ArrayList<String>();
ArrayList<String> databaseTypes = new ArrayList<String>();
ArrayList<String> formulaTypes = new ArrayList<>();
ArrayList<String> databaseTypes = new ArrayList<>();
for (FormulaType type : FormulaType.values()) {
formulaTypes.add(type.toString());
@@ -53,34 +54,31 @@ public class McconvertCommand implements TabExecutor {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return databaseConvertCommand.onCommand(sender, command, label, args);
}
else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
return experienceConvertCommand.onCommand(sender, command, label, args);
}
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return databaseConvertCommand.onCommand(sender, command, label, args);
} else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
return experienceConvertCommand.onCommand(sender, command, label, args);
}
return false;
default:
return false;
return false;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<String>(SUBCOMMANDS.size()));
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size()));
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<String>(DATABASE_TYPES.size()));
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<>(DATABASE_TYPES.size()));
}
if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[0].equalsIgnoreCase("exp")) {
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<String>(FORMULA_TYPES.size()));
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<>(FORMULA_TYPES.size()));
}
return ImmutableList.of();

View File

@@ -1,7 +1,6 @@
package com.gmail.nossr50.commands;
import com.gmail.nossr50.commands.party.PartySubcommandType;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
@@ -9,10 +8,11 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (!Permissions.mcmmoDescription(sender)) {
@@ -25,7 +25,7 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(mcSplit);
sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs"));
if (Config.getInstance().getDonateMessageEnabled()) {
if (mcMMO.p.getGeneralConfig().getDonateMessageEnabled()) {
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
}
@@ -34,7 +34,7 @@ public class McmmoCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
}
mcMMO.getHolidayManager().anniversaryCheck(sender);
// mcMMO.getHolidayManager().anniversaryCheck(sender);
return true;
case 1:

View File

@@ -9,35 +9,35 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McnotifyCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
switch (args.length) {
case 0:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
if (args.length == 0) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
//Not Loaded yet
if(mcMMOPlayer == null)
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications();
//Not Loaded yet
if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
return false;
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications();
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -1,7 +1,7 @@
package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList;
@@ -9,6 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -17,11 +18,21 @@ public class McscoreboardCommand implements TabExecutor {
private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if(!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
return true;
}
if(!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
return true;
}
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("reset")) {
@@ -31,7 +42,7 @@ public class McscoreboardCommand implements TabExecutor {
}
if (args[0].equalsIgnoreCase("keep")) {
if (!Config.getInstance().getAllowKeepBoard() || !Config.getInstance().getScoreboardsEnabled()) {
if (!mcMMO.p.getGeneralConfig().getAllowKeepBoard() || !mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true;
}
@@ -69,13 +80,11 @@ public class McscoreboardCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<String>(FIRST_ARGS.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<>(FIRST_ARGS.size()));
}
return ImmutableList.of();
}
private boolean help(CommandSender sender) {

View File

@@ -8,13 +8,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public abstract class ToggleCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
@@ -60,14 +61,12 @@ public abstract class ToggleCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return ImmutableList.of();
}
protected abstract boolean hasOtherPermission(CommandSender sender);

View File

@@ -1,21 +1,20 @@
package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +23,7 @@ public class XprateCommand implements TabExecutor {
private final double ORIGINAL_XP_RATE = ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
@@ -38,7 +37,7 @@ public class XprateCommand implements TabExecutor {
if (mcMMO.p.isXPEventEnabled()) {
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Stop"),
@@ -46,7 +45,7 @@ public class XprateCommand implements TabExecutor {
10, 10*20, 20);
}
if(Config.getInstance().broadcastEventMessages())
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
{
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
@@ -91,7 +90,7 @@ public class XprateCommand implements TabExecutor {
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
{
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
LocaleLoader.getString("Commands.Event.Start"),
@@ -99,7 +98,7 @@ public class XprateCommand implements TabExecutor {
10, 10*20, 20);
}
if(Config.getInstance().broadcastEventMessages())
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
{
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
@@ -116,16 +115,16 @@ public class XprateCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
if (StringUtils.isInt(args[0])) {
return ImmutableList.of();
}
return StringUtil.copyPartialMatches(args[0], CommandUtils.RESET_OPTIONS, new ArrayList<String>(CommandUtils.RESET_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[0], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
default:
return ImmutableList.of();
}

View File

@@ -0,0 +1,28 @@
package com.gmail.nossr50.commands.admin;
import com.gmail.nossr50.mcMMO;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class CompatibilityCommand implements CommandExecutor {
/**
* Executes the given command, returning its success.
* <br>
* If false is returned, then the "usage" plugin.yml entry for this command
* (if defined) will be sent to the player.
*
* @param commandSender Source of the command
* @param command Command which was executed
* @param s Alias of the command which was used
* @param strings Passed command arguments
* @return true if a valid command, otherwise false
*/
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
mcMMO.getCompatibilityManager().reportCompatibilityStatus(commandSender);
return true;
}
}

View File

@@ -0,0 +1,57 @@
//package com.gmail.nossr50.commands.admin;
//
//import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
//import com.gmail.nossr50.datatypes.player.McMMOPlayer;
//import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
//import com.gmail.nossr50.datatypes.treasure.Rarity;
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.skills.fishing.FishingManager;
//import com.gmail.nossr50.util.player.UserManager;
//import org.bukkit.Location;
//import org.bukkit.command.Command;
//import org.bukkit.command.CommandExecutor;
//import org.bukkit.command.CommandSender;
//import org.bukkit.entity.Player;
//import org.jetbrains.annotations.NotNull;
//
//public class DropTreasureCommand implements CommandExecutor {
// @Override
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
// if(sender instanceof Player) {
// if(!sender.isOp()) {
// sender.sendMessage("This command is for Operators only");
// return false;
// }
//
// Player player = (Player) sender;
// Location location = player.getLocation();
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
//
// if(mmoPlayer == null) {
// //TODO: Localize
// player.sendMessage("Your player data is not loaded yet");
// return false;
// }
//
// if(args.length == 0) {
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {
// FishingManager fishingManager = mmoPlayer.getFishingManager();
// }
// }
// //TODO: impl
// } else {
// String targetTreasure = args[1];
//
// //Drop all treasures matching the name
// //TODO: impl
// }
//
// return true;
// } else {
// sender.sendMessage("No console support for this command");
// return false;
// }
// }
//}

View File

@@ -5,26 +5,25 @@ import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
/**
* @author Mark Vainomaa
*/
public final class McmmoReloadLocaleCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (!Permissions.reloadlocale(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
LocaleLoader.reloadLocale();
sender.sendMessage(LocaleLoader.getString("Locale.Reloaded"));
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
if (!Permissions.reloadlocale(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
default:
return false;
}
LocaleLoader.reloadLocale();
sender.sendMessage(LocaleLoader.getString("Locale.Reloaded"));
return true;
}
return false;
}
}

View File

@@ -7,11 +7,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PlayerDebugCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode

View File

@@ -1,15 +1,52 @@
package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import org.bukkit.command.CommandSender;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager;
import org.jetbrains.annotations.NotNull;
public class AdminChatCommand extends ChatCommand {
public AdminChatCommand() {
super(ChatMode.ADMIN);
@CommandPermission("mcmmo.chat.adminchat")
@CommandAlias("ac|a|adminchat|achat") //Kept for historical reasons
public class AdminChatCommand extends BaseCommand {
private final @NotNull mcMMO pluginRef;
public AdminChatCommand(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
chatManager.handleChat(sender.getName(), getDisplayName(sender), buildChatMessage(args, 0));
@Default @Conditions(CommandManager.ADMIN_CONDITION)
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if(args == null || args.length == 0) {
//Process with no arguments
if(bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
} else {
//Not support for console
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
}
} else {
if(bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
if(mmoPlayer == null)
return;
//Message contains the original command so it needs to be passed to this method to trim it
pluginRef.getChatManager().processPlayerMessage(mmoPlayer, args, ChatChannel.ADMIN);
} else {
pluginRef.getChatManager().processConsoleMessage(args);
}
//Arguments are greater than 0, therefore directly send message and skip toggles
}
}
}

View File

@@ -1,142 +0,0 @@
package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.chat.ChatManagerFactory;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import java.util.ArrayList;
import java.util.List;
public abstract class ChatCommand implements TabExecutor {
private ChatMode chatMode;
protected ChatManager chatManager;
public ChatCommand(ChatMode chatMode) {
this.chatMode = chatMode;
this.chatManager = ChatManagerFactory.getChatManager(mcMMO.p, chatMode);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
McMMOPlayer mcMMOPlayer;
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!CommandUtils.hasPlayerDataKey(sender)) {
return true;
}
mcMMOPlayer = UserManager.getPlayer(sender.getName());
if (mcMMOPlayer.isChatEnabled(chatMode)) {
disableChatMode(mcMMOPlayer, sender);
}
else {
enableChatMode(mcMMOPlayer, sender);
}
return true;
case 1:
if (CommandUtils.shouldEnableToggle(args[0])) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!CommandUtils.hasPlayerDataKey(sender)) {
return true;
}
enableChatMode(UserManager.getPlayer(sender.getName()), sender);
return true;
}
if (CommandUtils.shouldDisableToggle(args[0])) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!CommandUtils.hasPlayerDataKey(sender)) {
return true;
}
disableChatMode(UserManager.getPlayer(sender.getName()), sender);
return true;
}
// Fallthrough
default:
handleChatSending(sender, args);
return true;
}
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
default:
return ImmutableList.of();
}
}
protected String buildChatMessage(String[] args, int index) {
StringBuilder builder = new StringBuilder();
builder.append(args[index]);
for (int i = index + 1; i < args.length; i++) {
builder.append(" ");
builder.append(args[i]);
}
return builder.toString();
}
protected String getDisplayName(CommandSender sender) {
return (sender instanceof Player) ? ((Player) sender).getDisplayName() : LocaleLoader.getString("Commands.Chat.Console");
}
protected abstract void handleChatSending(CommandSender sender, String[] args);
private void enableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
return;
}
mcMMOPlayer.enableChat(chatMode);
sender.sendMessage(chatMode.getEnabledMessage());
}
private void disableChatMode(McMMOPlayer mcMMOPlayer, CommandSender sender) {
if (chatMode == ChatMode.PARTY && mcMMOPlayer.getParty() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
mcMMOPlayer.disableChat(chatMode);
sender.sendMessage(chatMode.getDisabledMessage());
}
}

View File

@@ -1,62 +1,90 @@
package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.chat.PartyChatManager;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatMode;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyChatCommand extends ChatCommand {
public PartyChatCommand() {
super(ChatMode.PARTY);
@CommandPermission("mcmmo.chat.partychat")
@CommandAlias("pc|p|partychat|pchat") //Kept for historical reasons
public class PartyChatCommand extends BaseCommand {
private final @NotNull mcMMO pluginRef;
public PartyChatCommand(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
Party party;
String message;
@Default
@Conditions(CommandManager.PARTY_CONDITION)
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
if (sender instanceof Player) {
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
return;
party = UserManager.getPlayer((Player) sender).getParty();
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
if(args == null || args.length == 0) {
//Process with no arguments
if(bukkitCommandIssuer.isPlayer()) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
} else {
//Not support for console
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
}
} else {
//Here we split the logic, consoles need to target a party name and players do not
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
return;
/*
* Player Logic
*/
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
processCommandArgsPlayer(mmoPlayer, args);
/*
* Console Logic
*/
} else {
processCommandArgsConsole(args);
}
message = buildChatMessage(args, 0);
}
else {
if (args.length < 2) {
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
return;
}
/**
* Processes the command with arguments for a {@link McMMOPlayer}
* @param mmoPlayer target player
* @param args command arguments
*/
private void processCommandArgsPlayer(@NotNull McMMOPlayer mmoPlayer, @NotNull String[] args) {
//Player is not toggling and is chatting directly to party
pluginRef.getChatManager().processPlayerMessage(mmoPlayer, args, ChatChannel.PARTY);
}
/**
* Processes the command with arguments for a {@link com.gmail.nossr50.chat.author.ConsoleAuthor}
* @param args command arguments
*/
private void processCommandArgsConsole(@NotNull String[] args) {
if(args.length <= 1) {
//Only specific a party and not the message
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
} else {
//Grab party
Party targetParty = PartyManager.getParty(args[0]);
if(targetParty != null) {
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
} else {
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");
}
party = PartyManager.getParty(args[0]);
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return;
}
message = buildChatMessage(args, 1);
}
((PartyChatManager) chatManager).setParty(party);
chatManager.handleChat(sender.getName(), getDisplayName(sender), message);
}
}

View File

@@ -13,62 +13,63 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class ConvertDatabaseCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType();
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType();
if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString()));
return true;
}
if (previousType == newType || (newType == DatabaseType.CUSTOM && DatabaseManagerFactory.getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Same", newType.toString()));
return true;
}
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType);
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
if(oldDatabase == null) {
sender.sendMessage("Unable to load the old database! Check your log for errors.");
return true;
}
if (previousType == DatabaseType.CUSTOM) {
Class<?> clazz;
if (previousType == DatabaseType.CUSTOM) {
Class<?> clazz;
try {
clazz = Class.forName(args[1]);
try {
clazz = Class.forName(args[1]);
if (!DatabaseManager.class.isAssignableFrom(clazz)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
}
catch (Throwable e) {
e.printStackTrace();
if (!DatabaseManager.class.isAssignableFrom(clazz)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
} catch (Throwable e) {
e.printStackTrace();
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
return true;
}
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
UserManager.saveAll();
UserManager.clearAll();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
PlayerProfile profile = oldDatabase.loadPlayerProfile(player);
if (profile.isLoaded()) {
mcMMO.getDatabaseManager().saveUser(profile);
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.Start", previousType.toString(), newType.toString()));
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
UserManager.saveAll();
UserManager.clearAll();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId());
if (profile.isLoaded()) {
mcMMO.getDatabaseManager().saveUser(profile);
}
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
return true;
default:
return false;
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
return true;
}
return false;
}
}

View File

@@ -1,36 +1,33 @@
package com.gmail.nossr50.commands.database;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McpurgeCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
mcMMO.getDatabaseManager().purgePowerlessUsers();
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
mcMMO.getDatabaseManager().purgePowerlessUsers();
if (Config.getInstance().getOldUsersCutoff() != -1) {
mcMMO.getDatabaseManager().purgeOldUsers();
}
if (mcMMO.p.getGeneralConfig().getOldUsersCutoff() != -1) {
mcMMO.getDatabaseManager().purgeOldUsers();
}
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success"));
return true;
default:
return false;
sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success"));
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -17,43 +18,37 @@ import java.util.UUID;
public class McremoveCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false))) {
return true;
}
UUID uuid = null;
if(Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
}
else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
if (UserManager.getOfflinePlayer(playerName) == null && CommandUtils.unloadedProfile(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName))) {
return true;
}
default:
return false;
UUID uuid = null;
if (Bukkit.getPlayer(playerName) != null) {
uuid = Bukkit.getPlayer(playerName).getUniqueId();
}
if (mcMMO.getDatabaseManager().removeUser(playerName, uuid)) {
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
} else {
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
}
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return ImmutableList.of();
}
}

View File

@@ -1,37 +1,35 @@
package com.gmail.nossr50.commands.database;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MmoshowdbCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
if (clazz != null) {
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", clazz.getName()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (Config.getInstance().getUseMySQL() ? "sql" : "flatfile")));
if (clazz != null) {
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", clazz.getName()));
return true;
}
default:
return false;
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (mcMMO.p.getGeneralConfig().getUseMySQL() ? "sql" : "flatfile")));
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -1,11 +1,14 @@
package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -30,16 +33,29 @@ public class AddlevelsCommand extends ExperienceCommand {
return;
}
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null) {
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
} else {
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
}
}
@Override
protected void handlePlayerMessageAll(Player player, int value) {
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
}
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
}

View File

@@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender;
@@ -37,12 +38,18 @@ public class AddxpCommand extends ExperienceCommand {
}
@Override
protected void handlePlayerMessageAll(Player player, int value) {
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
}
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
}

View File

@@ -10,42 +10,40 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
public class ConvertExperienceCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
FormulaType previousType = mcMMO.getFormulaManager().getPreviousFormulaType();
FormulaType newType = FormulaType.getFormulaType(args[1].toUpperCase(Locale.ENGLISH));
if (newType == FormulaType.UNKNOWN) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Invalid"));
return true;
}
if (previousType == newType) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Same", newType.toString()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Start", previousType.toString(), newType.toString()));
UserManager.saveAll();
UserManager.clearAll();
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
FormulaType previousType = mcMMO.getFormulaManager().getPreviousFormulaType();
FormulaType newType = FormulaType.getFormulaType(args[1].toUpperCase(Locale.ENGLISH));
if (newType == FormulaType.UNKNOWN) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Invalid"));
return true;
}
default:
return false;
if (previousType == newType) {
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Same", newType.toString()));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Experience.Start", previousType.toString(), newType.toString()));
UserManager.saveAll();
UserManager.clearAll();
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
return true;
}
return false;
}
}

View File

@@ -7,31 +7,35 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillTools;
import com.google.common.collect.ImmutableList;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public abstract class ExperienceCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill;
switch (args.length) {
case 2:
if(args.length < 2) {
return false;
} else {
if(args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
if (!permissionsCheckSelf(sender)) {
sender.sendMessage(command.getPermissionMessage());
if(command.getPermissionMessage() != null)
sender.sendMessage(command.getPermissionMessage());
sender.sendMessage("(mcMMO) No permission!");
return true;
}
@@ -39,13 +43,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
skill = PrimarySkillType.getSkill(args[0]);
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
if (skill != null && skill.isChildSkill())
if (skill != null && SkillTools.isChildSkill(skill))
{
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
@@ -59,10 +63,10 @@ public abstract class ExperienceCommand implements TabExecutor {
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
return true;
case 3:
} else if((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) {
if (!permissionsCheckOthers(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
@@ -72,13 +76,13 @@ public abstract class ExperienceCommand implements TabExecutor {
return true;
}
skill = PrimarySkillType.getSkill(args[1]);
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
if (args[1].equalsIgnoreCase("all")) {
skill = null;
}
if (skill != null && skill.isChildSkill())
if (skill != null && SkillTools.isChildSkill(skill))
{
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
return true;
@@ -91,39 +95,52 @@ public abstract class ExperienceCommand implements TabExecutor {
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
UUID uuid = null;
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName);
if (player != null) {
uuid = player.getUniqueId();
}
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
PlayerProfile profile;
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
//Check loading by UUID
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
//Check loading by name
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
if(CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
}
editValues(null, profile, skill, value);
editValues(null, profile, skill, value, isSilent(args));
}
else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value, isSilent(args));
}
handleSenderMessage(sender, playerName, skill);
return true;
default:
} else {
return false;
}
}
}
private boolean isSilent(String[] args) {
int length = args.length;
if(length == 0)
return false;
return args[length-1].equalsIgnoreCase("-s");
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default:
return ImmutableList.of();
}
@@ -132,8 +149,8 @@ public abstract class ExperienceCommand implements TabExecutor {
protected abstract boolean permissionsCheckSelf(CommandSender sender);
protected abstract boolean permissionsCheckOthers(CommandSender sender);
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value);
protected abstract void handlePlayerMessageAll(Player player, int value);
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
protected abstract void handlePlayerMessageAll(Player player, int value, boolean isSilent);
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent);
private boolean validateArguments(CommandSender sender, String skillName, String value) {
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
@@ -144,25 +161,25 @@ public abstract class ExperienceCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
}
}
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value, boolean isSilent) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType, value);
}
if (player != null) {
handlePlayerMessageAll(player, value);
handlePlayerMessageAll(player, value, isSilent);
}
}
else {
handleCommand(player, profile, skill, value);
if (player != null) {
handlePlayerMessageSkill(player, value, skill);
handlePlayerMessageSkill(player, value, skill, isSilent);
}
}
}

View File

@@ -1,11 +1,14 @@
package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -36,16 +39,29 @@ public class MmoeditCommand extends ExperienceCommand {
return;
}
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer != null) {
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
} else {
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
}
}
@Override
protected void handlePlayerMessageAll(Player player, int value) {
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
}
@Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
if(isSilent)
return;
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));
}
}

View File

@@ -10,6 +10,7 @@ import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillTools;
import com.google.common.collect.ImmutableList;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
@@ -17,10 +18,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* This class mirrors the structure of ExperienceCommand, except the
@@ -28,7 +29,7 @@ import java.util.UUID;
*/
public class SkillresetCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill;
switch (args.length) {
case 1:
@@ -49,7 +50,7 @@ public class SkillresetCommand implements TabExecutor {
skill = null;
}
else {
skill = PrimarySkillType.getSkill(args[1]);
skill = mcMMO.p.getSkillTools().matchSkill(args[0]);
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
@@ -69,7 +70,7 @@ public class SkillresetCommand implements TabExecutor {
skill = null;
}
else {
skill = PrimarySkillType.getSkill(args[1]);
skill = mcMMO.p.getSkillTools().matchSkill(args[1]);
}
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
@@ -77,15 +78,18 @@ public class SkillresetCommand implements TabExecutor {
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
UUID uuid = null;
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName);
if (player != null) {
uuid = player.getUniqueId();
}
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
OfflinePlayer offlinePlayer = mcMMO.p.getServer().getOfflinePlayer(playerName);
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(offlinePlayer);
//Check loading by UUID
if (CommandUtils.unloadedProfile(sender, profile)) {
return true;
//Didn't find it by UUID so try to find it by name
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
//Check if it was present in DB
if(CommandUtils.unloadedProfile(sender, profile)) {
return true;
}
}
editValues(null, profile, skill);
@@ -103,13 +107,13 @@ public class SkillresetCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default:
return ImmutableList.of();
}
@@ -142,7 +146,7 @@ public class SkillresetCommand implements TabExecutor {
}
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
private boolean validateArguments(CommandSender sender, String skillName) {
@@ -154,13 +158,13 @@ public class SkillresetCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), playerName));
}
}
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType);
}

View File

@@ -1,64 +1,64 @@
package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender;
public class HardcoreCommand extends HardcoreModeCommand {
@Override
protected boolean checkTogglePermissions(CommandSender sender) {
return Permissions.hardcoreToggle(sender);
}
@Override
protected boolean checkModifyPermissions(CommandSender sender) {
return Permissions.hardcoreModify(sender);
}
@Override
protected boolean checkEnabled(PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreStatLossEnabled()) {
return false;
}
}
return true;
}
return skill.getHardcoreStatLossEnabled();
}
@Override
protected void enable(PrimarySkillType skill) {
toggle(true, skill);
}
@Override
protected void disable(PrimarySkillType skill) {
toggle(false, skill);
}
@Override
protected void modify(CommandSender sender, double newPercentage) {
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
}
private void toggle(boolean enable, PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreStatLossEnabled(enable);
}
}
else {
skill.setHardcoreStatLossEnabled(enable);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : skill.getName())));
}
}
//package com.gmail.nossr50.commands.hardcore;
//
//import com.gmail.nossr50.config.Config;
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//import com.gmail.nossr50.locale.LocaleLoader;
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.util.Permissions;
//import org.bukkit.command.CommandSender;
//
//public class HardcoreCommand extends HardcoreModeCommand {
// @Override
// protected boolean checkTogglePermissions(CommandSender sender) {
// return Permissions.hardcoreToggle(sender);
// }
//
// @Override
// protected boolean checkModifyPermissions(CommandSender sender) {
// return Permissions.hardcoreModify(sender);
// }
//
// @Override
// protected boolean checkEnabled(PrimarySkillType skill) {
// if (skill == null) {
// for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
// if (!primarySkillType.getHardcoreStatLossEnabled()) {
// return false;
// }
// }
//
// return true;
// }
//
// return skill.getHardcoreStatLossEnabled();
// }
//
// @Override
// protected void enable(PrimarySkillType skill) {
// toggle(true, skill);
// }
//
// @Override
// protected void disable(PrimarySkillType skill) {
// toggle(false, skill);
// }
//
// @Override
// protected void modify(CommandSender sender, double newPercentage) {
// Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
// sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
// }
//
// private void toggle(boolean enable, PrimarySkillType skill) {
// if (skill == null) {
// for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
// primarySkillType.setHardcoreStatLossEnabled(enable);
// }
// }
// else {
// skill.setHardcoreStatLossEnabled(enable);
// }
//
// mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.DeathStatLoss.Name"), (skill == null ? "all skills" : mcMMO.p.getSkillTools().getLocalizedSkillName(skill))));
// }
//}

View File

@@ -1,130 +1,129 @@
package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public abstract class HardcoreModeCommand implements TabExecutor {
protected final DecimalFormat percent = new DecimalFormat("##0.00%");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 0:
if (!checkTogglePermissions(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if (checkEnabled(null)) {
disable(null);
}
else {
enable(null);
}
return true;
case 1:
if (CommandUtils.shouldEnableToggle(args[0])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enable(null);
return true;
}
if (CommandUtils.shouldDisableToggle(args[0])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
disable(null);
return true;
}
if (CommandUtils.isInvalidDouble(sender, args[0])) {
return true;
}
if (!Permissions.hardcoreModify(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
modify(sender, Double.parseDouble(args[0]));
return true;
case 2:
if (CommandUtils.isInvalidSkill(sender, args[0])) {
return true;
}
PrimarySkillType skill = PrimarySkillType.getSkill(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) {
return true;
}
if (CommandUtils.shouldEnableToggle(args[1])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enable(skill);
return true;
}
if (CommandUtils.shouldDisableToggle(args[1])) {
if (!Permissions.hardcoreToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
enable(skill);
return true;
}
return true;
default:
return false;
}
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
if (StringUtils.isDouble(args[0])) {
return ImmutableList.of();
}
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
default:
return ImmutableList.of();
}
}
protected abstract boolean checkTogglePermissions(CommandSender sender);
protected abstract boolean checkModifyPermissions(CommandSender sender);
protected abstract boolean checkEnabled(PrimarySkillType skill);
protected abstract void enable(PrimarySkillType skill);
protected abstract void disable(PrimarySkillType skill);
protected abstract void modify(CommandSender sender, double newPercentage);
}
//package com.gmail.nossr50.commands.hardcore;
//
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//import com.gmail.nossr50.util.Permissions;
//import com.gmail.nossr50.util.commands.CommandUtils;
//import com.gmail.nossr50.util.text.StringUtils;
//import com.google.common.collect.ImmutableList;
//import org.bukkit.command.Command;
//import org.bukkit.command.CommandSender;
//import org.bukkit.command.TabExecutor;
//import org.bukkit.util.StringUtil;
//import org.jetbrains.annotations.NotNull;
//
//import java.text.DecimalFormat;
//import java.util.ArrayList;
//import java.util.List;
//
//public abstract class HardcoreModeCommand implements TabExecutor {
// protected final DecimalFormat percent = new DecimalFormat("##0.00%");
//
// @Override
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
// switch (args.length) {
// case 0:
// if (!checkTogglePermissions(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// if (checkEnabled(null)) {
// disable(null);
// }
// else {
// enable(null);
// }
//
// return true;
//
// case 1:
// if (CommandUtils.shouldEnableToggle(args[0])) {
// if (!Permissions.hardcoreToggle(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// enable(null);
// return true;
// }
//
// if (CommandUtils.shouldDisableToggle(args[0])) {
// if (!Permissions.hardcoreToggle(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// disable(null);
// return true;
// }
//
// if (CommandUtils.isInvalidDouble(sender, args[0])) {
// return true;
// }
//
// if (!Permissions.hardcoreModify(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// modify(sender, Double.parseDouble(args[0]));
// return true;
//
//
// case 2:
// if (CommandUtils.isInvalidSkill(sender, args[0])) {
// return true;
// }
//
// PrimarySkillType skill = PrimarySkillType.getSkill(args[0]);
//
// if (!CommandUtils.isChildSkill(sender, skill)) {
// return true;
// }
//
// if (CommandUtils.shouldEnableToggle(args[1])) {
// if (!Permissions.hardcoreToggle(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// enable(skill);
// return true;
// }
//
// if (CommandUtils.shouldDisableToggle(args[1])) {
// if (!Permissions.hardcoreToggle(sender)) {
// sender.sendMessage(command.getPermissionMessage());
// return true;
// }
//
// enable(skill);
// return true;
// }
//
// return true;
//
// default:
// return false;
// }
// }
//
// @Override
// public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
// if (args.length == 1) {
// if (StringUtils.isDouble(args[0])) {
// return ImmutableList.of();
// }
//
// return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
// }
// return ImmutableList.of();
// }
//
// protected abstract boolean checkTogglePermissions(CommandSender sender);
// protected abstract boolean checkModifyPermissions(CommandSender sender);
// protected abstract boolean checkEnabled(PrimarySkillType skill);
// protected abstract void enable(PrimarySkillType skill);
// protected abstract void disable(PrimarySkillType skill);
// protected abstract void modify(CommandSender sender, double newPercentage);
//}

View File

@@ -1,64 +1,64 @@
package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender;
public class VampirismCommand extends HardcoreModeCommand {
@Override
protected boolean checkTogglePermissions(CommandSender sender) {
return Permissions.vampirismToggle(sender);
}
@Override
protected boolean checkModifyPermissions(CommandSender sender) {
return Permissions.vampirismModify(sender);
}
@Override
protected boolean checkEnabled(PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreVampirismEnabled()) {
return false;
}
}
return true;
}
return skill.getHardcoreVampirismEnabled();
}
@Override
protected void enable(PrimarySkillType skill) {
toggle(true, skill);
}
@Override
protected void disable(PrimarySkillType skill) {
toggle(false, skill);
}
@Override
protected void modify(CommandSender sender, double newPercentage) {
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
}
private void toggle(boolean enable, PrimarySkillType skill) {
if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreVampirismEnabled(enable);
}
}
else {
skill.setHardcoreVampirismEnabled(enable);
}
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (skill == null ? "all skills" : skill)));
}
}
//package com.gmail.nossr50.commands.hardcore;
//
//import com.gmail.nossr50.config.Config;
//import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
//import com.gmail.nossr50.locale.LocaleLoader;
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.util.Permissions;
//import org.bukkit.command.CommandSender;
//
//public class VampirismCommand extends HardcoreModeCommand {
// @Override
// protected boolean checkTogglePermissions(CommandSender sender) {
// return Permissions.vampirismToggle(sender);
// }
//
// @Override
// protected boolean checkModifyPermissions(CommandSender sender) {
// return Permissions.vampirismModify(sender);
// }
//
// @Override
// protected boolean checkEnabled(PrimarySkillType skill) {
// if (skill == null) {
// for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
// if (!primarySkillType.getHardcoreVampirismEnabled()) {
// return false;
// }
// }
//
// return true;
// }
//
// return skill.getHardcoreVampirismEnabled();
// }
//
// @Override
// protected void enable(PrimarySkillType skill) {
// toggle(true, skill);
// }
//
// @Override
// protected void disable(PrimarySkillType skill) {
// toggle(false, skill);
// }
//
// @Override
// protected void modify(CommandSender sender, double newPercentage) {
// Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
// sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
// }
//
// private void toggle(boolean enable, PrimarySkillType skill) {
// if (skill == null) {
// for (PrimarySkillType primarySkillType : SkillTools.NON_CHILD_SKILLS) {
// primarySkillType.setHardcoreVampirismEnabled(enable);
// }
// }
// else {
// skill.setHardcoreVampirismEnabled(enable);
// }
//
// mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Hardcore.Mode." + (enable ? "Enabled" : "Disabled"), LocaleLoader.getString("Hardcore.Vampirism.Name"), (skill == null ? "all skills" : skill)));
// }
//}

View File

@@ -8,40 +8,37 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
Player player = (Player) sender;
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
Player player = (Player) sender;
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
PartyManager.joinInvitedParty(mcMMOPlayer);
//Check if player profile is loaded
if (UserManager.getPlayer(player) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
// Changing parties
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
PartyManager.joinInvitedParty(mcMMOPlayer);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));
return true;
}
}

View File

@@ -11,34 +11,30 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyChangeOwnerCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (!playerParty.hasMember(target.getUniqueId())) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true;
}
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {//Check if player profile is loaded
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (!playerParty.hasMember(target.getUniqueId())) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true;
}
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
}
}

View File

@@ -7,10 +7,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyChangePasswordCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.gmail.nossr50.datatypes.party.Party;
@@ -16,6 +15,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
@@ -28,7 +28,7 @@ public class PartyCommand implements TabExecutor {
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
static {
ArrayList<String> subcommands = new ArrayList<String>();
ArrayList<String> subcommands = new ArrayList<>();
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
subcommands.add(subcommand.toString());
@@ -38,27 +38,26 @@ public class PartyCommand implements TabExecutor {
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
}
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
private CommandExecutor partyKickCommand = new PartyKickCommand();
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
private CommandExecutor partyLockCommand = new PartyLockCommand();
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
private CommandExecutor partyTeleportCommand = new PtpCommand();
private CommandExecutor partyChatCommand = new PartyChatCommand();
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
private final CommandExecutor partyJoinCommand = new PartyJoinCommand();
private final CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
private final CommandExecutor partyCreateCommand = new PartyCreateCommand();
private final CommandExecutor partyQuitCommand = new PartyQuitCommand();
private final CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
private final CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
private final CommandExecutor partyInviteCommand = new PartyInviteCommand();
private final CommandExecutor partyKickCommand = new PartyKickCommand();
private final CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
private final CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
private final CommandExecutor partyLockCommand = new PartyLockCommand();
private final CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
private final CommandExecutor partyRenameCommand = new PartyRenameCommand();
private final CommandExecutor partyInfoCommand = new PartyInfoCommand();
private final CommandExecutor partyHelpCommand = new PartyHelpCommand();
private final CommandExecutor partyTeleportCommand = new PtpCommand();
private final CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@@ -131,8 +130,6 @@ public class PartyCommand implements TabExecutor {
return partyInviteCommand.onCommand(sender, command, label, args);
case TELEPORT:
return partyTeleportCommand.onCommand(sender, command, label, extractArgs(args));
case CHAT:
return partyChatCommand.onCommand(sender, command, label, extractArgs(args));
default:
break;
}
@@ -171,10 +168,10 @@ public class PartyCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PARTY_SUBCOMMANDS, new ArrayList<String>(PARTY_SUBCOMMANDS.size()));
return StringUtil.copyPartialMatches(args[0], PARTY_SUBCOMMANDS, new ArrayList<>(PARTY_SUBCOMMANDS.size()));
case 2:
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
@@ -188,33 +185,37 @@ public class PartyCommand implements TabExecutor {
case KICK:
case OWNER:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
case XPSHARE:
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size()));
case ITEMSHARE:
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<String>(ITEMSHARE_COMPLETIONS.size()));
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<>(ITEMSHARE_COMPLETIONS.size()));
case LOCK:
case CHAT:
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
case PASSWORD:
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<String>(CommandUtils.RESET_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
case TELEPORT:
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
Player player = (Player) sender;
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded
if(UserManager.getPlayer(player) == null)
if(mcMMOPlayer == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
Party party = UserManager.getPlayer(player).getParty();
if (mcMMOPlayer.getParty() == null)
return ImmutableList.of();
final Party party = mcMMOPlayer.getParty();
playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;
@@ -223,7 +224,7 @@ public class PartyCommand implements TabExecutor {
}
case 3:
if (PartySubcommandType.getSubcommand(args[0]) == PartySubcommandType.ITEMSHARE && isItemShareCategory(args[1])) {
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
}
return ImmutableList.of();

View File

@@ -8,10 +8,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyCreateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 2:
case 3:

View File

@@ -1,6 +1,7 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.PartyManager;
@@ -9,35 +10,33 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
if (mcMMOPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
final Party playerParty = mcMMOPlayer.getParty();
final String partyName = playerParty.getName();
for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String partyName = playerParty.getName();
member.sendMessage(LocaleLoader.getString("Party.Disband"));
}
for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
member.sendMessage(LocaleLoader.getString("Party.Disband"));
}
PartyManager.disbandParty(playerParty);
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));
return true;
PartyManager.disbandParty(mcMMOPlayer, playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));
return true;
}
}

View File

@@ -4,27 +4,25 @@ import com.gmail.nossr50.locale.LocaleLoader;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PartyHelpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
sender.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit"));
sender.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create"));
sender.sendMessage(LocaleLoader.getString("Party.Help.4", "/party <lock|unlock>"));
sender.sendMessage(LocaleLoader.getString("Party.Help.5", "/party password"));
sender.sendMessage(LocaleLoader.getString("Party.Help.6", "/party kick"));
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader"));
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband"));
sender.sendMessage(LocaleLoader.getString("Party.Help.9", "/party itemshare"));
sender.sendMessage(LocaleLoader.getString("Party.Help.10", "/party xpshare"));
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "help"));
return true;
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
sender.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit"));
sender.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create"));
sender.sendMessage(LocaleLoader.getString("Party.Help.4", "/party <lock|unlock>"));
sender.sendMessage(LocaleLoader.getString("Party.Help.5", "/party password"));
sender.sendMessage(LocaleLoader.getString("Party.Help.6", "/party kick"));
sender.sendMessage(LocaleLoader.getString("Party.Help.7", "/party leader"));
sender.sendMessage(LocaleLoader.getString("Party.Help.8", "/party disband"));
sender.sendMessage(LocaleLoader.getString("Party.Help.9", "/party itemshare"));
sender.sendMessage(LocaleLoader.getString("Party.Help.10", "/party xpshare"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "help"));
return true;
}
}

View File

@@ -1,11 +1,11 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
@@ -13,13 +13,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class PartyInfoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
case 1:
@@ -60,8 +61,8 @@ public class PartyInfoCommand implements CommandExecutor {
private void displayPartyFeatures(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header"));
List<String> unlockedPartyFeatures = new ArrayList<String>();
List<String> lockedPartyFeatures = new ArrayList<String>();
List<String> unlockedPartyFeatures = new ArrayList<>();
List<String> lockedPartyFeatures = new ArrayList<>();
for (PartyFeature partyFeature : PartyFeature.values()) {
if (!partyFeature.hasPermission(player)) {
@@ -84,7 +85,7 @@ public class PartyInfoCommand implements CommandExecutor {
}
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
return party.getLevel() >= Config.getInstance().getPartyFeatureUnlockLevel(partyFeature);
return party.getLevel() >= mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(partyFeature);
}
private void displayShareModeInfo(Player player, Party party) {

View File

@@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -11,64 +11,60 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyInviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
return true;
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!PartyManager.canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if(PartyManager.isPartyFull(target, playerParty))
{
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), Config.getInstance().getPartyMaxSize()));
return true;
}
mcMMOTarget.setPartyInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
return true;
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!PartyManager.canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (PartyManager.isPartyFull(target, playerParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), mcMMO.p.getGeneralConfig().getPartyMaxSize()));
return true;
}
mcMMOTarget.setPartyInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
}
}

View File

@@ -1,24 +1,25 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
public class PartyItemShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
@@ -27,7 +28,7 @@ public class PartyItemShareCommand implements CommandExecutor {
Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
if (party.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
return true;
}

View File

@@ -10,10 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyJoinCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 2:
case 3:

View File

@@ -12,46 +12,43 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyKickCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
if (!playerParty.hasMember(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true;
}
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (target.isOnline()) {
Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName();
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
}
if (!playerParty.hasMember(targetName)) {
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return true;
}
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
if (target.isOnline()) {
Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName();
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
}
PartyManager.removeFromParty(target, playerParty);
return true;
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
PartyManager.removeFromParty(target, playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
}
}

View File

@@ -9,10 +9,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyLockCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("lock")) {
@@ -67,7 +68,7 @@ public class PartyLockCommand implements CommandExecutor {
return;
}
if (lock ? party.isLocked() : !party.isLocked()) {
if (lock == party.isLocked()) {
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "IsLocked" : "IsntLocked")));
return;
}

View File

@@ -10,34 +10,31 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyQuitCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
Player player = (Player) sender;
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true;
}
PartyManager.removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "quit"));
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty();
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true;
}
PartyManager.removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "quit"));
return true;
}
}

View File

@@ -10,57 +10,54 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyRenameCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
Party playerParty = mcMMOPlayer.getParty();
String oldPartyName = playerParty.getName();
String newPartyName = args[1];
// This is to prevent party leaders from spamming other players with the rename message
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
sender.sendMessage(LocaleLoader.getString("Party.Rename.Same"));
return true;
}
Player player = mcMMOPlayer.getPlayer();
// Check to see if the party exists, and if it does cancel renaming the party
if (PartyManager.checkPartyExistence(player, newPartyName)) {
return true;
}
String leaderName = playerParty.getLeader().getPlayerName();
for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
return true;
}
if (!member.getName().equalsIgnoreCase(leaderName)) {
member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
}
}
playerParty.setName(newPartyName);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Rename", newPartyName));
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "rename", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">"));
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
Party playerParty = mcMMOPlayer.getParty();
String oldPartyName = playerParty.getName();
String newPartyName = args[1].replace(".", "");
// This is to prevent party leaders from spamming other players with the rename message
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
sender.sendMessage(LocaleLoader.getString("Party.Rename.Same"));
return true;
}
Player player = mcMMOPlayer.getPlayer();
// Check to see if the party exists, and if it does cancel renaming the party
if (PartyManager.checkPartyExistence(player, newPartyName)) {
return true;
}
String leaderName = playerParty.getLeader().getPlayerName();
for (Player member : playerParty.getOnlineMembers()) {
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
return true;
}
if (!member.getName().equalsIgnoreCase(leaderName)) {
member.sendMessage(LocaleLoader.getString("Party.InformedOnNameChange", leaderName, newPartyName));
}
}
playerParty.setName(newPartyName);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Rename", newPartyName));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "rename", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">"));
return true;
}
}

View File

@@ -1,21 +1,22 @@
package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyXpShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
@@ -24,29 +25,24 @@ public class PartyXpShareCommand implements CommandExecutor {
Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
if (party.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
return true;
}
switch (args.length) {
case 2:
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.NONE);
}
else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.EQUAL);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
}
return true;
default:
if (args.length == 2) {
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.NONE);
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
handleChangingShareMode(party, ShareMode.EQUAL);
} else {
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
return true;
}
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
return true;
}
private void handleChangingShareMode(Party party, ShareMode mode) {

View File

@@ -8,36 +8,33 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyAllianceInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
if (mcMMOPlayer.getParty().getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
PartyManager.acceptAllianceInvite(mcMMOPlayer);
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept"));
if (!mcMMOPlayer.hasPartyAllianceInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true;
}
if (mcMMOPlayer.getParty().getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
PartyManager.acceptAllianceInvite(mcMMOPlayer);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept"));
return true;
}
}

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -27,12 +28,12 @@ public class PartyAllianceCommand implements TabExecutor {
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
private final CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
private final CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
private final CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@@ -50,7 +51,7 @@ public class PartyAllianceCommand implements TabExecutor {
switch (args.length) {
case 1:
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
if (playerParty.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
return true;
}
@@ -68,7 +69,7 @@ public class PartyAllianceCommand implements TabExecutor {
case 2:
case 3:
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
if (playerParty.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
return true;
}
@@ -108,20 +109,18 @@ public class PartyAllianceCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<>(ALLIANCE_SUBCOMMANDS.size()));
if (matches.size() == 0) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
}
if (matches.size() == 0) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;
default:
return ImmutableList.of();
return matches;
}
return ImmutableList.of();
}
private void displayPartyHeader() {

View File

@@ -9,32 +9,29 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty();
if (party.getAlly() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.None"));
return true;
}
PartyManager.disbandAlliance(player, party, party.getAlly());
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty();
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband"));
if (party.getAlly() == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.None"));
return true;
}
PartyManager.disbandAlliance(player, party, party.getAlly());
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband"));
return true;
}
}

View File

@@ -10,68 +10,65 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceInviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 3:
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 3) {
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
return true;
}
if (!mcMMOTarget.inParty()) {
player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
return true;
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) {
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (playerParty.getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
mcMMOTarget.setPartyAllianceInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.1"));
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
default:
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "alliance", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName();
if (player.equals(target)) {
sender.sendMessage(LocaleLoader.getString("Party.Invite.Self"));
return true;
}
if (!mcMMOTarget.inParty()) {
player.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
return true;
}
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) {
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (playerParty.getAlly() != null) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.AlreadyAllies"));
return true;
}
mcMMOTarget.setPartyAllianceInvite(playerParty);
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.0", playerParty.getName(), playerName));
target.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.1"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "alliance", "invite", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
return true;
}
}

View File

@@ -7,10 +7,11 @@ import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PtpAcceptAnyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportAcceptAll(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;

View File

@@ -1,8 +1,8 @@
package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
@@ -11,10 +11,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PtpAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportAccept(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
@@ -34,7 +35,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true;
}
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), mcMMO.p.getGeneralConfig().getPTPCommandTimeout())) {
ptpRecord.removeRequest();
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
return true;
@@ -47,7 +48,7 @@ public class PtpAcceptCommand implements CommandExecutor {
return true;
}
if (Config.getInstance().getPTPCommandWorldPermissions()) {
if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) {
World targetWorld = target.getWorld();
World playerWorld = player.getWorld();

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
@@ -26,6 +25,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -33,12 +33,12 @@ import java.util.List;
public class PtpCommand implements TabExecutor {
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
private CommandExecutor ptpToggleCommand = new PtpToggleCommand();
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
private final CommandExecutor ptpToggleCommand = new PtpToggleCommand();
private final CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
private final CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@@ -75,90 +75,84 @@ public class PtpCommand implements TabExecutor {
Party party = mcMMOPlayer.getParty();
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
if (party.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
return true;
}
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("toggle")) {
return ptpToggleCommand.onCommand(sender, command, label, args);
}
if (args.length == 1) {
if (args[0].equalsIgnoreCase("toggle")) {
return ptpToggleCommand.onCommand(sender, command, label, args);
}
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
}
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
}
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
int hurtCooldown = mcMMO.p.getGeneralConfig().getPTPCommandRecentlyHurtCooldown();
if (hurtCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
if (hurtCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", timeRemaining));
return true;
}
}
if (args[0].equalsIgnoreCase("accept")) {
return ptpAcceptCommand.onCommand(sender, command, label, args);
}
if (!Permissions.partyTeleportSend(sender)) {
sender.sendMessage(command.getPermissionMessage());
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", timeRemaining));
return true;
}
}
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
if (args[0].equalsIgnoreCase("accept")) {
return ptpAcceptCommand.onCommand(sender, command, label, args);
}
if (ptpCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
return true;
}
}
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
if (!Permissions.partyTeleportSend(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
default:
return false;
int ptpCooldown = mcMMO.p.getGeneralConfig().getPTPCommandCooldown();
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
if (ptpCooldown > 0) {
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
if (timeRemaining > 0) {
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
return true;
}
}
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.inParty()) {
return ImmutableList.of();
}
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
if (matches.size() == 0) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
return matches;
default:
return ImmutableList.of();
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.inParty()) {
return ImmutableList.of();
}
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;
}
return ImmutableList.of();
}
private void sendTeleportRequest(CommandSender sender, Player player, String targetName) {
@@ -170,7 +164,7 @@ public class PtpCommand implements TabExecutor {
Player target = mcMMOTarget.getPlayer();
if (Config.getInstance().getPTPCommandWorldPermissions()) {
if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) {
World targetWorld = target.getWorld();
World playerWorld = player.getWorld();
@@ -199,7 +193,7 @@ public class PtpCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout()));
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", mcMMO.p.getGeneralConfig().getPTPCommandTimeout()));
}
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
@@ -250,13 +244,13 @@ public class PtpCommand implements TabExecutor {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
long warmup = Config.getInstance().getPTPCommandWarmup();
long warmup = mcMMO.p.getGeneralConfig().getPTPCommandWarmup();
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
}
else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);

View File

@@ -7,10 +7,11 @@ import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PtpToggleCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;

View File

@@ -1,6 +1,5 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@@ -10,99 +9,113 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillTools;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class InspectCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
if (mcMMOPlayer == null) {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName); // Temporary Profile
if (!CommandUtils.isLoaded(sender, profile)) {
if (!CommandUtils.isLoaded(sender, profile)) {
return true;
}
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()
&& sender instanceof Player
&& mcMMO.p.getGeneralConfig().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
if (!mcMMO.p.getGeneralConfig().getInspectUseChat()) {
return true;
}
}
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
if (!Config.getInstance().getInspectUseChat()) {
return true;
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
// Sum power level
int powerLevel = 0;
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS)
powerLevel += profile.getSkillLevel(skill);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel));
} else {
Player target = mcMMOPlayer.getPlayer();
boolean isVanished = false;
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
isVanished = true;
}
//Only distance check players who are online and not vanished
if (!isVanished && CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
return true;
}
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()
&& sender instanceof Player
&& mcMMO.p.getGeneralConfig().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer);
if (!mcMMO.p.getGeneralConfig().getInspectUseChat()) {
return true;
}
}
if (isVanished) {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
}
}
else {
Player target = mcMMOPlayer.getPlayer();
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
return true;
}
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
if (!Config.getInstance().getInspectUseChat()) {
return true;
}
}
} else {
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
CommandUtils.printGatheringSkills(target, sender);
CommandUtils.printCombatSkills(target, sender);
CommandUtils.printMiscSkills(target, sender);
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
}
return true;
CommandUtils.printGatheringSkills(target, sender);
CommandUtils.printCombatSkills(target, sender);
CommandUtils.printMiscSkills(target, sender);
default:
return false;
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", mcMMOPlayer.getPowerLevel()));
}
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return ImmutableList.of();
}
}

View File

@@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
@@ -12,12 +12,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MccooldownCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@@ -26,53 +27,48 @@ public class MccooldownCommand implements TabExecutor {
return true;
}
switch (args.length) {
case 0:
Player player = (Player) sender;
if (args.length == 0) {
Player player = (Player) sender;
if (Config.getInstance().getScoreboardsEnabled() && Config.getInstance().getCooldownUseBoard()) {
ScoreboardManager.enablePlayerCooldownScoreboard(player);
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && mcMMO.p.getGeneralConfig().getCooldownUseBoard()) {
ScoreboardManager.enablePlayerCooldownScoreboard(player);
if (!Config.getInstance().getCooldownUseChat()) {
return true;
}
}
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
if (!mcMMO.p.getGeneralConfig().getCooldownUseChat()) {
return true;
}
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (UserManager.getPlayer(player) == null) {
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
for (SuperAbilityType ability : SuperAbilityType.values()) {
if (!ability.getPermissions(player)) {
continue;
}
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
}
for (SuperAbilityType ability : SuperAbilityType.values()) {
if (!ability.getPermissions(player)) {
continue;
}
return true;
int seconds = mcMMOPlayer.calculateTimeRemaining(ability);
default:
return false;
if (seconds <= 0) {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getLocalizedName()));
} else {
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getLocalizedName(), seconds));
}
}
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
@@ -15,13 +15,14 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class McrankCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
@@ -72,14 +73,12 @@ public class McrankCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return ImmutableList.of();
}
private void display(CommandSender sender, String playerName) {
@@ -92,27 +91,27 @@ public class McrankCommand implements TabExecutor {
return;
}
long cooldownMillis = Math.min(Config.getInstance().getDatabasePlayerCooldown(), 1750);
long cooldownMillis = Math.min(mcMMO.p.getGeneralConfig().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
return;
}
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
if (((Player) sender).hasMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
return;
} else {
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
((Player) sender).setMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, new FixedMetadataValue(mcMMO.p, null));
}
mcMMOPlayer.actualizeDatabaseATS();
}
boolean useBoard = Config.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
boolean useChat = !useBoard || Config.getInstance().getRankUseChat();
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
}
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
@@ -10,12 +10,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McstatsCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@@ -24,49 +25,44 @@ public class McstatsCommand implements TabExecutor {
return true;
}
switch (args.length) {
case 0:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
if (args.length == 0) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender;
if (mcMMO.p.getGeneralConfig().getStatsUseBoard() && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
ScoreboardManager.enablePlayerStatsScoreboard(player);
if (!mcMMO.p.getGeneralConfig().getStatsUseChat()) {
return true;
}
}
Player player = (Player) sender;
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
if (Config.getInstance().getStatsUseBoard() && Config.getInstance().getScoreboardsEnabled()) {
ScoreboardManager.enablePlayerStatsScoreboard(player);
CommandUtils.printGatheringSkills(player);
CommandUtils.printCombatSkills(player);
CommandUtils.printMiscSkills(player);
if (!Config.getInstance().getStatsUseChat()) {
return true;
}
}
int powerLevelCap = mcMMO.p.getGeneralConfig().getPowerLevelCap();
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
} else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
}
CommandUtils.printGatheringSkills(player);
CommandUtils.printCombatSkills(player);
CommandUtils.printMiscSkills(player);
int powerLevelCap = Config.getInstance().getPowerLevelCap();
if (powerLevelCap != Integer.MAX_VALUE) {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
}
else {
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
}
return true;
default:
return false;
return true;
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@@ -1,15 +1,15 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -17,13 +17,14 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MctopCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill = null;
switch (args.length) {
@@ -66,13 +67,11 @@ public class MctopCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
default:
return ImmutableList.of();
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
}
return ImmutableList.of();
}
private void display(int page, PrimarySkillType skill, CommandSender sender, Command command) {
@@ -87,10 +86,10 @@ public class MctopCommand implements TabExecutor {
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
long cooldownMillis = Math.max(mcMMO.p.getGeneralConfig().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
if (seconds < 1) {
seconds = 1;
}
@@ -99,11 +98,11 @@ public class MctopCommand implements TabExecutor {
return;
}
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
if (((Player) sender).hasMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
return;
} else {
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
((Player) sender).setMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, new FixedMetadataValue(mcMMO.p, null));
}
mcMMOPlayer.actualizeDatabaseATS();
@@ -113,10 +112,10 @@ public class MctopCommand implements TabExecutor {
}
private void display(int page, PrimarySkillType skill, CommandSender sender) {
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
}
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
@@ -124,7 +123,7 @@ public class MctopCommand implements TabExecutor {
return null;
}
PrimarySkillType skill = PrimarySkillType.getSkill(skillName);
PrimarySkillType skill = mcMMO.p.getSkillTools().matchSkill(skillName);
if (CommandUtils.isChildSkill(sender, skill)) {
return null;

View File

@@ -0,0 +1,112 @@
package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.experience.ExperienceBarManager;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
public class XPBarCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(sender instanceof Player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
if(mmoPlayer == null) {
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
return false;
}
if(args.length == 0) {
return false;
} else if(args.length < 2) {
String option = args[0];
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
return true;
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
mmoPlayer.getExperienceBarManager().disableAllBars();
return true;
} else {
return false;
}
//Per skill Settings path
} else if (args.length == 2) {
String skillName = args[1];
if(SkillUtils.isSkill(skillName)) {
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
//Target setting
String option = args[0].toLowerCase();
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
//Change setting
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
private @Nullable ExperienceBarManager.XPBarSettingTarget getSettingTarget(String string) {
switch (string.toLowerCase()) {
case "hide":
return ExperienceBarManager.XPBarSettingTarget.HIDE;
case "show":
return ExperienceBarManager.XPBarSettingTarget.SHOW;
case "reset":
return ExperienceBarManager.XPBarSettingTarget.RESET;
case "disable":
return ExperienceBarManager.XPBarSettingTarget.DISABLE;
}
return null;
}
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
List<String> options = new ArrayList<>();
for(ExperienceBarManager.XPBarSettingTarget settingTarget : ExperienceBarManager.XPBarSettingTarget.values()) {
options.add(StringUtils.getCapitalized(settingTarget.toString()));
}
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
case 2:
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
default:
return ImmutableList.of();
}
}
}

View File

@@ -3,13 +3,14 @@ package com.gmail.nossr50.commands.server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
/**
* This command facilitates switching the skill system scale between classic and modern scale
*/
public class Mcmmoupgrade implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
return false;
}
}

View File

@@ -5,11 +5,11 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillActivationType;
import net.md_5.bungee.api.chat.TextComponent;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@@ -44,7 +44,7 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canDodge) {
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
@@ -69,9 +69,9 @@ public class AcrobaticsCommand extends SkillCommand {
//Chance Stat Calculations
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
//damageThreshold = mcMMO.p.getAdvancedConfig().getRollDamageThreshold();
String rollStrings[] = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
//Format
double rollChanceLucky = rollChance * 1.333D;
@@ -89,8 +89,8 @@ public class AcrobaticsCommand extends SkillCommand {
}
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);

View File

@@ -5,10 +5,10 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.chat.TextComponent;
import com.gmail.nossr50.util.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player;
import java.util.ArrayList;
@@ -74,7 +74,7 @@ public class AlchemyCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canCatalysis) {
messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
@@ -93,8 +93,8 @@ public class AlchemyCommand extends SkillCommand {
}
@Override
protected List<TextComponent> getTextComponents(Player player) {
List<TextComponent> textComponents = new ArrayList<>();
protected List<Component> getTextComponents(Player player) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);

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