mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 17:53:00 +01:00
Compare commits
363 Commits
tridentsxb
...
endgame
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e7c889f8f | ||
|
|
e8a46d6ac8 | ||
|
|
39503b7038 | ||
|
|
6d0fbfd02e | ||
|
|
84cb6e3f7b | ||
|
|
bead5feb14 | ||
|
|
e9407246d7 | ||
|
|
221175d2d3 | ||
|
|
bf901a0a34 | ||
|
|
ef3887a720 | ||
|
|
fba6e8a961 | ||
|
|
04ed2a47d4 | ||
|
|
7da8c8c83a | ||
|
|
4d060b192b | ||
|
|
2117c67084 | ||
|
|
4d85f24d98 | ||
|
|
416c5383c9 | ||
|
|
7f9ed94d23 | ||
|
|
b0d0030d60 | ||
|
|
cdc187b211 | ||
|
|
3361d28887 | ||
|
|
c358c8ce0b | ||
|
|
aa65be0e1b | ||
|
|
70383b7250 | ||
|
|
85f27fdbdb | ||
|
|
5bfca3c218 | ||
|
|
2271bd5236 | ||
|
|
b0c42f8e44 | ||
|
|
66a4886ee4 | ||
|
|
b3b8a12b6d | ||
|
|
f051edd03d | ||
|
|
377bf1be4d | ||
|
|
dda5b45bb1 | ||
|
|
009d809d76 | ||
|
|
33cad7c2f1 | ||
|
|
efabaf1466 | ||
|
|
9cbe10827f | ||
|
|
fdc308762c | ||
|
|
826d16d916 | ||
|
|
4ba0f76eb9 | ||
|
|
04c9db88ab | ||
|
|
3fbb4827ca | ||
|
|
94754b150c | ||
|
|
8cc4798752 | ||
|
|
415e3df226 | ||
|
|
a941a1cc7f | ||
|
|
b0efd46584 | ||
|
|
dadc295431 | ||
|
|
76d4b50554 | ||
|
|
afff3b4c50 | ||
|
|
1799d455b7 | ||
|
|
b5608ccb01 | ||
|
|
d57e225576 | ||
|
|
2f166507ca | ||
|
|
9360e147ac | ||
|
|
967ffd6442 | ||
|
|
5f63faf65d | ||
|
|
7973ccc848 | ||
|
|
347e6112fb | ||
|
|
65dfcb492d | ||
|
|
23a549a6d3 | ||
|
|
7e3826a4d6 | ||
|
|
3e11b7da2c | ||
|
|
23b8e0a28c | ||
|
|
25952154e3 | ||
|
|
c8dedfc980 | ||
|
|
a522ab7b2f | ||
|
|
a0923ad786 | ||
|
|
dd04ee48b9 | ||
|
|
89b895af81 | ||
|
|
9e1f5b44a6 | ||
|
|
a54590576f | ||
|
|
06160c6d04 | ||
|
|
12e5a7f054 | ||
|
|
1f20e6344b | ||
|
|
13ba51cdf1 | ||
|
|
4f22391465 | ||
|
|
5f1a545437 | ||
|
|
bad7023129 | ||
|
|
785f18c13a | ||
|
|
357995ecb0 | ||
|
|
3e26eca48e | ||
|
|
dd339c20ea | ||
|
|
c34230a82e | ||
|
|
192626f4da | ||
|
|
24a57fab3d | ||
|
|
78596dc00e | ||
|
|
0b1b753d4c | ||
|
|
3cbdcddcc1 | ||
|
|
25ecb6e1de | ||
|
|
019d22d92a | ||
|
|
e39022cc64 | ||
|
|
a41106ee30 | ||
|
|
b2110d4e1c | ||
|
|
f22043ebb5 | ||
|
|
cc1b511c02 | ||
|
|
cbcddbf528 | ||
|
|
e9a020565f | ||
|
|
44ab8d93ab | ||
|
|
78922ea337 | ||
|
|
75ace0cfa0 | ||
|
|
db01b61371 | ||
|
|
d30b2f7bf6 | ||
|
|
133a60c4bf | ||
|
|
72957c3d31 | ||
|
|
4f79f7881c | ||
|
|
684e96ff6b | ||
|
|
f88dfe479e | ||
|
|
f40f68bdf0 | ||
|
|
640f4b0a9b | ||
|
|
978ee4a9a3 | ||
|
|
0ab93586fd | ||
|
|
7af0bc468a | ||
|
|
dc1d2540db | ||
|
|
aaa47d3b67 | ||
|
|
63e7c09ed4 | ||
|
|
5b9ab65c78 | ||
|
|
fc9287622d | ||
|
|
534b22233d | ||
|
|
0db1d846bc | ||
|
|
2c49f8ffeb | ||
|
|
921a0228db | ||
|
|
ac68c4ebe6 | ||
|
|
8bb50fb53c | ||
|
|
4553310bb9 | ||
|
|
9b0632d63c | ||
|
|
69ef484b86 | ||
|
|
606a92f1ef | ||
|
|
02c5aa4628 | ||
|
|
576b3c476c | ||
|
|
79730383ab | ||
|
|
68d4a179f1 | ||
|
|
7264e1a8d6 | ||
|
|
e011f545a7 | ||
|
|
283fa14380 | ||
|
|
5f388a9906 | ||
|
|
cd96bc79d8 | ||
|
|
ae961caeab | ||
|
|
0b4d87aebc | ||
|
|
6106f70c24 | ||
|
|
100a7f8a8f | ||
|
|
4c792c4f2c | ||
|
|
db4b820f80 | ||
|
|
ca710b4302 | ||
|
|
668cc0e4a3 | ||
|
|
6845fb4c44 | ||
|
|
6d0542b524 | ||
|
|
d84a5b37b7 | ||
|
|
c072ae4990 | ||
|
|
2d78eaa495 | ||
|
|
36adde7b3d | ||
|
|
6bdc51be76 | ||
|
|
af15617196 | ||
|
|
e4470fd061 | ||
|
|
643dff7915 | ||
|
|
01fbfccc0d | ||
|
|
2362fe994a | ||
|
|
08b08b1285 | ||
|
|
12fb4a3679 | ||
|
|
4a5e3542ef | ||
|
|
59f711834b | ||
|
|
7f66d27141 | ||
|
|
11cf882830 | ||
|
|
05c86f1125 | ||
|
|
b077d9e0fb | ||
|
|
bb44e56bdb | ||
|
|
965540dfaf | ||
|
|
75822472fc | ||
|
|
59aecb79a1 | ||
|
|
c865c2d2e3 | ||
|
|
93c64a8770 | ||
|
|
30ac82181e | ||
|
|
2b219f48ec | ||
|
|
fed0483d40 | ||
|
|
101c43a4bc | ||
|
|
fb738d85f6 | ||
|
|
032a407c8a | ||
|
|
33e615f0f1 | ||
|
|
8feba60e2c | ||
|
|
8a4fe8ae5d | ||
|
|
45f96793a5 | ||
|
|
df0362bcba | ||
|
|
25d558a5fa | ||
|
|
c0e4d7a43d | ||
|
|
993b418fbc | ||
|
|
9cf856221d | ||
|
|
4db6e03517 | ||
|
|
eb1393c02c | ||
|
|
e1a54b72a9 | ||
|
|
b266c7ce5b | ||
|
|
38f937fa01 | ||
|
|
6d7982c0cf | ||
|
|
89fa26d0eb | ||
|
|
edd85c2f19 | ||
|
|
88b6517f88 | ||
|
|
2c09a0fdb6 | ||
|
|
90721ee859 | ||
|
|
aa4011a226 | ||
|
|
fa82fe8e67 | ||
|
|
444e1532f2 | ||
|
|
1a34d2f647 | ||
|
|
d543843235 | ||
|
|
c40af913f4 | ||
|
|
f6268fe291 | ||
|
|
27854720f0 | ||
|
|
d19cf1e260 | ||
|
|
4a8630262e | ||
|
|
c41d2d1f39 | ||
|
|
8821fb0b2f | ||
|
|
5ab55c1653 | ||
|
|
8066f7f7f2 | ||
|
|
5ea18e8ba7 | ||
|
|
0bf3f98d95 | ||
|
|
fa33fa3d32 | ||
|
|
8b6a4c1e5b | ||
|
|
0ccd89fad4 | ||
|
|
16e90da8fd | ||
|
|
86e7bfbf89 | ||
|
|
8f0fb76847 | ||
|
|
3be15d3f65 | ||
|
|
74ced18bd0 | ||
|
|
2e0a371ed8 | ||
|
|
68ffe31246 | ||
|
|
405de477d3 | ||
|
|
db0ae36fa7 | ||
|
|
5d2028b5dc | ||
|
|
3e645a022d | ||
|
|
c21a040ddb | ||
|
|
dd4a5a6b9a | ||
|
|
d5ce8fc6ff | ||
|
|
829aaea5d4 | ||
|
|
c92ae16c7f | ||
|
|
40160498ca | ||
|
|
9d08d88f2a | ||
|
|
2ca3544741 | ||
|
|
ef714f98c9 | ||
|
|
dd550feb65 | ||
|
|
ddc9a69f4b | ||
|
|
61388f46f1 | ||
|
|
341dc45202 | ||
|
|
13f7482b39 | ||
|
|
a78dcffde7 | ||
|
|
3671d0b565 | ||
|
|
1b11fd2369 | ||
|
|
c36ff85cbf | ||
|
|
77cefbdfab | ||
|
|
fbe0cd1471 | ||
|
|
728ba512c3 | ||
|
|
10470dde13 | ||
|
|
11245e87ef | ||
|
|
b88d752f61 | ||
|
|
09ce259288 | ||
|
|
519d469cb2 | ||
|
|
cf67e3502a | ||
|
|
9ab4584dfe | ||
|
|
8d27e8fccf | ||
|
|
ba1f15b655 | ||
|
|
5b1a69b3f7 | ||
|
|
d185c7538c | ||
|
|
2347fc294f | ||
|
|
7aaec5b707 | ||
|
|
20a713e04d | ||
|
|
81faf93f31 | ||
|
|
19c0f6757e | ||
|
|
ec0815043e | ||
|
|
182717eacf | ||
|
|
e287ad47d1 | ||
|
|
8eee39b88b | ||
|
|
4bf2ad46ea | ||
|
|
def676d8d7 | ||
|
|
f8433cdbcc | ||
|
|
a2e10dbd0c | ||
|
|
e55ce00d62 | ||
|
|
73c465ee64 | ||
|
|
c30892a0a5 | ||
|
|
58e7323c3e | ||
|
|
7fc6577196 | ||
|
|
162c605dac | ||
|
|
280eb0ba51 | ||
|
|
8e5251ba66 | ||
|
|
1e43e34547 | ||
|
|
5575309b79 | ||
|
|
88dae5d5dd | ||
|
|
da3909c08f | ||
|
|
6cad4993ed | ||
|
|
af6e6b9545 | ||
|
|
cd937a812d | ||
|
|
264c0e2c78 | ||
|
|
b42278932e | ||
|
|
7fc7125ed3 | ||
|
|
d3f012de27 | ||
|
|
dfa16c70a7 | ||
|
|
8805a25d85 | ||
|
|
f91a2217c8 | ||
|
|
64f1ae4af6 | ||
|
|
6d9a9d165d | ||
|
|
5edc0d065d | ||
|
|
a346fc3338 | ||
|
|
dc94fedee1 | ||
|
|
93a6a73b4e | ||
|
|
2c849d9cb4 | ||
|
|
b79d452a6d | ||
|
|
fb94374e3c | ||
|
|
5255ae846d | ||
|
|
e816310da8 | ||
|
|
de6ba4fb6a | ||
|
|
e35bfe758c | ||
|
|
fffbacd239 | ||
|
|
f286af3fff | ||
|
|
7e28799f94 | ||
|
|
78dc56d263 | ||
|
|
e3dfdfc6ee | ||
|
|
4819a45be9 | ||
|
|
5e0f8a334d | ||
|
|
5f0cc2b09a | ||
|
|
6ff37c8baa | ||
|
|
f7dc72359b | ||
|
|
1ab5b82b22 | ||
|
|
28c6c90f23 | ||
|
|
9bb38e3193 | ||
|
|
551fac84a5 | ||
|
|
0bc25b263b | ||
|
|
fa9a3ae766 | ||
|
|
33df92ea3a | ||
|
|
c3d86ba6c5 | ||
|
|
b569b9456e | ||
|
|
4e6e58d9ca | ||
|
|
619eec7667 | ||
|
|
97cfb1cfc7 | ||
|
|
c28c8d164a | ||
|
|
e74e1e6829 | ||
|
|
6dbc7adf48 | ||
|
|
cbaef4a092 | ||
|
|
eb10bcbc96 | ||
|
|
2875545fa4 | ||
|
|
be595f2568 | ||
|
|
882f6197c6 | ||
|
|
0d2f370185 | ||
|
|
da1fcfe30a | ||
|
|
f983f95961 | ||
|
|
d67c561fed | ||
|
|
989f7fd51b | ||
|
|
e4b8b74987 | ||
|
|
9e7bb12dc3 | ||
|
|
95c291d630 | ||
|
|
9b4070d971 | ||
|
|
6d0fe4fb58 | ||
|
|
3e937c183f | ||
|
|
1a180c4cdf | ||
|
|
f039b4cbfa | ||
|
|
6a3671a190 | ||
|
|
e30c7110eb | ||
|
|
fe889cf1c5 | ||
|
|
f7640938df | ||
|
|
1bde79cd6f | ||
|
|
addf9b0431 | ||
|
|
32b41b3fd3 | ||
|
|
73e36b11b3 | ||
|
|
1ff2c0dcfc | ||
|
|
39a6c31894 | ||
|
|
9303d441b1 | ||
|
|
ce09a8bcdc | ||
|
|
eda227006f |
11
.github/workflows/maven.yml
vendored
11
.github/workflows/maven.yml
vendored
@@ -31,12 +31,13 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# 2. Setup Java 1.8 JDK
|
||||
- name: Java 1.8 setup
|
||||
uses: actions/setup-java@v1.4.3
|
||||
# 2. Setup Java 17 JDK (Adopt)
|
||||
- name: Java 17 setup
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-package: jdk
|
||||
java-version: 1.8
|
||||
java-version: '17'
|
||||
|
||||
# 3. Setup local Maven package cache to speed up building
|
||||
- name: Cache Maven packages
|
||||
@@ -48,4 +49,4 @@ jobs:
|
||||
|
||||
# 4. Build via Maven
|
||||
- name: Build via Maven
|
||||
run: mvn verify -B --file pom.xml
|
||||
run: mvn verify -B --file pom.xml -DdisableXmlReport=true
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -55,3 +55,4 @@
|
||||
|
||||
# Atlassian Stuff
|
||||
/atlassian-ide-plugin.xml
|
||||
/nulllocale_override.properties
|
||||
|
||||
612
Changelog.txt
612
Changelog.txt
@@ -1,113 +1,505 @@
|
||||
Version 2.2.000
|
||||
//TODO: Add level up milestone processing hooks
|
||||
//TODO: Verify fishing durability change is removed
|
||||
General
|
||||
Added Crossbows Skill, this skill is a WIP and feedback on discord is appreciated
|
||||
Added Tridents Skill, this skill is a WIP and feedback on discord is appreciated
|
||||
Added the "endgame" triple drop subskill 'Mother Lode' to Mining
|
||||
Added the "endgame" triple drop subskill 'Clean Cuts' to Woodcutting
|
||||
Added the "endgame" triple drop subskill 'Verdant Bounty' to Herbalism
|
||||
Added /mmopower command which simply shows your power level (aliases /mmopowerlevel /powerlevel)
|
||||
|
||||
Removed the mcimport command as its useless (was for mod configs)
|
||||
mcMMO-API is now the library used for mcMMO API
|
||||
Parts of the API have been migrated to mcMMO-API
|
||||
(API) mcMMO makes use of jmal (Java Minecraft Abstraction Library) for some abstraction now
|
||||
(API) Added skill register
|
||||
(API) Skill hierarchy is now defined by Skill in mcMMO-API, and mcMMO needs a skill to be registered to be aware of it
|
||||
(API) A lot of changes to the API, I'll be including a document with the release of this update to explain the finer details
|
||||
When using commands that require typing a skill name, locale names are now always checked
|
||||
When using commands that require typing a skill name, it is now legal to provide the skills fully qualified identifier
|
||||
Config
|
||||
Added 'Send_To_Console' settings to chat.yml to toggle sending party or admin chat messages to console
|
||||
Replaced 'Experience_Formula.Modifier' in experience.yml with 'Experience_Formula.Skill_Multiplier' which is easier to understand and less prone to divide by zero bugs
|
||||
child.yml config is gone now, feel free to delete it
|
||||
|
||||
Codebase Stuff
|
||||
Many places that passed type Player now passes type McMMOPlayer instead
|
||||
Tweaks
|
||||
Tree Feller now drops 90% less non-wood block rewards (leaves/etc) on average from Knock on Wood.
|
||||
Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk
|
||||
Updated advanced.yml with entries for the new skills
|
||||
|
||||
New Skill - Tridents
|
||||
New Skill - Crossbows
|
||||
Permission nodes
|
||||
Added 'mcmmo.commands.mmopower' permission node for the new /mmopower command
|
||||
Added 'mcmmo.commands.crossbows' permission node
|
||||
Added 'mcmmo.ability.crossbows.crossbowslimitbreak' permission node
|
||||
Added 'mcmmo.ability.crossbows.trickshot' permission node
|
||||
Added 'mcmmo.ability.herbalism.verdantbounty' permission node
|
||||
Added 'mcmmo.ability.mining.motherlode' permission node
|
||||
Added 'mcmmo.ability.woodcutting.cleancuts' permission node
|
||||
|
||||
New config file named 'tridents.yml'
|
||||
Locale
|
||||
Added locale entries for motherlode, cleancuts, and verdant bounty
|
||||
|
||||
New command /tridents - Skill Info for Tridents
|
||||
New command /crossbows - Skill Info for Crossbows
|
||||
|
||||
Added Sub-Skill named Multi Tasking to Tridents
|
||||
Added Sub-Skill named Tridents Limit Break to Tridents
|
||||
|
||||
Added Sub-Skill named Super Shotgun to Crossbows
|
||||
Added Sub-Skill named Crossbows Limit Break to Crossbows
|
||||
|
||||
Permission node descriptions had mentions of ability changed to sub-skill and other minor corrections
|
||||
mcMMO will now register arrows shot from the offhand as being from either Archery or Crossbows (before mcMMO ignored offhand Archery)
|
||||
|
||||
(These permissions are all included in the mcmmo.defaults node)
|
||||
New permission node 'mcmmo.commands.tridents'
|
||||
New permission node 'mcmmo.skills.tridents'
|
||||
New permission node 'mcmmo.ability.tridents.all'
|
||||
New permission node 'mcmmo.ability.tridents.multitasking'
|
||||
New permission node 'mcmmo.ability.tridents.tridentslimitbreak'
|
||||
|
||||
New permission node 'mcmmo.commands.crossbows'
|
||||
New permission node 'mcmmo.skills.crossbows'
|
||||
New permission node 'mcmmo.ability.crossbows.all'
|
||||
New permission node 'mcmmo.ability.crossbows.crossbowslimitbreak'
|
||||
New permission node 'mcmmo.ability.crossbows.coneofdeath'
|
||||
|
||||
The Party system has some new features, and a lot of bad features were removed completely, read the notes
|
||||
Parties can no longer have passwords (see notes)
|
||||
Parties can no longer be locked (see notes)
|
||||
Parties no longer have item share (see notes)
|
||||
Party alliances are gone (see notes)
|
||||
Parties are always private (see notes)
|
||||
Party members can be promoted to Officer by the Party Leader (officers are mini-party leaders)
|
||||
Added Party Officer chat, only other officers (including the party leader) can read and participate
|
||||
Added the following party subcommands: promote, demote
|
||||
Removed the following party subcommands: join, lock, unlock, password, alliance, item share
|
||||
|
||||
Added permission node 'mcmmo.chat.officerpartychat'
|
||||
|
||||
The following permission nodes were removed because their related feature was removed
|
||||
Removed permission node 'mcmmo.commands.party.unlock'
|
||||
Removed permission node 'mcmmo.commands.party.alliance'
|
||||
Removed permission node 'mcmmo.commands.party.password'
|
||||
Removed permission node 'mcmmo.commands.party.itemshare'
|
||||
|
||||
The following permission nodes were removed because permissions for these commands don't make sense, if you want to disable party commands just negate 'mcmmo.commands.party'
|
||||
Removed permission node 'mcmmo.commands.party.quit'
|
||||
Removed permission node 'mcmmo.commands.party.kick'
|
||||
|
||||
Added new locale string 'Overhaul.Name.Tridents'
|
||||
Added new locale string 'Tridents.SubSkill.TridentsLimitBreak.Name'
|
||||
Added new locale string 'Tridents.SubSkill.TridentsLimitBreak.Description'
|
||||
Added new locale string 'Tridents.SubSkill.TridentsLimitBreak.Stat'
|
||||
|
||||
Added new locale string 'Overhaul.Name.Crossbows'
|
||||
Added new locale string 'Crossbows.SubSkill.CrossbowsLimitBreak.Name'
|
||||
Added new locale string 'Crossbows.SubSkill.CrossbowsLimitBreak.Description'
|
||||
Added new locale string 'Crossbows.SubSkill.CrossbowsLimitBreak.Stat'
|
||||
|
||||
Added new locale string 'Commands.MissingProfile'
|
||||
Removed locale string 'Commands.Offline'
|
||||
|
||||
|
||||
Player Power Levels no longer need to pass permission checks when summing skills
|
||||
Minor improvements to how player data is serialized
|
||||
SMP mod settings removed from config.yml (this is a legacy feature and didn't really do anything anymore)
|
||||
Refactored & Optimized a bunch of code involving player and party data
|
||||
|
||||
Added XP bar settings for Tridents & Crossbows to experience.yml
|
||||
Changed some debug level logging to info level for convenience
|
||||
|
||||
Database Changes
|
||||
XP Bar settings (set by /mmoxpbar command) are now saved
|
||||
Players can now be marked as exempt from leadboards
|
||||
Party Chat Spy toggle is now saved
|
||||
(FlatFile) Fixed a bug where last login was not being saved
|
||||
Schema updated for the new skills and supers and things mentioned above
|
||||
|
||||
|
||||
Notes:
|
||||
These are the first new skills that I've written for mcMMO in about 9 years, I'll be listening closely to feedback and tweaking them often.
|
||||
Parties got unnecessarily complex in my absence, I have removed many party features in order to simplify parties and bring them closer to my vision. I have also added new features which should improve parties where it matters.
|
||||
About the removed party features, all the features I removed I consider poor quality features and I don't think they belong in mcMMO. Feel free to yell at me in discord if you disagree.
|
||||
I don't know what genius decided to make parties public by default, when I found out that parties had been changed to such a system I could barely contain my disgust. Parties are back to being private, you get invited by a party leader or party officer. That is the only way to join a party.
|
||||
Version 2.1.196
|
||||
Crossbows can now be fished up with enchantments
|
||||
Codebase
|
||||
Major rewrite for how random chance was handled in the code
|
||||
Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail
|
||||
A lot of new unit tests were added to help keep mcMMO stable as part of this update, of course, more could always be added.
|
||||
|
||||
NOTES:
|
||||
One feature of this update is to provide a endgame benefits to some skills that you can grind for a long time, ideally for a long while. I will likely expand upon this idea in future updates.
|
||||
A few skills have these endgame oriented subskills, these new subskills provide a small benefit at first that grows and scales up to level 10,000 (or 1,000 for Standard mode which no one uses) and does not have ranks (other than the initial rank to unlock it).
|
||||
These endgame sub skills unlock at level 1000 for users with default mcMMO settings, or 100 for those using the optional Standard scaling.
|
||||
You can tweak the benefits of these skills in advanced.yml, the default settings are meant to be a good starting point.
|
||||
|
||||
Crossbows and Tridents are WIP skills, I would like feedback on discord about them.
|
||||
|
||||
More info on the new Triple Drop skills (Mother Lode, Clean Cuts, Verdant Bounty):
|
||||
Currently these start at about 5% chance and can reach a maximum 50% chance if a player acquired 10,000 skill, you can adjust this in advanced.yml
|
||||
These skills respect double drop settings from config.yml just like the corresponding Double Drop skills do, if a double drop is disabled for an item, then its disabled for triple drops too.
|
||||
I added a new Power Level Command, for now this just shows you your current power level. If I ever add features based on power level, this command will likely display output related to those features.
|
||||
|
||||
Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.
|
||||
|
||||
Version 2.1.231
|
||||
Fixed a bug preventing parties from being made without passwords (Thanks Momshroom)
|
||||
Updated korean locale (thanks mangchi57)
|
||||
Added some unit tests for party creation
|
||||
|
||||
Version 2.1.230
|
||||
Fixed an error that could happen when mcMMO was saving when parties were disabled by party.yml (thanks IAISI & L4BORG)
|
||||
Fixed several exceptions when checking PVP damage when parties were disabled by party.yml (thanks IAISI & L4BORG)
|
||||
|
||||
Version 2.1.229
|
||||
Added new party.yml config, which lets admins disable the party system entirely without having to use permissions
|
||||
Fixed error caused by missing API in McMMOEntityDamageByRuptureEvent
|
||||
(API) Major API changes to PartyManager
|
||||
(API) PartyManager is no longer a static singleton class, use mcMMO.getPartyManager() to get the PartyManager
|
||||
(API) Added com.gmail.nossr50.mcMMO.isPartySystemEnabled to check if the party system is enabled
|
||||
(API) Added com.gmail.nossr50.api.PartyAPI.isPartySystemEnabled as an alternative, to check if the party system is enabled
|
||||
(API) Added missing com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent.getHandlerList
|
||||
|
||||
NOTES:
|
||||
Admins can now enable/disable the whole party system with a setting in the new party.yml config
|
||||
You'll have to start your server one time to generate the config, then change the setting and reboot your server.
|
||||
|
||||
Version 2.1.228
|
||||
Fixed a stack trace due to Spigot API break on EntityDamageEvent and EntityDamageByEntity event
|
||||
(API) - Removed FakeEntityDamageEvent and FakeEntityDamageByEntityEvent
|
||||
(API) - Reworked McMMOEntityDamageByRuptureEvent, this no longer extends EntityDamageByEntityEvent, instead it extends EntityEvent
|
||||
|
||||
Notes:
|
||||
Some care went into keeping mcMMO compatible with older versions despite a big API break from Spigot, this may introduce some new bugs, so please report them if you run into any.
|
||||
|
||||
Version 2.1.227
|
||||
Fixed bug where some text would not be displayed to players (Adventure dependency update)
|
||||
Repair sound effect from mcMMO can now be adjusted in Minecraft sound options (Thanks MithicSpirit)
|
||||
Korean locale updated (Thanks Pindang2)
|
||||
Simplified Chinese locale updated (Thanks YuanYuanOwO)
|
||||
|
||||
NOTES:
|
||||
For those curious, mcMMO uses Adventure to do a lot of the message sending to players.
|
||||
It typically needs updating when new versions of MC come out, sorry for the delay on my part.
|
||||
|
||||
Version 2.1.226
|
||||
Added Short_Grass to experience.yml for Herbalism
|
||||
Updated Hylian Treasures "Bushes" alias to use short_grass when playing on new Minecraft versions
|
||||
Fixed dirt_path and grass_block not being correctly whitelisted for herbalism abilities
|
||||
Version 2.1.225
|
||||
Fixed text from mcMMO not being sent or displayed to the player
|
||||
Updated Adventure dependencies
|
||||
Added new API McMMOPlayerNotificationEvent.getPlayer
|
||||
|
||||
Version 2.1.224
|
||||
Updated to a new build of ACF to fix NoSuchFieldException locale
|
||||
Improved Folia Support (Thanks HSGamer)
|
||||
Fishing Shake has 8 ranks again
|
||||
|
||||
NOTES:
|
||||
At some point Shake got reduced to 1 rank, this didn't really make sense as it was meant to be a skill that ranked up and got better over time.
|
||||
It now has 8 ranks again, you may need to update advanced.yml and skillranks.yml to get the new ranks.
|
||||
Version 2.1.223
|
||||
Folia Support added (Thanks to HSGamer, TechnicallyCoded, Rockyers, and Yomamaeatstoes)
|
||||
|
||||
NOTES: This update brings mcMMO to Folia, not all features are guaranteed to work but from limited testing it appears to be working well.
|
||||
Version 2.1.222
|
||||
Fixed dupe exploit
|
||||
Glow Lichen default XP changed from 200 to 5
|
||||
A lot of mcMMO logging was moved from INFO to DEBUG, this should reduce the amount of noise in your logs and console
|
||||
|
||||
NOTES: If you want to see all logging messages, modify config.yml and set General.Verbose_Logging to true
|
||||
You will have to adjust experience.yml to get the balance changes, or delete it to generate a new one
|
||||
Version 2.1.221
|
||||
PAPI Support is now built into mcMMO and loads when mcMMO loads (as long as you have PAPI running)
|
||||
Fixed blast mining bonus drops not working (Thanks warriiorrrr)
|
||||
Added fail safes to prevent bonus drops metadata from lingering on blocks
|
||||
|
||||
NOTES: Placeholders were brought in from electroniccat's original work on a PAPI expansion for mcMMO, the placeholders are the same as a result
|
||||
I will be adding a leaderboard placeholder in the next patch (most likely). Feel free to share details of what functionality you'd want from additional placeholders on discord.
|
||||
Version 2.1.220
|
||||
(API) Added TreeFellerBlockBreakEvent class which extends FakeBlockBreakEvent (see notes), this is sent out during Tree Feller processing to allow other plugins to differentiate between Tree Feller and other fake block break events
|
||||
Config files update automatically again
|
||||
Default configs are now copied to plugins/mcMMO/defaults for easy reference
|
||||
Fixed child skills counting towards power level in /inspect (Thanks Wariorrrr)
|
||||
|
||||
NOTES: For a while configs were not updating automatically as a rewrite of how config files were loaded was partially done, this is now complete and configs will update automatically again.
|
||||
Fake block break events have been sent out historically by mcMMO to check other plugins for a players permission to break or place a block, Tree Feller will now specify via inheritance its own event type for this so mcMMO plugins can handle Tree Feller fake block break events differently if they so choose.
|
||||
You can now view the default configs more easily as they are now copied to plugins/mcMMO/defaults, these configs will be overwritten on start up to match the default values of the config in the JAR
|
||||
Version 2.1.219
|
||||
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
|
||||
Fixed wiki url being incorrect in commands
|
||||
Party loading is more resilient (Thanks Wariorrrr)
|
||||
Fixed periods not being replaced whe nrenaming party (Thanks Wariorrrr)
|
||||
Fixed Party Teleport NPE (Thanks Wariorrrr)
|
||||
Added support for various new things from Minecraft 1.20
|
||||
Fixed double drop issue with Beetroots
|
||||
Added 'Camel' to taming experience in experience.yml
|
||||
Added 'Sniffer' to taming experience in experience.yml
|
||||
Added 'Snifflet' to taming experience in experience.yml
|
||||
Added 'Pitcher_Plant' to bonus drops in config.yml
|
||||
Added 'Torchflower' to bonus drops in config.yml
|
||||
Added 'Pink_Petals' to bonus drops in config.yml
|
||||
Added 'Cherry_Log' to bonus drops in config.yml
|
||||
Added 'Cherry_Wood' to bonus drops in config.yml
|
||||
Added 'Camel' to combat experience in experience.yml
|
||||
Added 'Sniffer' to combat experience in experience.yml
|
||||
Added 'Snifflet' to combat experience in experience.yml
|
||||
Added 'Torchflower' to herbalism experience in experience.yml
|
||||
Added 'Pitcher_Plant' to herbalism experience in experience.yml
|
||||
Added 'Pink_Petals' to herbalism experience in experience.yml
|
||||
Added 'Cherry_Log' to woodcutting experience in experience.yml
|
||||
Added 'Cherry_Wood' to woodcutting experience in experience.yml
|
||||
Added 'Stripped_Cherry_Log' to woodcutting experience in experience.yml
|
||||
Added 'Stripped_Cherry_Wood' to woodcutting experience in experience.yml
|
||||
Added 'Skills.Mining.BlastMining.Bonus_Drops.Enabled' to advanced.yml to enable/disable bonus drops from Blast Mining
|
||||
NOTE: There are plans to add experience and potentially subskills for discovering items via the new brushing mechanic, but this will have to wait for new Spigot API to become available
|
||||
|
||||
Version 2.1.218
|
||||
Fixed locale pt_BR type (thanks MrPowerGamerBR)
|
||||
Updated Russian Locale (thanks imDaniX)
|
||||
Harvest Lumber checks main hand enchantments when delivering bonuses (thanks destro174)
|
||||
Fixed bug where players could use inspect to determine if vanished players were online (thanks DarkKnights22)
|
||||
|
||||
Version 2.1.217
|
||||
Tree Feller will now break blocks within the limit instead of refusing to fell the entire tree (partial big tree destruction)
|
||||
Mangrove trees resulting from growth are now marked as natural (existing trees marked unnatural before this update will not be retroactively fixed)
|
||||
Fixed a bug removing comments from configs (see notes)
|
||||
Fixed mouse-hover tooltip windows (thanks Greymagic27)
|
||||
|
||||
NOTES:
|
||||
Regarding the secure chat feature Minecraft rolled out, once APIs have updated I will look into rolling support for that into admin/party chat.
|
||||
Comments should no longer get removed from config but I haven't added any code to add missing comments back in, for now if you want comments you can delete the config file to regenerate it (sorry for the inconvenience)
|
||||
|
||||
Version 2.1.216
|
||||
Reverted Unarmed changes from 2.1.215 (fixes block breaker/beserk active at all time for all players)
|
||||
Added Sculk_* blocks to Mining XP
|
||||
You can use Hoe(s) to gain mining XP, Hoe(s) won't benefit from Super Breaker nor will they activate it (see notes)
|
||||
|
||||
NOTES:
|
||||
Hoe's being able to gain Mining XP is primarily for Sculk blocks which have Hoe as the fastest tool yet to me feel like Mining blocks, let me know what you think
|
||||
The Sculk blocks don't quite fit perfectly as mining-related, especially since hoes are the fastest tool to use for them. Let me know what you think.
|
||||
Version 2.1.215
|
||||
Fixed Coal Blocks and potentially other fuel sources not showing burning animation to players (see notes)
|
||||
Level up broadcasts from level milestones will now be visible to the player who achieved them
|
||||
Fixed a bug where hovering over skill descriptions did not display anything (thanks Greymagic27)
|
||||
Added Dripstone to experience.yml (thanks Greymagic27)
|
||||
Added Mangrove_Log to experience.yml (should fix behavior for tree-feller etc)
|
||||
Item in main hand is now used for Tree Feller drops (thanks destro174)
|
||||
|
||||
NOTES:
|
||||
The burning animation bug is actually in Spigot, it takes an int for setBurnTime when it really should only take a short as the game is expecting a short value, I implemented a hacky workaround via Math.min
|
||||
There is a bug where you may lose your config comments, this will be complex to solve, for now you can check our GitHub for the configs with comments.
|
||||
|
||||
Version 2.1.214
|
||||
Temporarily removed FakePlayerAnimationEvent (see notes)
|
||||
Players can now see their own level up broadcasts
|
||||
|
||||
NOTES:
|
||||
Spigot updated PlayerAnimationEvent with an API break between versions 1.18 and 1.19, as a temporary fix for mcMMO to be able to support both of these
|
||||
Minecraft versions I have temporarily removed FakePlayerAnimationEvent. I am working on a fix to dynamically use the correct API depending on the version of MC
|
||||
as many people will likely be stuck on 1.18 for a while.
|
||||
FakePlayerAnimationEvent existed to circumvent false positives on anti-cheat plugins such as NoCheat, however
|
||||
I am unsure if it is still needed and removing it may have no ill effects.. however I cannot be certain.
|
||||
Anti-cheat plugin authors should be informed to update if you run into false positives with mcMMO after this update so they can make the appropriate changes.
|
||||
Version 2.1.213
|
||||
Updated various mechanics to recognize and understand the new blocks
|
||||
Added 'Packed_Mud' to mining xp
|
||||
Added 'Mud_Bricks' to mining xp
|
||||
Added 'Reinforced_Deepslate' to mining xp
|
||||
Added 'Mud' to excavation xp
|
||||
Added 'Muddy Mangrove Roots' to excavation xp
|
||||
Added 'Mangrove_Roots' to woodcutting xp
|
||||
Added 'Stripped_Mangrove_Log' to woodcutting xp
|
||||
Added 'Stripped_Crimson_Stem' to woodcutting xp
|
||||
Added 'Stripped_Warped_Stem' to woodcutting xp
|
||||
Added 'Allay' to combat experience
|
||||
Added 'Frog' to combat experience and taming experience
|
||||
Added 'Tadpole' to combat experience
|
||||
Added 'Warden' to combat experience
|
||||
|
||||
Changes to excavation treasures (requires manual editing or regenerating the config)
|
||||
Added Mud as a block which can drop various treasures (see notes)
|
||||
Added Muddy_Mangrove_Roots as a block which can drop various treasures (see notes)
|
||||
Added Stick as a new excavation drop, which drops from mud and muddy mangrove roots (see notes)
|
||||
Added Potato as a new excavation drop, which drops from mud and dirt (see notes)
|
||||
Added Feather as a new excavation drop, which drops from mud (see notes)
|
||||
Added Spyglass as a new excavation drop, which drops rarely from mud and dirt (see notes)
|
||||
Added Trident as a new excavation drop, which drops somewhat rarely from mud, muddy mangrove roots, and clay (see notes)
|
||||
Added Heart of the Sea as a new excavation drop, which drops very rarely from mud and requires a very high excavation level to appear
|
||||
|
||||
NOTES:
|
||||
To get the new excavation drop list, the easiest way is to delete treasures.yml and mcMMO will regenerate it with the newest version
|
||||
I'll likely be tweaking the treasures list in the near future, leave feedback on discord if you have suggestions
|
||||
|
||||
Version 2.1.212
|
||||
An herbalism exploit has been patched (thanks WhatsTheBadNews)
|
||||
Added 'ExploitFix.Combat.XPCeiling.Enabled' to experience.yml
|
||||
Added 'ExploitFix.Combat.XPCeiling.Damage_Limit' to experience.yml
|
||||
Single instances of combat damage above 100 give are capped to give the same reward as 100 by default (100 is a lot, but you can change this in settings)
|
||||
|
||||
NOTES: The damage ceiling won't affect server that don't have mobs running around with abnormally high health, if your server does you'll want to adjust this limit or disable it.
|
||||
Version 2.1.211
|
||||
Added /mmodebug info for players hitting other players
|
||||
Fixed Immortal Player bug
|
||||
Removed all of Spigot's buggy and deprecated DamageModifier API, this fixes the bug where players would become immortal when using certain other plugins
|
||||
Rupture is back to doing "pure" damage (due to the above change)
|
||||
|
||||
NOTES:
|
||||
Rupture damage will be tweaked based on feedback as it is dealing "pure" damage
|
||||
Version 2.1.210
|
||||
Fixed a memory leak involving mob metadata
|
||||
Fixed a potential null pointer exception in InventoryListener
|
||||
|
||||
NOTES:
|
||||
If you're having issues with "immortal players" this is a known plugin incompatibility between mcMMO and another plugin, I need more info on what plugins need to be present to cause it. Please post info to GitHub issues or tag me on discord.
|
||||
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
|
||||
If you run into issues with this version of mcMMO, please post about it on GitHub
|
||||
|
||||
Version 2.1.209
|
||||
Fixed a bug where some config files did not get trimmed completely
|
||||
|
||||
NOTES:
|
||||
This should fix the issue for everyone, let me know if you still run into trouble!
|
||||
Don't be afraid to ping me on discord
|
||||
|
||||
Version 2.1.208
|
||||
Significantly rewrote to how mcMMO loads/updates config files
|
||||
Fixed a bug where huge config files caused the server to take forever to start/shutdown
|
||||
Fixed config files duplicating comments and updated their code to use Spigot API (thanks the456gamer)
|
||||
mcMMO now repairs config files (removing duplicate comments, see notes)
|
||||
Updated lithuanian locale (thanks dexasz)
|
||||
|
||||
NOTES:
|
||||
Due to a change in Spigot mcMMO started growing config files at an alarming rate until they became so big they wouldn't load, and well before they got to that stage they slowed down loading the server
|
||||
mcMMO now uses the Spigot API in a smarter way for config files
|
||||
|
||||
Version 2.1.207
|
||||
Fixed an IndexOutOfBounds exception with our BlockTracker
|
||||
Fixed a bug where leveling up a party at level cap would spam the chat with messages
|
||||
mcMMO will no longer use enchanted repair materials (thanks JeBobs)
|
||||
Added an option to allow enchanted repair materials 'Skills.Repair.Use_Enchanted_Materials' in config.yml
|
||||
Temporarily rolling required Java version back to 16
|
||||
Added unicode (UTF-8) support to locale files (no more UTF-16 codes needed)
|
||||
Added locale key 'Scoreboard.Disabled' to en_US
|
||||
Added locale key 'Scoreboard.NotSetupYet' to en_US
|
||||
Fixed a bug where Salvage sent messages even though the event was cancelled (Thanks TheBusyBiscuit)
|
||||
|
||||
Version 2.1.206
|
||||
Fixed a memory leak involving Herbalism under specific circumstances
|
||||
Fixed a memory leak involving Rupture under specific circumstances
|
||||
Fixed a memory leak involving Dodge
|
||||
Fixed a memory leak involving Endermen and block pickups
|
||||
Fixed a memory leak from plugin conflicts when double drops get activated
|
||||
Fixed a memory leak that required a specific config.yml setup with mob health bars
|
||||
You can no longer set mob health bars to -1 in config.yml to set it to display permanently (this was problematic behavior)
|
||||
Fixed a bug preventing Action Bar messages from showing
|
||||
Fixed a bug where Alchemy XP wasn't being granted
|
||||
Lowered the default volume of level up from .75 to .3 in sounds.yml (delete sounds.yml to get this change automagically)
|
||||
Updated adventure platform dependency
|
||||
Updated to use Java 17
|
||||
|
||||
NOTES:
|
||||
mcMMO will target the newest version of MC moving forward, any backwards compatibility with prior versions of Minecraft should be considered a side effect rather than intended.
|
||||
|
||||
Version 2.1.205
|
||||
Fixed yet another exception preventing Alchemy from working (thanks NemuruYama)
|
||||
Added some code to cleanup potential memory leaks
|
||||
|
||||
NOTES:
|
||||
Sorry for the delay in this patch, I have had a terrible cold all weekend, feeling better now
|
||||
|
||||
Version 2.1.204
|
||||
Fixed IndexOutOfBounds exception (thanks gecko10000) (related to Alchemy)
|
||||
Added double smelt to copper ingot and netherite scrap (thanks Lyther)
|
||||
|
||||
Version 2.1.203
|
||||
mcMMO now requires Java 16
|
||||
mcMMO now requires the newest version of Minecraft (currently 1.17.1)
|
||||
Fixed several API breaks (mostly affected Alchemy)
|
||||
Fixed a bug relating to Shake percentages (thanks Lyther)
|
||||
Fixed hexcolors not displaying correctly in level up milestone broadcasts (thanks gecko10000)
|
||||
(API) Added deprecated constructors for PlayerProfile (thanks PikaMug)
|
||||
mcMMO has had many of its dependencies updated to newer builds
|
||||
|
||||
NOTES:
|
||||
If you want to play mcMMO on older versions, simply use 2.1.202 instead
|
||||
Keeping mcMMO backwards compatible with older versions is getting messy, and I'd rather be able to focus my attention at newer features than having to make an elaborate build process (or alternatively hacky code) to support older versions of the game
|
||||
Furthermore, it seems most people are playing 1.17.1 by a wide margin
|
||||
You may have trouble compiling the source code if your maven is not setup to run JDK16, if you get any errors when compiling this is likely the reason
|
||||
|
||||
The data from bstats went into making this decision (shoutout to Qixils for typing this up too)
|
||||
71.9% of servers are running 1.17.X
|
||||
97.9% of servers are running ≥1.16
|
||||
99.3% of servers are running ≥1.15
|
||||
|
||||
Version 2.1.202
|
||||
Fixed a bug where mcMMO didn't reward XP for Kelp
|
||||
Fixed a bug where mcMMO marked bonemealed Azalea trees as unnatural (and thus did not give XP or get affected by Tree Feller)
|
||||
Added Amethyst_Block to experience.yml for Mining
|
||||
Added Flowering Azalea Leaves to Tree Feller's white list
|
||||
Fixed a bug where mcMMO didn't appropriately flag blocks as natural in some tree growing events
|
||||
(SQL) Added more MySQL/MariaDB settings (allowPublicKeyRetrieval - thanks rosaage)
|
||||
(API) Added CREATED_PARTY and DISBANDED_PARTY to EventReason (used in some party events - thanks PikaMug )
|
||||
Party member name matching is no longer case sensitive (thanks Wariorrrr)
|
||||
Updated zh_CN locale (thanks GhostDC)
|
||||
Added some settings for over fishing (Settings are in experience.yml under Fishing_ExploitFix_Options - thanks tunagohan)
|
||||
|
||||
NOTES:
|
||||
This means tree feller will correctly traverse flowering azalea leaves during its ability
|
||||
|
||||
Version 2.1.201
|
||||
Tweaked the visual/audio effect for Rupture
|
||||
(API) TNT is set as the source in Blast Mining (1.16.1 and up)
|
||||
Fixed an exploit related to Ability Buffs remaining on tools
|
||||
Blast Mining no longer drops Budding Amethyst since its not legal to obtain this item through normal gameplay
|
||||
Added mcinspect and mmoinspect aliases to inspect command
|
||||
Portuguese translation of Woodcutting changed back to Lenhador
|
||||
Updated zh_CN (Chinese) locale, thanks GhostDC!
|
||||
Major changes to zh_TW locale, thanks gregman98
|
||||
Added '/skill keep' shortcut (for example /mining keep) thanks GriffinCodes
|
||||
Impact is now more balanced as the formula has been changed (see notes) thanks emanondev
|
||||
|
||||
NOTES:
|
||||
Impact will deal less durability damage to armors without unbreaking, and more to armors with unbreaking
|
||||
|
||||
Version 2.1.200
|
||||
Fixed a major 1.17 exploit
|
||||
Dodge will no longer trigger while blocking
|
||||
Action Bar messages can now be disabled (thanks TheBusyBiscuit)
|
||||
mcMMO is better at MC version parsing now (thanks stepech & TheBusyBiscuit)
|
||||
|
||||
Version 2.1.199
|
||||
Fixed IndexOutOfBounds error for servers running 1.17 or higher
|
||||
Fixed a bug that caused MySQL/MariaDB to malfunction for 1.17 (see notes)
|
||||
Renamed Deepslate Lapis Lazuli Ore to Deepslate Lapis Ore in experience.yml and config.yml
|
||||
Added some code to prevent mcMMO from breaking if it doesn't recognize the version of the game
|
||||
Optimized CompatibilitySupportLayer - this handles some of the logic for supporting multiple versions of the game
|
||||
Added Unit Tests for MinecraftGameVersion
|
||||
|
||||
NOTES:
|
||||
I have temporarily disabled SSL for MySQL/MariaDB for 1.17 ( proper fix coming soon )
|
||||
|
||||
Version 2.1.198
|
||||
Fixed a bug where Smelting didn't work with the new 1.17 materials
|
||||
Updated dependency Adventure to 4.8.0 (thanks TheBusyBiscuit)
|
||||
|
||||
Version 2.1.197
|
||||
This update adds compatibility for new mobs and blocks from 1.17
|
||||
This build of mcMMO should be more compatible with certain versions of ViaVersion
|
||||
Players are no longer launched from Minecarts when using a Fishing Rod (they are still dismounted) thanks lexikiq
|
||||
Updated Japanese locale (thanks ViaSnake)
|
||||
Updated Brazil Portuguese (pt_BR) locale (thanks Paulo Guilherme)
|
||||
Added Goat to experience.yml for combat and taming
|
||||
Added Axolotl to experience.yml for combat and taming
|
||||
Added Glow_Squid to experience.yml for combat and taming
|
||||
Added Glow Berries to Farmer's Diet
|
||||
Updated Super Breaker to recognize the new pick-axe appropriate blocks
|
||||
Updated Tree Feller to recognize Azalea Leaves
|
||||
|
||||
Added Rooted Dirt to experience.yml for Excavation
|
||||
Added Small Dripleaf to experience.yml for Herbalism
|
||||
Added Big Dripleaf to experience.yml for Herbalism
|
||||
Added Moss Block to experience.yml for Herbalism
|
||||
Added Cave Vines to experience.yml for Herbalism
|
||||
Added Cave Vines Plant to experience.yml for Herbalism
|
||||
Added Glow Lichen to experience.yml for Herbalism
|
||||
Added Tuff to experience.yml for Mining
|
||||
Added Calcite to experience.yml for Mining
|
||||
Added Smooth Basalt to experience.yml for Mining
|
||||
Added Block_Of_Amethyst to experience.yml for Mining
|
||||
Added Budding Amethyst to experience.yml for Mining
|
||||
Added Small_Amethyst_Bud to experience.yml for Mining
|
||||
Added Medium Amethyst Bud to experience.yml for Mining
|
||||
Added Large Amethyst Bud to experience.yml for Mining
|
||||
Added Amethyst Cluster to experience.yml for Mining
|
||||
Added Deepslate to experience.yml for Mining
|
||||
Added Cobbled Deepslate to experience.yml for Mining
|
||||
Added Copper Ore to experience.yml for Mining
|
||||
Added Deepslate Redstone Ore to experience.yml for Mining
|
||||
Added Deepslate Copper Ore to experience.yml for Mining
|
||||
Added Deepslate Coal Ore to experience.yml for Mining
|
||||
Added Deepslate Diamond Ore to experience.yml for Mining
|
||||
Added Deepslate Emerald Ore to experience.yml for Mining
|
||||
Added Deepslate Iron Ore to experience.yml for Mining
|
||||
Added Deepslate Gold Ore to experience.yml for Mining
|
||||
Added Deepslate Lapis Lazuli Ore to experience.yml for Mining
|
||||
Added Lapis Lazuli Ore to experience.yml for Mining (was missing)
|
||||
|
||||
Added Moss Block to Bonus Drops for Herbalism in config.yml
|
||||
Added Glow Berries to Bonus Drops for Herbalism in config.yml
|
||||
Added Cave Vines to Bonus Drops for Herbalism in config.yml
|
||||
Added Cave Vines Plant to Bonus Drops for Herbalism in config.yml
|
||||
Added Tuff to Bonus Drops for Mining in config.yml
|
||||
Added Amethyst Shard to Bonus Drops for Mining in config.yml
|
||||
Added Calcite to Bonus Drops for Mining in config.yml
|
||||
Added Smooth Basalt to Bonus Drops for Mining in config.yml
|
||||
Added Block_Of_Amethyst to Bonus Drops for Mining in config.yml
|
||||
Added Budding Amethyst to Bonus Drops for Mining in config.yml
|
||||
Added Small_Amethyst_Bud to Bonus Drops for Mining in config.yml
|
||||
Added Medium Amethyst Bud to Bonus Drops for Mining in config.yml
|
||||
Added Large Amethyst Bud to Bonus Drops for Mining in config.yml
|
||||
Added Amethyst Cluster to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate to Bonus Drops for Mining in config.yml
|
||||
Added Cobbled Deepslate to Bonus Drops for Mining in config.yml
|
||||
Added Raw Iron to Bonus Drops for Mining in config.yml
|
||||
Added Raw Gold to Bonus Drops for Mining in config.yml
|
||||
Added Raw Copper to Bonus Drops for Mining in config.yml
|
||||
Added Copper Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Redstone Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Copper Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Coal Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Diamond Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Emerald Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Iron Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Gold Ore to Bonus Drops for Mining in config.yml
|
||||
Added Deepslate Lapis Lazuli Ore to Bonus Drops for Mining in config.yml
|
||||
Added Lapis Lazuli Ore to Bonus Drops for Mining in config.yml (was missing)
|
||||
|
||||
Added Cobbled Deepslate to experience.yml for Smelting
|
||||
Added Raw Copper to experience.yml for Smelting
|
||||
Added Raw Iron to experience.yml for Smelting
|
||||
Added Raw Gold to experience.yml for Smelting
|
||||
Added Copper Ore to experience.yml for Smelting
|
||||
Added Deepslate Redstone Ore to experience.yml for Smelting
|
||||
Added Deepslate Copper Ore to experience.yml for Smelting
|
||||
Added Deepslate Coal Ore to experience.yml for Smelting
|
||||
Added Deepslate Diamond Ore to experience.yml for Smelting
|
||||
Added Deepslate Emerald Ore to experience.yml for Smelting
|
||||
Added Deepslate Iron Ore to experience.yml for Smelting
|
||||
Added Deepslate Gold Ore to experience.yml for Smelting
|
||||
Added Deepslate Lapis Lazuli Ore to experience.yml for Smelting
|
||||
Added Lapis Lazuli Ore to experience.yml for Smelting (was missing)
|
||||
|
||||
NOTES:
|
||||
Another patch will follow this one shortly to add more 1.17 support, I am waiting on the Spigot API to test some stuff which isn't out yet.
|
||||
You shouldn't need to edit your configs for this update, your configs should update automatically.
|
||||
Expect some patches following this update for Axolotl and other new entities, waiting on the Spigot API to become available
|
||||
If you run into any issues with ViaVersion or ViaBackwards, use the latest dev builds for each.
|
||||
|
||||
Version 2.1.196
|
||||
Removed the explosion from Rupture
|
||||
Adjusted Rupture to play its particle effect less often
|
||||
Fixed a bug where Rupture never applied to additional targets during Serrated Strikes
|
||||
Fixed a bug where players without Rupture permission could use Rupture during Serrated Strikes
|
||||
Fixed a possible null error for our SelfListener
|
||||
Added locale string 'Swords.Combat.Rupture.Note.Update.One'
|
||||
Updated locale string 'Guides.Swords.Section.1'
|
||||
Crossbows can now be fished up with enchantments
|
||||
(API) Added McMMOEntityDamageByRuptureEvent (thanks qixils)
|
||||
|
||||
NOTES:
|
||||
For now Rupture is non-lethal, I may add back a lethal component at the end of its damage
|
||||
Rupture will be in a state of change for a while as I receive feedback (give me feedback in Discord!)
|
||||
Crossbows is not in the default fishing loot list, you'd have to add it yourself.
|
||||
For Devs: McMMOEntityDamageByRuptureEvent extends EntityDamageByEntityEvent and uses CUSTOM type damage
|
||||
|
||||
Version 2.1.195
|
||||
Fixed a null connection error which affected some SQL users
|
||||
@@ -990,7 +1382,7 @@ Version 2.1.128
|
||||
Fixed a bug where certain types of ore did not receive bonuses from Blast Mining
|
||||
Fixed a few locale errors with commands
|
||||
(API) Added ExperienceAPI::addCombatXP for adding combat XP to players, signature may change so its deprecated for now
|
||||
mcMMO now logs whether or not its using FlatFile or SQL database on load
|
||||
mcMMO now logs whether its using FlatFile or SQL database on load
|
||||
(1.16) Strider added to combat experience with a value of 1.2
|
||||
|
||||
NOTES: A more thorough look at Unarmed balance will happen in the future, the intention of this nerf is to make Unarmed less rewarding until it is leveled quite a bit.
|
||||
@@ -1010,7 +1402,7 @@ Version 2.1.127
|
||||
Version 2.1.126
|
||||
mcMMO now relies on NMS for some of its features, if NMS cannot properly be wired up when initializing mcMMO behaviours relying on NMS will either be partially supported or disabled
|
||||
mcMMO now has a compatibility mode, any features that require specific versions of Minecraft for full functionality will be disabled if your server is not running a compatible version, mcMMO will still function in compatibility mode, but either the feature will be modified or disabled depending on the version of the server software
|
||||
New command /mmocompat - Shows information about whether or not mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console.
|
||||
New command /mmocompat - Shows information about whether mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console.
|
||||
New command /mmoxpbar (alias /xpbarsettings) - Players can choose to always show XP bars or to never show XP bars on a per skill basis
|
||||
XPBars now last for 3 seconds before hiding instead of 2 seconds
|
||||
Fixed an exploit involving fishing rods
|
||||
@@ -1646,7 +2038,7 @@ Version 2.1.68
|
||||
Fixed a bug where consuming food in the off hand did not trigger the Diet abilities
|
||||
|
||||
Version 2.1.67
|
||||
The XP bar now reflects whether or not the player is receiving the early game boost
|
||||
The XP bar now reflects whether the player is receiving the early game boost
|
||||
Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP
|
||||
New locale string 'XPBar.Template.EarlyGameBoost'
|
||||
|
||||
@@ -1695,7 +2087,7 @@ Version 2.1.63
|
||||
Version 2.1.62
|
||||
Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission)
|
||||
Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2)
|
||||
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled
|
||||
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether the XP rate event messages are enabled
|
||||
Updated hu_HU locale (thanks andris155)
|
||||
Added XP for mining Magma_Block (default 30 XP - Update your config, see notes)
|
||||
Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes)
|
||||
@@ -1703,9 +2095,9 @@ Version 2.1.62
|
||||
New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console
|
||||
New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below
|
||||
New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations sent to the user who executed the command
|
||||
New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled
|
||||
New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether messages for the event are enabled
|
||||
New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued
|
||||
New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled
|
||||
New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether messages for the event are enabled
|
||||
New locale string - 'Notifications.Admin.XPRate.End.Others' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued
|
||||
|
||||
NOTES:
|
||||
@@ -1976,7 +2368,7 @@ Version 2.1.26
|
||||
|
||||
Notes:
|
||||
The new Limit Break subskills are intended to make Prot IV players less tanky and for you to feel more powerful for having high skill level.
|
||||
Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an end game skill compared to before.
|
||||
Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an endgame skill compared to before.
|
||||
With these new changes, most skills can 2 shot normal diamond armor, and it takes about 5 hits to kill someone in Prot IV Diamond Armor.
|
||||
I'm not sure everyone will like these changes, the net result is players are a lot easier to kill now, whereas before you could take quite a beating before getting killed.
|
||||
I collected several sets of data before making these changes, including damage to player with and without prot 4 diamond armor, damage to those players with and without enchanted weapons, damage with and without leveling your skills, and combinations of the previously mentioned things.
|
||||
@@ -3677,7 +4069,7 @@ Removed performance debugging
|
||||
Removed some useless settings from the config file
|
||||
|
||||
Version 1.0.34
|
||||
Fixed the PVP setting determining whether or not you would hurt yourself from AoE Abilities
|
||||
Fixed the PVP setting determining whether you would hurt yourself from AoE Abilities
|
||||
Added Dutch (nl) language support
|
||||
Super Breaker now gives the correct XP as determined by config.yml
|
||||
Sand Stone XP is now configurable and no longer shares the 'stone' node
|
||||
@@ -3687,7 +4079,7 @@ Version 1.0.33
|
||||
Fixed the toggle for the Excavation drop 'Cocoa Beans'
|
||||
Fixed bug where Unarmed users could disarm without being bare handed
|
||||
Cocoa Beans now have an XP modifier in config.yml
|
||||
You can now toggle whether or not Mobspawners will give XP (in config.yml)
|
||||
You can now toggle whether Mobspawners will give XP (in config.yml)
|
||||
MySQL version now makes requests to the MySQL server less frequently (should help performance)
|
||||
Fixed bug with Skull Splitter hitting the user
|
||||
|
||||
|
||||
46
README.md
46
README.md
@@ -11,7 +11,12 @@ Spigot Resource: https://spigot.mcmmo.org
|
||||
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
|
||||
|
||||
### Builds
|
||||
Currently, you can obtain our builds via the Spigot resource page: http://spigot.mcmmo.org
|
||||
Currently, you can obtain our builds via the Spigot or Polymart:
|
||||
|
||||
|
||||
http://spigot.mcmmo.org
|
||||
|
||||
https://polymart.org/resource/mcmmo.727
|
||||
|
||||
### Brief Description
|
||||
The goal of mcMMO is to take core Minecraft game mechanics and expand them into an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
|
||||
@@ -21,20 +26,14 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
|
||||
#### Project Lead & Founder
|
||||
[](https://github.com/nossr50)
|
||||
|
||||
#### mcMMO Devs
|
||||
#### Current mcMMO Devs
|
||||
[](https://github.com/nossr50)
|
||||
[](https://github.com/kashike)
|
||||
[](https://github.com/electronicboy)
|
||||
|
||||
#### Classic Maintainer
|
||||
[](https://github.com/t00thpick1)
|
||||
|
||||
## Former Team Members
|
||||
|
||||
### Former Lead & Awesome guy
|
||||
[](https://github.com/gmcferrin)
|
||||
|
||||
### Former team members
|
||||
[](https://github.com/gmcferrin)
|
||||
[](https://github.com/kashike)
|
||||
[](https://github.com/electronicboy)
|
||||
[](https://github.com/t00thpick1)
|
||||
[](https://github.com/bm01)
|
||||
[](https://github.com/Glitchfinder)
|
||||
[](https://github.com/NuclearW)
|
||||
@@ -43,20 +42,23 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
|
||||
[](https://github.com/riking)
|
||||
[](https://github.com/TheYeti)
|
||||
|
||||
#### Folia Contributors
|
||||
[<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)
|
||||
|
||||
## Compiling
|
||||
|
||||
mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO.
|
||||
mcMMO uses Maven to manage dependencies, packaging, and shading of necessary classes; Maven is required to compile mcMMO. It is recommended to always use the latest version of maven.
|
||||
|
||||
The typical command used to build mcMMO is: `mvn clean package install`
|
||||
|
||||
Required Libraries:
|
||||
* Spigot
|
||||
* JUnit
|
||||
* WorldGuard 7
|
||||
* bStats Bukkit
|
||||
The typical command used to build mcMMO is: `mvn clean install`
|
||||
|
||||
https://spigot.mcmmo.org for more up to date information.
|
||||
|
||||
Resource Page
|
||||
Downloads:
|
||||
|
||||
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
|
||||
|
||||
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
|
||||
|
||||
https://polymart.org/resource/mcmmo.727
|
||||
|
||||
275
pom.xml
Executable file → Normal file
275
pom.xml
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.2.000-ALPHA-SNAPSHOT</version>
|
||||
<version>2.2.000-RC1</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<issueManagement>
|
||||
@@ -72,28 +75,37 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
<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>2.22.2</version>
|
||||
<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>3.8.1</version>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg> <!-- used for ACF syntax stuff -->
|
||||
</compilerArgs>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<excludes>
|
||||
</excludes>
|
||||
</configuration>
|
||||
@@ -118,7 +130,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
@@ -131,7 +143,6 @@
|
||||
<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-common</include>
|
||||
<include>net.kyori:adventure-platform-viaversion</include>
|
||||
<include>net.kyori:adventure-platform-facet</include>
|
||||
<include>net.kyori:adventure-nbt</include>
|
||||
@@ -139,28 +150,21 @@
|
||||
<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>net.kyori:option</include>
|
||||
<include>co.aikar:acf-bukkit</include>
|
||||
<include>com.neetgames:mcMMO-API</include>
|
||||
<!-- <include>com.neetgames:jmal</include>-->
|
||||
<include>com.neetgames:NEET-lib</include>
|
||||
<include>com.tcoded:FoliaLib</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<!-- <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>-->
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.kyori.examination</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.kyori.examination</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>net.kyori.adventure</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori.adventure</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.neetgames.neetlib</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.neetlib</shadedPattern>
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>co.aikar.commands</pattern>
|
||||
@@ -186,6 +190,10 @@
|
||||
<pattern>org.bstats</pattern>
|
||||
<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>
|
||||
<executions>
|
||||
@@ -202,15 +210,18 @@
|
||||
<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>neet-games</id>
|
||||
<url>https://nexus.neetgames.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
@@ -220,8 +231,8 @@
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://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>
|
||||
@@ -231,122 +242,132 @@
|
||||
<id>aikar</id>
|
||||
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
||||
</repository>
|
||||
<repository> <!-- for development builds -->
|
||||
<id>sonatype-oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
<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>
|
||||
<!-- <dependencyManagement>-->
|
||||
<!-- <dependencies>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.junit</groupId>-->
|
||||
<!-- <artifactId>junit-bom</artifactId>-->
|
||||
<!-- <version>5.7.1</version>-->
|
||||
<!-- <type>pom</type>-->
|
||||
<!-- <scope>import</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- </dependencies>-->
|
||||
<!-- </dependencyManagement>-->
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
|
||||
<dependency>
|
||||
<groupId>com.neetgames</groupId>
|
||||
<artifactId>mcMMO-API</artifactId>
|
||||
<version>0.01.00-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.neetgames</groupId>
|
||||
<artifactId>jmal-core</artifactId>
|
||||
<version>0.01.00-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.neetgames</groupId>
|
||||
<artifactId>jmal-bukkit</artifactId>
|
||||
<version>0.01.00-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.neetgames</groupId>
|
||||
<artifactId>NEET-lib</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.seeseemelk</groupId>
|
||||
<artifactId>MockBukkit-v1.16</artifactId>
|
||||
<version>0.25.0</version>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.2.224</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<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.0-SNAPSHOT</version> <!-- Replace this as well -->
|
||||
<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.2</version>
|
||||
</dependency>
|
||||
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||
<version>4.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-nbt</artifactId>
|
||||
<version>4.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-key</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<artifactId>adventure-text-serializer-json</artifactId>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-nbt</artifactId>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-key</artifactId>
|
||||
<version>4.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-api</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<version>4.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-common</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-nbt</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-facet</artifactId>
|
||||
<version>4.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-viaversion</artifactId>
|
||||
<version>4.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>option</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.scm</groupId>
|
||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||
<version>1.9.4</version>
|
||||
<version>2.0.0-M1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.5-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 -->
|
||||
@@ -369,50 +390,44 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.7.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.7.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<version>5.6.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-api-mockito2</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<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>19.0.0</version>
|
||||
<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>
|
||||
</project>
|
||||
|
||||
@@ -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.mcMMO;
|
||||
import com.gmail.nossr50.util.MetadataConstants;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -84,7 +84,7 @@ public final class AbilityAPI {
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
if(entity.isValid()) {
|
||||
if(entity.hasMetadata(mcMMO.RUPTURE_META_KEY)) {
|
||||
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,142 +1,142 @@
|
||||
//package com.gmail.nossr50.api;
|
||||
//
|
||||
//import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
//import com.gmail.nossr50.mcMMO;
|
||||
//import com.gmail.nossr50.util.player.UserManager;
|
||||
//import org.bukkit.entity.Player;
|
||||
//
|
||||
//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, 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);
|
||||
//// }
|
||||
//
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class ChatAPI {
|
||||
private ChatAPI() {}
|
||||
|
||||
// /**
|
||||
// * Check if a player is currently talking in party chat.
|
||||
// * Send a message to all members of a party
|
||||
// * </br>
|
||||
// * This function is designed for API usage.
|
||||
// *
|
||||
// * @param player The player to check
|
||||
// * @return true if the player is using party chat, false otherwise
|
||||
// * @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 boolean isUsingPartyChat(Player player) {
|
||||
// return UserManager.getPlayer(player).getChatChannel() == ChatChannel.PARTY;
|
||||
// public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
|
||||
// getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Check if a player is currently talking in party chat.
|
||||
// * Send a message to all members of a party
|
||||
// * </br>
|
||||
// * This function is designed for API usage.
|
||||
// *
|
||||
// * @param playerName The name of the player to check
|
||||
// * @return true if the player is using party chat, false otherwise
|
||||
// * @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 boolean isUsingPartyChat(String playerName) {
|
||||
// return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.PARTY;
|
||||
// public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
|
||||
// getPartyChatManager(plugin, party).handleChat(sender, message);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Check if a player is currently talking in admin chat.
|
||||
// * Send a message to administrators
|
||||
// * </br>
|
||||
// * This function is designed for API usage.
|
||||
// *
|
||||
// * @param player The player to check
|
||||
// * @return true if the player is using admin chat, false otherwise
|
||||
// * @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 boolean isUsingAdminChat(Player player) {
|
||||
// return UserManager.getPlayer(player).getChatChannel() == ChatChannel.ADMIN;
|
||||
// public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
|
||||
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, displayName, message);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Check if a player is currently talking in admin chat.
|
||||
// * Send a message to administrators
|
||||
// * </br>
|
||||
// * This function is designed for API usage.
|
||||
// *
|
||||
// * @param playerName The name of the player to check
|
||||
// * @return true if the player is using admin chat, false otherwise
|
||||
// * @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 boolean isUsingAdminChat(String playerName) {
|
||||
// return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.ADMIN;
|
||||
// public static void sendAdminChat(Plugin plugin, String sender, String message) {
|
||||
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, message);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Toggle the party chat mode of a player.
|
||||
// *
|
||||
// * @param player The player to toggle party chat on.
|
||||
// */
|
||||
// public static void togglePartyChat(Player player) {
|
||||
// mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.PARTY);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Toggle the party chat mode of a player.
|
||||
// *
|
||||
// * @param playerName The name of the player to toggle party chat on.
|
||||
// */
|
||||
// public static void togglePartyChat(String playerName) {
|
||||
// mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.PARTY);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Toggle the admin chat mode of a player.
|
||||
// *
|
||||
// * @param player The player to toggle admin chat on.
|
||||
// */
|
||||
// public static void toggleAdminChat(Player player) {
|
||||
// mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.ADMIN);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Toggle the admin chat mode of a player.
|
||||
// *
|
||||
// * @param playerName The name of the player to toggle party chat on.
|
||||
// */
|
||||
// public static void toggleAdminChat(String playerName) {
|
||||
// mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.ADMIN);
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingPartyChat(Player player) {
|
||||
return UserManager.getPlayer(player).getChatChannel() == ChatChannel.PARTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in party chat.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using party chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingPartyChat(String playerName) {
|
||||
return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.PARTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingAdminChat(Player player) {
|
||||
return UserManager.getPlayer(player).getChatChannel() == ChatChannel.ADMIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is currently talking in admin chat.
|
||||
*
|
||||
* @param playerName The name of the player to check
|
||||
* @return true if the player is using admin chat, false otherwise
|
||||
*/
|
||||
public static boolean isUsingAdminChat(String playerName) {
|
||||
return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.ADMIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the party chat mode of a player.
|
||||
*
|
||||
* @param player The player to toggle party chat on.
|
||||
*/
|
||||
public static void togglePartyChat(Player player) {
|
||||
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.PARTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the party chat mode of a player.
|
||||
*
|
||||
* @param playerName The name of the player to toggle party chat on.
|
||||
*/
|
||||
public static void togglePartyChat(String playerName) {
|
||||
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.PARTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the admin chat mode of a player.
|
||||
*
|
||||
* @param player The player to toggle admin chat on.
|
||||
*/
|
||||
public static void toggleAdminChat(Player player) {
|
||||
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(player), ChatChannel.ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the admin chat mode of a player.
|
||||
*
|
||||
* @param playerName The name of the player to toggle party chat on.
|
||||
*/
|
||||
public static void toggleAdminChat(String playerName) {
|
||||
mcMMO.p.getChatManager().setOrToggleChatChannel(UserManager.getPlayer(playerName), ChatChannel.ADMIN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ 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.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;
|
||||
@@ -20,7 +19,6 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class ExperienceAPI {
|
||||
@@ -35,13 +33,13 @@ 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) {
|
||||
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 or not the entity should reward XP when giving out the 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
|
||||
@@ -56,7 +54,7 @@ public final class ExperienceAPI {
|
||||
|
||||
/**
|
||||
* Start the task that gives combat XP.
|
||||
* Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the 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
|
||||
@@ -706,7 +704,7 @@ public final class ExperienceAPI {
|
||||
PrimarySkillType skill = getSkillType(skillType);
|
||||
|
||||
if (SkillTools.isChildSkill(skill)) {
|
||||
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
|
||||
|
||||
for (PrimarySkillType parentSkill : parentSkills) {
|
||||
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||
@@ -737,7 +735,7 @@ public final class ExperienceAPI {
|
||||
PrimarySkillType skill = getSkillType(skillType);
|
||||
|
||||
if (SkillTools.isChildSkill(skill)) {
|
||||
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
|
||||
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
|
||||
|
||||
for (PrimarySkillType parentSkill : parentSkills) {
|
||||
profile.addLevels(parentSkill, (levels / parentSkills.size()));
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
public enum FakeBlockBreakEventType {
|
||||
FAKE,
|
||||
TREE_FELLER
|
||||
}
|
||||
@@ -1,17 +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
|
||||
//}
|
||||
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
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ package com.gmail.nossr50.api;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -24,13 +25,22 @@ public final class PartyAPI {
|
||||
* @return the name of the player's party, or null if not in a party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
if (!inParty(player)) {
|
||||
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || !inParty(player)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return UserManager.getPlayer(player).getParty().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the party system is enabled.
|
||||
*
|
||||
* @return true if the party system is enabled, false otherwise
|
||||
*/
|
||||
public static boolean isPartySystemEnabled() {
|
||||
return mcMMO.p.getPartyConfig().isPartyEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player is in a party.
|
||||
* </br>
|
||||
@@ -40,7 +50,7 @@ public final class PartyAPI {
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||
return false;
|
||||
|
||||
return UserManager.getPlayer(player).inParty();
|
||||
@@ -51,12 +61,15 @@ public final class PartyAPI {
|
||||
* </br>
|
||||
* This function is designed for API usage.
|
||||
*
|
||||
* @param playera The first player to check
|
||||
* @param playerb The second player to check
|
||||
* @param playerA The first player to check
|
||||
* @param playerB The second player to check
|
||||
* @return true if the two players are in the same party, false otherwise
|
||||
*/
|
||||
public static boolean inSameParty(Player playera, Player playerb) {
|
||||
return PartyManager.inSameParty(playera, playerb);
|
||||
public static boolean inSameParty(Player playerA, Player playerB) {
|
||||
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return false;
|
||||
|
||||
return mcMMO.p.getPartyManager().inSameParty(playerA, playerB);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +80,7 @@ public final class PartyAPI {
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public static List<Party> getParties() {
|
||||
return PartyManager.getParties();
|
||||
return mcMMO.p.getPartyManager().getParties();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,23 +94,29 @@ public final class PartyAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addToParty(Player player, String partyName) {
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if player profile is loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer == null)
|
||||
return;
|
||||
|
||||
Party party = PartyManager.getParty(partyName);
|
||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||
|
||||
if (party == null) {
|
||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||
} else {
|
||||
if(PartyManager.isPartyFull(player, party))
|
||||
if(mcMMO.p.getPartyManager().isPartyFull(player, party))
|
||||
{
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PartyManager.addToParty(UserManager.getPlayer(player), party);
|
||||
mcMMO.p.getPartyManager().addToParty(mmoPlayer, party);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,19 +138,18 @@ public final class PartyAPI {
|
||||
* @param partyName The party to add the player to
|
||||
* @param bypassLimit if true bypasses party size limits
|
||||
*/
|
||||
//TODO: bypasslimit not used?
|
||||
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
||||
//Check if player profile is loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
Party party = PartyManager.getParty(partyName);
|
||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||
|
||||
if (party == null) {
|
||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||
}
|
||||
|
||||
PartyManager.addToParty(UserManager.getPlayer(player), party);
|
||||
mcMMO.p.getPartyManager().addToParty(UserManager.getPlayer(player), party);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,10 +161,10 @@ public final class PartyAPI {
|
||||
*/
|
||||
public static void removeFromParty(Player player) {
|
||||
//Check if player profile is loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
PartyManager.removeFromParty(UserManager.getPlayer(player));
|
||||
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,8 +175,11 @@ public final class PartyAPI {
|
||||
* @param partyName The party name
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public static String getPartyLeader(String partyName) {
|
||||
return PartyManager.getPartyLeaderName(partyName);
|
||||
public static @Nullable String getPartyLeader(String partyName) {
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return null;
|
||||
|
||||
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +192,10 @@ public final class PartyAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setPartyLeader(String partyName, String playerName) {
|
||||
PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName));
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return;
|
||||
|
||||
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,9 +208,12 @@ public final class PartyAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
||||
List<OfflinePlayer> members = new ArrayList<>();
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
|
||||
List<OfflinePlayer> members = new ArrayList<>();
|
||||
for (UUID memberUniqueId : mcMMO.p.getPartyManager().getAllMembers(player).keySet()) {
|
||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
|
||||
members.add(member);
|
||||
}
|
||||
@@ -203,7 +230,10 @@ public final class PartyAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static LinkedHashSet<String> getMembers(Player player) {
|
||||
return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values();
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return null;
|
||||
|
||||
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +245,10 @@ public final class PartyAPI {
|
||||
* @return all the player names and uuids in the player's party
|
||||
*/
|
||||
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
||||
return PartyManager.getAllMembers(player);
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return null;
|
||||
|
||||
return mcMMO.p.getPartyManager().getAllMembers(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +260,10 @@ public final class PartyAPI {
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(String partyName) {
|
||||
return PartyManager.getOnlineMembers(partyName);
|
||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||
return null;
|
||||
|
||||
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +275,7 @@ public final class PartyAPI {
|
||||
* @return all online players in the player's party
|
||||
*/
|
||||
public static List<Player> getOnlineMembers(Player player) {
|
||||
return PartyManager.getOnlineMembers(player);
|
||||
return mcMMO.p.getPartyManager().getOnlineMembers(player);
|
||||
}
|
||||
|
||||
public static boolean hasAlly(String partyName) {
|
||||
@@ -247,7 +283,7 @@ public final class PartyAPI {
|
||||
}
|
||||
|
||||
public static String getAllyName(String partyName) {
|
||||
Party ally = PartyManager.getParty(partyName).getAlly();
|
||||
Party ally = mcMMO.p.getPartyManager().getParty(partyName).getAlly();
|
||||
if (ally != null) {
|
||||
return ally.getName();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
public class InvalidFormulaTypeException extends RuntimeException {
|
||||
private static final long serialVersionUID = 3368670229490121886L;
|
||||
|
||||
public InvalidFormulaTypeException() {
|
||||
super("That is not a valid FormulaType.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
public class InvalidPlayerException extends RuntimeException {
|
||||
private static final long serialVersionUID = 907213002618581385L;
|
||||
|
||||
public InvalidPlayerException() {
|
||||
super("That player does not exist in the database.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
public class InvalidSkillException extends RuntimeException {
|
||||
private static final long serialVersionUID = 942705284195791157L;
|
||||
|
||||
public InvalidSkillException() {
|
||||
super("That is not a valid skill.");
|
||||
}
|
||||
|
||||
public InvalidSkillException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
public class InvalidXPGainReasonException extends RuntimeException {
|
||||
private static final long serialVersionUID = 4427052841957931157L;
|
||||
|
||||
public InvalidXPGainReasonException() {
|
||||
super("That is not a valid XPGainReason.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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(@NotNull Player player) {
|
||||
super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet! : " + player.getName() + " " + player.getUniqueId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.api.exceptions;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ValueOutOfBoundsException extends RuntimeException {
|
||||
public ValueOutOfBoundsException(@NotNull String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ 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.locale.LocaleLoader;
|
||||
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 com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@@ -43,9 +43,9 @@ public class ChatManager {
|
||||
*
|
||||
* @param mmoPlayer target player
|
||||
* @param rawMessage the raw message from the player as it was typed
|
||||
* @param isAsync whether or not this is getting processed via async
|
||||
* @param isAsync whether this is getting processed via async
|
||||
*/
|
||||
public void processPlayerMessage(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) {
|
||||
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) {
|
||||
processPlayerMessage(mmoPlayer, mmoPlayer.getChatChannel(), rawMessage, isAsync);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ChatManager {
|
||||
* @param args the raw command arguments from the player
|
||||
* @param chatChannel target channel
|
||||
*/
|
||||
public void processPlayerMessage(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull String[] args, @NotNull ChatChannel chatChannel) {
|
||||
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String[] args, @NotNull ChatChannel chatChannel) {
|
||||
String chatMessageWithoutCommand = buildChatMessage(args);
|
||||
|
||||
//Commands are never async
|
||||
@@ -69,9 +69,9 @@ public class ChatManager {
|
||||
* @param mmoPlayer target player
|
||||
* @param chatChannel target chat channel
|
||||
* @param rawMessage raw chat message as it was typed
|
||||
* @param isAsync whether or not this is getting processed via async
|
||||
* @param isAsync whether this is getting processed via async
|
||||
*/
|
||||
private void processPlayerMessage(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) {
|
||||
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()));
|
||||
@@ -119,19 +119,19 @@ public class ChatManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the chat channel of a {@link OnlineMMOPlayer}
|
||||
* 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 OnlineMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
||||
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
||||
if(targetChatChannel == mmoPlayer.getChatChannel()) {
|
||||
//Disabled message
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||
mmoPlayer.setChatMode(ChatChannel.NONE);
|
||||
} else {
|
||||
mmoPlayer.setChatMode(targetChatChannel);
|
||||
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Chat.Channel.On", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.On", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,14 +155,14 @@ public class ChatManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the player is allowed to send a message to the chat channel they are targeting
|
||||
* 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 OnlineMMOPlayer mmoPlayer) {
|
||||
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
|
||||
switch (mmoPlayer.getChatChannel()) {
|
||||
case ADMIN:
|
||||
if(Misc.adaptPlayer(mmoPlayer).isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
||||
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -197,7 +197,7 @@ public class ChatManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a specific chat channel is enabled
|
||||
* Whether a specific chat channel is enabled
|
||||
* ChatChannels are enabled/disabled via user config
|
||||
*
|
||||
* If chat is disabled, this always returns false
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.gmail.nossr50.chat;
|
||||
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
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;
|
||||
@@ -22,9 +23,8 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
|
||||
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 player = (Player) t;
|
||||
OnlineMMOPlayer mcMMOPlayer = UserManager.queryPlayer(player);
|
||||
if(t instanceof Player player) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if(mcMMOPlayer != null) {
|
||||
return mcMMOPlayer.getParty() == party;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class AbstractPlayerAuthor implements Author {
|
||||
* 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 or not to use this authors display name
|
||||
* @param useDisplayName whether to use this authors display name
|
||||
*/
|
||||
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
||||
if(useDisplayName) {
|
||||
|
||||
@@ -17,14 +17,14 @@ public interface Author extends Identity {
|
||||
@NotNull String getAuthoredName(@NotNull ChatChannel chatChannel);
|
||||
|
||||
/**
|
||||
* Whether or not this author is a {@link org.bukkit.command.ConsoleCommandSender}
|
||||
* Whether this author is a {@link org.bukkit.command.ConsoleCommandSender}
|
||||
*
|
||||
* @return true if this author is the console
|
||||
*/
|
||||
boolean isConsole();
|
||||
|
||||
/**
|
||||
* Whether or not this author is a {@link org.bukkit.entity.Player}
|
||||
* Whether this author is a {@link org.bukkit.entity.Player}
|
||||
* @return true if this author is a player
|
||||
*/
|
||||
boolean isPlayer();
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.config.ChatConfig;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||
@@ -44,7 +45,7 @@ public class AdminChatMailer extends AbstractChatMailer {
|
||||
public @NotNull Predicate<CommandSender> predicate() {
|
||||
return (commandSender) -> commandSender.isOp()
|
||||
|| commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION)
|
||||
|| commandSender instanceof ConsoleCommandSender;
|
||||
|| (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.ADMIN) && commandSender instanceof ConsoleCommandSender);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,8 +74,8 @@ public class AdminChatMailer extends AbstractChatMailer {
|
||||
*
|
||||
* @param author the author
|
||||
* @param rawString the raw message as the author typed it before any styling
|
||||
* @param isAsync whether or not this is being processed asynchronously
|
||||
* @param canColor whether or not the author can use colors in chat
|
||||
* @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));
|
||||
|
||||
@@ -4,12 +4,12 @@ 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 com.neetgames.mcmmo.party.Party;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -27,8 +27,8 @@ public class PartyChatMailer extends AbstractChatMailer {
|
||||
*
|
||||
* @param author the author
|
||||
* @param rawString the raw message as the author typed it before any styling
|
||||
* @param isAsync whether or not this is being processed asynchronously
|
||||
* @param canColor whether or not the author can use colors in chat
|
||||
* @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);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.gmail.nossr50.chat.message;
|
||||
|
||||
import com.gmail.nossr50.chat.author.Author;
|
||||
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.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.base.Objects;
|
||||
import com.neetgames.mcmmo.party.Party;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -51,7 +52,8 @@ public class PartyChatMessage extends AbstractChatMessage {
|
||||
messagePartyChatSpies(spyMessage);
|
||||
|
||||
//Console message
|
||||
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
||||
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
|
||||
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +63,7 @@ public class PartyChatMessage extends AbstractChatMessage {
|
||||
*/
|
||||
private void messagePartyChatSpies(@NotNull TextComponent spyMessage) {
|
||||
//Find the people with permissions
|
||||
for(OnlineMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
//Check for toggled players
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.commands.skills.PowerLevelCommand;
|
||||
import com.gmail.nossr50.config.ChatConfig;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@@ -20,9 +21,14 @@ 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 MMO_DATA_LOADED = "mmoDataLoaded";
|
||||
|
||||
//CHAT
|
||||
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";
|
||||
|
||||
//SKILLS
|
||||
public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition";
|
||||
|
||||
private final @NotNull mcMMO pluginRef;
|
||||
private final @NotNull BukkitCommandManager bukkitCommandManager;
|
||||
@@ -36,9 +42,16 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
registerSkillCommands(); //TODO: Implement other skills not just power level
|
||||
registerChatCommands();
|
||||
}
|
||||
|
||||
private void registerSkillCommands() {
|
||||
if(mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
|
||||
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers chat commands if the chat system is enabled
|
||||
*/
|
||||
@@ -47,13 +60,30 @@ public class CommandManager {
|
||||
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
|
||||
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
||||
}
|
||||
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
||||
if(pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
||||
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerConditions() {
|
||||
registerChatCommandConditions(); //Chat Commands
|
||||
registerSkillConditions();
|
||||
}
|
||||
|
||||
private void registerSkillConditions() {
|
||||
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
|
||||
if(issuer.getIssuer() instanceof Player) {
|
||||
validateLoadedData(issuer.getPlayer());
|
||||
} else {
|
||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void registerChatCommandConditions() {
|
||||
// Method or Class based - Can only be used on methods
|
||||
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
||||
BukkitCommandIssuer issuer = context.getIssuer();
|
||||
@@ -78,6 +108,7 @@ public class CommandManager {
|
||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
||||
//TODO: Is there even a point in validating permission? look into this later
|
||||
validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer());
|
||||
}
|
||||
});
|
||||
@@ -105,7 +136,7 @@ public class CommandManager {
|
||||
public void validatePlayerParty(@NotNull Player player) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer.getParty() == null) {
|
||||
if(!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
|
||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
||||
}
|
||||
}
|
||||
|
||||
336
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
336
src/main/java/com/gmail/nossr50/commands/McImportCommand.java
Normal file
@@ -0,0 +1,336 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ModConfigType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
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;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class McImportCommand implements CommandExecutor {
|
||||
int fileAmount;
|
||||
|
||||
@Override
|
||||
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() {
|
||||
String importFilePath = mcMMO.getModDirectory() + File.separator + "import";
|
||||
File importFile = new File(importFilePath, "import.log");
|
||||
mcMMO.p.getLogger().info("Starting import of mod materials...");
|
||||
fileAmount = 0;
|
||||
|
||||
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<>();
|
||||
|
||||
BufferedReader in = null;
|
||||
|
||||
try {
|
||||
// Open the file
|
||||
in = new BufferedReader(new FileReader(importFile));
|
||||
|
||||
String line;
|
||||
String materialName;
|
||||
String modName;
|
||||
|
||||
// While not at the end of the file
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] split1 = line.split("material ");
|
||||
|
||||
if (split1.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split2 = split1[1].split(" with");
|
||||
|
||||
if (split2.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
materialName = split2[0];
|
||||
|
||||
// Categorise each material under a mod config type
|
||||
ModConfigType type = ModConfigType.getModConfigType(materialName);
|
||||
|
||||
if (!materialNames.containsKey(type)) {
|
||||
materialNames.put(type, new ArrayList<>());
|
||||
}
|
||||
|
||||
materialNames.get(type).add(materialName);
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)");
|
||||
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
|
||||
return false;
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
tryClose(in);
|
||||
}
|
||||
|
||||
createOutput(materialNames);
|
||||
|
||||
mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
|
||||
for (ModConfigType modConfigType : materialNames.keySet()) {
|
||||
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<>());
|
||||
}
|
||||
|
||||
materialNamesType.get(modName).add(materialName);
|
||||
}
|
||||
|
||||
createOutput(modConfigType, materialNamesType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tryClose(Closeable c) {
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
c.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createOutput(ModConfigType modConfigType, HashMap<String, ArrayList<String>> materialNames) {
|
||||
File outputFilePath = new File(mcMMO.getModDirectory() + File.separator + "output");
|
||||
if (!outputFilePath.exists() && !outputFilePath.mkdirs()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output directory! " + outputFilePath.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileWriter out = null;
|
||||
String type = modConfigType.name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
for (String modName : materialNames.keySet()) {
|
||||
File outputFile = new File(outputFilePath, modName + "." + type + ".yml");
|
||||
mcMMO.p.getLogger().info("Creating " + outputFile.getName());
|
||||
try {
|
||||
if (outputFile.exists() && !outputFile.delete()) {
|
||||
mcMMO.p.getLogger().severe("Not able to delete old output file! " + outputFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!outputFile.createNewFile()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output file! " + outputFile.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
|
||||
StringBuilder writer = new StringBuilder();
|
||||
HashMap<String, ArrayList<String>> configSections = getConfigSections(modConfigType, modName, materialNames);
|
||||
|
||||
if (configSections == null) {
|
||||
mcMMO.p.getLogger().severe("Something went wrong!! type is " + type);
|
||||
return;
|
||||
}
|
||||
|
||||
// Write the file, go through each skill and write all the materials
|
||||
for (String configSection : configSections.keySet()) {
|
||||
if (configSection.equals("UNIDENTIFIED")) {
|
||||
writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n");
|
||||
writer.append("# copy and pasted to a valid section of this config file.").append("\r\n");
|
||||
}
|
||||
writer.append(configSection).append(":").append("\r\n");
|
||||
|
||||
for (String line : configSections.get(configSection)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
|
||||
writer.append("\r\n");
|
||||
}
|
||||
|
||||
out = new FileWriter(outputFile);
|
||||
out.write(writer.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
tryClose(out);
|
||||
fileAmount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSections(ModConfigType type, String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
switch (type) {
|
||||
case BLOCKS:
|
||||
return getConfigSectionsBlocks(modName, materialNames);
|
||||
case TOOLS:
|
||||
return getConfigSectionsTools(modName, materialNames);
|
||||
case ARMOR:
|
||||
return getConfigSectionsArmor(modName, materialNames);
|
||||
case UNKNOWN:
|
||||
return getConfigSectionsUnknown(modName, materialNames);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
|
||||
|
||||
// Go through all the materials and categorise them under a skill
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String skillName = "UNIDENTIFIED";
|
||||
if (materialName.contains("ORE")) {
|
||||
skillName = "Mining";
|
||||
}
|
||||
else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||
skillName = "Woodcutting";
|
||||
}
|
||||
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")) {
|
||||
skillName = "Excavation";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(skillName)) {
|
||||
configSections.put(skillName, new ArrayList<>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(skillName);
|
||||
skillContents.add(" " + materialName + "|0:");
|
||||
skillContents.add(" " + " " + "XP_Gain: 99");
|
||||
skillContents.add(" " + " " + "Double_Drops_Enabled: true");
|
||||
|
||||
if (skillName.equals("Mining")) {
|
||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||
}
|
||||
else if (skillName.equals("Woodcutting")) {
|
||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||
}
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
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)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("PICKAXE")) {
|
||||
toolType = "Pickaxes";
|
||||
}
|
||||
else if (materialName.contains("AXE")) {
|
||||
toolType = "Axes";
|
||||
}
|
||||
else if (materialName.contains("BOW")) {
|
||||
toolType = "Bows";
|
||||
}
|
||||
else if (materialName.contains("HOE")) {
|
||||
toolType = "Hoes";
|
||||
}
|
||||
else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||
toolType = "Shovels";
|
||||
}
|
||||
else if (materialName.contains("SWORD")) {
|
||||
toolType = "Swords";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
skillContents.add(" " + " " + "XP_Modifier: 1.0");
|
||||
skillContents.add(" " + " " + "Tier: 1");
|
||||
skillContents.add(" " + " " + "Ability_Enabled: true");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
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)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||
toolType = "Boots";
|
||||
}
|
||||
else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||
toolType = "Chestplates";
|
||||
}
|
||||
else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||
toolType = "Helmets";
|
||||
}
|
||||
else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
||||
toolType = "Leggings";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private void addRepairableLines(String materialName, ArrayList<String> skillContents) {
|
||||
skillContents.add(" " + " " + "Repairable: true");
|
||||
skillContents.add(" " + " " + "Repair_Material: REPAIR_MATERIAL_NAME");
|
||||
skillContents.add(" " + " " + "Repair_Material_Data_Value: 0");
|
||||
skillContents.add(" " + " " + "Repair_Material_Quantity: 9");
|
||||
skillContents.add(" " + " " + "Repair_Material_Pretty_Name: Repair Item Name");
|
||||
skillContents.add(" " + " " + "Repair_MinimumLevel: 0");
|
||||
skillContents.add(" " + " " + "Repair_XpMultiplier: 1.0");
|
||||
|
||||
Material material = Material.matchMaterial(materialName);
|
||||
short durability = (material == null) ? (short) 9999 : material.getMaxDurability();
|
||||
skillContents.add(" " + " " + "Durability: " + ((durability > 0) ? durability : (short) 9999));
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
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<>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(configKey);
|
||||
skillContents.add(" " + materialName);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class AbilityToggleCommand extends ToggleCommand {
|
||||
public class McabilityCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.mcabilityOthers(sender);
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
@@ -24,8 +24,10 @@ public class McnotifyCommand implements TabExecutor {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
|
||||
//Not Loaded yet
|
||||
if (mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
|
||||
mcMMOPlayer.toggleChatNotifications();
|
||||
|
||||
@@ -23,6 +23,16 @@ public class McscoreboardCommand implements TabExecutor {
|
||||
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")) {
|
||||
|
||||
@@ -11,7 +11,6 @@ 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.mcMMO;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -78,7 +77,7 @@ public class PartyChatCommand extends BaseCommand {
|
||||
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]);
|
||||
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
|
||||
|
||||
if(targetParty != null) {
|
||||
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
||||
|
||||
@@ -61,13 +61,13 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
PlayerProfile profile = oldDatabase.loadPlayerProfile(player);
|
||||
|
||||
if (profile.isLoaded()) {
|
||||
mcMMO.getDatabaseManager().saveUser(profile.getPlayerData());
|
||||
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
|
||||
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 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);
|
||||
mcMMO.p.getFoliaLib().getImpl().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class RemoveCommand implements TabExecutor {
|
||||
public class McremoveCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -8,7 +9,6 @@ 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 com.neetgames.mcmmo.experience.XPGainReason;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
profile.addLevels(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
else {
|
||||
profile.addXp(skill, value);
|
||||
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
|
||||
profile.scheduleAsyncSave();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
||||
UserManager.saveAll();
|
||||
UserManager.clearAll();
|
||||
|
||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
||||
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 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
|
||||
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;
|
||||
|
||||
@@ -9,7 +9,6 @@ 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 com.neetgames.mcmmo.experience.XPGainReason;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -32,7 +31,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
profile.modifySkill(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -26,7 +27,7 @@ import java.util.List;
|
||||
* This class mirrors the structure of ExperienceCommand, except the
|
||||
* value/quantity argument is removed.
|
||||
*/
|
||||
public class SkillResetCommand implements TabExecutor {
|
||||
public class SkillresetCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
PrimarySkillType skill;
|
||||
@@ -125,7 +126,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
profile.modifySkill(skill, 0);
|
||||
|
||||
if (player == null) {
|
||||
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -31,11 +31,11 @@ public class PartyAcceptCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
// Changing parties
|
||||
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
|
||||
if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.joinInvitedParty(mcMMOPlayer);
|
||||
mcMMO.p.getPartyManager().joinInvitedParty(mcMMOPlayer);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
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;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -31,7 +30,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
|
||||
mcMMO.p.getPartyManager().setPartyLeader(target.getUniqueId(), playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
@@ -21,11 +23,45 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PartyCommand implements TabExecutor {
|
||||
private static final List<String> PARTY_SUBCOMMANDS;
|
||||
private static final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
|
||||
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
|
||||
private final List<String> PARTY_SUBCOMMANDS;
|
||||
private final List<String> XPSHARE_COMPLETIONS = ImmutableList.of("none", "equal");
|
||||
private final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
|
||||
private final CommandExecutor partyJoinCommand;
|
||||
private final CommandExecutor partyAcceptCommand;
|
||||
private final CommandExecutor partyCreateCommand;
|
||||
private final CommandExecutor partyQuitCommand;
|
||||
private final CommandExecutor partyXpShareCommand;
|
||||
private final CommandExecutor partyItemShareCommand;
|
||||
private final CommandExecutor partyInviteCommand;
|
||||
private final CommandExecutor partyKickCommand;
|
||||
private final CommandExecutor partyDisbandCommand;
|
||||
private final CommandExecutor partyChangeOwnerCommand;
|
||||
private final CommandExecutor partyLockCommand;
|
||||
private final CommandExecutor partyChangePasswordCommand;
|
||||
private final CommandExecutor partyRenameCommand;
|
||||
private final CommandExecutor partyInfoCommand;
|
||||
private final CommandExecutor partyHelpCommand;
|
||||
private final CommandExecutor partyTeleportCommand;
|
||||
private final CommandExecutor partyAllianceCommand;
|
||||
public PartyCommand() {
|
||||
partyJoinCommand = new PartyJoinCommand();
|
||||
partyAcceptCommand = new PartyAcceptCommand();
|
||||
partyCreateCommand = new PartyCreateCommand();
|
||||
partyQuitCommand = new PartyQuitCommand();
|
||||
partyXpShareCommand = new PartyXpShareCommand();
|
||||
partyItemShareCommand = new PartyItemShareCommand();
|
||||
partyInviteCommand = new PartyInviteCommand();
|
||||
partyKickCommand = new PartyKickCommand();
|
||||
partyDisbandCommand = new PartyDisbandCommand();
|
||||
partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||
partyLockCommand = new PartyLockCommand();
|
||||
partyChangePasswordCommand = new PartyChangePasswordCommand();
|
||||
partyRenameCommand = new PartyRenameCommand();
|
||||
partyInfoCommand = new PartyInfoCommand();
|
||||
partyHelpCommand = new PartyHelpCommand();
|
||||
partyTeleportCommand = new PtpCommand();
|
||||
partyAllianceCommand = new PartyAllianceCommand();
|
||||
|
||||
static {
|
||||
ArrayList<String> subcommands = new ArrayList<>();
|
||||
|
||||
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
|
||||
@@ -36,20 +72,6 @@ public class PartyCommand implements TabExecutor {
|
||||
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
||||
}
|
||||
|
||||
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 partyInviteCommand = new PartyInviteCommand();
|
||||
private final CommandExecutor partyKickCommand = new PartyKickCommand();
|
||||
private final CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
||||
private final CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||
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();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
@@ -67,13 +89,13 @@ public class PartyCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (args.length < 1) {
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
@@ -134,31 +156,18 @@ public class PartyCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (subcommand) {
|
||||
case XPSHARE:
|
||||
return partyXpShareCommand.onCommand(sender, command, label, args);
|
||||
case ITEMSHARE:
|
||||
return partyItemShareCommand.onCommand(sender, command, label, args);
|
||||
case KICK:
|
||||
return partyKickCommand.onCommand(sender, command, label, args);
|
||||
case DISBAND:
|
||||
return partyDisbandCommand.onCommand(sender, command, label, args);
|
||||
case OWNER:
|
||||
return partyChangeOwnerCommand.onCommand(sender, command, label, args);
|
||||
case LOCK:
|
||||
case UNLOCK:
|
||||
return partyLockCommand.onCommand(sender, command, label, args);
|
||||
case PASSWORD:
|
||||
return partyChangePasswordCommand.onCommand(sender, command, label, args);
|
||||
case RENAME:
|
||||
return partyRenameCommand.onCommand(sender, command, label, args);
|
||||
case ALLIANCE:
|
||||
return partyAllianceCommand.onCommand(sender, command, label, args);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
return switch (subcommand) {
|
||||
case XPSHARE -> partyXpShareCommand.onCommand(sender, command, label, args);
|
||||
case ITEMSHARE -> partyItemShareCommand.onCommand(sender, command, label, args);
|
||||
case KICK -> partyKickCommand.onCommand(sender, command, label, args);
|
||||
case DISBAND -> partyDisbandCommand.onCommand(sender, command, label, args);
|
||||
case OWNER -> partyChangeOwnerCommand.onCommand(sender, command, label, args);
|
||||
case LOCK, UNLOCK -> partyLockCommand.onCommand(sender, command, label, args);
|
||||
case PASSWORD -> partyChangePasswordCommand.onCommand(sender, command, label, args);
|
||||
case RENAME -> partyRenameCommand.onCommand(sender, command, label, args);
|
||||
case ALLIANCE -> partyAllianceCommand.onCommand(sender, command, label, args);
|
||||
default -> true;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,12 +182,13 @@ public class PartyCommand implements TabExecutor {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
|
||||
switch (subcommand) {
|
||||
case JOIN:
|
||||
case INVITE:
|
||||
case KICK:
|
||||
case OWNER:
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||
case XPSHARE:
|
||||
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size()));
|
||||
@@ -192,17 +202,21 @@ public class PartyCommand implements TabExecutor {
|
||||
case TELEPORT:
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
if (matches.isEmpty()) {
|
||||
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<>(playerNames.size()));
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -26,16 +26,16 @@ public class PartyCreateCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
// Check to see if the party exists, and if it does cancel creating a new party
|
||||
if (PartyManager.checkPartyExistence(player, args[1])) {
|
||||
if (mcMMO.p.getPartyManager().checkPartyExistence(player, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Changing parties
|
||||
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) {
|
||||
if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, args[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args));
|
||||
mcMMO.p.getPartyManager().createParty(mcMMOPlayer, args[1], getPassword(args));
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
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;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -15,23 +16,24 @@ public class PartyDisbandCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (UserManager.getPlayer((Player) sender) == null) {
|
||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
if (mcMMOPlayer == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String partyName = playerParty.getName();
|
||||
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)) {
|
||||
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
member.sendMessage(LocaleLoader.getString("Party.Disband"));
|
||||
}
|
||||
|
||||
PartyManager.disbandParty(playerParty);
|
||||
mcMMO.p.getPartyManager().disbandParty(mcMMOPlayer, playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));
|
||||
|
||||
@@ -6,7 +6,6 @@ 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;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -125,7 +124,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
* Only show members of the party that this member can see
|
||||
*/
|
||||
|
||||
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
|
||||
List<Player> nearMembers = mcMMO.p.getPartyManager().getNearVisibleMembers(mcMMOPlayer);
|
||||
int membersOnline = party.getVisibleMembers(player).size();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
||||
|
||||
@@ -4,7 +4,6 @@ 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;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -40,19 +39,19 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PartyManager.inSameParty(player, target)) {
|
||||
if (mcMMO.p.getPartyManager().inSameParty(player, target)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!PartyManager.canInvite(mcMMOPlayer)) {
|
||||
if (!mcMMO.p.getPartyManager().canInvite(mcMMOPlayer)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Locked"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
if (PartyManager.isPartyFull(target, playerParty)) {
|
||||
if (mcMMO.p.getPartyManager().isPartyFull(target, playerParty)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), mcMMO.p.getGeneralConfig().getPartyMaxSize()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.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(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (party.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase(Locale.ENGLISH));
|
||||
|
||||
if (mode == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
handleChangingShareMode(party, mode);
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
boolean toggle;
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||
toggle = true;
|
||||
}
|
||||
else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||
toggle = false;
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase(Locale.ENGLISH)), toggle);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChangingShareMode(Party party, ShareMode mode) {
|
||||
party.setItemShareMode(mode);
|
||||
|
||||
String changeModeMessage = LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Item"), LocaleLoader.getString("Party.ShareMode." + StringUtils.getCapitalized(mode.toString())));
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(changeModeMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleToggleItemShareCategory(Party party, ItemShareType type, boolean toggle) {
|
||||
party.setSharingDrops(type, toggle);
|
||||
|
||||
String toggleMessage = LocaleLoader.getString("Commands.Party.ToggleShareCategory", StringUtils.getCapitalized(type.toString()), toggle ? "enabled" : "disabled");
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(toggleMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
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.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
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(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
case 3:
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
if (!mcMMOTarget.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.PlayerNotInParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party targetParty = mcMMOTarget.getParty();
|
||||
|
||||
if (player.equals(target) || (mcMMOPlayer.inParty() && mcMMOPlayer.getParty().equals(targetParty))) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Join.Self"));
|
||||
return true;
|
||||
}
|
||||
|
||||
String password = getPassword(args);
|
||||
|
||||
// Make sure party passwords match
|
||||
if (!mcMMO.p.getPartyManager().checkPartyPassword(player, targetParty, password)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String partyName = targetParty.getName();
|
||||
|
||||
// Changing parties
|
||||
if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, partyName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mcMMO.p.getPartyManager().isPartyFull(player, targetParty))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName));
|
||||
mcMMO.p.getPartyManager().addToParty(mcMMOPlayer, targetParty);
|
||||
return true;
|
||||
|
||||
default:
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.3", "party", "join", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">", "[" + LocaleLoader.getString("Commands.Usage.Password") + "]"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private String getPassword(String[] args) {
|
||||
if (args.length == 3) {
|
||||
return args[2];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
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;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -37,15 +36,15 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
Player onlineTarget = target.getPlayer();
|
||||
String partyName = playerParty.getName();
|
||||
|
||||
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
|
||||
mcMMO.p.getPartyManager().processPartyLeaving(UserManager.getPlayer(onlineTarget));
|
||||
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
|
||||
}
|
||||
|
||||
PartyManager.removeFromParty(target, playerParty);
|
||||
mcMMO.p.getPartyManager().removeFromParty(target, playerParty);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
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(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("lock")) {
|
||||
togglePartyLock(sender, true);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
||||
togglePartyLock(sender, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!args[0].equalsIgnoreCase("lock")) {
|
||||
sendUsageStrings(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
togglePartyLock(sender, true);
|
||||
}
|
||||
else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
togglePartyLock(sender, false);
|
||||
}
|
||||
else {
|
||||
sendUsageStrings(sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
sendUsageStrings(sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendUsageStrings(CommandSender sender) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "lock", "[on|off]"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "unlock"));
|
||||
}
|
||||
|
||||
private void togglePartyLock(CommandSender sender, boolean lock) {
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return;
|
||||
}
|
||||
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) {
|
||||
sender.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (lock == party.isLocked()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "IsLocked" : "IsntLocked")));
|
||||
return;
|
||||
}
|
||||
|
||||
party.setLocked(lock);
|
||||
sender.sendMessage(LocaleLoader.getString("Party." + (lock ? "Locked" : "Unlocked")));
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ 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;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -26,11 +26,11 @@ public class PartyQuitCommand implements CommandExecutor {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
|
||||
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.removeFromParty(mcMMOPlayer);
|
||||
mcMMO.p.getPartyManager().removeFromParty(mcMMOPlayer);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ 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;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
String oldPartyName = playerParty.getName();
|
||||
String newPartyName = args[1];
|
||||
String newPartyName = args[1].replace(".", "");
|
||||
|
||||
// This is to prevent party leaders from spamming other players with the rename message
|
||||
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
|
||||
@@ -36,14 +36,14 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
Player player = mcMMOPlayer.getPlayer();
|
||||
|
||||
// Check to see if the party exists, and if it does cancel renaming the party
|
||||
if (PartyManager.checkPartyExistence(player, newPartyName)) {
|
||||
if (mcMMO.p.getPartyManager().checkPartyExistence(player, newPartyName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String leaderName = playerParty.getLeader().getPlayerName();
|
||||
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
public enum PartySubCommandType {
|
||||
public enum PartySubcommandType {
|
||||
JOIN,
|
||||
ACCEPT,
|
||||
CREATE,
|
||||
@@ -8,18 +8,21 @@ public enum PartySubCommandType {
|
||||
INFO,
|
||||
QUIT,
|
||||
XPSHARE,
|
||||
ITEMSHARE,
|
||||
INVITE,
|
||||
KICK,
|
||||
DISBAND,
|
||||
OWNER,
|
||||
LOCK,
|
||||
UNLOCK,
|
||||
PASSWORD,
|
||||
RENAME,
|
||||
TELEPORT,
|
||||
CHAT,
|
||||
PROMOTE,
|
||||
DEMOTE;
|
||||
ALLIANCE;
|
||||
|
||||
public static PartySubCommandType getSubcommand(String commandName) {
|
||||
for (PartySubCommandType command : values()) {
|
||||
public static PartySubcommandType getSubcommand(String commandName) {
|
||||
for (PartySubcommandType command : values()) {
|
||||
if (command.name().equalsIgnoreCase(commandName)) {
|
||||
return command;
|
||||
}
|
||||
@@ -36,8 +39,14 @@ public enum PartySubCommandType {
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
||||
return XPSHARE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||
return ITEMSHARE;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("ally")) {
|
||||
return ALLIANCE;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
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 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(@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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
mcMMO.p.getPartyManager().acceptAllianceInvite(mcMMOPlayer);
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "accept"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
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.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
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 PartyAllianceCommand implements TabExecutor {
|
||||
private Player player;
|
||||
private Party playerParty;
|
||||
private Party targetParty;
|
||||
|
||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||
|
||||
private final CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
|
||||
private final CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
|
||||
private final CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (playerParty.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (playerParty.getAlly() == null) {
|
||||
printUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
targetParty = playerParty.getAlly();
|
||||
|
||||
displayPartyHeader();
|
||||
displayMemberInfo(mcMMOPlayer);
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
if (playerParty.getLevel() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("invite")) {
|
||||
return partyAllianceInviteCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("accept")) {
|
||||
return partyAllianceAcceptCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("disband")) {
|
||||
return partyAllianceDisbandCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (playerParty.getAlly() == null) {
|
||||
printUsage();
|
||||
return true;
|
||||
}
|
||||
|
||||
targetParty = playerParty.getAlly();
|
||||
|
||||
displayPartyHeader();
|
||||
displayMemberInfo(mcMMOPlayer);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean printUsage() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.0"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.1"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
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<>(playerNames.size()));
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
private void displayPartyHeader() {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Ally", playerParty.getName(), targetParty.getName()));
|
||||
}
|
||||
|
||||
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
|
||||
List<Player> nearMembers = mcMMO.p.getPartyManager().getNearMembers(mcMMOPlayer);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header"));
|
||||
player.sendMessage(playerParty.createMembersList(player));
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");
|
||||
player.sendMessage(targetParty.createMembersList(player));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
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 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(@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();
|
||||
|
||||
if (party.getAlly() == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.p.getPartyManager().disbandAlliance(player, party, party.getAlly());
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "alliance", "disband"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
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.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
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(@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;
|
||||
}
|
||||
|
||||
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 (mcMMO.p.getPartyManager().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;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
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.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
@@ -210,7 +209,7 @@ public class PtpCommand implements TabExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!PartyManager.inSameParty(player, target)) {
|
||||
if (!mcMMO.p.getPartyManager().inSameParty(player, target)) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return false;
|
||||
}
|
||||
@@ -250,7 +249,7 @@ public class PtpCommand implements TabExecutor {
|
||||
|
||||
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);
|
||||
|
||||
@@ -9,6 +9,7 @@ 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;
|
||||
@@ -62,6 +63,12 @@ public class InspectCommand implements TabExecutor {
|
||||
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;
|
||||
@@ -85,10 +92,16 @@ public class InspectCommand implements TabExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
|
||||
if (isVanished) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||
} 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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -97,11 +98,11 @@ public class McrankCommand 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();
|
||||
@@ -110,7 +111,7 @@ public class McrankCommand implements TabExecutor {
|
||||
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) {
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -97,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();
|
||||
@@ -114,7 +115,7 @@ public class MctopCommand implements TabExecutor {
|
||||
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) {
|
||||
|
||||
@@ -5,9 +5,8 @@ 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.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -30,7 +29,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ACROBATICS_DODGE
|
||||
if (canDodge) {
|
||||
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE);
|
||||
String[] dodgeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_DODGE);
|
||||
dodgeChance = dodgeStrings[0];
|
||||
dodgeChanceLucky = dodgeStrings[1];
|
||||
}
|
||||
@@ -38,8 +37,8 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
|
||||
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
canDodge = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_DODGE);
|
||||
canRoll = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,25 +56,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
|
||||
if(abstractSubSkill != null)
|
||||
{
|
||||
double rollChance, graceChance;
|
||||
|
||||
//Chance to roll at half
|
||||
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Chance to graceful roll
|
||||
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
|
||||
|
||||
//Chance Stat Calculations
|
||||
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||
//damageThreshold = mcMMO.p.getAdvancedConfig().getRollDamageThreshold();
|
||||
|
||||
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Format
|
||||
double rollChanceLucky = rollChance * 1.333D;
|
||||
double graceChanceLucky = graceChance * 1.333D;
|
||||
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));
|
||||
|
||||
@@ -68,8 +68,8 @@ public class AlchemyCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
canCatalysis = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,8 +4,9 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -32,14 +33,14 @@ public class ArcheryCommand extends SkillCommand {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ARCHERY_ARROW_RETRIEVAL
|
||||
if (canRetrieve) {
|
||||
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
String[] retrieveStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
retrieveChance = retrieveStrings[0];
|
||||
retrieveChanceLucky = retrieveStrings[1];
|
||||
}
|
||||
|
||||
// ARCHERY_DAZE
|
||||
if (canDaze) {
|
||||
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE);
|
||||
String[] dazeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_DAZE);
|
||||
dazeChance = dazeStrings[0];
|
||||
dazeChanceLucky = dazeStrings[1];
|
||||
}
|
||||
@@ -52,9 +53,9 @@ public class ArcheryCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE);
|
||||
canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
canSkillShot = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
canDaze = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_DAZE);
|
||||
canRetrieve = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +76,7 @@ public class ArcheryCommand extends SkillCommand {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||
if(Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.axes.Axes;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -48,7 +48,7 @@ public class AxesCommand extends SkillCommand {
|
||||
|
||||
// CRITICAL HIT
|
||||
if (canCritical) {
|
||||
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
String[] criticalHitStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
critChance = criticalHitStrings[0];
|
||||
critChanceLucky = criticalHitStrings[1];
|
||||
}
|
||||
@@ -64,10 +64,10 @@ public class AxesCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT);
|
||||
canCritical = Permissions.canUseSubSkill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = Permissions.canUseSubSkill(player, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = Permissions.canUseSubSkill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = Permissions.canUseSubSkill(player, SubSkillType.AXES_GREATER_IMPACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +96,7 @@ public class AxesCommand extends SkillCommand {
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||
if(Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
@@ -1,49 +1,76 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillType.*;
|
||||
|
||||
public class CrossbowsCommand extends SkillCommand {
|
||||
private boolean canTrickShot;
|
||||
private boolean canPoweredShot;
|
||||
|
||||
public CrossbowsCommand() {
|
||||
super(PrimarySkillType.CROSSBOWS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// TODO: Implement data calculations
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTrickShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_TRICK_SHOT)
|
||||
&& Permissions.trickShot(player);
|
||||
|
||||
canPoweredShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_POWERED_SHOT)
|
||||
&& Permissions.poweredShot(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
|
||||
CrossbowsManager crossbowsManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
|
||||
|
||||
if(canUseSubskill(mmoPlayer, SubSkillType.CROSSBOWS_SUPER_SHOTGUN)) {
|
||||
String additionalArrowCount = String.valueOf(crossbowsManager.getSuperShotgunAdditionalArrowCount());
|
||||
messages.add(getStatMessage(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, additionalArrowCount));
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
if (mmoPlayer == null) {
|
||||
return messages;
|
||||
}
|
||||
|
||||
if (canPoweredShot) {
|
||||
messages.add(getStatMessage(ARCHERY_SKILL_SHOT, percent.format(mmoPlayer.getCrossbowsManager().getDamageBonusPercent(player))));
|
||||
}
|
||||
|
||||
if (canTrickShot) {
|
||||
messages.add(getStatMessage(CROSSBOWS_TRICK_SHOT,
|
||||
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
|
||||
}
|
||||
|
||||
if(Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
messages.add(ChatColor.GRAY + "The Crossbows skill is a work in progress and is still being developed, feedback would be appreciated in the mcMMO discord server.");
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.CROSSBOWS);
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.CROSSBOWS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
canTreasureHunt = Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,7 +54,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||
if(Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
||||
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.random.Probability;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
@@ -79,7 +81,8 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
// FISHING_SHAKE
|
||||
if (canShake) {
|
||||
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(player, PrimarySkillType.FISHING, fishingManager.getShakeChance());
|
||||
Probability shakeProbability = Probability.ofPercent(fishingManager.getShakeChance());
|
||||
String[] shakeStrings = ProbabilityUtil.getRNGDisplayValues(shakeProbability);
|
||||
shakeChance = shakeStrings[0];
|
||||
shakeChanceLucky = shakeStrings[1];
|
||||
}
|
||||
@@ -98,12 +101,12 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = canUseSubskill(player, SubSkillType.FISHING_MAGIC_HUNTER) && canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canShake = canUseSubskill(player, SubSkillType.FISHING_SHAKE);
|
||||
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
|
||||
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
|
||||
canTreasureHunt = Permissions.canUseSubSkill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = Permissions.canUseSubSkill(player, SubSkillType.FISHING_MAGIC_HUNTER) && Permissions.canUseSubSkill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canShake = Permissions.canUseSubSkill(player, SubSkillType.FISHING_SHAKE);
|
||||
canFishermansDiet = Permissions.canUseSubSkill(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer() != null && Permissions.canUseSubSkill(player, SubSkillType.FISHING_MASTER_ANGLER);
|
||||
canIceFish = Permissions.canUseSubSkill(player, SubSkillType.FISHING_ICE_FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
@@ -24,6 +24,8 @@ public class HerbalismCommand extends SkillCommand {
|
||||
private int farmersDietRank;
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String tripleDropChance;
|
||||
private String tripleDropChanceLucky;
|
||||
private String hylianLuckChance;
|
||||
private String hylianLuckChanceLucky;
|
||||
private String shroomThumbChance;
|
||||
@@ -35,6 +37,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
private boolean canGreenThumbBlocks;
|
||||
private boolean canFarmersDiet;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canTripleDrop;
|
||||
private boolean canShroomThumb;
|
||||
|
||||
public HerbalismCommand() {
|
||||
@@ -46,10 +49,16 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
if (canTripleDrop) {
|
||||
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_VERDANT_BOUNTY);
|
||||
tripleDropChance = tripleDropStrings[0];
|
||||
tripleDropChanceLucky = tripleDropStrings[1];
|
||||
}
|
||||
|
||||
// FARMERS DIET
|
||||
if (canFarmersDiet) {
|
||||
@@ -67,21 +76,21 @@ public class HerbalismCommand extends SkillCommand {
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
|
||||
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
String[] greenThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbChance = greenThumbStrings[0];
|
||||
greenThumbChanceLucky = greenThumbStrings[1];
|
||||
}
|
||||
|
||||
// HYLIAN LUCK
|
||||
if (hasHylianLuck) {
|
||||
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
String[] hylianLuckStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
hylianLuckChance = hylianLuckStrings[0];
|
||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||
}
|
||||
|
||||
// SHROOM THUMB
|
||||
if (canShroomThumb) {
|
||||
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
String[] shroomThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
shroomThumbChance = shroomThumbStrings[0];
|
||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||
}
|
||||
@@ -89,13 +98,14 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
hasHylianLuck = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOTS) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
|
||||
canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill);
|
||||
canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
canFarmersDiet = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill);
|
||||
canTripleDrop = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_VERDANT_BOUNTY) && !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill);
|
||||
canShroomThumb = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,11 +116,16 @@ public class HerbalismCommand extends SkillCommand {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
|
||||
if (canTripleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_VERDANT_BOUNTY, tripleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canFarmersDiet) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.HERBALISM_FARMERS_DIET, String.valueOf(farmersDietRank)));
|
||||
}
|
||||
|
||||
|
||||
if (canGreenTerra) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
|
||||
|
||||
@@ -6,8 +6,8 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -18,6 +18,8 @@ import java.util.List;
|
||||
public class MiningCommand extends SkillCommand {
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String tripleDropChance;
|
||||
private String tripleDropChanceLucky;
|
||||
private String superBreakerLength;
|
||||
private String superBreakerLengthEndurance;
|
||||
|
||||
@@ -30,6 +32,7 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
private boolean canSuperBreaker;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canTripleDrop;
|
||||
private boolean canBlast;
|
||||
private boolean canBiggerBombs;
|
||||
private boolean canDemoExpert;
|
||||
@@ -51,10 +54,17 @@ public class MiningCommand extends SkillCommand {
|
||||
blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D);
|
||||
blastRadiusIncrease = miningManager.getBlastRadiusModifier();
|
||||
}
|
||||
|
||||
// Mastery TRIPLE DROPS
|
||||
if (canTripleDrop) {
|
||||
String[] masteryTripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.MINING_MOTHER_LODE);
|
||||
tripleDropChance = masteryTripleDropStrings[0];
|
||||
tripleDropChanceLucky = masteryTripleDropStrings[1];
|
||||
}
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
@@ -72,7 +82,8 @@ public class MiningCommand extends SkillCommand {
|
||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
canDoubleDrop = Permissions.canUseSubSkill(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
canTripleDrop = Permissions.canUseSubSkill(player, SubSkillType.MINING_MOTHER_LODE);
|
||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||
}
|
||||
|
||||
@@ -94,13 +105,18 @@ public class MiningCommand extends SkillCommand {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
|
||||
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
||||
}
|
||||
|
||||
|
||||
if (canDoubleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_DOUBLE_DROPS, doubleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if(canTripleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canSuperBreaker) {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
|
||||
|
||||
@@ -27,12 +27,11 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
/*
|
||||
* Only allow players to use this command
|
||||
*/
|
||||
if(commandSender instanceof Player)
|
||||
if(commandSender instanceof Player player)
|
||||
{
|
||||
if(args.length < 1)
|
||||
return false;
|
||||
|
||||
Player player = (Player) commandSender;
|
||||
if(Permissions.mmoinfo(player))
|
||||
{
|
||||
if(args == null || args[0] == null)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
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.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandPermission("mcmmo.commands.mmopower")
|
||||
@CommandAlias("mmopower|mmopowerlevel|powerlevel")
|
||||
public class PowerLevelCommand extends BaseCommand {
|
||||
private final @NotNull mcMMO pluginRef;
|
||||
|
||||
public PowerLevelCommand(@NotNull mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
@Default
|
||||
@Conditions(CommandManager.POWER_LEVEL_CONDITION)
|
||||
public void processCommand(String[] args) {
|
||||
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
||||
Player player = bukkitCommandIssuer.getPlayer();
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player); //Should never be null at this point because its caught in an ACF validation
|
||||
if (mmoPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int powerLevel = mmoPlayer.getPowerLevel();
|
||||
|
||||
mmoPlayer.getPlayer().sendMessage(ChatColor.DARK_AQUA + "Your " + ChatColor.GOLD + "[mcMMO]" + ChatColor.DARK_AQUA + " power level is: " + ChatColor.GREEN + powerLevel);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
@@ -68,7 +68,7 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
// SUPER REPAIR
|
||||
if (canSuperRepair) {
|
||||
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
String[] superRepairStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
superRepairChance = superRepairStrings[0];
|
||||
superRepairChanceLucky = superRepairStrings[1];
|
||||
}
|
||||
@@ -76,9 +76,9 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canSuperRepair = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
@@ -30,8 +31,8 @@ public class SalvageCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canScrapCollector = canUseSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
|
||||
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
canScrapCollector = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
|
||||
canArcaneSalvage = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,16 +5,12 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillTools;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
@@ -32,7 +28,6 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class SkillCommand implements TabExecutor {
|
||||
protected PrimarySkillType skill;
|
||||
@@ -59,18 +54,17 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, skill);
|
||||
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
|
||||
boolean hasEndurance = PerksUtils.handleActivationPerks(player, 0, 0) != 0;
|
||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
@@ -116,8 +110,21 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if ("keep".equals(args[0].toLowerCase())) {
|
||||
if (!mcMMO.p.getGeneralConfig().getAllowKeepBoard()
|
||||
|| !mcMMO.p.getGeneralConfig().getScoreboardsEnabled()
|
||||
|| !mcMMO.p.getGeneralConfig().getSkillUseBoard()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
ScoreboardManager.keepBoard(sender.getName());
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Keep"));
|
||||
return true;
|
||||
}
|
||||
|
||||
return skillGuideCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
@@ -161,7 +168,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
*/
|
||||
|
||||
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
var parents = mcMMO.p.getSkillTools().getChildSkillParents(skill);
|
||||
|
||||
//TODO: Add JSON here
|
||||
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
|
||||
@@ -211,7 +218,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
if (args.length == 1) {
|
||||
return ImmutableList.of("?");
|
||||
return ImmutableList.of("?", "keep");
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -220,9 +227,9 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
|
||||
}
|
||||
|
||||
protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
|
||||
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
|
||||
}
|
||||
// protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
|
||||
// return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
|
||||
// }
|
||||
|
||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||
int maxLength = mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill));
|
||||
@@ -285,14 +292,4 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
protected abstract List<Component> getTextComponents(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a player can use a skill
|
||||
* @param player target player
|
||||
* @param subSkillType target subskill
|
||||
* @return true if the player has permission and has the skill unlocked
|
||||
*/
|
||||
protected boolean canUseSubskill(Player player, SubSkillType subSkillType)
|
||||
{
|
||||
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -39,14 +39,14 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
// FLUX MINING
|
||||
/*if (canFluxMine) {
|
||||
String[] fluxMiningStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
String[] fluxMiningStrings = getRNGDisplayValues(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
str_fluxMiningChance = fluxMiningStrings[0];
|
||||
str_fluxMiningChanceLucky = fluxMiningStrings[1];
|
||||
}*/
|
||||
|
||||
// SECOND SMELT
|
||||
if (canSecondSmelt) {
|
||||
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
String[] secondSmeltStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
str_secondSmeltChance = secondSmeltStrings[0];
|
||||
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||
}
|
||||
@@ -54,8 +54,8 @@ public class SmeltingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
canFuelEfficiency = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
//canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ 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.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -38,7 +39,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// SWORDS_COUNTER_ATTACK
|
||||
if (canCounter) {
|
||||
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
String[] counterStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
counterChance = counterStrings[0];
|
||||
counterChanceLucky = counterStrings[1];
|
||||
}
|
||||
@@ -69,8 +70,8 @@ public class SwordsCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canRupture = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canRupture = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@@ -91,9 +92,9 @@ public class SwordsCommand extends SkillCommand {
|
||||
ruptureLengthSecondsAgainstMobs));
|
||||
|
||||
messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.TickDamage", rupturePureTickDamageAgainstPlayers, rupturePureTickDamageAgainstMobs));
|
||||
messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.ExplosionDamage", ruptureExplosionDamageAgainstPlayers, ruptureExplosionDamageAgainstMobs));
|
||||
// messages.add(LocaleLoader.getString("Swords.SubSkill.Rupture.Stat.ExplosionDamage", ruptureExplosionDamageAgainstPlayers, ruptureExplosionDamageAgainstMobs));
|
||||
|
||||
messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note"));
|
||||
messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note.Update.One"));
|
||||
}
|
||||
|
||||
if (canSerratedStrike) {
|
||||
@@ -101,13 +102,13 @@ public class SwordsCommand extends SkillCommand {
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
||||
{
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -35,7 +35,7 @@ public class TamingCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
if (canGore) {
|
||||
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE);
|
||||
String[] goreStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.TAMING_GORE);
|
||||
goreChance = goreStrings[0];
|
||||
goreChanceLucky = goreStrings[1];
|
||||
}
|
||||
@@ -43,15 +43,15 @@ public class TamingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE);
|
||||
canBeastLore = Permissions.canUseSubSkill(player, SubSkillType.TAMING_BEAST_LORE);
|
||||
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||
canEnvironmentallyAware = canUseSubskill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = canUseSubskill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = canUseSubskill(player, SubSkillType.TAMING_GORE);
|
||||
canSharpenedClaws = canUseSubskill(player, SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = canUseSubskill(player, SubSkillType.TAMING_SHOCK_PROOF);
|
||||
canThickFur = canUseSubskill(player, SubSkillType.TAMING_THICK_FUR);
|
||||
canHolyHound = canUseSubskill(player, SubSkillType.TAMING_HOLY_HOUND);
|
||||
canEnvironmentallyAware = Permissions.canUseSubSkill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = Permissions.canUseSubSkill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = Permissions.canUseSubSkill(player, SubSkillType.TAMING_GORE);
|
||||
canSharpenedClaws = Permissions.canUseSubSkill(player, SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = Permissions.canUseSubSkill(player, SubSkillType.TAMING_SHOCK_PROOF);
|
||||
canThickFur = Permissions.canUseSubSkill(player, SubSkillType.TAMING_THICK_FUR);
|
||||
canHolyHound = Permissions.canUseSubSkill(player, SubSkillType.TAMING_HOLY_HOUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,37 +1,58 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillType.TRIDENTS_IMPALE;
|
||||
import static com.gmail.nossr50.datatypes.skills.SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK;
|
||||
|
||||
public class TridentsCommand extends SkillCommand {
|
||||
|
||||
|
||||
public TridentsCommand() {
|
||||
super(PrimarySkillType.TRIDENTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
|
||||
protected void dataCalculations(Player player, float skillValue) {}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<>();
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
if (mmoPlayer == null) {
|
||||
return messages;
|
||||
}
|
||||
|
||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
|
||||
messages.add(getStatMessage(TRIDENTS_IMPALE,
|
||||
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
|
||||
}
|
||||
|
||||
messages.add(ChatColor.GRAY + "The Tridents skill is a work in progress and is still being developed, feedback would be appreciated in the mcMMO discord server.");
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Component> getTextComponents(@NotNull Player player) {
|
||||
protected List<Component> getTextComponents(Player player) {
|
||||
List<Component> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.TRIDENTS);
|
||||
|
||||
@@ -5,9 +5,9 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -40,7 +40,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// UNARMED_ARROW_DEFLECT
|
||||
if (canDeflect) {
|
||||
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
String[] deflectStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
deflectChance = deflectStrings[0];
|
||||
deflectChanceLucky = deflectStrings[1];
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
// UNARMED_DISARM
|
||||
if (canDisarm) {
|
||||
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);
|
||||
String[] disarmStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_DISARM);
|
||||
disarmChance = disarmStrings[0];
|
||||
disarmChanceLucky = disarmStrings[1];
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
// IRON GRIP
|
||||
if (canIronGrip) {
|
||||
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
String[] ironGripStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
ironGripChance = ironGripStrings[0];
|
||||
ironGripChanceLucky = ironGripStrings[1];
|
||||
}
|
||||
@@ -75,10 +75,10 @@ public class UnarmedCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
|
||||
canIronArm = canUseSubskill(player, SubSkillType.UNARMED_STEEL_ARM_STYLE);
|
||||
canDeflect = canUseSubskill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = canUseSubskill(player, SubSkillType.UNARMED_DISARM);
|
||||
canIronGrip = canUseSubskill(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
canIronArm = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_STEEL_ARM_STYLE);
|
||||
canDeflect = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_DISARM);
|
||||
canIronGrip = Permissions.canUseSubSkill(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
// TODO: Apparently we forgot about block cracker?
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if(canUseSubskill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||
if(Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.ProbabilityUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.text.TextComponentFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -18,15 +18,15 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
private String treeFellerLength;
|
||||
private String treeFellerLengthEndurance;
|
||||
private String doubleDropChance;
|
||||
private String tripleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String tripleDropChanceLucky;
|
||||
|
||||
private boolean canTreeFell;
|
||||
private boolean canLeafBlow;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canTripleDrop;
|
||||
private boolean canKnockOnWood;
|
||||
private boolean canSplinter;
|
||||
private boolean canBarkSurgeon;
|
||||
private boolean canNaturesBounty;
|
||||
|
||||
public WoodcuttingCommand() {
|
||||
super(PrimarySkillType.WOODCUTTING);
|
||||
@@ -38,7 +38,14 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
if (canDoubleDrop) {
|
||||
setDoubleDropClassicChanceStrings(player);
|
||||
}
|
||||
|
||||
|
||||
//Clean Cuts
|
||||
if(canTripleDrop) {
|
||||
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
||||
tripleDropChance = tripleDropStrings[0];
|
||||
tripleDropChanceLucky = tripleDropStrings[1];
|
||||
}
|
||||
|
||||
// TREE FELLER
|
||||
if (canTreeFell) {
|
||||
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
@@ -48,7 +55,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
@@ -56,14 +63,12 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||
&& !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill)
|
||||
canDoubleDrop = !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill)
|
||||
&& Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||
&& RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
canKnockOnWood = canTreeFell && canUseSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD);
|
||||
/*canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER);
|
||||
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
|
||||
canNaturesBounty = canUseSubskill(player, SubSkillType.WOODCUTTING_NATURES_BOUNTY);*/
|
||||
canTripleDrop = !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill) && Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
||||
canLeafBlow = Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
canKnockOnWood = canTreeFell && Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,6 +80,12 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if(canTripleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
|
||||
if (canKnockOnWood) {
|
||||
String lootNote;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public class AdvancedConfig extends BukkitConfig {
|
||||
|
||||
public AdvancedConfig(File dataFolder) {
|
||||
super("advanced.yml", dataFolder);
|
||||
@@ -99,8 +99,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
if(getAxeMasteryRankDamageMultiplier() < 0)
|
||||
{
|
||||
if (getAxeMasteryRankDamageMultiplier() < 0) {
|
||||
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
|
||||
}
|
||||
|
||||
@@ -404,12 +403,18 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
/* GENERAL */
|
||||
|
||||
public boolean canApplyLimitBreakPVE() { return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false); }
|
||||
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 0); }
|
||||
public boolean canApplyLimitBreakPVE() {
|
||||
return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false);
|
||||
}
|
||||
|
||||
public int getStartingLevel() {
|
||||
return config.getInt("Skills.General.StartingLevel", 1);
|
||||
}
|
||||
|
||||
public boolean allowPlayerTips() {
|
||||
return config.getBoolean("Feedback.PlayerTips", true);
|
||||
@@ -417,11 +422,12 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
* It returns a different value depending on whether the server is in retro mode
|
||||
*
|
||||
* @return the level at which abilities stop increasing in length
|
||||
*/
|
||||
public int getAbilityLengthCap() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.CapLevel", 50);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.CapLevel", 500);
|
||||
@@ -429,28 +435,33 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* This returns the frequency at which abilities will increase in length
|
||||
* It returns a different value depending on whether or not the server is in retro mode
|
||||
* It returns a different value depending on whether the server is in retro mode
|
||||
*
|
||||
* @return the number of levels required per ability length increase
|
||||
*/
|
||||
public int getAbilityLength() {
|
||||
if(!mcMMO.isRetroModeEnabled())
|
||||
if (!mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.General.Ability.Length.Standard.IncreaseLevel", 5);
|
||||
else
|
||||
return config.getInt("Skills.General.Ability.Length.RetroMode.IncreaseLevel", 50);
|
||||
}
|
||||
|
||||
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
|
||||
public int getEnchantBuff() {
|
||||
return config.getInt("Skills.General.Ability.EnchantBuff", 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs the max bonus level for a skill used in RNG calculations
|
||||
* All max level values in the config are multiplied by 10 if the server is in retro mode as the values in the config are based around the new 1-100 skill system scaling
|
||||
* A value of 10 in the file will be returned as 100 for retro mode servers to accommodate the change in scaling
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
*
|
||||
* @return the level at which this skills max benefits will be reached on the curve
|
||||
*/
|
||||
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
||||
String keyPath = subSkillType.getAdvConfigAddress() + ".MaxBonusLevel.";
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath+"RetroMode", 1000) : config.getInt(keyPath+"Standard", 100);
|
||||
return mcMMO.isRetroModeEnabled() ? config.getInt(keyPath + "RetroMode", 1000) : config.getInt(keyPath + "Standard", 100);
|
||||
}
|
||||
|
||||
public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {
|
||||
@@ -462,35 +473,29 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
return config.getDouble(subSkillType.getAdvConfigAddress() + ".ChanceMax", 100.0D);
|
||||
}
|
||||
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public double getMaximumProbability(AbstractSubSkill abstractSubSkill) {
|
||||
return getMaximumProbability(abstractSubSkill.getSubSkillType());
|
||||
}
|
||||
|
||||
/* Notification Settings */
|
||||
|
||||
public boolean doesSkillCommandSendBlankLines()
|
||||
{
|
||||
public boolean doesSkillCommandSendBlankLines() {
|
||||
return config.getBoolean("Feedback.SkillCommand.BlankLinesAboveHeader", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".Enabled", true);
|
||||
public boolean doesNotificationUseActionBar(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".Enabled", true);
|
||||
}
|
||||
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType)
|
||||
{
|
||||
return config.getBoolean("Feedback.ActionBarNotifications."+notificationType.toString()+".SendCopyOfMessageToChat", false);
|
||||
public boolean doesNotificationSendCopyToChat(NotificationType notificationType) {
|
||||
return config.getBoolean("Feedback.ActionBarNotifications." + notificationType.toString() + ".SendCopyOfMessageToChat", false);
|
||||
}
|
||||
|
||||
public boolean useTitlesForXPEvent()
|
||||
{
|
||||
public boolean useTitlesForXPEvent() {
|
||||
return config.getBoolean("Feedback.Events.XP.SendTitles", true);
|
||||
}
|
||||
|
||||
public boolean sendAbilityNotificationToOtherPlayers()
|
||||
{
|
||||
public boolean sendAbilityNotificationToOtherPlayers() {
|
||||
return config.getBoolean("Feedback.Events.AbilityActivation.SendNotificationToOtherPlayers", true);
|
||||
}
|
||||
|
||||
@@ -509,6 +514,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Used to color our details header in our JSON Hover Object tooltips
|
||||
*
|
||||
* @return the ChatColor for this element
|
||||
*/
|
||||
/*public ChatColor getJSONStatHoverDetailsColor()
|
||||
@@ -557,7 +563,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
{
|
||||
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
|
||||
}*/
|
||||
|
||||
private ChatColor getChatColorFromKey(String keyLocation) {
|
||||
String colorName = config.getString(keyLocation);
|
||||
|
||||
@@ -598,110 +603,260 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Some SubSkills have the ability to retain classic functionality
|
||||
*
|
||||
* @param subSkillType SubSkillType with classic functionality
|
||||
*
|
||||
* @return true if the subskill is in classic mode
|
||||
*/
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType)
|
||||
{
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress()+".Classic");
|
||||
public boolean isSubSkillClassic(SubSkillType subSkillType) {
|
||||
return config.getBoolean(subSkillType.getAdvConfigAddress() + ".Classic");
|
||||
}
|
||||
|
||||
/* ACROBATICS */
|
||||
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }
|
||||
public double getDodgeDamageModifier() {
|
||||
return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D); }
|
||||
public double getRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.Roll.DamageThreshold", 7.0D);
|
||||
}
|
||||
|
||||
public double getGracefulRollDamageThreshold() { return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D); }
|
||||
public double getGracefulRollDamageThreshold() {
|
||||
return config.getDouble("Skills.Acrobatics.GracefulRoll.DamageThreshold", 14.0D);
|
||||
}
|
||||
|
||||
/* ALCHEMY */
|
||||
public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); }
|
||||
public int getCatalysisMaxBonusLevel() {
|
||||
if (mcMMO.isRetroModeEnabled()) {
|
||||
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.RetroMode", 1000);
|
||||
} else {
|
||||
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.Standard", 100);
|
||||
}
|
||||
}
|
||||
|
||||
public double getCatalysisMinSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D); }
|
||||
public double getCatalysisMaxSpeed() { return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D); }
|
||||
public double getCatalysisMinSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MinSpeed", 1.0D);
|
||||
}
|
||||
|
||||
public double getCatalysisMaxSpeed() {
|
||||
return config.getDouble("Skills.Alchemy.Catalysis.MaxSpeed", 4.0D);
|
||||
}
|
||||
|
||||
|
||||
/* ARCHERY */
|
||||
public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
|
||||
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
|
||||
public double getSkillShotRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D);
|
||||
}
|
||||
|
||||
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
|
||||
public double getSkillShotDamageMax() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
|
||||
public double getDazeBonusDamage() {
|
||||
return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D);
|
||||
}
|
||||
|
||||
public double getForceMultiplier() {
|
||||
return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D);
|
||||
}
|
||||
|
||||
/* AXES */
|
||||
public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
|
||||
public double getAxeMasteryRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D);
|
||||
}
|
||||
|
||||
public double getCriticalStrikesPVPModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D); }
|
||||
public double getCriticalStrikesPVEModifier() { return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D); }
|
||||
public double getCriticalStrikesPVPModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVP_Modifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactChance() { return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D); }
|
||||
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D); }
|
||||
public double getGreaterImpactBonusDamage() { return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D); }
|
||||
public double getCriticalStrikesPVEModifier() {
|
||||
return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
|
||||
public double getImpactDurabilityDamageMultiplier() { return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D); }
|
||||
public double getGreaterImpactChance() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); }
|
||||
public double getGreaterImpactModifier() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.KnockbackModifier", 1.5D);
|
||||
}
|
||||
|
||||
public double getGreaterImpactBonusDamage() {
|
||||
return config.getDouble("Skills.Axes.GreaterImpact.BonusDamage", 2.0D);
|
||||
}
|
||||
|
||||
public double getImpactChance() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D);
|
||||
}
|
||||
|
||||
public double getImpactDurabilityDamageMultiplier() {
|
||||
return config.getDouble("Skills.Axes.ArmorImpact.DamagePerRank", 6.5D);
|
||||
}
|
||||
|
||||
public double getSkullSplitterModifier() {
|
||||
return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
/* CROSSBOWS */
|
||||
public double getPoweredShotRankDamageMultiplier() {
|
||||
return config.getDouble("Skills.Crossbows.PoweredShot.RankDamageMultiplier", 10.0D);
|
||||
}
|
||||
|
||||
public double getPoweredShotDamageMax() {
|
||||
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
//Nothing to configure, everything is already configurable in config.yml
|
||||
|
||||
/* FISHING */
|
||||
public double getShakeChance(int rank) { return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank); }
|
||||
public int getFishingVanillaXPModifier(int rank) { return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank); }
|
||||
public double getShakeChance(int rank) {
|
||||
return config.getDouble("Skills.Fishing.ShakeChance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getFishingReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);}
|
||||
public int getFishingReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);}
|
||||
public int getFishingBoatReductionMinWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);}
|
||||
public int getFishingBoatReductionMaxWaitTicks() { return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);}
|
||||
public int getFishingReductionMinWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);}
|
||||
public int getFishingReductionMaxWaitCap() { return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);}
|
||||
public int getFishermanDietRankChange() { return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200); }
|
||||
public int getFishingVanillaXPModifier(int rank) {
|
||||
return config.getInt("Skills.Fishing.VanillaXPMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getFishingReductionMinWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Min_Wait", 10);
|
||||
}
|
||||
|
||||
public int getFishingReductionMaxWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Per_Rank.Max_Wait", 30);
|
||||
}
|
||||
|
||||
public int getFishingBoatReductionMinWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Min_Wait", 10);
|
||||
}
|
||||
|
||||
public int getFishingBoatReductionMaxWaitTicks() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Boat_Tick_Reduction.Max_Wait", 30);
|
||||
}
|
||||
|
||||
public int getFishingReductionMinWaitCap() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Min_Wait", 40);
|
||||
}
|
||||
|
||||
public int getFishingReductionMaxWaitCap() {
|
||||
return config.getInt("Skills.Fishing.MasterAngler.Tick_Reduction_Caps.Max_Wait", 100);
|
||||
}
|
||||
|
||||
public int getFishermanDietRankChange() {
|
||||
return config.getInt("Skills.Fishing.FishermansDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
|
||||
public double getMasterAnglerBoatModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0); }
|
||||
public double getMasterAnglerBiomeModifier() {return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0); }
|
||||
public double getMasterAnglerBoatModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BoatModifier", 2.0);
|
||||
}
|
||||
|
||||
public double getMasterAnglerBiomeModifier() {
|
||||
return config.getDouble("Skills.Fishing.MasterAngler.BiomeModifier", 2.0);
|
||||
}
|
||||
|
||||
/* HERBALISM */
|
||||
public int getFarmerDietRankChange() { return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200); }
|
||||
public int getFarmerDietRankChange() {
|
||||
return config.getInt("Skills.Herbalism.FarmersDiet.RankChange", 200);
|
||||
}
|
||||
|
||||
public int getGreenThumbStageChange() { return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200); }
|
||||
public int getGreenThumbStageChange() {
|
||||
return config.getInt("Skills.Herbalism.GreenThumb.StageChange", 200);
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
public boolean getDoubleDropSilkTouchEnabled() { return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true); }
|
||||
public boolean getAllowMiningTripleDrops() { return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true); }
|
||||
public int getBlastMiningRankLevel(int rank) { return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank); }
|
||||
public double getBlastDamageDecrease(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank); }
|
||||
public double getOreBonus(int rank) { return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank); }
|
||||
public double getDebrisReduction(int rank) { return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank); }
|
||||
public int getDropMultiplier(int rank) { return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank); }
|
||||
public double getBlastRadiusModifier(int rank) { return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank); }
|
||||
public boolean getDoubleDropSilkTouchEnabled() {
|
||||
return config.getBoolean("Skills.Mining.DoubleDrops.SilkTouch", true);
|
||||
}
|
||||
|
||||
public boolean getAllowMiningTripleDrops() {
|
||||
return config.getBoolean("Skills.Mining.SuperBreaker.AllowTripleDrops", true);
|
||||
}
|
||||
|
||||
public int getBlastMiningRankLevel(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.Rank_Levels.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastDamageDecrease(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastDamageDecrease.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getOreBonus(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.OreBonus.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean isBlastMiningBonusDropsEnabled() {
|
||||
return config.getBoolean("Skills.Mining.BlastMining.Bonus_Drops.Enabled", true);
|
||||
}
|
||||
|
||||
public double getDebrisReduction(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.DebrisReduction.Rank_" + rank);
|
||||
}
|
||||
|
||||
public int getDropMultiplier(int rank) {
|
||||
return config.getInt("Skills.Mining.BlastMining.DropMultiplier.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getBlastRadiusModifier(int rank) {
|
||||
return config.getDouble("Skills.Mining.BlastMining.BlastRadiusModifier.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* REPAIR */
|
||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); }
|
||||
public double getRepairMasteryMaxBonus() {
|
||||
return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingEnchantLossEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank); }
|
||||
public int getRepairMasteryMaxLevel() {
|
||||
return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
||||
public double getArcaneForgingDowngradeChance(int rank) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank); }
|
||||
public boolean getAllowEnchantedRepairMaterials() {
|
||||
return config.getBoolean("Skills.Repair.Use_Enchanted_Materials", false);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
|
||||
public boolean getArcaneForgingEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank); }
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank); }
|
||||
public double getArcaneForgingKeepEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Keep_Enchants_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean getArcaneForgingDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true);
|
||||
}
|
||||
|
||||
public double getArcaneForgingDowngradeChance(int rank) {
|
||||
return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + rank);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true);
|
||||
}
|
||||
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() {
|
||||
return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(int rank) {
|
||||
return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + rank);
|
||||
}
|
||||
|
||||
/* SMELTING */
|
||||
public int getBurnModifierMaxLevel() {
|
||||
if(mcMMO.isRetroModeEnabled())
|
||||
if (mcMMO.isRetroModeEnabled())
|
||||
return config.getInt("Skills.Smelting.FuelEfficiency.RetroMode.MaxBonusLevel", 1000);
|
||||
else
|
||||
return config.getInt("Skills.Smelting.FuelEfficiency.Standard.MaxBonusLevel", 100);
|
||||
}
|
||||
|
||||
public double getFluxMiningChance() { return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D); }
|
||||
public double getFluxMiningChance() {
|
||||
return config.getDouble("Skills.Smelting.FluxMining.Chance", 33.0D);
|
||||
}
|
||||
|
||||
/* SWORDS */
|
||||
public double getRuptureTickDamage(boolean isTargetPlayer, int rank) {
|
||||
@@ -731,35 +886,68 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
return config.getDouble(root + rank, 33);
|
||||
}
|
||||
|
||||
public double getCounterModifier() { return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D); }
|
||||
public double getCounterModifier() {
|
||||
return config.getDouble("Skills.Swords.CounterAttack.DamageModifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getSerratedStrikesModifier() { return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D); }
|
||||
public int getSerratedStrikesTicks() { return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5); }
|
||||
public double getSerratedStrikesModifier() {
|
||||
return config.getDouble("Skills.Swords.SerratedStrikes.DamageModifier", 4.0D);
|
||||
}
|
||||
|
||||
public int getSerratedStrikesTicks() {
|
||||
return config.getInt("Skills.Swords.SerratedStrikes.RuptureTicks", 5);
|
||||
}
|
||||
|
||||
/* TAMING */
|
||||
public double getGoreModifier() { return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D); }
|
||||
public double getGoreModifier() {
|
||||
return config.getDouble("Skills.Taming.Gore.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); }
|
||||
public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); }
|
||||
public double getFastFoodChance() {
|
||||
return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D);
|
||||
}
|
||||
|
||||
public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); }
|
||||
public double getPummelChance() {
|
||||
return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D);
|
||||
}
|
||||
|
||||
public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); }
|
||||
public double getThickFurModifier() {
|
||||
return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D);
|
||||
}
|
||||
|
||||
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D); }
|
||||
public double getShockProofModifier() {
|
||||
return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D);
|
||||
}
|
||||
|
||||
public double getMinHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D); }
|
||||
public double getMaxHorseJumpStrength() { return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D); }
|
||||
public double getSharpenedClawsBonus() {
|
||||
return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 2.0D);
|
||||
}
|
||||
|
||||
public double getMinHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MinHorseJumpStrength", 0.7D);
|
||||
}
|
||||
|
||||
public double getMaxHorseJumpStrength() {
|
||||
return config.getDouble("Skills.Taming.CallOfTheWild.MaxHorseJumpStrength", 2.0D);
|
||||
}
|
||||
|
||||
/* UNARMED */
|
||||
|
||||
public boolean isSteelArmDamageCustom() { return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false); }
|
||||
public boolean isSteelArmDamageCustom() {
|
||||
return config.getBoolean("Skills.Unarmed.SteelArmStyle.Damage_Override", false);
|
||||
}
|
||||
|
||||
public double getSteelArmOverride(int rank, double def) {
|
||||
String key = "Rank_" + rank;
|
||||
return config.getDouble("Skills.Unarmed.SteelArmStyle.Override." + key, def);
|
||||
}
|
||||
public boolean getDisarmProtected() { return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false); }
|
||||
|
||||
public boolean getDisarmProtected() {
|
||||
return config.getBoolean("Skills.Unarmed.Disarm.AntiTheft", false);
|
||||
}
|
||||
|
||||
/* WOODCUTTING */
|
||||
public boolean isKnockOnWoodXPOrbEnabled() { return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true); }
|
||||
public boolean isKnockOnWoodXPOrbEnabled() {
|
||||
return config.getBoolean("Skills.Woodcutting.TreeFeller.Knock_On_Wood.Add_XP_Orbs_To_Drops", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||
super(relativePath, fileName, dataFolder);
|
||||
}
|
||||
|
||||
public AutoUpdateConfigLoader(String fileName, File dataFolder) {
|
||||
super(fileName, dataFolder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
||||
super(relativePath, fileName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateConfigLoader(String fileName) {
|
||||
super(fileName);
|
||||
}
|
||||
|
||||
protected void saveConfig() {
|
||||
try {
|
||||
mcMMO.p.getLogger().info("Saving changes to config file - "+fileName);
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected @NotNull FileConfiguration getInternalConfig() {
|
||||
return YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadFile() {
|
||||
super.loadFile();
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
Set<String> oldKeys = new HashSet<>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
Set<String> newKeys = new HashSet<>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
// Don't need a re-save if we have old keys sticking around?
|
||||
// Would be less saving, but less... correct?
|
||||
if (!newKeys.isEmpty() || !oldKeys.isEmpty()) {
|
||||
needSave = true;
|
||||
}
|
||||
//
|
||||
// for (String key : oldKeys) {
|
||||
// mcMMO.p.debug("Detected potentially unused key: " + key);
|
||||
// //config.set(key, null);
|
||||
// }
|
||||
|
||||
for (String key : newKeys) {
|
||||
mcMMO.p.debug("Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
config.set(key, internalConfig.get(key));
|
||||
}
|
||||
|
||||
if (needSave) {
|
||||
// Get Bukkit's version of an acceptable config with new keys, and no old keys
|
||||
String output = config.saveToString();
|
||||
|
||||
// Convert to the superior 4 space indentation
|
||||
output = output.replace(" ", " ");
|
||||
|
||||
// Rip out Bukkit's attempt to save comments at the top of the file
|
||||
while (output.replaceAll("[//s]", "").startsWith("#")) {
|
||||
output = output.substring(output.indexOf('\n', output.indexOf('#')) + 1);
|
||||
}
|
||||
|
||||
// Read the internal config to get comments, then put them in the new one
|
||||
try {
|
||||
// Read internal
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(mcMMO.p.getResource(fileName)));
|
||||
LinkedHashMap<String, String> comments = new LinkedHashMap<>();
|
||||
StringBuilder temp = new StringBuilder();
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.contains("#")) {
|
||||
temp.append(line).append("\n");
|
||||
}
|
||||
else if (line.contains(":")) {
|
||||
line = line.substring(0, line.indexOf(":") + 1);
|
||||
if (temp.length() > 0) {
|
||||
if(comments.containsKey(line)) {
|
||||
int index = 0;
|
||||
while(comments.containsKey(line + index)) {
|
||||
index++;
|
||||
}
|
||||
|
||||
line = line + index;
|
||||
}
|
||||
|
||||
comments.put(line, temp.toString());
|
||||
temp = new StringBuilder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dump to the new one
|
||||
HashMap<String, Integer> indexed = new HashMap<>();
|
||||
for (String key : comments.keySet()) {
|
||||
String actualkey = key.substring(0, key.indexOf(":") + 1);
|
||||
|
||||
int index = 0;
|
||||
if(indexed.containsKey(actualkey)) {
|
||||
index = indexed.get(actualkey);
|
||||
}
|
||||
boolean isAtTop = !output.contains("\n" + actualkey);
|
||||
index = output.indexOf((isAtTop ? "" : "\n") + actualkey, index);
|
||||
|
||||
if (index >= 0) {
|
||||
output = output.substring(0, index) + "\n" + comments.get(key) + output.substring(isAtTop ? index : index + 1);
|
||||
indexed.put(actualkey, index + comments.get(key).length() + actualkey.length() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Save it
|
||||
if(dataFolder == null) {
|
||||
mcMMO.p.getLogger().severe("Data folder should never be null!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String saveName = fileName;
|
||||
// At this stage we cannot guarantee that Config has been loaded, so we do the check directly here
|
||||
if (!mcMMO.p.getConfig().getBoolean("General.Config_Update_Overwrite", true)) {
|
||||
saveName += ".new";
|
||||
}
|
||||
|
||||
File newSaveFile = new File(dataFolder, saveName);
|
||||
FileWriter fileWriter = new FileWriter(newSaveFile.getAbsolutePath());
|
||||
BufferedWriter writer = new BufferedWriter(fileWriter);
|
||||
writer.write(output);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AutoUpdateLegacyConfigLoader extends LegacyConfigLoader {
|
||||
public AutoUpdateLegacyConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||
super(relativePath, fileName, dataFolder);
|
||||
}
|
||||
|
||||
public AutoUpdateLegacyConfigLoader(String fileName, File dataFolder) {
|
||||
super(fileName, dataFolder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateLegacyConfigLoader(String relativePath, String fileName) {
|
||||
super(relativePath, fileName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public AutoUpdateLegacyConfigLoader(String fileName) {
|
||||
super(fileName);
|
||||
}
|
||||
|
||||
protected void saveConfig() {
|
||||
try {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving changes to config file - " + fileName);
|
||||
config.options().indent(2);
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected @NotNull FileConfiguration getInternalConfig() {
|
||||
return YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadFile() {
|
||||
super.loadFile();
|
||||
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(mcMMO.p.getResourceAsReader(fileName));
|
||||
|
||||
Set<String> configKeys = config.getKeys(true);
|
||||
Set<String> internalConfigKeys = internalConfig.getKeys(true);
|
||||
|
||||
boolean needSave = false;
|
||||
|
||||
// keys present in current config file that are not in the template
|
||||
Set<String> oldKeys = new HashSet<>(configKeys);
|
||||
oldKeys.removeAll(internalConfigKeys);
|
||||
|
||||
if (!oldKeys.isEmpty()) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "old key(s) in \"" + fileName + "\"");
|
||||
for (String key : oldKeys) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), " old-key:" + key);
|
||||
}
|
||||
}
|
||||
|
||||
// keys present in template that are not in current file
|
||||
Set<String> newKeys = new HashSet<>(internalConfigKeys);
|
||||
newKeys.removeAll(configKeys);
|
||||
|
||||
if (!newKeys.isEmpty()) {
|
||||
needSave = true;
|
||||
}
|
||||
|
||||
for (String key : newKeys) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Adding new key: " + key + " = " + internalConfig.get(key));
|
||||
config.set(key, internalConfig.get(key));
|
||||
}
|
||||
|
||||
if (needSave) {
|
||||
// Save it
|
||||
|
||||
if (dataFolder == null) {
|
||||
mcMMO.p.getLogger().severe("Data folder should never be null!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String saveName = fileName;
|
||||
// At this stage we cannot guarantee that Config has been loaded, so we do the check directly here
|
||||
if (!mcMMO.p.getConfig().getBoolean("General.Config_Update_Overwrite", true)) {
|
||||
saveName += ".new";
|
||||
}
|
||||
|
||||
File newSaveFile = new File(dataFolder, saveName);
|
||||
YamlConfiguration yamlConfiguration = config;
|
||||
yamlConfiguration.options().indent(4);
|
||||
yamlConfiguration.save(newSaveFile);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
181
src/main/java/com/gmail/nossr50/config/BukkitConfig.java
Normal file
181
src/main/java/com/gmail/nossr50/config/BukkitConfig.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BukkitConfig {
|
||||
boolean copyDefaults = true;
|
||||
protected final String fileName;
|
||||
protected final File configFile;
|
||||
protected YamlConfiguration defaultYamlConfig;
|
||||
protected YamlConfiguration config;
|
||||
protected @NotNull final File dataFolder;
|
||||
private boolean savedDefaults = false;
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder, boolean copyDefaults) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Initializing config: " + fileName);
|
||||
this.copyDefaults = copyDefaults;
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
this.defaultYamlConfig = saveDefaultConfigToDisk();
|
||||
this.config = initConfig();
|
||||
updateFile();
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Config initialized: " + fileName);
|
||||
}
|
||||
|
||||
public BukkitConfig(@NotNull String fileName, @NotNull File dataFolder) {
|
||||
this(fileName, dataFolder, true);
|
||||
}
|
||||
|
||||
public BukkitConfig(@NotNull String fileName) {
|
||||
this(fileName, mcMMO.p.getDataFolder());
|
||||
}
|
||||
public BukkitConfig(@NotNull String fileName, boolean copyDefaults) {
|
||||
this(fileName, mcMMO.p.getDataFolder(), copyDefaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the file on the disk by copying out any new and missing defaults
|
||||
*/
|
||||
public void updateFile() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
|
||||
if(copyDefaults && !savedDefaults) {
|
||||
copyMissingDefaultsFromResource();
|
||||
savedDefaults = true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies missing keys and values from the internal resource config within the JAR
|
||||
*/
|
||||
private void copyMissingDefaultsFromResource() {
|
||||
boolean updated = false;
|
||||
for (String key : defaultYamlConfig.getKeys(true)) {
|
||||
if (!config.contains(key)) {
|
||||
config.set(key, defaultYamlConfig.get(key));
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
updateFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the config from the JAR to defaults/<fileName>
|
||||
*/
|
||||
YamlConfiguration saveDefaultConfigToDisk() {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
||||
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
||||
if(inputStream == null) {
|
||||
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
|
||||
return null;
|
||||
}
|
||||
|
||||
//Save default file into defaults/<fileName>
|
||||
File defaultsFolder = new File(dataFolder, "defaults");
|
||||
if (!defaultsFolder.exists()) {
|
||||
defaultsFolder.mkdir();
|
||||
}
|
||||
File defaultFile = new File(defaultsFolder, fileName);
|
||||
Path path = defaultFile.toPath();
|
||||
Files.copy(inputStream, path, java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
// Load file into YAML config
|
||||
YamlConfiguration defaultYamlConfig = new YamlConfiguration();
|
||||
defaultYamlConfig.load(defaultFile);
|
||||
return defaultYamlConfig;
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
YamlConfiguration initConfig() {
|
||||
if (!configFile.exists()) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "User config file not found, copying a default config to disk: " + fileName);
|
||||
mcMMO.p.saveResource(fileName, false);
|
||||
}
|
||||
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Loading config from disk: " + fileName);
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.options().indent(4);
|
||||
|
||||
try {
|
||||
config.options().parseComments(true);
|
||||
} catch (NoSuchMethodError e) {
|
||||
//e.printStackTrace();
|
||||
// mcMMO.p.getLogger().severe("Your Spigot/CraftBukkit API is out of date, update your server software!");
|
||||
}
|
||||
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
try {
|
||||
config.load(configFile);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
protected abstract void loadKeys();
|
||||
|
||||
protected boolean validateKeys() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean noErrorsInConfig(List<String> issues) {
|
||||
for (String issue : issues) {
|
||||
mcMMO.p.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
}
|
||||
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||
mcMMO.p.noErrorsInConfigFiles = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void backup() {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "You are using an old version of the " + fileName + " file.");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Your old file has been renamed to " + fileName + ".old and has been replaced by an updated version.");
|
||||
|
||||
configFile.renameTo(new File(configFile.getPath() + ".old"));
|
||||
|
||||
if (mcMMO.p.getResource(fileName) != null) {
|
||||
mcMMO.p.saveResource(fileName, true);
|
||||
}
|
||||
|
||||
mcMMO.p.getLogger().warning("Reloading " + fileName + " with new values...");
|
||||
initConfig();
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return configFile;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatConfig extends AutoUpdateConfigLoader {
|
||||
public class ChatConfig extends BukkitConfig {
|
||||
private static ChatConfig instance;
|
||||
|
||||
private ChatConfig() {
|
||||
@@ -40,8 +40,10 @@ public class ChatConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not to use display names for players in target {@link ChatChannel}
|
||||
* Whether to use display names for players in target {@link ChatChannel}
|
||||
*
|
||||
* @param chatChannel target chat channel
|
||||
*
|
||||
* @return true if display names should be used
|
||||
*/
|
||||
public boolean useDisplayNames(@NotNull ChatChannel chatChannel) {
|
||||
@@ -49,6 +51,12 @@ public class ChatConfig extends AutoUpdateConfigLoader {
|
||||
return config.getBoolean(key, true);
|
||||
}
|
||||
|
||||
public boolean isConsoleIncludedInAudience(@NotNull ChatChannel chatChannel) {
|
||||
String key = "Chat.Channels." + StringUtils.getCapitalized(chatChannel.toString()) + ".Send_To_Console";
|
||||
return config.getBoolean(key, true);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSpyingAutomatic() {
|
||||
return config.getBoolean("Chat.Channels.Party.Spies.Automatically_Enable_Spying", false);
|
||||
}
|
||||
|
||||
@@ -4,28 +4,26 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
|
||||
public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
public class CoreSkillsConfig extends BukkitConfig {
|
||||
private static CoreSkillsConfig instance;
|
||||
|
||||
public CoreSkillsConfig()
|
||||
{
|
||||
public CoreSkillsConfig() {
|
||||
super("coreskills.yml");
|
||||
validate();
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance() {
|
||||
if (instance == null)
|
||||
instance = new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static CoreSkillsConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new CoreSkillsConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
|
||||
@@ -37,23 +35,25 @@ public class CoreSkillsConfig extends AutoUpdateConfigLoader {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Whether or not a skill is enabled
|
||||
* Whether a skill is enabled
|
||||
* Defaults true
|
||||
*
|
||||
* @param abstractSubSkill SubSkill definition to check
|
||||
*
|
||||
* @return true if subskill is enabled
|
||||
*/
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString())+"."+ abstractSubSkill.getConfigKeyName()+".Enabled", true);
|
||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()) + "." + abstractSubSkill.getConfigKeyName() + ".Enabled", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this primary skill is enabled
|
||||
* Whether this primary skill is enabled
|
||||
*
|
||||
* @param primarySkillType target primary skill
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType)
|
||||
{
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString())+".Enabled", true);
|
||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString()) + ".Enabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,27 +1,28 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ConfigLoader {
|
||||
protected String fileName;
|
||||
@Deprecated
|
||||
public abstract class LegacyConfigLoader {
|
||||
protected final File configFile;
|
||||
protected FileConfiguration config;
|
||||
protected @NotNull final File dataFolder;
|
||||
protected final @NotNull File dataFolder;
|
||||
protected String fileName;
|
||||
protected YamlConfiguration config;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||
public LegacyConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
public ConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||
public LegacyConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||
this.fileName = fileName;
|
||||
this.dataFolder = dataFolder;
|
||||
configFile = new File(dataFolder, fileName);
|
||||
@@ -29,7 +30,7 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
public LegacyConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
||||
@@ -37,7 +38,7 @@ public abstract class ConfigLoader {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ConfigLoader(String fileName) {
|
||||
public LegacyConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(mcMMO.p.getDataFolder(), fileName);
|
||||
this.dataFolder = mcMMO.p.getDataFolder();
|
||||
@@ -46,17 +47,15 @@ public abstract class ConfigLoader {
|
||||
|
||||
protected void loadFile() {
|
||||
if (!configFile.exists()) {
|
||||
mcMMO.p.debug("Creating mcMMO " + fileName + " File...");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File...");
|
||||
|
||||
try {
|
||||
mcMMO.p.saveResource(fileName, false); // Normal files
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
mcMMO.p.saveResource(configFile.getParentFile().getName() + File.separator + fileName, false); // Mod files
|
||||
}
|
||||
}
|
||||
else {
|
||||
mcMMO.p.debug("Loading mcMMO " + fileName + " File...");
|
||||
} else {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File...");
|
||||
}
|
||||
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
@@ -78,9 +77,8 @@ public abstract class ConfigLoader {
|
||||
|
||||
protected void validate() {
|
||||
if (validateKeys()) {
|
||||
mcMMO.p.debug("No errors found in " + fileName + "!");
|
||||
}
|
||||
else {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
|
||||
} else {
|
||||
mcMMO.p.getLogger().warning("Errors were found in " + fileName + "! mcMMO was disabled!");
|
||||
mcMMO.p.getServer().getPluginManager().disablePlugin(mcMMO.p);
|
||||
mcMMO.p.noErrorsInConfigFiles = false;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
|
||||
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
||||
|
||||
public class PersistentDataConfig extends AutoUpdateConfigLoader {
|
||||
public class PersistentDataConfig extends BukkitConfig {
|
||||
private static PersistentDataConfig instance;
|
||||
|
||||
private PersistentDataConfig() {
|
||||
|
||||
@@ -3,35 +3,34 @@ package com.gmail.nossr50.config;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class RankConfig extends AutoUpdateConfigLoader {
|
||||
public class RankConfig extends BukkitConfig {
|
||||
private static RankConfig instance;
|
||||
|
||||
public RankConfig()
|
||||
{
|
||||
public RankConfig() {
|
||||
super("skillranks.yml");
|
||||
validate();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static RankConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
public static RankConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new RankConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
List<String> reason = new ArrayList<>();
|
||||
@@ -46,12 +45,13 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank)
|
||||
{
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
String key = subSkillType.getRankConfigAddress();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
@@ -59,33 +59,37 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param subSkillType target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode)
|
||||
{
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank, boolean retroMode) {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
return config.getInt(key, getInternalConfig().getInt(key));
|
||||
return config.getInt(key, defaultYamlConfig.getInt(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
*
|
||||
* @param abstractSubSkill target subskill
|
||||
* @param rank the rank we are checking
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank)
|
||||
{
|
||||
String key = abstractSubSkill.getPrimaryKeyName()+"."+abstractSubSkill.getConfigKeyName();
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
String key = abstractSubSkill.getPrimaryKeyName() + "." + abstractSubSkill.getConfigKeyName();
|
||||
|
||||
return findRankByRootAddress(rank, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unlock level for a subskill depending on the gamemode
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
*
|
||||
* @param key root address of the subskill in the rankskills.yml file
|
||||
* @param rank the rank we are checking
|
||||
*
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
private int findRankByRootAddress(int rank, String key) {
|
||||
@@ -125,62 +129,57 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) {
|
||||
String key = getRankAddressKey(subSkillType, rank, retroMode);
|
||||
int defaultValue = getInternalConfig().getInt(key);
|
||||
int defaultValue = defaultYamlConfig.getInt(key);
|
||||
config.set(key, defaultValue);
|
||||
mcMMO.p.getLogger().info(key +" SET -> " + defaultValue);
|
||||
LogUtils.debug(mcMMO.p.getLogger(), key + " SET -> " + defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for valid keys for subskill ranks
|
||||
*/
|
||||
private void checkKeys(@NotNull List<String> reasons)
|
||||
{
|
||||
private void checkKeys(@NotNull List<String> reasons) {
|
||||
HashSet<SubSkillType> badSkillSetup = new HashSet<>();
|
||||
|
||||
|
||||
//For now we will only check ranks of stuff I've overhauled
|
||||
checkConfig(reasons, badSkillSetup, true);
|
||||
checkConfig(reasons, badSkillSetup, false);
|
||||
|
||||
//Fix bad entries
|
||||
if(badSkillSetup.isEmpty())
|
||||
if (badSkillSetup.isEmpty())
|
||||
return;
|
||||
|
||||
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
|
||||
|
||||
for(SubSkillType subSkillType : badSkillSetup) {
|
||||
mcMMO.p.getLogger().info("(FIXING CONFIG) Resetting rank config settings for skill named - "+subSkillType.toString());
|
||||
for (SubSkillType subSkillType : badSkillSetup) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
|
||||
fixBadEntries(subSkillType);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkConfig(@NotNull List<String> reasons, @NotNull HashSet<SubSkillType> badSkillSetup, boolean retroMode) {
|
||||
for(SubSkillType subSkillType : SubSkillType.values())
|
||||
{
|
||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||
//Keeping track of the rank requirements and making sure there are no logical errors
|
||||
int curRank = 0;
|
||||
int prevRank = 0;
|
||||
|
||||
for(int x = 0; x < subSkillType.getNumRanks(); x++)
|
||||
{
|
||||
int index = x+1;
|
||||
for (int x = 0; x < subSkillType.getNumRanks(); x++) {
|
||||
int index = x + 1;
|
||||
|
||||
if(curRank > 0)
|
||||
if (curRank > 0)
|
||||
prevRank = curRank;
|
||||
|
||||
curRank = getSubSkillUnlockLevel(subSkillType, index, retroMode);
|
||||
|
||||
//Do we really care if its below 0? Probably not
|
||||
if(curRank < 0)
|
||||
{
|
||||
reasons.add("(CONFIG ISSUE) " + subSkillType.toString() + " should not have any ranks that require a negative level!");
|
||||
if (curRank < 0) {
|
||||
reasons.add("(CONFIG ISSUE) " + subSkillType + " should not have any ranks that require a negative level!");
|
||||
badSkillSetup.add(subSkillType);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(prevRank > curRank)
|
||||
{
|
||||
if (prevRank > curRank) {
|
||||
//We're going to allow this but we're going to warn them
|
||||
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill "+ subSkillType.toString()+" set up poorly, sequential ranks should have ascending requirements");
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
|
||||
badSkillSetup.add(subSkillType);
|
||||
}
|
||||
}
|
||||
@@ -188,9 +187,8 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
private void fixBadEntries(@NotNull SubSkillType subSkillType) {
|
||||
for(int x = 0; x < subSkillType.getNumRanks(); x++)
|
||||
{
|
||||
int index = x+1;
|
||||
for (int x = 0; x < subSkillType.getNumRanks(); x++) {
|
||||
int index = x + 1;
|
||||
|
||||
//Reset Retromode entries
|
||||
resetRankValue(subSkillType, index, true);
|
||||
@@ -198,6 +196,6 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
||||
resetRankValue(subSkillType, index, false);
|
||||
}
|
||||
|
||||
saveConfig();
|
||||
updateFile();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,42 @@
|
||||
package com.gmail.nossr50.config;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.LogUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
|
||||
public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
public class SoundConfig extends BukkitConfig {
|
||||
private static SoundConfig instance;
|
||||
|
||||
public SoundConfig()
|
||||
{
|
||||
public SoundConfig() {
|
||||
super("sounds.yml");
|
||||
validate();
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance() {
|
||||
if (instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
|
||||
}
|
||||
|
||||
public static SoundConfig getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
return new SoundConfig();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
for(SoundType soundType : SoundType.values())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Volume") < 0)
|
||||
{
|
||||
mcMMO.p.getLogger().info("[mcMMO] Sound volume cannot be below 0 for "+soundType.toString());
|
||||
for (SoundType soundType : SoundType.values()) {
|
||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound volume cannot be below 0 for " + soundType);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Sounds with custom pitching don't use pitch values
|
||||
if(!soundType.usesCustomPitch())
|
||||
{
|
||||
if(config.getDouble("Sounds."+soundType.toString()+".Pitch") < 0)
|
||||
{
|
||||
mcMMO.p.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for "+soundType.toString());
|
||||
if (!soundType.usesCustomPitch()) {
|
||||
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound pitch cannot be below 0 for " + soundType);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -49,23 +44,22 @@ public class SoundConfig extends AutoUpdateConfigLoader {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getMasterVolume() { return (float) config.getDouble("Sounds.MasterVolume", 1.0); }
|
||||
public float getMasterVolume() {
|
||||
return (float) config.getDouble("Sounds.MasterVolume", 1.0);
|
||||
}
|
||||
|
||||
public float getVolume(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Volume";
|
||||
public float getVolume(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Volume";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public float getPitch(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Pitch";
|
||||
public float getPitch(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Pitch";
|
||||
return (float) config.getDouble(key);
|
||||
}
|
||||
|
||||
public boolean getIsEnabled(SoundType soundType)
|
||||
{
|
||||
String key = "Sounds."+soundType.toString()+".Enabled";
|
||||
public boolean getIsEnabled(SoundType soundType) {
|
||||
String key = "Sounds." + soundType.toString() + ".Enabled";
|
||||
return config.getBoolean(key, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,20 +15,28 @@ public class WorldBlacklist {
|
||||
|
||||
private final String blackListFileName = "world_blacklist.txt";
|
||||
|
||||
public WorldBlacklist(mcMMO plugin)
|
||||
{
|
||||
public WorldBlacklist(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
blacklist = new ArrayList<>();
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
public static boolean isWorldBlacklisted(World world) {
|
||||
|
||||
for (String s : blacklist) {
|
||||
if (world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
//Make the blacklist file if it doesn't exist
|
||||
File blackListFile = new File(plugin.getDataFolder() + File.separator + blackListFileName);
|
||||
|
||||
try {
|
||||
if(!blackListFile.exists())
|
||||
if (!blackListFile.exists())
|
||||
blackListFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -48,12 +56,11 @@ public class WorldBlacklist {
|
||||
|
||||
String currentLine;
|
||||
|
||||
while((currentLine = bufferedReader.readLine()) != null)
|
||||
{
|
||||
if(currentLine.length() == 0)
|
||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||
if (currentLine.length() == 0)
|
||||
continue;
|
||||
|
||||
if(!blacklist.contains(currentLine))
|
||||
if (!blacklist.contains(currentLine))
|
||||
blacklist.add(currentLine);
|
||||
}
|
||||
|
||||
@@ -66,11 +73,12 @@ public class WorldBlacklist {
|
||||
closeRead(fileReader);
|
||||
}
|
||||
|
||||
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
|
||||
if(blacklist.size() > 0)
|
||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||
}
|
||||
|
||||
private void closeRead(Reader reader) {
|
||||
if(reader != null) {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
@@ -78,16 +86,4 @@ public class WorldBlacklist {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWorldBlacklisted(World world)
|
||||
{
|
||||
|
||||
for(String s : blacklist)
|
||||
{
|
||||
if(world.getName().equalsIgnoreCase(s))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.experience;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.config.BukkitConfig;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
@@ -13,12 +13,11 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
public class ExperienceConfig extends BukkitConfig {
|
||||
private static ExperienceConfig instance;
|
||||
|
||||
private ExperienceConfig() {
|
||||
@@ -35,7 +34,8 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {}
|
||||
protected void loadKeys() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean validateKeys() {
|
||||
@@ -140,219 +140,291 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return noErrorsInConfig(reason);
|
||||
}
|
||||
|
||||
public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
|
||||
public boolean isEarlyGameBoostEnabled() {
|
||||
return config.getBoolean("EarlyGameBoost.Enabled", true);
|
||||
}
|
||||
|
||||
/*
|
||||
* FORMULA SETTINGS
|
||||
*/
|
||||
|
||||
/* EXPLOIT TOGGLES */
|
||||
public boolean isSnowExploitPrevented() { return config.getBoolean("ExploitFix.SnowGolemExcavation", true); }
|
||||
public boolean isEndermanEndermiteFarmingPrevented() { return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true); }
|
||||
public boolean isPistonCheatingPrevented() { return config.getBoolean("ExploitFix.PistonCheating", true); }
|
||||
public boolean isPistonExploitPrevented() { return config.getBoolean("ExploitFix.Pistons", false); }
|
||||
public boolean allowUnsafeEnchantments() { return config.getBoolean("ExploitFix.UnsafeEnchantments", false); }
|
||||
public boolean isCOTWBreedingPrevented() { return config.getBoolean("ExploitFix.COTWBreeding", true); }
|
||||
public boolean isNPCInteractionPrevented() { return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true); }
|
||||
public boolean isSnowExploitPrevented() {
|
||||
return config.getBoolean("ExploitFix.SnowGolemExcavation", true);
|
||||
}
|
||||
|
||||
public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }
|
||||
public boolean isTreeFellerXPReduced() { return config.getBoolean("ExploitFix.TreeFellerReducedXP", true); }
|
||||
public boolean isEndermanEndermiteFarmingPrevented() {
|
||||
return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true);
|
||||
}
|
||||
|
||||
public boolean isPistonCheatingPrevented() {
|
||||
return config.getBoolean("ExploitFix.PistonCheating", true);
|
||||
}
|
||||
|
||||
public boolean isPistonExploitPrevented() {
|
||||
return config.getBoolean("ExploitFix.Pistons", false);
|
||||
}
|
||||
|
||||
public boolean allowUnsafeEnchantments() {
|
||||
return config.getBoolean("ExploitFix.UnsafeEnchantments", false);
|
||||
}
|
||||
|
||||
public boolean isCOTWBreedingPrevented() {
|
||||
return config.getBoolean("ExploitFix.COTWBreeding", true);
|
||||
}
|
||||
|
||||
public boolean isNPCInteractionPrevented() {
|
||||
return config.getBoolean("ExploitFix.PreventPluginNPCInteraction", true);
|
||||
}
|
||||
|
||||
public boolean isFishingExploitingPrevented() {
|
||||
return config.getBoolean("ExploitFix.Fishing", true);
|
||||
}
|
||||
|
||||
public int getFishingExploitingOptionMoveRange() {
|
||||
return config.getInt("Fishing_ExploitFix_Options.MoveRange", 3);
|
||||
}
|
||||
|
||||
public int getFishingExploitingOptionOverFishLimit() {
|
||||
return config.getInt("Fishing_ExploitFix_Options.OverFishLimit", 10);
|
||||
}
|
||||
|
||||
public boolean isAcrobaticsExploitingPrevented() {
|
||||
return config.getBoolean("ExploitFix.Acrobatics", true);
|
||||
}
|
||||
|
||||
public boolean isTreeFellerXPReduced() {
|
||||
return config.getBoolean("ExploitFix.TreeFellerReducedXP", true);
|
||||
}
|
||||
|
||||
/* Curve settings */
|
||||
public FormulaType getFormulaType() { return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve")); }
|
||||
public boolean getCumulativeCurveEnabled() { return config.getBoolean("Experience_Formula.Cumulative_Curve", false); }
|
||||
public FormulaType getFormulaType() {
|
||||
return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve"));
|
||||
}
|
||||
|
||||
public boolean getCumulativeCurveEnabled() {
|
||||
return config.getBoolean("Experience_Formula.Cumulative_Curve", false);
|
||||
}
|
||||
|
||||
/* Curve values */
|
||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||
public double getMultiplier(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier");
|
||||
}
|
||||
|
||||
public int getBase(FormulaType type) {
|
||||
return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base");
|
||||
}
|
||||
|
||||
public double getExponent(FormulaType type) {
|
||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent");
|
||||
}
|
||||
|
||||
/* Global modifier */
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||
public void setExperienceGainsGlobalMultiplier(double value) { config.set("Experience_Formula.Multiplier.Global", value); }
|
||||
public double getExperienceGainsGlobalMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.Global", 1.0);
|
||||
}
|
||||
|
||||
public void setExperienceGainsGlobalMultiplier(double value) {
|
||||
config.set("Experience_Formula.Multiplier.Global", value);
|
||||
}
|
||||
|
||||
/* PVP modifier */
|
||||
public double getPlayerVersusPlayerXP() { return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0); }
|
||||
public double getPlayerVersusPlayerXP() {
|
||||
return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0);
|
||||
}
|
||||
|
||||
/* Spawned Mob modifier */
|
||||
public double getSpawnedMobXpMultiplier() { return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0); }
|
||||
public double getEggXpMultiplier() { return config.getDouble("Experience_Formula.Eggs.Multiplier", 0.0); }
|
||||
public double getTamedMobXpMultiplier() { return config.getDouble("Experience_Formula.Player_Tamed.Multiplier", 0.0); }
|
||||
public double getNetherPortalXpMultiplier() { return config.getDouble("Experience_Formula.Nether_Portal.Multiplier", 0.0); }
|
||||
public double getBredMobXpMultiplier() { return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0); }
|
||||
public double getSpawnedMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getEggXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Eggs.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getTamedMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Player_Tamed.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getNetherPortalXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Nether_Portal.Multiplier", 0.0);
|
||||
}
|
||||
|
||||
public double getBredMobXpMultiplier() {
|
||||
return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0);
|
||||
}
|
||||
|
||||
/* Skill modifiers */
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
|
||||
public double getFormulaSkillModifier(PrimarySkillType skill) {
|
||||
return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString()), 1);
|
||||
}
|
||||
|
||||
/* Custom XP perk */
|
||||
public double getCustomXpPerkBoost() { return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25); }
|
||||
public double getCustomXpPerkBoost() {
|
||||
return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25);
|
||||
}
|
||||
|
||||
/* Diminished Returns */
|
||||
public float getDiminishedReturnsCap() { return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D); }
|
||||
public boolean getDiminishedReturnsEnabled() { return config.getBoolean("Diminished_Returns.Enabled", false); }
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) { return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000); }
|
||||
public int getDiminishedReturnsTimeInterval() { return config.getInt("Diminished_Returns.Time_Interval", 10); }
|
||||
public float getDiminishedReturnsCap() {
|
||||
return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D);
|
||||
}
|
||||
|
||||
public boolean getDiminishedReturnsEnabled() {
|
||||
return config.getBoolean("Diminished_Returns.Enabled", false);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) {
|
||||
return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000);
|
||||
}
|
||||
|
||||
public int getDiminishedReturnsTimeInterval() {
|
||||
return config.getInt("Diminished_Returns.Time_Interval", 10);
|
||||
}
|
||||
|
||||
/* Conversion */
|
||||
public double getExpModifier() { return config.getDouble("Conversion.Exp_Modifier", 1); }
|
||||
public double getExpModifier() {
|
||||
return config.getDouble("Conversion.Exp_Modifier", 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* XP SETTINGS
|
||||
*/
|
||||
|
||||
/* General Settings */
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() { return config.getBoolean("Experience_Values.PVP.Rewards", true); }
|
||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
||||
return config.getBoolean("Experience_Values.PVP.Rewards", true);
|
||||
}
|
||||
|
||||
/* Combat XP Multipliers */
|
||||
public double getCombatXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getAnimalsXP(EntityType entity) { return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP()); }
|
||||
public double getAnimalsXP() { return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0); }
|
||||
public boolean hasCombatXP(EntityType entity) {return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_")); }
|
||||
public double getCombatXP(String entity) {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier." + entity);
|
||||
}
|
||||
|
||||
public double getCombatXP(EntityType entity) {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
public double getAnimalsXP(EntityType entity) {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP());
|
||||
}
|
||||
|
||||
public double getAnimalsXP() {
|
||||
return config.getDouble("Experience_Values.Combat.Multiplier.Animals", 1.0);
|
||||
}
|
||||
|
||||
public boolean hasCombatXP(EntityType entity) {
|
||||
return config.contains("Experience_Values.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, Material material)
|
||||
{
|
||||
//TODO: Temporary measure to fix an exploit caused by a yet to be fixed Spigot bug (as of 7/3/2020)
|
||||
if(material.toString().equalsIgnoreCase("LILY_PAD"))
|
||||
public int getXp(PrimarySkillType skill, Material material) {
|
||||
return getXpHelper(skill, StringUtils.getExplicitConfigMaterialString(material),
|
||||
StringUtils.getFriendlyConfigMaterialString(material),
|
||||
StringUtils.getWildcardConfigMaterialString(material));
|
||||
}
|
||||
|
||||
public int getXp(PrimarySkillType skill, BlockState blockState) {
|
||||
Material material = blockState.getType();
|
||||
return getXp(skill, material);
|
||||
}
|
||||
|
||||
public int getXp(PrimarySkillType skill, Block block) {
|
||||
Material material = block.getType();
|
||||
return getXp(skill, material);
|
||||
}
|
||||
|
||||
public int getXp(PrimarySkillType skill, BlockData data) {
|
||||
return getXpHelper(skill, StringUtils.getExplicitConfigBlockDataString(data),
|
||||
StringUtils.getFriendlyConfigBlockDataString(data),
|
||||
StringUtils.getWildcardConfigBlockDataString(data));
|
||||
}
|
||||
|
||||
private int getXpHelper(PrimarySkillType skill, String explicitString, String friendlyString, String wildcardString) {
|
||||
if (explicitString.equalsIgnoreCase("LILY_PAD")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(material);
|
||||
if (config.contains(explicitString))
|
||||
return config.getInt(explicitString);
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(material);
|
||||
if (config.contains(friendlyString))
|
||||
return config.getInt(friendlyString);
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(material);
|
||||
if (config.contains(wildcardString))
|
||||
return config.getInt(wildcardString);
|
||||
String[] configStrings = {explicitString, friendlyString, wildcardString};
|
||||
|
||||
for (String configString : configStrings) {
|
||||
String fullPath = baseString + configString;
|
||||
if (config.contains(fullPath)) {
|
||||
return config.getInt(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, BlockState blockState)
|
||||
{
|
||||
Material data = blockState.getType();
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
return config.getInt(explicitString);
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return config.getInt(friendlyString);
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||
if (config.contains(wildcardString))
|
||||
return config.getInt(wildcardString);
|
||||
return 0;
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material material) {
|
||||
return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigMaterialString(material),
|
||||
StringUtils.getFriendlyConfigMaterialString(material),
|
||||
StringUtils.getWildcardConfigMaterialString(material));
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, Block block)
|
||||
{
|
||||
Material data = block.getType();
|
||||
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
return config.getInt(explicitString);
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return config.getInt(friendlyString);
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||
if (config.contains(wildcardString))
|
||||
return config.getInt(wildcardString);
|
||||
return 0;
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) {
|
||||
return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigBlockDataString(data),
|
||||
StringUtils.getFriendlyConfigBlockDataString(data),
|
||||
StringUtils.getWildcardConfigBlockDataString(data));
|
||||
}
|
||||
|
||||
/* Materials */
|
||||
public int getXp(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
private boolean doesBlockGiveSkillXPHelper(PrimarySkillType skill, String explicitString, String friendlyString, String wildcardString) {
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
return config.getInt(explicitString);
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return config.getInt(friendlyString);
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||
if (config.contains(wildcardString))
|
||||
return config.getInt(wildcardString);
|
||||
return 0;
|
||||
String[] configStrings = {explicitString, friendlyString, wildcardString};
|
||||
|
||||
for (String configString : configStrings) {
|
||||
String fullPath = baseString + configString;
|
||||
if (config.contains(fullPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material data)
|
||||
{
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
return true;
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||
if (config.contains(explicitString))
|
||||
return true;
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
/*
|
||||
* Experience Bar Stuff
|
||||
*/
|
||||
|
||||
public boolean isPartyExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPartyExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Party", true);
|
||||
}
|
||||
|
||||
public boolean isPassiveGainsExperienceBarsEnabled()
|
||||
{
|
||||
public boolean isPassiveGainsExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Update.Passive", true);
|
||||
}
|
||||
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle()
|
||||
{
|
||||
public boolean getDoExperienceBarsAlwaysUpdateTitle() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
||||
}
|
||||
|
||||
public boolean getAddExtraDetails() { return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);}
|
||||
public boolean isExperienceBarsEnabled() { return config.getBoolean("Experience_Bars.Enable", true); }
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Enable", true);}
|
||||
public boolean isExperienceBarEnabled(@NotNull PrimarySkillType primarySkillType) { return config.getBoolean("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.getRawSkillName())+".Enable", true);}
|
||||
|
||||
public BarColor getExperienceBarColor(@NotNull PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.getRawSkillName())+".Color");
|
||||
|
||||
for(BarColor barColor : BarColor.values())
|
||||
{
|
||||
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barColor;
|
||||
}
|
||||
|
||||
//In case the value is invalid
|
||||
return BarColor.WHITE;
|
||||
public boolean getAddExtraDetails() {
|
||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
|
||||
}
|
||||
public boolean useCombatHPCeiling() {
|
||||
return config.getBoolean("ExploitFix.Combat.XPCeiling.Enabled", true);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
|
||||
{
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
|
||||
public int getCombatHPCeiling() {
|
||||
return config.getInt("ExploitFix.Combat.XPCeiling.HP_Modifier_Limit", 100);
|
||||
}
|
||||
|
||||
for(BarColor barColor : BarColor.values())
|
||||
{
|
||||
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
public boolean isExperienceBarsEnabled() {
|
||||
return config.getBoolean("Experience_Bars.Enable", true);
|
||||
}
|
||||
|
||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) {
|
||||
return config.getBoolean("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Enable", true);
|
||||
}
|
||||
|
||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Color");
|
||||
|
||||
for (BarColor barColor : BarColor.values()) {
|
||||
if (barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barColor;
|
||||
}
|
||||
|
||||
@@ -361,24 +433,10 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".BarStyle");
|
||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".BarStyle");
|
||||
|
||||
for(BarStyle barStyle : BarStyle.values())
|
||||
{
|
||||
if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barStyle;
|
||||
}
|
||||
|
||||
//In case the value is invalid
|
||||
return BarStyle.SOLID;
|
||||
}
|
||||
|
||||
public BarStyle getExperienceBarStyle(@NotNull PrimarySkillType primarySkillType) {
|
||||
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.getRawSkillName())+".BarStyle");
|
||||
|
||||
for(BarStyle barStyle : BarStyle.values())
|
||||
{
|
||||
if(barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
for (BarStyle barStyle : BarStyle.values()) {
|
||||
if (barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||
return barStyle;
|
||||
}
|
||||
|
||||
@@ -387,29 +445,51 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
public int getDodgeXPModifier() { return config.getInt("Experience_Values.Acrobatics.Dodge", 120); }
|
||||
public int getRollXPModifier() { return config.getInt("Experience_Values.Acrobatics.Roll", 80); }
|
||||
public int getFallXPModifier() { return config.getInt("Experience_Values.Acrobatics.Fall", 120); }
|
||||
public int getDodgeXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Dodge", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() { return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0); }
|
||||
public int getRollXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Roll", 80);
|
||||
}
|
||||
|
||||
public int getFallXPModifier() {
|
||||
return config.getInt("Experience_Values.Acrobatics.Fall", 120);
|
||||
}
|
||||
|
||||
public double getFeatherFallXPModifier() {
|
||||
return config.getDouble("Experience_Values.Acrobatics.FeatherFall_Multiplier", 2.0);
|
||||
}
|
||||
|
||||
/* Alchemy */
|
||||
public double getPotionXP(PotionStage stage) { return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
|
||||
public double getPotionXP(PotionStage stage) {
|
||||
return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
||||
}
|
||||
|
||||
/* Archery */
|
||||
public double getArcheryDistanceMultiplier() { return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025); }
|
||||
public double getArcheryDistanceMultiplier() {
|
||||
return config.getDouble("Experience_Values.Archery.Distance_Multiplier", 0.025);
|
||||
}
|
||||
|
||||
public int getFishingShakeXP() { return config.getInt("Experience_Values.Fishing.Shake", 50); }
|
||||
public int getFishingShakeXP() {
|
||||
return config.getInt("Experience_Values.Fishing.Shake", 50);
|
||||
}
|
||||
|
||||
/* Repair */
|
||||
public double getRepairXPBase() { return config.getDouble("Experience_Values.Repair.Base", 1000.0); }
|
||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
public double getRepairXPBase() {
|
||||
return config.getDouble("Experience_Values.Repair.Base", 1000.0);
|
||||
}
|
||||
|
||||
public double getRepairXP(MaterialType repairMaterialType) {
|
||||
return config.getDouble("Experience_Values.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXP(EntityType type)
|
||||
{
|
||||
public int getTamingXP(EntityType type) {
|
||||
return config.getInt("Experience_Values.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||
}
|
||||
|
||||
public boolean preventStoneLavaFarming() { return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);}
|
||||
public boolean preventStoneLavaFarming() {
|
||||
return config.getBoolean("ExploitFix.LavaStoneAndCobbleFarming", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ArmorConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
|
||||
modManager.registerCustomArmor(new CustomArmorLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BlockConfigManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
|
||||
modManager.registerCustomBlocks(new CustomBlockLegacyConfig(fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -13,17 +13,15 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
public class CustomArmorLegacyConfig extends LegacyConfigLoader {
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customChestplates = new ArrayList<>();
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
public List<Material> customLeggings = new ArrayList<>();
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customBoots = new ArrayList<>();
|
||||
public List<Material> customChestplates = new ArrayList<>();
|
||||
public List<Material> customHelmets = new ArrayList<>();
|
||||
public List<Material> customLeggings = new ArrayList<>();
|
||||
|
||||
public List<Repairable> repairables = new ArrayList<>();
|
||||
|
||||
protected CustomArmorConfig(String fileName) {
|
||||
protected CustomArmorLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
@@ -11,20 +11,18 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
public class CustomBlockLegacyConfig extends LegacyConfigLoader {
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
protected CustomBlockLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
||||
@@ -85,12 +83,10 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockMaterial);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
} else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockMaterial);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
customLeaves.add(blockMaterial);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.config.LegacyConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
@@ -9,11 +9,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CustomEntityConfig extends ConfigLoader {
|
||||
public class CustomEntityLegacyConfig extends LegacyConfigLoader {
|
||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
|
||||
|
||||
protected CustomEntityConfig(String fileName) {
|
||||
protected CustomEntityLegacyConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
loadKeys();
|
||||
}
|
||||
@@ -31,8 +31,7 @@ public class CustomEntityConfig extends ConfigLoader {
|
||||
|
||||
try {
|
||||
clazz = ClassUtils.getClass(className);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||
mcMMO.p.getLogger().warning("This custom entity may not function properly.");
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user