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

Compare commits

..

129 Commits

Author SHA1 Message Date
nossr50
3d38dcb26b Comment out deprecated API (for now...) 2021-04-20 14:43:08 -07:00
nossr50
256dbc14e2 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-04-20 14:35:31 -07:00
nossr50
f643010f4b Tweaks to API 2021-04-20 14:09:15 -07:00
nossr50
70b1c23f50 Tweak pom 2021-04-20 13:59:49 -07:00
nossr50
29ee91ddfc Merge branches 'tridentsxbows' and 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-04-07 16:21:02 -07:00
nossr50
bf1426502d Merge remote-tracking branch 'origin/tridentsxbows' into tridentsxbows 2021-03-31 14:06:44 -07:00
nossr50
d21368f3e6 Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into tridentsxbows 2021-03-31 14:01:32 -07:00
nossr50
34d4b6f944 Pretty sure this is never thrown here 2021-03-30 11:57:31 -07:00
nossr50
05bc20a007 Add some notes 2021-03-30 11:52:35 -07:00
nossr50
6e0750b5fc Lets start over on PersistentPartyData 2021-03-30 11:51:14 -07:00
nossr50
ed807342cc Tweaks to exception throwing/catching for PlayerData 2021-03-30 11:48:34 -07:00
nossr50
1de9c2610b Readability 2021-03-30 11:39:10 -07:00
nossr50
788e7e433b Add equals and hashCode to PlayerData 2021-03-30 11:38:33 -07:00
nossr50
ac4bad5194 On third thought, Dirty types are pointless 2021-03-30 11:36:20 -07:00
nossr50
b57458a08a More work on reducing compiler errors 2021-03-19 14:36:52 -07:00
nossr50
062665ded4 Add back some missing commands 2021-03-19 13:40:38 -07:00
nossr50
9b856f456c Move save operation handling to its own class 2021-03-19 13:31:18 -07:00
nossr50
d33c214266 Rollback UserManager to being static again 2021-03-19 12:44:03 -07:00
nossr50
3bda73de2e Merge branches 'tridentsxbows' and 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-03-19 12:35:34 -07:00
nossr50
cc5fe92143 Fix compiler errors on FlatFileDatabase 2021-03-18 12:57:37 -07:00
nossr50
ef06546721 More work on gutting out the new skill system & reducing compiler errors 2021-03-17 14:35:24 -07:00
nossr50
b20beed836 Roll back FormulaConversionTask to master 2021-03-16 16:17:30 -07:00
nossr50
3d6b9ba539 Discard more unfinished API, eliminate more errors 2021-03-16 16:16:00 -07:00
nossr50
1c63e34dbb Comment out old API, will use as a reference when writing new API 2021-03-16 16:13:08 -07:00
nossr50
86ba265064 Rollback UserManager to match master 2021-03-16 15:47:49 -07:00
nossr50
f837be8e90 Rollback api classes to match master 2021-03-16 15:40:46 -07:00
nossr50
e958baf720 Rollback command classes to master versions 2021-03-16 15:37:23 -07:00
nossr50
8e1b223288 Gutting new skill system part 2 2021-03-16 14:59:08 -07:00
nossr50
a6276bded8 Gutting out new Skill API and putting it on hold 2021-03-16 14:43:31 -07:00
nossr50
31904ef181 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-03-16 14:18:09 -07:00
nossr50
a379b90c46 Return type McMMOPlayer from UserManager 2021-03-04 14:53:21 -08:00
nossr50
7c270feacb Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-03-03 16:36:24 -08:00
nossr50
2bad0a67a6 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-02-05 15:51:51 -08:00
nossr50
602d47698a Start to migrate Party API -> mcMMO-API 2021-01-06 15:31:02 -08:00
nossr50
d044de5350 more work on api + remove mcimport command 2021-01-06 12:12:14 -08:00
nossr50
85b88e568a Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into tridentsxbows 2021-01-06 10:29:37 -08:00
nossr50
fc10243d6f Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into tridentsxbows 2021-01-06 10:17:27 -08:00
nossr50
8a91791d2d Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-01-04 14:15:02 -08:00
nossr50
4e8262d818 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2021-01-02 16:07:17 -08:00
nossr50
5b898049a3 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-12-30 15:49:16 -08:00
nossr50
6f88c282cf minor cleanup on skill register impl 2020-12-24 16:43:27 -08:00
nossr50
21ac44ee61 More work on skill API impl/migration 2020-12-24 16:41:09 -08:00
nossr50
9b9ffbb982 More work on migrating commands to new API 2020-12-23 15:29:39 -08:00
nossr50
537b120ffc Updating command classes to new API 2020-12-23 14:58:32 -08:00
nossr50
25f7dd223d More API migration on the DB impl 2020-12-23 12:00:05 -08:00
nossr50
843e3ace99 API migration on DBs 2020-12-23 11:08:57 -08:00
nossr50
8a507de8d6 brain getting tired, time for break, more api migration included 2020-12-22 19:28:47 -08:00
nossr50
7e756c4438 More API migration 2020-12-22 19:23:03 -08:00
nossr50
4199ea0095 More API migration, feels like a mountain of work left lol 2020-12-22 17:27:25 -08:00
nossr50
73bc12841a Add Override annotations, remove redundant javadocs 2020-12-22 14:28:23 -08:00
nossr50
35be5bc17d Generify the maps 2020-12-22 14:24:37 -08:00
nossr50
b7f713a50f Use OnlineMMOPlayer over McMMOPlayer 2020-12-22 13:43:12 -08:00
nossr50
573d9d014e More work on Skill API migration 2020-12-17 16:22:22 -08:00
nossr50
abcf6413f5 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-12-17 15:10:53 -08:00
nossr50
9e931f880e updated changelog 2020-12-16 15:54:22 -08:00
nossr50
306b8cfac4 more work on migrating the API 2020-12-15 16:24:11 -08:00
nossr50
407b6fb343 more API migration 2020-12-15 09:31:51 -08:00
nossr50
d8f8d541fc more work on migrating API 2020-12-14 15:20:01 -08:00
nossr50
64e1d1a9d7 more refactoring/rewrites for player data loading stuff 2020-12-10 17:15:14 -08:00
nossr50
0e22583df4 fix skill commands 2020-12-10 16:15:47 -08:00
nossr50
1c132ddb12 slow refactoring over skill commands 2020-12-09 18:42:48 -08:00
nossr50
81d184c19e slowly refactoring stuff 2020-12-09 18:33:16 -08:00
nossr50
8491d0f4e5 annotate messaging classes + update more things to use mmoPlayer 2020-12-09 18:09:04 -08:00
nossr50
a2a41e77ea Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-12-09 17:37:30 -08:00
nossr50
8e17090cc7 these javadocs are straight up wrong 2020-12-08 15:36:24 -08:00
nossr50
3cb63202a3 more work on parties and user data 2020-12-08 15:34:16 -08:00
nossr50
0bb65e66e8 add rank edit on forced party leader 2020-12-08 14:32:45 -08:00
nossr50
17268ca4ad forced promotion on a random player in a party if party leader is ever null 2020-12-08 14:31:54 -08:00
nossr50
29fffbcc2a don't forget to init partyLeaderRef 2020-12-08 14:20:36 -08:00
nossr50
a8257f3d6e more work towards party stuff 2020-12-08 14:18:46 -08:00
nossr50
85ad0ddd17 More work on parties 2020-12-07 16:40:24 -08:00
nossr50
4e81d4ddb6 some work on experience rewrites 2020-12-04 15:36:22 -08:00
nossr50
704e24d58b SkillIdentity will be used to ID skills, establish relationships, and avoid name conflicts
Will probably move this into the mcMMO API which I might just get started on depending on my motivation
2020-12-03 13:57:46 -08:00
nossr50
450d09e9e4 wip expmanager/party/mcmmo player rewrites 2020-11-16 13:43:47 -08:00
nossr50
5dc95b1fca Merge branches 'tridentsxbows' and 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-11-13 13:53:12 -08:00
nossr50
148647709a Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-11-11 16:42:53 -08:00
nossr50
cf245b02a5 WIP of reworking classes involved in querying data, also some work done to the party code rewrite 2020-10-15 16:19:47 -07:00
nossr50
9e450adb0b reworking party code 2020-09-30 13:04:35 -07:00
nossr50
e057dfc482 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-09-30 11:35:03 -07:00
nossr50
790ac99aa4 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-09-30 11:33:00 -07:00
nossr50
934ba24b17 Applying the new design to DirtySet (formerly DirtyDataSet) as well 2020-09-17 18:46:30 -07:00
nossr50
0bfb3b23b6 DirtyMap (renamed from DirtyDataMap) treated as the map instead of a container 2020-09-17 18:26:46 -07:00
nossr50
5aaa749907 DirtyDataMap implements Map 2020-09-17 18:06:18 -07:00
nossr50
6f6f76532e Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-09-17 17:13:30 -07:00
nossr50
86fdafef08 More work on parties 2020-09-17 17:12:34 -07:00
nossr50
11c29c8299 silly git stash requirements 2020-09-10 15:56:50 -07:00
nossr50
d7099a69d8 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-09-10 15:13:07 -07:00
nossr50
4d8a57d119 upstream changes 2020-09-08 19:19:36 -07:00
nossr50
9e5c9ec567 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-09-01 13:40:01 -07:00
nossr50
17137f3a08 Update SQL Queries + SQL DB Schema 2020-08-20 21:24:48 -07:00
nossr50
642a351bb5 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-20 17:30:21 -07:00
nossr50
daada1a643 Refactoring a bunch of stuff, more refactoring to come 2020-08-17 21:15:27 -07:00
nossr50
0e9e1f5133 A lot of spaghetti relating to player state has been moved into new managers 2020-08-17 21:12:16 -07:00
nossr50
3b0b3d7eb0 DirtyData type automatically marks data as dirty when modified 2020-08-17 21:10:29 -07:00
nossr50
2ae70dddaa Immutable Player Data involved in saving moved into its own class 2020-08-17 21:09:11 -07:00
nossr50
6d5e38bec2 Updating FlatFile schema for the new data 2020-08-17 21:07:30 -07:00
nossr50
9a0c9f36a8 Moved all persistent player data into its own class 2020-08-17 21:03:07 -07:00
nossr50
58432ce80e McMMOPlayer & PlayerProfile redesigned
This is part 1 of a huge refactor, I'm going to be separating this refactor into a few commits for a cleaner history.
2020-08-17 20:40:31 -07:00
nossr50
1d950be7e4 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-11 20:44:13 -07:00
nossr50
8ca6ef5782 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-08 22:11:19 -07:00
nossr50
9038abac8f Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-08 19:37:04 -07:00
nossr50
0f1bfc4141 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-07 11:52:39 -07:00
nossr50
ae5ee8957c Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-08-06 19:02:18 -07:00
nossr50
d80c275abb Part 1 of reworking ability tools 2020-08-01 14:42:38 -07:00
nossr50
916a747f88 More work on new super abilities 2020-07-31 19:41:28 -07:00
nossr50
ea2e2bdc9a More cleanup on ability activation handling 2020-07-31 17:41:43 -07:00
nossr50
03f1733387 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-30 19:24:20 -07:00
nossr50
df7c9e0b1c SuperAbilityManager will handle super ability stuff 2020-07-30 19:23:10 -07:00
nossr50
2020fdd4ea Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-30 13:18:20 -07:00
nossr50
2c64eadafa command tweaks for xbow 2020-07-29 10:42:38 -07:00
nossr50
93eba8da2b more work on new skill commands 2020-07-29 10:25:16 -07:00
nossr50
a82b899eb6 Add some missing things for new skill commands 2020-07-29 10:22:18 -07:00
nossr50
8112973dbe Renamed Cone of Death to Super Shotgun 2020-07-29 10:05:12 -07:00
nossr50
f390e6a78a Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-29 08:20:08 -07:00
nossr50
3ca06f2518 More work on xbows 2020-07-28 18:17:57 -07:00
nossr50
515d58f04f Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-27 21:53:12 -07:00
nossr50
9eade9abc7 placeholder xbow code 2020-07-27 21:11:07 -07:00
nossr50
e0cf66c421 Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-26 05:08:49 -07:00
nossr50
49a1a8916b Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows 2020-07-13 07:49:59 -07:00
nossr50
c46f2534b8 Some work on craftable tridents 2020-07-13 07:23:28 -07:00
nossr50
5ed415e453 Further separate crossbows from bows 2020-07-10 20:17:37 -07:00
nossr50
7543d8be12 Initial work on crossbows 2020-07-07 15:00:56 -07:00
nossr50
cf6af4630d proper InventoryClickEvent array index fix 2020-07-07 13:52:20 -07:00
nossr50
bb167b00eb Array out of index fix 2020-07-07 08:56:33 -07:00
nossr50
d578b7322a Smelting makes use of bonus drops for Second Smelt now
Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
2020-07-07 08:52:31 -07:00
nossr50
86ee5944bc update changelog 2020-07-07 08:42:47 -07:00
nossr50
ae82571c56 sub-skill instead of ability 2020-07-07 08:41:54 -07:00
nossr50
5cd1419b21 some work on limit break for tridents/xbows 2020-07-07 08:34:59 -07:00
nossr50
ea448dfa47 tridents/xbows WIP part 1 2020-07-06 20:44:10 -07:00
440 changed files with 24888 additions and 27543 deletions

View File

@@ -31,13 +31,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
# 2. Setup Java 17 JDK (Adopt)
- name: Java 17 setup
uses: actions/setup-java@v2
# 2. Setup Java 1.8 JDK
- name: Java 1.8 setup
uses: actions/setup-java@v1.4.3
with:
distribution: 'adopt'
java-package: jdk
java-version: '17'
java-version: 1.8
# 3. Setup local Maven package cache to speed up building
- name: Cache Maven packages
@@ -49,4 +48,4 @@ jobs:
# 4. Build via Maven
- name: Build via Maven
run: mvn verify -B --file pom.xml -DdisableXmlReport=true
run: mvn verify -B --file pom.xml

1
.gitignore vendored
View File

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

View File

@@ -1,505 +1,113 @@
Version 2.2.000
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)
//TODO: Add level up milestone processing hooks
//TODO: Verify fishing durability change is removed
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
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
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
Codebase Stuff
Many places that passed type Player now passes type McMMOPlayer instead
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 Skill - Tridents
New Skill - Crossbows
Locale
Added locale entries for motherlode, cleancuts, and verdant bounty
New config file named 'tridents.yml'
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.
New command /tridents - Skill Info for Tridents
New command /crossbows - Skill Info for Crossbows
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.
Added Sub-Skill named Multi Tasking to Tridents
Added Sub-Skill named Tridents Limit Break to Tridents
Crossbows and Tridents are WIP skills, I would like feedback on discord about them.
Added Sub-Skill named Super Shotgun to Crossbows
Added Sub-Skill named Crossbows Limit Break to Crossbows
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.
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)
Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.
(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'
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
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'
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)
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
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
Added permission node 'mcmmo.chat.officerpartychat'
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.
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
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.
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
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
@@ -1382,7 +990,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 its using FlatFile or SQL database on load
mcMMO now logs whether or not 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.
@@ -1402,7 +1010,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 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 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 /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
@@ -2038,7 +1646,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 the player is receiving the early game boost
The XP bar now reflects whether or not 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'
@@ -2087,7 +1695,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 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 or not 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)
@@ -2095,9 +1703,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 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 or not 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 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 or not 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:
@@ -2368,7 +1976,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 endgame 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 end game 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.
@@ -4069,7 +3677,7 @@ Removed performance debugging
Removed some useless settings from the config file
Version 1.0.34
Fixed the PVP setting determining whether you would hurt yourself from AoE Abilities
Fixed the PVP setting determining whether or not 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
@@ -4079,7 +3687,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 Mobspawners will give XP (in config.yml)
You can now toggle whether or not 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

View File

@@ -11,12 +11,7 @@ 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 or Polymart:
http://spigot.mcmmo.org
https://polymart.org/resource/mcmmo.727
Currently, you can obtain our builds via the Spigot resource page: http://spigot.mcmmo.org
### 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.
@@ -26,14 +21,20 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
#### Project Lead & Founder
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
#### Current mcMMO Devs
#### mcMMO Devs
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
### Former team members
[![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin)
[![kashike](https://secure.gravatar.com/avatar/b5e86d6d443b957fd5cdee55501f3799.png)](https://github.com/kashike)
[![electronicboy](https://secure.gravatar.com/avatar/44759c38d311ce09596de6a2d5b88036.png)](https://github.com/electronicboy)
#### Classic Maintainer
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
## Former Team Members
### Former Lead & Awesome guy
[![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin)
### Former team members
[![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01)
[![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder)
[![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW)
@@ -42,23 +43,20 @@ In December 2018, the original author and creator of mcMMO (nossr50) returned an
[![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking)
[![TheYeti](https://i.imgur.com/tzFrxdo.png)](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 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.
mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO.
The typical command used to build mcMMO is: `mvn clean install`
The typical command used to build mcMMO is: `mvn clean package install`
Required Libraries:
* Spigot
* JUnit
* WorldGuard 7
* bStats Bukkit
https://spigot.mcmmo.org for more up to date information.
Downloads:
Resource Page
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
https://polymart.org/resource/mcmmo.727
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/

251
pom.xml Normal file → Executable file
View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.000-RC1</version>
<version>2.2.000-ALPHA-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>
@@ -14,9 +14,6 @@
<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>
@@ -75,37 +72,28 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
<trimStackTrace>false</trimStackTrace>
</configuration>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
<trimStackTrace>false</trimStackTrace>
</configuration>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M6</version>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.8.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>
@@ -130,7 +118,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.2.3</version>
<configuration>
<artifactSet>
<includes>
@@ -143,6 +131,7 @@
<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>
@@ -150,21 +139,28 @@
<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.tcoded:FoliaLib</include>
<include>com.neetgames:mcMMO-API</include>
<!-- <include>com.neetgames:jmal</include>-->
<include>com.neetgames:NEET-lib</include>
</includes>
</artifactSet>
<!-- <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>-->
<relocations>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.gmail.nossr50.mcmmo.kyori</shadedPattern>
<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>
</relocation>
<relocation>
<pattern>co.aikar.commands</pattern>
@@ -190,10 +186,6 @@
<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>
@@ -210,18 +202,15 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>3.5.2</version>
<version>2.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>
@@ -231,8 +220,8 @@
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
<repository>
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
<id>sk89q-repo</id>
<url>https://maven.sk89q.com/repo/</url>
</repository>
<repository> <!-- for development builds -->
<id>sonatype-oss</id>
@@ -242,132 +231,122 @@
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
<repository> <!-- for development builds -->
<id>sonatype-oss</id>
<url>https://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.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
<scope>test</scope>
<groupId>com.neetgames</groupId>
<artifactId>mcMMO-API</artifactId>
<version>0.01.00-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<scope>provided</scope>
<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>
<scope>test</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId> <!-- Don't forget to replace this -->
<version>0.5.1-SNAPSHOT</version> <!-- Replace this as well -->
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-bungeecord</artifactId>
<version>4.3.2</version>
<version>0.5.0-SNAPSHOT</version> <!-- Replace this as well -->
</dependency>
<!-- adventure-api, adventure-text-serializer-gson, adventure-platform-bukkit-->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
<version>4.15.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.15.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<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>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.15.0</version>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
<version>4.15.0</version>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.15.0</version>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId>
<version>4.3.2</version>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.2</version>
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-facet</artifactId>
<version>4.3.2</version>
<artifactId>adventure-platform-api</artifactId>
<version>4.0.0-SNAPSHOT</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>
<artifactId>adventure-platform-common</artifactId>
<version>4.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>2.0.0-M1</version>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<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>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-core</artifactId>
<version>7.0.7</version>
<version>7.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<!-- We use jetbrains instead. Excluding this -->
@@ -390,44 +369,50 @@
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<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>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>4.6.1</version>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>10.1.0-M17</version>
<version>7.0.52</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>23.0.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.3.1</version>
<scope>compile</scope>
<version>19.0.0</version>
</dependency>
</dependencies>
</project>

View File

@@ -2,7 +2,7 @@ package com.gmail.nossr50.api;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.mcMMO;
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(MetadataConstants.METADATA_KEY_RUPTURE)) {
if(entity.hasMetadata(mcMMO.RUPTURE_META_KEY)) {
return true;
}
}

View File

@@ -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() {}
//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);
//// }
//
// /**
// * Send a message to all members of a party
// * </br>
// * This function is designed for API usage.
// * Check if a player is currently talking in party chat.
// *
// * @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
// * @param player The player to check
// * @return true if the player is using party chat, false otherwise
// */
// public static void sendPartyChat(Plugin plugin, String sender, String displayName, String party, String message) {
// getPartyChatManager(plugin, party).handleChat(sender, displayName, message);
// public static boolean isUsingPartyChat(Player player) {
// return UserManager.getPlayer(player).getChatChannel() == ChatChannel.PARTY;
// }
//
// /**
// * Send a message to all members of a party
// * </br>
// * This function is designed for API usage.
// * Check if a player is currently talking in party chat.
// *
// * @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
// * @param playerName The name of the player to check
// * @return true if the player is using party chat, false otherwise
// */
// public static void sendPartyChat(Plugin plugin, String sender, String party, String message) {
// getPartyChatManager(plugin, party).handleChat(sender, message);
// public static boolean isUsingPartyChat(String playerName) {
// return UserManager.getPlayer(playerName).getChatChannel() == ChatChannel.PARTY;
// }
//
// /**
// * Send a message to administrators
// * </br>
// * This function is designed for API usage.
// * Check if a player is currently talking in admin chat.
// *
// * @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
// * @param player The player to check
// * @return true if the player is using admin chat, false otherwise
// */
// public static void sendAdminChat(Plugin plugin, String sender, String displayName, String message) {
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, displayName, message);
// public static boolean isUsingAdminChat(Player player) {
// return UserManager.getPlayer(player).getChatChannel() == ChatChannel.ADMIN;
// }
//
// /**
// * Send a message to administrators
// * </br>
// * This function is designed for API usage.
// * Check if a player is currently talking in admin chat.
// *
// * @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
// * @param playerName The name of the player to check
// * @return true if the player is using admin chat, false otherwise
// */
// public static void sendAdminChat(Plugin plugin, String sender, String message) {
// ChatManagerFactory.getChatManager(plugin, ChatChannel.ADMIN).handleChat(sender, message);
// public static boolean isUsingAdminChat(String playerName) {
// return UserManager.getPlayer(playerName).getChatChannel() == 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);
}
}
//
// /**
// * 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);
// }
//}

View File

@@ -9,6 +9,7 @@ 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;
@@ -19,6 +20,7 @@ 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 {
@@ -33,13 +35,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(@NotNull String skillType) {
public static boolean isValidSkillType(String skillType) {
return mcMMO.p.getSkillTools().matchSkill(skillType) != null;
}
/**
* Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
* Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP
*
* @param mcMMOPlayer The attacking player
* @param target The defending entity
@@ -54,7 +56,7 @@ public final class ExperienceAPI {
/**
* Start the task that gives combat XP.
* Processes combat XP like mcMMO normally would, so mcMMO will check whether the entity should reward XP when giving out the XP
* Processes combat XP like mcMMO normally would, so mcMMO will check whether or not the entity should reward XP when giving out the XP
*
* @param mcMMOPlayer The attacking player
* @param target The defending entity
@@ -704,7 +706,7 @@ public final class ExperienceAPI {
PrimarySkillType skill = getSkillType(skillType);
if (SkillTools.isChildSkill(skill)) {
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size()));
@@ -735,7 +737,7 @@ public final class ExperienceAPI {
PrimarySkillType skill = getSkillType(skillType);
if (SkillTools.isChildSkill(skill)) {
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size()));

View File

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

View File

@@ -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
//}

View File

@@ -3,13 +3,12 @@ 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.*;
@@ -25,22 +24,13 @@ 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 (!mcMMO.p.getPartyConfig().isPartyEnabled() || !inParty(player)) {
if (!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>
@@ -50,7 +40,7 @@ public final class PartyAPI {
* @return true if the player is in a party, false otherwise
*/
public static boolean inParty(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if(UserManager.getPlayer(player) == null)
return false;
return UserManager.getPlayer(player).inParty();
@@ -61,15 +51,12 @@ 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) {
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
return false;
return mcMMO.p.getPartyManager().inSameParty(playerA, playerB);
public static boolean inSameParty(Player playera, Player playerb) {
return PartyManager.inSameParty(playera, playerb);
}
/**
@@ -80,7 +67,7 @@ public final class PartyAPI {
* @return the list of parties.
*/
public static List<Party> getParties() {
return mcMMO.p.getPartyManager().getParties();
return PartyManager.getParties();
}
/**
@@ -94,29 +81,23 @@ 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
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(mmoPlayer == null)
if(UserManager.getPlayer(player) == null)
return;
Party party = mcMMO.p.getPartyManager().getParty(partyName);
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
} else {
if(mcMMO.p.getPartyManager().isPartyFull(player, party))
if(PartyManager.isPartyFull(player, party))
{
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
return;
}
}
mcMMO.p.getPartyManager().addToParty(mmoPlayer, party);
PartyManager.addToParty(UserManager.getPlayer(player), party);
}
/**
@@ -138,18 +119,19 @@ 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(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if(UserManager.getPlayer(player) == null)
return;
Party party = mcMMO.p.getPartyManager().getParty(partyName);
Party party = PartyManager.getParty(partyName);
if (party == null) {
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
}
mcMMO.p.getPartyManager().addToParty(UserManager.getPlayer(player), party);
PartyManager.addToParty(UserManager.getPlayer(player), party);
}
/**
@@ -161,10 +143,10 @@ public final class PartyAPI {
*/
public static void removeFromParty(Player player) {
//Check if player profile is loaded
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
if(UserManager.getPlayer(player) == null)
return;
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
PartyManager.removeFromParty(UserManager.getPlayer(player));
}
/**
@@ -175,11 +157,8 @@ public final class PartyAPI {
* @param partyName The party name
* @return the leader of the party
*/
public static @Nullable String getPartyLeader(String partyName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
public static String getPartyLeader(String partyName) {
return PartyManager.getPartyLeaderName(partyName);
}
/**
@@ -192,10 +171,7 @@ public final class PartyAPI {
*/
@Deprecated
public static void setPartyLeader(String partyName, String playerName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
return;
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
PartyManager.setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), PartyManager.getParty(partyName));
}
/**
@@ -208,12 +184,9 @@ public final class PartyAPI {
*/
@Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
return null;
}
List<OfflinePlayer> members = new ArrayList<>();
for (UUID memberUniqueId : mcMMO.p.getPartyManager().getAllMembers(player).keySet()) {
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
members.add(member);
}
@@ -230,10 +203,7 @@ public final class PartyAPI {
*/
@Deprecated
public static LinkedHashSet<String> getMembers(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
return (LinkedHashSet<String>) PartyManager.getAllMembers(player).values();
}
/**
@@ -245,10 +215,7 @@ public final class PartyAPI {
* @return all the player names and uuids in the player's party
*/
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getAllMembers(player);
return PartyManager.getAllMembers(player);
}
/**
@@ -260,10 +227,7 @@ public final class PartyAPI {
* @return all online players in this party
*/
public static List<Player> getOnlineMembers(String partyName) {
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
return null;
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
return PartyManager.getOnlineMembers(partyName);
}
/**
@@ -275,7 +239,7 @@ public final class PartyAPI {
* @return all online players in the player's party
*/
public static List<Player> getOnlineMembers(Player player) {
return mcMMO.p.getPartyManager().getOnlineMembers(player);
return PartyManager.getOnlineMembers(player);
}
public static boolean hasAlly(String partyName) {
@@ -283,7 +247,7 @@ public final class PartyAPI {
}
public static String getAllyName(String partyName) {
Party ally = mcMMO.p.getPartyManager().getParty(partyName).getAlly();
Party ally = PartyManager.getParty(partyName).getAlly();
if (ally != null) {
return ally.getName();
}

View File

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

View File

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

View File

@@ -1,9 +0,0 @@
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.");
}
}

View File

@@ -1,9 +0,0 @@
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.");
}
}

View File

@@ -1,13 +0,0 @@
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);
}
}

View File

@@ -1,9 +0,0 @@
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.");
}
}

View File

@@ -1,12 +0,0 @@
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());
}
}

View File

@@ -1,9 +0,0 @@
package com.gmail.nossr50.api.exceptions;
import org.jetbrains.annotations.NotNull;
public class ValueOutOfBoundsException extends RuntimeException {
public ValueOutOfBoundsException(@NotNull String message) {
super(message);
}
}

View File

@@ -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 this is getting processed via async
* @param isAsync whether or not this is getting processed via async
*/
public void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull String rawMessage, boolean isAsync) {
public void processPlayerMessage(@NotNull OnlineMMOPlayer 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 McMMOPlayer mmoPlayer, @NotNull String[] args, @NotNull ChatChannel chatChannel) {
public void processPlayerMessage(@NotNull OnlineMMOPlayer 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 this is getting processed via async
* @param isAsync whether or not this is getting processed via async
*/
private void processPlayerMessage(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel chatChannel, @NotNull String rawMessage, boolean isAsync) {
private void processPlayerMessage(@NotNull OnlineMMOPlayer 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 McMMOPlayer}
* Change the chat channel of a {@link OnlineMMOPlayer}
* Targeting the channel a player is already in will remove that player from the chat channel
* @param mmoPlayer target player
* @param targetChatChannel target chat channel
*/
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
public void setOrToggleChatChannel(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
if(targetChatChannel == mmoPlayer.getChatChannel()) {
//Disabled message
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
mmoPlayer.setChatMode(ChatChannel.NONE);
} else {
mmoPlayer.setChatMode(targetChatChannel);
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.On", StringUtils.getCapitalized(targetChatChannel.toString())));
Misc.adaptPlayer(mmoPlayer).sendMessage(LocaleLoader.getString("Chat.Channel.On", StringUtils.getCapitalized(targetChatChannel.toString())));
}
}
@@ -155,14 +155,14 @@ public class ChatManager {
}
/**
* Whether the player is allowed to send a message to the chat channel they are targeting
* Whether or not the player is allowed to send a message to the chat channel they are targeting
* @param mmoPlayer target player
* @return true if the player can send messages to that chat channel
*/
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
public boolean isMessageAllowed(@NotNull OnlineMMOPlayer mmoPlayer) {
switch (mmoPlayer.getChatChannel()) {
case ADMIN:
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
if(Misc.adaptPlayer(mmoPlayer).isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
return true;
}
break;
@@ -197,7 +197,7 @@ public class ChatManager {
}
/**
* Whether a specific chat channel is enabled
* Whether or not a specific chat channel is enabled
* ChatChannels are enabled/disabled via user config
*
* If chat is disabled, this always returns false

View File

@@ -1,8 +1,7 @@
package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.player.UserManager;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@@ -23,8 +22,9 @@ 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) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(t instanceof Player) {
Player player = (Player) t;
OnlineMMOPlayer mcMMOPlayer = UserManager.queryPlayer(player);
if(mcMMOPlayer != null) {
return mcMMOPlayer.getParty() == party;
}

View File

@@ -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 to use this authors display name
* @param useDisplayName whether or not to use this authors display name
*/
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
if(useDisplayName) {

View File

@@ -17,14 +17,14 @@ public interface Author extends Identity {
@NotNull String getAuthoredName(@NotNull ChatChannel chatChannel);
/**
* Whether this author is a {@link org.bukkit.command.ConsoleCommandSender}
* Whether or not this author is a {@link org.bukkit.command.ConsoleCommandSender}
*
* @return true if this author is the console
*/
boolean isConsole();
/**
* Whether this author is a {@link org.bukkit.entity.Player}
* Whether or not this author is a {@link org.bukkit.entity.Player}
* @return true if this author is a player
*/
boolean isPlayer();

View File

@@ -3,7 +3,6 @@ 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;
@@ -45,7 +44,7 @@ public class AdminChatMailer extends AbstractChatMailer {
public @NotNull Predicate<CommandSender> predicate() {
return (commandSender) -> commandSender.isOp()
|| commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION)
|| (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.ADMIN) && commandSender instanceof ConsoleCommandSender);
|| commandSender instanceof ConsoleCommandSender;
}
/**
@@ -74,8 +73,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 this is being processed asynchronously
* @param canColor whether the author can use colors in chat
* @param isAsync whether or not this is being processed asynchronously
* @param canColor whether or not 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));

View File

@@ -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 this is being processed asynchronously
* @param canColor whether the author can use colors in chat
* @param isAsync whether or not this is being processed asynchronously
* @param canColor whether or not 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);

View File

@@ -1,14 +1,13 @@
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;
@@ -52,8 +51,7 @@ public class PartyChatMessage extends AbstractChatMessage {
messagePartyChatSpies(spyMessage);
//Console message
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
}
/**
@@ -63,7 +61,7 @@ public class PartyChatMessage extends AbstractChatMessage {
*/
private void messagePartyChatSpies(@NotNull TextComponent spyMessage) {
//Find the people with permissions
for(McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
for(OnlineMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
Player player = mcMMOPlayer.getPlayer();
//Check for toggled players

View File

@@ -5,7 +5,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.CommandSender;
public class McabilityCommand extends ToggleCommand {
public class AbilityToggleCommand extends ToggleCommand {
@Override
protected boolean hasOtherPermission(CommandSender sender) {
return Permissions.mcabilityOthers(sender);

View File

@@ -5,7 +5,6 @@ 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;
@@ -21,14 +20,9 @@ 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";
//SKILLS
public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition";
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
private final @NotNull mcMMO pluginRef;
private final @NotNull BukkitCommandManager bukkitCommandManager;
@@ -42,16 +36,9 @@ 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
*/
@@ -60,30 +47,13 @@ public class CommandManager {
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
}
if(pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
if(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();
@@ -108,7 +78,6 @@ 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());
}
});
@@ -136,7 +105,7 @@ public class CommandManager {
public void validatePlayerParty(@NotNull Player player) {
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if(!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
if(mmoPlayer.getParty() == null) {
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
}
}

View File

@@ -1,336 +0,0 @@
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;
}
}

View File

@@ -1,5 +1,6 @@
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;

View File

@@ -24,10 +24,8 @@ 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();

View File

@@ -23,16 +23,6 @@ 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")) {

View File

@@ -11,6 +11,7 @@ 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;
@@ -77,7 +78,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 = mcMMO.p.getPartyManager().getParty(args[0]);
Party targetParty = PartyManager.getParty(args[0]);
if(targetParty != null) {
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);

View File

@@ -61,13 +61,13 @@ public class ConvertDatabaseCommand implements CommandExecutor {
PlayerProfile profile = oldDatabase.loadPlayerProfile(player);
if (profile.isLoaded()) {
mcMMO.getDatabaseManager().saveUser(profile);
mcMMO.getDatabaseManager().saveUser(profile.getPlayerData());
}
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 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().runAsync(new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()));
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
return true;
}
return false;

View File

@@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class McremoveCommand implements TabExecutor {
public class RemoveCommand implements TabExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {

View File

@@ -1,6 +1,5 @@
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;
@@ -9,6 +8,7 @@ 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) {
profile.scheduleAsyncSave();
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
return;
}

View File

@@ -33,7 +33,7 @@ public class AddxpCommand extends ExperienceCommand {
}
else {
profile.addXp(skill, value);
profile.scheduleAsyncSave();
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
}
}

View File

@@ -36,10 +36,10 @@ public class ConvertExperienceCommand implements CommandExecutor {
UserManager.saveAll();
UserManager.clearAll();
mcMMO.p.getFoliaLib().getImpl().runLater(new FormulaConversionTask(sender, newType), 1);
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
mcMMO.p.getFoliaLib().getImpl().runLaterAsync(new PlayerProfileLoadingTask(player), 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
return true;

View File

@@ -9,6 +9,7 @@ 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;
@@ -31,7 +32,7 @@ public class MmoeditCommand extends ExperienceCommand {
profile.modifySkill(skill, value);
if (player == null) {
profile.scheduleAsyncSave();
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
return;
}

View File

@@ -1,6 +1,5 @@
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;
@@ -27,7 +26,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;
@@ -126,7 +125,7 @@ public class SkillresetCommand implements TabExecutor {
profile.modifySkill(skill, 0);
if (player == null) {
profile.scheduleAsyncSave();
UserManager.getPlayerSaveHandler().scheduleAsyncSave(profile.getPlayerData());
return;
}

View File

@@ -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.mcMMO;
import com.gmail.nossr50.party.PartyManager;
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 (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, mcMMOPlayer.getPartyInvite().getName())) {
return true;
}
mcMMO.p.getPartyManager().joinInvitedParty(mcMMOPlayer);
PartyManager.joinInvitedParty(mcMMOPlayer);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "accept"));

View File

@@ -3,6 +3,7 @@ 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;
@@ -30,7 +31,7 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
return true;
}
mcMMO.p.getPartyManager().setPartyLeader(target.getUniqueId(), playerParty);
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "owner", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));

View File

@@ -1,8 +1,6 @@
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;
@@ -23,45 +21,11 @@ import java.util.Collections;
import java.util.List;
public class PartyCommand implements TabExecutor {
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();
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");
static {
ArrayList<String> subcommands = new ArrayList<>();
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
@@ -72,6 +36,20 @@ 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)) {
@@ -89,13 +67,13 @@ public class PartyCommand implements TabExecutor {
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null)
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (args.length < 1) {
if (!mcMMOPlayer.inParty()) {
@@ -156,18 +134,31 @@ public class PartyCommand implements TabExecutor {
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;
};
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;
}
@Override
@@ -182,13 +173,12 @@ 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()));
@@ -202,21 +192,17 @@ 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.isEmpty()) {
if (matches.size() == 0) {
Player player = (Player) sender;
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded
if(mcMMOPlayer == null)
if(UserManager.getPlayer(player) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
if (mcMMOPlayer.getParty() == null)
return ImmutableList.of();
final Party party = mcMMOPlayer.getParty();
Party party = UserManager.getPlayer(player).getParty();
playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));

View File

@@ -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.mcMMO;
import com.gmail.nossr50.party.PartyManager;
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 (mcMMO.p.getPartyManager().checkPartyExistence(player, args[1])) {
if (PartyManager.checkPartyExistence(player, args[1])) {
return true;
}
// Changing parties
if (!mcMMO.p.getPartyManager().changeOrJoinParty(mcMMOPlayer, args[1])) {
if (!PartyManager.changeOrJoinParty(mcMMOPlayer, args[1])) {
return true;
}
mcMMO.p.getPartyManager().createParty(mcMMOPlayer, args[1], getPassword(args));
PartyManager.createParty(mcMMOPlayer, args[1], getPassword(args));
return true;
default:

View File

@@ -1,10 +1,9 @@
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.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -16,24 +15,23 @@ public class PartyDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
if (mcMMOPlayer == null) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
final Party playerParty = mcMMOPlayer.getParty();
final String partyName = playerParty.getName();
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String partyName = playerParty.getName();
for (Player member : playerParty.getOnlineMembers()) {
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
member.sendMessage(LocaleLoader.getString("Party.Disband"));
}
mcMMO.p.getPartyManager().disbandParty(mcMMOPlayer, playerParty);
PartyManager.disbandParty(playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));

View File

@@ -6,6 +6,7 @@ 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;
@@ -124,7 +125,7 @@ public class PartyInfoCommand implements CommandExecutor {
* Only show members of the party that this member can see
*/
List<Player> nearMembers = mcMMO.p.getPartyManager().getNearVisibleMembers(mcMMOPlayer);
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
int membersOnline = party.getVisibleMembers(player).size();
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));

View File

@@ -4,6 +4,7 @@ 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;
@@ -39,19 +40,19 @@ public class PartyInviteCommand implements CommandExecutor {
return true;
}
if (mcMMO.p.getPartyManager().inSameParty(player, target)) {
if (PartyManager.inSameParty(player, target)) {
sender.sendMessage(LocaleLoader.getString("Party.Player.InSameParty", targetName));
return true;
}
if (!mcMMO.p.getPartyManager().canInvite(mcMMOPlayer)) {
if (!PartyManager.canInvite(mcMMOPlayer)) {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
Party playerParty = mcMMOPlayer.getParty();
if (mcMMO.p.getPartyManager().isPartyFull(target, playerParty)) {
if (PartyManager.isPartyFull(target, playerParty)) {
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), mcMMO.p.getGeneralConfig().getPartyMaxSize()));
return true;
}

View File

@@ -1,97 +0,0 @@
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);
}
}
}

View File

@@ -1,88 +0,0 @@
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;
}
}

View File

@@ -4,6 +4,7 @@ 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;
@@ -36,15 +37,15 @@ public class PartyKickCommand implements CommandExecutor {
Player onlineTarget = target.getPlayer();
String partyName = playerParty.getName();
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
if (!PartyManager.handlePartyChangeEvent(onlineTarget, partyName, null, EventReason.KICKED_FROM_PARTY)) {
return true;
}
mcMMO.p.getPartyManager().processPartyLeaving(UserManager.getPlayer(onlineTarget));
PartyManager.processPartyLeaving(UserManager.getPlayer(onlineTarget));
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
}
mcMMO.p.getPartyManager().removeFromParty(target, playerParty);
PartyManager.removeFromParty(target, playerParty);
return true;
}
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "kick", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));

View File

@@ -1,79 +0,0 @@
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")));
}
}

View File

@@ -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.mcMMO;
import com.gmail.nossr50.party.PartyManager;
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 (!mcMMO.p.getPartyManager().handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
if (!PartyManager.handlePartyChangeEvent(player, playerParty.getName(), null, EventReason.LEFT_PARTY)) {
return true;
}
mcMMO.p.getPartyManager().removeFromParty(mcMMOPlayer);
PartyManager.removeFromParty(mcMMOPlayer);
sender.sendMessage(LocaleLoader.getString("Commands.Party.Leave"));
return true;
}

View File

@@ -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.mcMMO;
import com.gmail.nossr50.party.PartyManager;
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].replace(".", "");
String newPartyName = args[1];
// 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 (mcMMO.p.getPartyManager().checkPartyExistence(player, newPartyName)) {
if (PartyManager.checkPartyExistence(player, newPartyName)) {
return true;
}
String leaderName = playerParty.getLeader().getPlayerName();
for (Player member : playerParty.getOnlineMembers()) {
if (!mcMMO.p.getPartyManager().handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
return true;
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party;
public enum PartySubcommandType {
public enum PartySubCommandType {
JOIN,
ACCEPT,
CREATE,
@@ -8,21 +8,18 @@ public enum PartySubcommandType {
INFO,
QUIT,
XPSHARE,
ITEMSHARE,
INVITE,
KICK,
DISBAND,
OWNER,
LOCK,
UNLOCK,
PASSWORD,
RENAME,
TELEPORT,
CHAT,
ALLIANCE;
PROMOTE,
DEMOTE;
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;
}
@@ -39,14 +36,8 @@ 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;
}
}

View File

@@ -1,40 +0,0 @@
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;
}
}

View File

@@ -1,137 +0,0 @@
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));
}
}

View File

@@ -1,37 +0,0 @@
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;
}
}

View File

@@ -1,74 +0,0 @@
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;
}
}

View File

@@ -7,6 +7,7 @@ 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;
@@ -209,7 +210,7 @@ public class PtpCommand implements TabExecutor {
return false;
}
if (!mcMMO.p.getPartyManager().inSameParty(player, target)) {
if (!PartyManager.inSameParty(player, target)) {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
return false;
}
@@ -249,7 +250,7 @@ public class PtpCommand implements TabExecutor {
if (warmup > 0) {
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup);
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
}
else {
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);

View File

@@ -9,7 +9,6 @@ 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;
@@ -63,12 +62,6 @@ 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;
@@ -92,16 +85,10 @@ public class InspectCommand implements TabExecutor {
}
}
if (isVanished) {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
} else {
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", target.getName()));
}
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()));
}

View File

@@ -4,7 +4,6 @@ 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;
@@ -98,11 +97,11 @@ public class McrankCommand implements TabExecutor {
return;
}
if (((Player) sender).hasMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND)) {
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
return;
} else {
((Player) sender).setMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, new FixedMetadataValue(mcMMO.p, null));
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
}
mcMMOPlayer.actualizeDatabaseATS();
@@ -111,7 +110,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();
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat));
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@@ -5,7 +5,6 @@ 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;
@@ -98,11 +97,11 @@ public class MctopCommand implements TabExecutor {
return;
}
if (((Player) sender).hasMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND)) {
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
return;
} else {
((Player) sender).setMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, new FixedMetadataValue(mcMMO.p, null));
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
}
mcMMOPlayer.actualizeDatabaseATS();
@@ -115,7 +114,7 @@ public class MctopCommand implements TabExecutor {
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat));
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@@ -5,8 +5,9 @@ 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.Permissions;
import com.gmail.nossr50.util.random.ProbabilityUtil;
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.text.TextComponentFactory;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player;
@@ -29,7 +30,7 @@ public class AcrobaticsCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) {
// ACROBATICS_DODGE
if (canDodge) {
String[] dodgeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_DODGE);
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE);
dodgeChance = dodgeStrings[0];
dodgeChanceLucky = dodgeStrings[1];
}
@@ -37,8 +38,8 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canDodge = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_DODGE);
canRoll = Permissions.canUseSubSkill(player, SubSkillType.ACROBATICS_ROLL);
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
}
@Override
@@ -56,7 +57,25 @@ public class AcrobaticsCommand extends SkillCommand {
if(abstractSubSkill != null)
{
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ACROBATICS_ROLL);
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;
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));

View File

@@ -68,8 +68,8 @@ public class AlchemyCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canCatalysis = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CATALYSIS);
canConcoctions = Permissions.canUseSubSkill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS);
canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
}
@Override

View File

@@ -4,9 +4,8 @@ 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;
@@ -33,14 +32,14 @@ public class ArcheryCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) {
// ARCHERY_ARROW_RETRIEVAL
if (canRetrieve) {
String[] retrieveStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
retrieveChance = retrieveStrings[0];
retrieveChanceLucky = retrieveStrings[1];
}
// ARCHERY_DAZE
if (canDaze) {
String[] dazeStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.ARCHERY_DAZE);
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE);
dazeChance = dazeStrings[0];
dazeChanceLucky = dazeStrings[1];
}
@@ -53,9 +52,9 @@ public class ArcheryCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canSkillShot = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_SKILL_SHOT);
canDaze = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_DAZE);
canRetrieve = Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT);
canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE);
canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
}
@Override
@@ -76,7 +75,7 @@ public class ArcheryCommand extends SkillCommand {
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
}
if(Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
if(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))));
}

View File

@@ -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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.AXES_CRITICAL_STRIKES);
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = 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);
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);
}
@Override
@@ -96,7 +96,7 @@ public class AxesCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
}
if(Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
if(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))));
}

View File

@@ -1,76 +1,49 @@
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.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.datatypes.skills.SubSkillType;
import com.gmail.nossr50.skills.crossbows.CrossbowsManager;
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.*;
public class CrossbowsCommand extends SkillCommand {
private boolean canTrickShot;
private boolean canPoweredShot;
public CrossbowsCommand() {
super(PrimarySkillType.CROSSBOWS);
}
@Override
protected void dataCalculations(Player player, float skillValue) {
// TODO: Implement data calculations
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue) {
}
@Override
protected void permissionsCheck(Player player) {
canTrickShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_TRICK_SHOT)
&& Permissions.trickShot(player);
protected void permissionsCheck(@NotNull OnlineMMOPlayer mmoPlayer) {
canPoweredShot = RankUtils.hasUnlockedSubskill(player, CROSSBOWS_POWERED_SHOT)
&& Permissions.poweredShot(player);
}
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
protected @NotNull List<String> statsDisplay(@NotNull OnlineMMOPlayer mmoPlayer, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<>();
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
if (mmoPlayer == null) {
return messages;
}
CrossbowsManager crossbowsManager = ((McMMOPlayer) (mmoPlayer)).getCrossbowManager();
if (canPoweredShot) {
messages.add(getStatMessage(ARCHERY_SKILL_SHOT, percent.format(mmoPlayer.getCrossbowsManager().getDamageBonusPercent(player))));
if(canUseSubskill(mmoPlayer, SubSkillType.CROSSBOWS_SUPER_SHOTGUN)) {
String additionalArrowCount = String.valueOf(crossbowsManager.getSuperShotgunAdditionalArrowCount());
messages.add(getStatMessage(SubSkillType.CROSSBOWS_SUPER_SHOTGUN, additionalArrowCount));
}
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 List<Component> getTextComponents(Player player) {
protected @NotNull List<Component> getTextComponents(@NotNull OnlineMMOPlayer mmoPlayer) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.CROSSBOWS);
TextComponentFactory.getSubSkillTextComponents(mmoPlayer, textComponents, PrimarySkillType.CROSSBOWS);
return textComponents;
}

View File

@@ -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 = Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
canTreasureHunt = 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(Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
if(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,

View File

@@ -7,10 +7,8 @@ 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.Probability;
import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.StringUtils;
import com.gmail.nossr50.util.text.TextComponentFactory;
@@ -81,8 +79,7 @@ public class FishingCommand extends SkillCommand {
// FISHING_SHAKE
if (canShake) {
Probability shakeProbability = Probability.ofPercent(fishingManager.getShakeChance());
String[] shakeStrings = ProbabilityUtil.getRNGDisplayValues(shakeProbability);
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(player, PrimarySkillType.FISHING, fishingManager.getShakeChance());
shakeChance = shakeStrings[0];
shakeChanceLucky = shakeStrings[1];
}
@@ -101,12 +98,12 @@ public class FishingCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
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);
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);
}
@Override

View File

@@ -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,8 +24,6 @@ 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;
@@ -37,7 +35,6 @@ public class HerbalismCommand extends SkillCommand {
private boolean canGreenThumbBlocks;
private boolean canFarmersDiet;
private boolean canDoubleDrop;
private boolean canTripleDrop;
private boolean canShroomThumb;
public HerbalismCommand() {
@@ -49,16 +46,10 @@ public class HerbalismCommand extends SkillCommand {
// DOUBLE DROPS
if (canDoubleDrop) {
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_DOUBLE_DROPS);
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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) {
@@ -76,21 +67,21 @@ public class HerbalismCommand extends SkillCommand {
if (canGreenThumbBlocks || canGreenThumbPlants) {
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
String[] greenThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB);
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB);
greenThumbChance = greenThumbStrings[0];
greenThumbChanceLucky = greenThumbStrings[1];
}
// HYLIAN LUCK
if (hasHylianLuck) {
String[] hylianLuckStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK);
hylianLuckChance = hylianLuckStrings[0];
hylianLuckChanceLucky = hylianLuckStrings[1];
}
// SHROOM THUMB
if (canShroomThumb) {
String[] shroomThumbStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.HERBALISM_SHROOM_THUMB);
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB);
shroomThumbChance = shroomThumbStrings[0];
shroomThumbChanceLucky = shroomThumbStrings[1];
}
@@ -98,14 +89,13 @@ public class HerbalismCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
hasHylianLuck = Permissions.canUseSubSkill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
hasHylianLuck = 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.BEETROOTS) || 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.BEETROOT) || 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 = 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);
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);
}
@Override
@@ -116,16 +106,11 @@ 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) : ""));

View File

@@ -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,8 +18,6 @@ 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;
@@ -32,7 +30,6 @@ public class MiningCommand extends SkillCommand {
private boolean canSuperBreaker;
private boolean canDoubleDrop;
private boolean canTripleDrop;
private boolean canBlast;
private boolean canBiggerBombs;
private boolean canDemoExpert;
@@ -54,17 +51,10 @@ 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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.MINING_DOUBLE_DROPS);
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
@@ -82,8 +72,7 @@ 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 = Permissions.canUseSubSkill(player, SubSkillType.MINING_DOUBLE_DROPS);
canTripleDrop = Permissions.canUseSubSkill(player, SubSkillType.MINING_MOTHER_LODE);
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS);
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
}
@@ -105,18 +94,13 @@ 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) : ""));

View File

@@ -27,11 +27,12 @@ public class MmoInfoCommand implements TabExecutor {
/*
* Only allow players to use this command
*/
if(commandSender instanceof Player player)
if(commandSender instanceof Player)
{
if(args.length < 1)
return false;
Player player = (Player) commandSender;
if(Permissions.mmoinfo(player))
{
if(args == null || args[0] == null)

View File

@@ -1,40 +0,0 @@
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);
}
}

View File

@@ -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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.REPAIR_SUPER_REPAIR);
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_SUPER_REPAIR);
canMasterRepair = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
canArcaneForge = Permissions.canUseSubSkill(player, SubSkillType.REPAIR_ARCANE_FORGING);
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);

View File

@@ -5,7 +5,6 @@ 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;
@@ -31,8 +30,8 @@ public class SalvageCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canScrapCollector = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
canArcaneSalvage = Permissions.canUseSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
canScrapCollector = canUseSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR);
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
}
@Override

View File

@@ -5,12 +5,16 @@ 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;
@@ -28,6 +32,7 @@ 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;
@@ -54,17 +59,18 @@ public abstract class SkillCommand implements TabExecutor {
return true;
}
Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer == null) {
if(UserManager.getPlayer((Player) sender) == 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
@@ -110,21 +116,8 @@ 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);
}
@@ -168,7 +161,7 @@ public abstract class SkillCommand implements TabExecutor {
*/
var parents = mcMMO.p.getSkillTools().getChildSkillParents(skill);
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
//TODO: Add JSON here
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
@@ -218,7 +211,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("?", "keep");
return ImmutableList.of("?");
}
return ImmutableList.of();
}
@@ -227,9 +220,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));
@@ -292,4 +285,14 @@ 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);
}
}

View File

@@ -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 = getRNGDisplayValues(player, SubSkillType.SMELTING_FLUX_MINING);
String[] fluxMiningStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_FLUX_MINING);
str_fluxMiningChance = fluxMiningStrings[0];
str_fluxMiningChanceLucky = fluxMiningStrings[1];
}*/
// SECOND SMELT
if (canSecondSmelt) {
String[] secondSmeltStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SMELTING_SECOND_SMELT);
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
canSecondSmelt = Permissions.canUseSubSkill(player, SubSkillType.SMELTING_SECOND_SMELT);
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
canSecondSmelt = 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);
}

View File

@@ -6,10 +6,9 @@ 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.SkillUtils;
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,7 +38,7 @@ public class SwordsCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) {
// SWORDS_COUNTER_ATTACK
if (canCounter) {
String[] counterStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK);
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK);
counterChance = counterStrings[0];
counterChanceLucky = counterStrings[1];
}
@@ -70,8 +69,8 @@ public class SwordsCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canRupture = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
canCounter = SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
canRupture = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
}
@@ -92,9 +91,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.Update.One"));
messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note"));
}
if (canSerratedStrike) {
@@ -102,13 +101,13 @@ public class SwordsCommand extends SkillCommand {
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
}
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
if(canUseSubskill(player, SubSkillType.SWORDS_STAB))
{
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
String.valueOf(UserManager.getPlayer(player).getSwordsManager().getStabDamage())));
}
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
if(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))));
}

View File

@@ -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.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.SkillActivationType;
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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.TAMING_GORE);
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = Permissions.canUseSubSkill(player, SubSkillType.TAMING_BEAST_LORE);
canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE);
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
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);
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);
}
@Override

View File

@@ -1,58 +1,37 @@
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(Player player, float skillValue) {}
protected void dataCalculations(@NotNull OnlineMMOPlayer mmoPlayer, 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 List<Component> getTextComponents(Player player) {
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) {
List<Component> textComponents = new ArrayList<>();
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.TRIDENTS);

View File

@@ -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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT);
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_DISARM);
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.UNARMED_IRON_GRIP);
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, 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 = 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);
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);
// 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(Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
if(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))));
}

View File

@@ -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,14 +38,7 @@ 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);
@@ -55,7 +48,7 @@ public class WoodcuttingCommand extends SkillCommand {
}
private void setDoubleDropClassicChanceStrings(Player player) {
String[] doubleDropStrings = ProbabilityUtil.getRNGDisplayValues(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
@@ -63,12 +56,14 @@ public class WoodcuttingCommand extends SkillCommand {
@Override
protected void permissionsCheck(Player player) {
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
canDoubleDrop = !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill)
&& Permissions.canUseSubSkill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER)
&& !mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(skill)
&& RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
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);
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);*/
}
@Override
@@ -80,12 +75,6 @@ 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;

View File

@@ -10,7 +10,7 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class AdvancedConfig extends BukkitConfig {
public class AdvancedConfig extends AutoUpdateConfigLoader {
public AdvancedConfig(File dataFolder) {
super("advanced.yml", dataFolder);
@@ -99,7 +99,8 @@ public class AdvancedConfig extends BukkitConfig {
}
/* AXES */
if (getAxeMasteryRankDamageMultiplier() < 0) {
if(getAxeMasteryRankDamageMultiplier() < 0)
{
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
}
@@ -403,18 +404,12 @@ public class AdvancedConfig extends BukkitConfig {
}
@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", 1);
}
public boolean canApplyLimitBreakPVE() { return config.getBoolean("Skills.General.LimitBreak.AllowPVE", false); }
public int getStartingLevel() { return config.getInt("Skills.General.StartingLevel", 0); }
public boolean allowPlayerTips() {
return config.getBoolean("Feedback.PlayerTips", true);
@@ -422,12 +417,11 @@ public class AdvancedConfig extends BukkitConfig {
/**
* This returns the maximum level at which superabilities will stop lengthening from scaling alongside skill level.
* It returns a different value depending on whether the server is in retro mode
*
* It returns a different value depending on whether or not 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);
@@ -435,33 +429,28 @@ public class AdvancedConfig extends BukkitConfig {
/**
* This returns the frequency at which abilities will increase in length
* It returns a different value depending on whether the server is in retro mode
*
* It returns a different value depending on whether or not 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) {
@@ -473,29 +462,35 @@ public class AdvancedConfig extends BukkitConfig {
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);
}
@@ -514,7 +509,6 @@ public class AdvancedConfig extends BukkitConfig {
/**
* Used to color our details header in our JSON Hover Object tooltips
*
* @return the ChatColor for this element
*/
/*public ChatColor getJSONStatHoverDetailsColor()
@@ -563,6 +557,7 @@ public class AdvancedConfig extends BukkitConfig {
{
return getChatColor(config.getString("Style.JSON.Notification."+notificationType.toString()+".Color"));
}*/
private ChatColor getChatColorFromKey(String keyLocation) {
String colorName = config.getString(keyLocation);
@@ -603,260 +598,110 @@ public class AdvancedConfig extends BukkitConfig {
/**
* 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() {
if (mcMMO.isRetroModeEnabled()) {
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.RetroMode", 1000);
} else {
return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel.Standard", 100);
}
}
public int getCatalysisMaxBonusLevel() { return config.getInt("Skills.Alchemy.Catalysis.MaxBonusLevel", 1000); }
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 getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
public double getSkillShotDamageMax() {
return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D);
}
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
public double getDazeBonusDamage() {
return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D);
}
public double getForceMultiplier() {
return config.getDouble("Skills.Archery.ForceMultiplier", 2.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 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 getCriticalStrikesPVEModifier() {
return config.getDouble("Skills.Axes.CriticalStrikes.PVE_Modifier", 2.0D);
}
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 getGreaterImpactChance() {
return config.getDouble("Skills.Axes.GreaterImpact.Chance", 25.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 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);
}
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.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 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 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 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 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);
}
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); }
/* REPAIR */
public double getRepairMasteryMaxBonus() {
return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D);
}
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100); }
public int getRepairMasteryMaxLevel() {
return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 100);
}
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 boolean getAllowEnchantedRepairMaterials() {
return config.getBoolean("Skills.Repair.Use_Enchanted_Materials", false);
}
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 getArcaneForgingEnchantLossEnabled() {
return config.getBoolean("Skills.Repair.ArcaneForging.May_Lose_Enchants", true);
}
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
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);
}
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) {
@@ -886,68 +731,35 @@ public class AdvancedConfig extends BukkitConfig {
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 getFastFoodChance() { return config.getDouble("Skills.Taming.FastFoodService.Chance", 50.0D); }
public double getPummelChance() { return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D); }
public double getPummelChance() {
return config.getDouble("Skills.Taming.Pummel.Chance", 10.0D);
}
public double getThickFurModifier() { return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D); }
public double getThickFurModifier() {
return config.getDouble("Skills.Taming.ThickFur.Modifier", 2.0D);
}
public double getShockProofModifier() { return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D); }
public double getShockProofModifier() {
return config.getDouble("Skills.Taming.ShockProof.Modifier", 6.0D);
}
public double getSharpenedClawsBonus() { return config.getDouble("Skills.Taming.SharpenedClaws.Bonus", 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);
}
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); }
}

View File

@@ -0,0 +1,167 @@
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();
}
}
}
}

View File

@@ -1,106 +0,0 @@
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();
}
}
}
}

View File

@@ -1,181 +0,0 @@
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;
}
}

View File

@@ -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 BukkitConfig {
public class ChatConfig extends AutoUpdateConfigLoader {
private static ChatConfig instance;
private ChatConfig() {
@@ -40,10 +40,8 @@ public class ChatConfig extends BukkitConfig {
}
/**
* Whether to use display names for players in target {@link ChatChannel}
*
* Whether or not 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) {
@@ -51,12 +49,6 @@ public class ChatConfig extends BukkitConfig {
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);
}

View File

@@ -1,28 +1,27 @@
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.util.List;
@Deprecated
public abstract class LegacyConfigLoader {
protected final File configFile;
protected final @NotNull File dataFolder;
public abstract class ConfigLoader {
protected String fileName;
protected YamlConfiguration config;
protected final File configFile;
protected FileConfiguration config;
protected @NotNull final File dataFolder;
public LegacyConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
this.fileName = fileName;
this.dataFolder = dataFolder;
configFile = new File(dataFolder, relativePath + File.separator + fileName);
loadFile();
}
public LegacyConfigLoader(String fileName, @NotNull File dataFolder) {
public ConfigLoader(String fileName, @NotNull File dataFolder) {
this.fileName = fileName;
this.dataFolder = dataFolder;
configFile = new File(dataFolder, fileName);
@@ -30,7 +29,7 @@ public abstract class LegacyConfigLoader {
}
@Deprecated
public LegacyConfigLoader(String relativePath, String fileName) {
public ConfigLoader(String relativePath, String fileName) {
this.fileName = fileName;
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
this.dataFolder = mcMMO.p.getDataFolder();
@@ -38,7 +37,7 @@ public abstract class LegacyConfigLoader {
}
@Deprecated
public LegacyConfigLoader(String fileName) {
public ConfigLoader(String fileName) {
this.fileName = fileName;
configFile = new File(mcMMO.p.getDataFolder(), fileName);
this.dataFolder = mcMMO.p.getDataFolder();
@@ -47,15 +46,17 @@ public abstract class LegacyConfigLoader {
protected void loadFile() {
if (!configFile.exists()) {
LogUtils.debug(mcMMO.p.getLogger(), "Creating mcMMO " + fileName + " File...");
mcMMO.p.debug("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 {
LogUtils.debug(mcMMO.p.getLogger(), "Loading mcMMO " + fileName + " File...");
}
else {
mcMMO.p.debug("Loading mcMMO " + fileName + " File...");
}
config = YamlConfiguration.loadConfiguration(configFile);
@@ -77,8 +78,9 @@ public abstract class LegacyConfigLoader {
protected void validate() {
if (validateKeys()) {
LogUtils.debug(mcMMO.p.getLogger(), "No errors found in " + fileName + "!");
} else {
mcMMO.p.debug("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;

View File

@@ -4,26 +4,28 @@ 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 BukkitConfig {
public class CoreSkillsConfig extends AutoUpdateConfigLoader {
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() {
@@ -35,25 +37,23 @@ public class CoreSkillsConfig extends BukkitConfig {
*/
/**
* Whether a skill is enabled
* Whether or not 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 this primary skill is enabled
*
* Whether or not 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

View File

@@ -1,8 +1,8 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.metadata.MobMetaFlagType;
import com.gmail.nossr50.util.compat.layers.persistentdata.MobMetaFlagType;
public class PersistentDataConfig extends BukkitConfig {
public class PersistentDataConfig extends AutoUpdateConfigLoader {
private static PersistentDataConfig instance;
private PersistentDataConfig() {

View File

@@ -3,34 +3,35 @@ 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 BukkitConfig {
public class RankConfig extends AutoUpdateConfigLoader {
private static RankConfig instance;
public RankConfig() {
public RankConfig()
{
super("skillranks.yml");
validate();
instance = this;
}
public static RankConfig getInstance() {
if (instance == null)
return new RankConfig();
return instance;
}
@Override
protected void loadKeys() {
}
public static RankConfig getInstance()
{
if(instance == null)
return new RankConfig();
return instance;
}
@Override
protected boolean validateKeys() {
List<String> reason = new ArrayList<>();
@@ -45,13 +46,12 @@ public class RankConfig extends BukkitConfig {
/**
* 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,37 +59,33 @@ public class RankConfig extends BukkitConfig {
/**
* 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, defaultYamlConfig.getInt(key));
return config.getInt(key, getInternalConfig().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) {
@@ -129,57 +125,62 @@ public class RankConfig extends BukkitConfig {
private void resetRankValue(@NotNull SubSkillType subSkillType, int rank, boolean retroMode) {
String key = getRankAddressKey(subSkillType, rank, retroMode);
int defaultValue = defaultYamlConfig.getInt(key);
int defaultValue = getInternalConfig().getInt(key);
config.set(key, defaultValue);
LogUtils.debug(mcMMO.p.getLogger(), key + " SET -> " + defaultValue);
mcMMO.p.getLogger().info(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;
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
mcMMO.p.getLogger().info("(FIXING CONFIG) mcMMO is correcting a few mistakes found in your skill rank config setup");
for (SubSkillType subSkillType : badSkillSetup) {
LogUtils.debug(mcMMO.p.getLogger(), "(FIXING CONFIG) Resetting rank config settings for skill named - " + subSkillType.toString());
for(SubSkillType subSkillType : badSkillSetup) {
mcMMO.p.getLogger().info("(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 + " should not have any ranks that require a negative level!");
if(curRank < 0)
{
reasons.add("(CONFIG ISSUE) " + subSkillType.toString() + " 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
LogUtils.debug(mcMMO.p.getLogger(), "(CONFIG ISSUE) You have the ranks for the subskill " + subSkillType + " set up poorly, sequential ranks should have ascending requirements");
mcMMO.p.getLogger().info("(CONFIG ISSUE) You have the ranks for the subskill "+ subSkillType.toString()+" set up poorly, sequential ranks should have ascending requirements");
badSkillSetup.add(subSkillType);
}
}
@@ -187,8 +188,9 @@ public class RankConfig extends BukkitConfig {
}
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);
@@ -196,6 +198,6 @@ public class RankConfig extends BukkitConfig {
resetRankValue(subSkillType, index, false);
}
updateFile();
saveConfig();
}
}

View File

@@ -1,42 +1,47 @@
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 BukkitConfig {
public class SoundConfig extends AutoUpdateConfigLoader {
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) {
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound volume cannot be below 0 for " + soundType);
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());
return false;
}
//Sounds with custom pitching don't use pitch values
if (!soundType.usesCustomPitch()) {
if (config.getDouble("Sounds." + soundType + ".Pitch") < 0) {
LogUtils.debug(mcMMO.p.getLogger(), "[mcMMO] Sound pitch cannot be below 0 for " + soundType);
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());
return false;
}
}
@@ -44,22 +49,23 @@ public class SoundConfig extends BukkitConfig {
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);
}
}

View File

@@ -15,28 +15,20 @@ 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 static boolean isWorldBlacklisted(World world) {
for (String s : blacklist) {
if (world.getName().equalsIgnoreCase(s))
return true;
}
return false;
}
public void init() {
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();
@@ -56,11 +48,12 @@ 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);
}
@@ -73,12 +66,11 @@ public class WorldBlacklist {
closeRead(fileReader);
}
if(blacklist.size() > 0)
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
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) {
@@ -86,4 +78,16 @@ public class WorldBlacklist {
}
}
}
public static boolean isWorldBlacklisted(World world)
{
for(String s : blacklist)
{
if(world.getName().equalsIgnoreCase(s))
return true;
}
return false;
}
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.config.experience;
import com.gmail.nossr50.config.BukkitConfig;
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@@ -13,11 +13,12 @@ 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 BukkitConfig {
public class ExperienceConfig extends AutoUpdateConfigLoader {
private static ExperienceConfig instance;
private ExperienceConfig() {
@@ -34,8 +35,7 @@ public class ExperienceConfig extends BukkitConfig {
}
@Override
protected void loadKeys() {
}
protected void loadKeys() {}
@Override
protected boolean validateKeys() {
@@ -140,291 +140,219 @@ public class ExperienceConfig extends BukkitConfig {
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 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 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);
}
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); }
/* 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()), 1);
}
public double getFormulaSkillModifier(PrimarySkillType skill) { return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString())); }
/* 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(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(" ", "_"));
}
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) {
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")) {
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"))
return 0;
}
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String[] configStrings = {explicitString, friendlyString, wildcardString};
for (String configString : configStrings) {
String fullPath = baseString + configString;
if (config.contains(fullPath)) {
return config.getInt(fullPath);
}
}
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);
return 0;
}
/* Materials */
public int getXp(PrimarySkillType skill, BlockState blockState)
{
Material data = blockState.getType();
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material material) {
return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigMaterialString(material),
StringUtils.getFriendlyConfigMaterialString(material),
StringUtils.getWildcardConfigMaterialString(material));
}
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, BlockData data) {
return doesBlockGiveSkillXPHelper(skill, StringUtils.getExplicitConfigBlockDataString(data),
StringUtils.getFriendlyConfigBlockDataString(data),
StringUtils.getWildcardConfigBlockDataString(data));
}
private boolean doesBlockGiveSkillXPHelper(PrimarySkillType skill, String explicitString, String friendlyString, String wildcardString) {
String baseString = "Experience_Values." + StringUtils.getCapitalized(skill.toString()) + ".";
String[] configStrings = {explicitString, friendlyString, wildcardString};
for (String configString : configStrings) {
String fullPath = baseString + configString;
if (config.contains(fullPath)) {
return true;
}
}
return false;
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;
}
/* 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;
}
/* Materials */
public int getXp(PrimarySkillType skill, BlockData data)
{
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;
}
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 useCombatHPCeiling() {
return config.getBoolean("ExploitFix.Combat.XPCeiling.Enabled", true);
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 int getCombatHPCeiling() {
return config.getInt("ExploitFix.Combat.XPCeiling.HP_Modifier_Limit", 100);
}
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType)
{
String colorValueFromConfig = config.getString("Experience_Bars."+StringUtils.getCapitalized(primarySkillType.toString())+".Color");
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))
for(BarColor barColor : BarColor.values())
{
if(barColor.toString().equalsIgnoreCase(colorValueFromConfig))
return barColor;
}
@@ -433,10 +361,24 @@ public class ExperienceConfig extends BukkitConfig {
}
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))
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))
return barStyle;
}
@@ -445,51 +387,29 @@ public class ExperienceConfig extends BukkitConfig {
}
/* Acrobatics */
public int getDodgeXPModifier() {
return config.getInt("Experience_Values.Acrobatics.Dodge", 120);
}
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 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);
}
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);}
}

View File

@@ -29,7 +29,7 @@ public class ArmorConfigManager {
continue;
}
modManager.registerCustomArmor(new CustomArmorLegacyConfig(fileName));
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
}
}
}

View File

@@ -29,7 +29,7 @@ public class BlockConfigManager {
continue;
}
modManager.registerCustomBlocks(new CustomBlockLegacyConfig(fileName));
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
}
}
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.skills.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.mcMMO;
@@ -13,15 +13,17 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
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<>();
public class CustomArmorConfig extends ConfigLoader {
private boolean needsUpdate = false;
protected CustomArmorLegacyConfig(String fileName) {
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) {
super("mods", fileName);
loadKeys();
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Material;
@@ -11,18 +11,20 @@ import java.util.HashMap;
import java.util.List;
import java.util.Set;
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<>();
public class CustomBlockConfig extends ConfigLoader {
private boolean needsUpdate = false;
protected CustomBlockLegacyConfig(String fileName) {
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) {
super("mods", fileName);
loadKeys();
}
@@ -83,10 +85,12 @@ public class CustomBlockLegacyConfig extends LegacyConfigLoader {
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
}

View File

@@ -1,6 +1,6 @@
package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.config.ConfigLoader;
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 CustomEntityLegacyConfig extends LegacyConfigLoader {
public class CustomEntityConfig extends ConfigLoader {
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
protected CustomEntityLegacyConfig(String fileName) {
protected CustomEntityConfig(String fileName) {
super("mods", fileName);
loadKeys();
}
@@ -31,7 +31,8 @@ public class CustomEntityLegacyConfig extends LegacyConfigLoader {
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