Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endgame Update #4840

Merged
merged 89 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
eda2270
endgame progression WIP
nossr50 Feb 4, 2021
ce09a8b
get mmopower working
nossr50 Feb 6, 2021
9303d44
Change condition on power level command
nossr50 Feb 6, 2021
39a6c31
Add permission nodes for mastery subskills
nossr50 Feb 8, 2021
1ff2c0d
Add Mother Lode mastery subskill to Mining
nossr50 Feb 8, 2021
73e36b1
rename references to mining mastery -> mother lode
nossr50 Feb 8, 2021
32b41b3
Update references to mastery in en_us for Mining to Mother Lode
nossr50 Feb 8, 2021
addf9b0
Add Clean Cuts to Woodcutting
nossr50 Feb 8, 2021
1bde79c
add toggle for sending chat messages to console
nossr50 Feb 10, 2021
f764093
RandomChanceUtil refactor part 1
nossr50 Feb 17, 2021
fe889cf
RandomChanceUtil Refactor part 2
nossr50 Feb 18, 2021
e30c711
RandomChanceUtil refactor part 3
nossr50 Feb 18, 2021
6a3671a
RandomChanceUtil refactor part 4
nossr50 Feb 19, 2021
f039b4c
Fix display values for RNG
nossr50 Feb 24, 2021
1a180c4
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
nossr50 Feb 27, 2021
3e937c1
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
nossr50 Mar 2, 2021
bb44e56
Merge master into endgame branch to prepare merge for beta 2.2.000 up…
nossr50 Dec 4, 2022
b077d9e
Fix compilation errors
nossr50 Dec 5, 2022
05c86f1
Add some unit tests for new RNG dice rolls
nossr50 Dec 11, 2022
11cf882
Probability factory should live within the interface
nossr50 Dec 18, 2022
7f66d27
Rename test
nossr50 Dec 18, 2022
59f7118
Refactor Probability API a bit
nossr50 Dec 19, 2022
4a5e354
Add static chance skills to probability unit tests
nossr50 Dec 19, 2022
12fb4a3
Refactor probability tests a little bit
nossr50 Dec 19, 2022
e4470fd
More work on end game skills
nossr50 Feb 19, 2023
36adde7
Added some unit tests for double drops, fixed bug with bonus drops
nossr50 Mar 20, 2023
6845fb4
Fix some bugs with new Probability type and unit tests
nossr50 Mar 26, 2023
68d4a17
merge master
nossr50 Apr 3, 2023
576b3c4
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
nossr50 Apr 3, 2023
02c5aa4
Remove unused config values
nossr50 Apr 3, 2023
8bb50fb
Add Tridents/Xbows (WIP)
nossr50 Apr 4, 2023
2c49f8f
Fixed failing tests + improved support for Xbows/Tridents
nossr50 Apr 8, 2023
0db1d84
Add missing parent definitions for Xbows/Tridents
nossr50 Apr 8, 2023
534b222
More work on Xbows/Tridents
nossr50 Apr 11, 2023
fc92876
Add missing skill command definitions to plugin.yml
nossr50 Apr 11, 2023
5b9ab65
Add Xbows/Tridents to combat skills list
nossr50 Apr 11, 2023
63e7c09
Added missing locale strings for Xbows/Tridents
nossr50 Apr 11, 2023
aaa47d3
Add some combat processing logic for Tridents/Xbows
nossr50 Apr 11, 2023
dc1d254
Fixed UnarmedManager being used for Tridents
nossr50 Apr 11, 2023
7af0bc4
Config files will update automatically again
nossr50 Apr 11, 2023
f88dfe4
Pull master
nossr50 Apr 17, 2023
4f79f78
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
nossr50 Apr 17, 2023
72957c3
Add XP test for Woodcutting
nossr50 Apr 19, 2023
d30b2f7
Fixed divide by zero bug impacting tridents XP when missing from config
nossr50 Apr 23, 2023
75ace0c
Merge master
nossr50 May 13, 2023
cbcddbf
Merge master
nossr50 May 29, 2023
c8dedfc
Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into endgame
nossr50 Dec 18, 2023
2595215
Add in trident command
nossr50 Dec 19, 2023
23b8e0a
Add BowType metadata
nossr50 Dec 21, 2023
3e11b7d
Add Explosive Shot definition
nossr50 Dec 21, 2023
7e3826a
WIP starting work on supers for archery/crossbow
nossr50 Dec 21, 2023
7973ccc
Update FlatFile for new skill cds
nossr50 Dec 22, 2023
5f63faf
Unit test refactor
nossr50 Dec 22, 2023
967ffd6
update Changelog.txt
nossr50 Dec 22, 2023
9360e14
Fun with arrows
nossr50 Dec 22, 2023
1799d45
Deflect arrows off surfaces
nossr50 Dec 24, 2023
afff3b4
Move projectile stuff to util
nossr50 Dec 24, 2023
76d4b50
Refactor ricochet code, don't reflect shallow angles
nossr50 Dec 28, 2023
dadc295
Trickshot boiler plate stuff
nossr50 Dec 28, 2023
b0efd46
starting work on sql unit tests
nossr50 Dec 28, 2023
a941a1c
kill child.yml and more work on sql unit tests
nossr50 Dec 28, 2023
8cc4798
Merge master
nossr50 Jan 3, 2024
3fbb482
Update SQL schema when missing columns
nossr50 Jan 3, 2024
04c9db8
more h2 compatibility stuff
nossr50 Jan 3, 2024
4ba0f76
Bouncing
nossr50 Jan 3, 2024
826d16d
More work on Crossbows & Tridents
nossr50 Jan 4, 2024
fdc3087
Hack to disable supers that aren't ready yet
nossr50 Jan 14, 2024
9cbe108
Buff end game skills
nossr50 Jan 14, 2024
efabaf1
more work on end game update
nossr50 Jan 14, 2024
33cad7c
typos
nossr50 Jan 14, 2024
009d809
Fix bug with Excavation drop rate and misc mysql changes
nossr50 Jan 15, 2024
dda5b45
improve SQL exceptions to be more easily debuggable
nossr50 Jan 15, 2024
377bf1b
Tree Feller non-wood drop rate reduced by 90%
nossr50 Jan 15, 2024
f051edd
Tree Feller non-wood drop rate reduced by 90%
nossr50 Jan 22, 2024
b3b8a12
Crossbow Fixes
nossr50 Jan 22, 2024
66a4886
Crossbow multi-shot arrows that bounce are no longer pickup-able
nossr50 Jan 28, 2024
b0c42f8
enable super shotgun permission
nossr50 Feb 3, 2024
2271bd5
wip super shotgun
nossr50 Feb 4, 2024
70383b7
merge master
nossr50 Feb 18, 2024
fba6e8a
merge master
nossr50 Mar 19, 2024
ef3887a
fix unit tests
nossr50 Mar 30, 2024
bf901a0
remove unimplemented features, fix tests again, and optimize imports
nossr50 Mar 30, 2024
221175d
locale changes
nossr50 Mar 30, 2024
e940724
update note about WIP status on tridents/xbows
nossr50 Mar 30, 2024
84cb6e3
add metadata cleanup for trick shot
nossr50 Mar 30, 2024
6d0fbfd
updating changelog
nossr50 Mar 30, 2024
39503b7
Fix missing verdant bounty stat in herbalism command
nossr50 Mar 30, 2024
e8a46d6
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into endgame
nossr50 Mar 30, 2024
3e7c889
mcMMO 2.2.000-RC1 candidate for release
nossr50 Mar 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 60 additions & 9 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
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)

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

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

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

Locale
Added locale entries for motherlode, cleancuts, and verdant bounty

Codebase
Major rewrite for how random chance was handled in the code
Many skills with RNG elements now send out a SubSkillEvent (which can be used to modify probability or cancel the results), some skills without RNG still send out this event when activated, this event is cancellable so it can be used to make a skill fail
A lot of new unit tests were added to help keep mcMMO stable as part of this update, of course, more could always be added.

NOTES:
One feature of this update is to provide a endgame benefits to some skills that you can grind for a long time, ideally for a long while. I will likely expand upon this idea in future updates.
A few skills have these endgame oriented subskills, these new subskills provide a small benefit at first that grows and scales up to level 10,000 (or 1,000 for Standard mode which no one uses) and does not have ranks (other than the initial rank to unlock it).
These endgame sub skills unlock at level 1000 for users with default mcMMO settings, or 100 for those using the optional Standard scaling.
You can tweak the benefits of these skills in advanced.yml, the default settings are meant to be a good starting point.

Crossbows and Tridents are WIP skills, I would like feedback on discord about them.

More info on the new Triple Drop skills (Mother Lode, Clean Cuts, Verdant Bounty):
Currently these start at about 5% chance and can reach a maximum 50% chance if a player acquired 10,000 skill, you can adjust this in advanced.yml
These skills respect double drop settings from config.yml just like the corresponding Double Drop skills do, if a double drop is disabled for an item, then its disabled for triple drops too.
I added a new Power Level Command, for now this just shows you your current power level. If I ever add features based on power level, this command will likely display output related to those features.

Regarding Maces, I will likely add that as a WIP skill when the next Minecraft update drops.

Version 2.1.231
Fixed a bug preventing parties from being made without passwords (Thanks Momshroom)
Updated korean locale (thanks mangchi57)
Expand Down Expand Up @@ -1331,7 +1382,7 @@ Version 2.1.128
Fixed a bug where certain types of ore did not receive bonuses from Blast Mining
Fixed a few locale errors with commands
(API) Added ExperienceAPI::addCombatXP for adding combat XP to players, signature may change so its deprecated for now
mcMMO now logs whether or not its using FlatFile or SQL database on load
mcMMO now logs whether its using FlatFile or SQL database on load
(1.16) Strider added to combat experience with a value of 1.2

NOTES: A more thorough look at Unarmed balance will happen in the future, the intention of this nerf is to make Unarmed less rewarding until it is leveled quite a bit.
Expand All @@ -1351,7 +1402,7 @@ Version 2.1.127
Version 2.1.126
mcMMO now relies on NMS for some of its features, if NMS cannot properly be wired up when initializing mcMMO behaviours relying on NMS will either be partially supported or disabled
mcMMO now has a compatibility mode, any features that require specific versions of Minecraft for full functionality will be disabled if your server is not running a compatible version, mcMMO will still function in compatibility mode, but either the feature will be modified or disabled depending on the version of the server software
New command /mmocompat - Shows information about whether or not mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console.
New command /mmocompat - Shows information about whether mcMMO is fully functional or if some features are disabled due to the server software not being fully supported. Can be used by players or console.
New command /mmoxpbar (alias /xpbarsettings) - Players can choose to always show XP bars or to never show XP bars on a per skill basis
XPBars now last for 3 seconds before hiding instead of 2 seconds
Fixed an exploit involving fishing rods
Expand Down Expand Up @@ -1987,7 +2038,7 @@ Version 2.1.68
Fixed a bug where consuming food in the off hand did not trigger the Diet abilities

Version 2.1.67
The XP bar now reflects whether or not the player is receiving the early game boost
The XP bar now reflects whether the player is receiving the early game boost
Players who are receiving an early game boost will be shown "Learning a skill..." as the title of the XP bar while gaining XP
New locale string 'XPBar.Template.EarlyGameBoost'

Expand Down Expand Up @@ -2036,17 +2087,17 @@ Version 2.1.63
Version 2.1.62
Added a new admin notification system, sensitive commands will print chat messages to "admins" (players with either Operator status or admin chat permission)
Added a setting to disable the new admin notifications to config.yml 'General.AdminNotifications' (this will be more configurable in 2.2)
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether or not the XP rate event messages are enabled
OPs and players with the admin chat permission will now see details about XP rate event commands regardless of whether the XP rate event messages are enabled
Updated hu_HU locale (thanks andris155)
Added XP for mining Magma_Block (default 30 XP - Update your config, see notes)
Diamond tools & armor in the repair config now have a minimum level of 0 (Update your config, temporary hotfix, 2.2 addresses this issue, see notes)
Guardian default combat XP multiplier reduced from 3.0 to 1.0 (update config if you want this change)
New locale string - 'Server.ConsoleName' the name of the server console, this will be used in place of player names when sending admin notifications out if the command was used from console
New locale string - 'Notifications.Admin.Format.Others' style formatting + prefix for admin notifications used in the other new strings below
New locale string - 'Notifications.Admin.Format.Self' style formatting + prefix for admin command confirmations sent to the user who executed the command
New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether or not messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.Start.Self' sent to the user who modifies the XP rate regardless of whether messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.Start.Others' details of who started an XP rate event are sent to players who have Operator status or admin chat permission when the command to start or modify XP of an event has been issued
New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether or not messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.End.Self' sent to the user who ended the XP rate event regardless of whether messages for the event are enabled
New locale string - 'Notifications.Admin.XPRate.End.Others' details of who ended an XP rate event are sent to players who have Operator status or admin chat permission when the command to end the event has been issued

NOTES:
Expand Down Expand Up @@ -2317,7 +2368,7 @@ Version 2.1.26

Notes:
The new Limit Break subskills are intended to make Prot IV players less tanky and for you to feel more powerful for having high skill level.
Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an end game skill compared to before.
Limit Break has 10 ranks, each rank gives 1 extra RAW damage, this is damage before reductions from armor and enchantments. The net result is you deal about 50% more damage with an endgame skill compared to before.
With these new changes, most skills can 2 shot normal diamond armor, and it takes about 5 hits to kill someone in Prot IV Diamond Armor.
I'm not sure everyone will like these changes, the net result is players are a lot easier to kill now, whereas before you could take quite a beating before getting killed.
I collected several sets of data before making these changes, including damage to player with and without prot 4 diamond armor, damage to those players with and without enchanted weapons, damage with and without leveling your skills, and combinations of the previously mentioned things.
Expand Down Expand Up @@ -4018,7 +4069,7 @@ Removed performance debugging
Removed some useless settings from the config file

Version 1.0.34
Fixed the PVP setting determining whether or not you would hurt yourself from AoE Abilities
Fixed the PVP setting determining whether you would hurt yourself from AoE Abilities
Added Dutch (nl) language support
Super Breaker now gives the correct XP as determined by config.yml
Sand Stone XP is now configurable and no longer shares the 'stone' node
Expand All @@ -4028,7 +4079,7 @@ Version 1.0.33
Fixed the toggle for the Excavation drop 'Cocoa Beans'
Fixed bug where Unarmed users could disarm without being bare handed
Cocoa Beans now have an XP modifier in config.yml
You can now toggle whether or not Mobspawners will give XP (in config.yml)
You can now toggle whether Mobspawners will give XP (in config.yml)
MySQL version now makes requests to the MySQL server less frequently (should help performance)
Fixed bug with Skull Splitter hitting the user

Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.231</version>
<version>2.2.000-RC1</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>
Expand Down Expand Up @@ -258,6 +258,13 @@
<!-- ... -->
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/gmail/nossr50/api/ExperienceAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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;
Expand All @@ -20,7 +19,6 @@
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Set;
import java.util.UUID;

public final class ExperienceAPI {
Expand Down Expand Up @@ -706,7 +704,7 @@ public static void addLevelOffline(String playerName, String skillType, int leve
PrimarySkillType skill = getSkillType(skillType);

if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);

for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size()));
Expand Down Expand Up @@ -737,7 +735,7 @@ public static void addLevelOffline(UUID uuid, String skillType, int levels) {
PrimarySkillType skill = getSkillType(skillType);

if (SkillTools.isChildSkill(skill)) {
Set<PrimarySkillType> parentSkills = FamilyTree.getParents(skill);
var parentSkills = mcMMO.p.getSkillTools().getChildSkillParents(skill);

for (PrimarySkillType parentSkill : parentSkills) {
profile.addLevels(parentSkill, (levels / parentSkills.size()));
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/gmail/nossr50/api/PartyAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
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 jdk.jfr.Experimental;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.gmail.nossr50.api.exceptions;

import org.jetbrains.annotations.NotNull;

public class ValueOutOfBoundsException extends RuntimeException {
public ValueOutOfBoundsException(@NotNull String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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;
Expand Down Expand Up @@ -44,7 +45,7 @@ public AdminChatMailer(Plugin pluginRef) {
public @NotNull Predicate<CommandSender> predicate() {
return (commandSender) -> commandSender.isOp()
|| commandSender.hasPermission(MCMMO_CHAT_ADMINCHAT_PERMISSION)
|| commandSender instanceof ConsoleCommandSender;
|| (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.ADMIN) && commandSender instanceof ConsoleCommandSender);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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;
Expand Down Expand Up @@ -51,7 +52,8 @@ public void sendMessage() {
messagePartyChatSpies(spyMessage);

//Console message
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
}

/**
Expand Down
33 changes: 32 additions & 1 deletion src/main/java/com/gmail/nossr50/commands/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -20,9 +21,14 @@
* For now this class will only handle ACF converted commands, all other commands will be handled elsewhere
*/
public class CommandManager {
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";

//CHAT
public static final @NotNull String ADMIN_CONDITION = "adminCondition";
public static final @NotNull String PARTY_CONDITION = "partyCondition";
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";

//SKILLS
public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition";

private final @NotNull mcMMO pluginRef;
private final @NotNull BukkitCommandManager bukkitCommandManager;
Expand All @@ -36,9 +42,16 @@ public CommandManager(@NotNull mcMMO pluginRef) {
}

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
*/
Expand All @@ -54,6 +67,23 @@ private void registerChatCommands() {
}

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();
Expand All @@ -78,6 +108,7 @@ public void registerConditions() {
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());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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;
Expand Down
Loading
Loading