endgame progression WIP

This commit is contained in:
nossr50
2021-02-04 14:56:06 -08:00
parent 085c8dbf68
commit eda227006f
7 changed files with 103 additions and 2 deletions

View File

@ -5,7 +5,9 @@ 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.config.Config;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
@ -20,9 +22,14 @@ import org.jetbrains.annotations.NotNull;
* For now this class will only handle ACF converted commands, all other commands will be handled elsewhere
*/
public class CommandManager {
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
//CHAT
public static final @NotNull String ADMIN_CONDITION = "adminCondition";
public static final @NotNull String PARTY_CONDITION = "partyCondition";
public static final @NotNull String MMO_DATA_LOADED = "mmoDataLoaded";
//SKILLS
public static final @NotNull String POWER_LEVEL_CONDITION = "powerLevelCondition";
private final @NotNull mcMMO pluginRef;
private final @NotNull BukkitCommandManager bukkitCommandManager;
@ -36,9 +43,16 @@ public class CommandManager {
}
private void registerCommands() {
registerSkillCommands(); //TODO: Implement other skills not just power level
registerChatCommands();
}
private void registerSkillCommands() {
if(Config.getInstance().isMasterySystemEnabled()) {
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
}
}
/**
* Registers chat commands if the chat system is enabled
*/
@ -54,6 +68,23 @@ public class CommandManager {
}
public void registerConditions() {
registerChatCommandConditions(); //Chat Commands
registerSkillConditions();
}
private void registerSkillConditions() {
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
if(issuer.getIssuer() instanceof Player) {
validateLoadedData(issuer.getPlayer());
} else {
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
}
});
}
private void registerChatCommandConditions() {
// Method or Class based - Can only be used on methods
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
BukkitCommandIssuer issuer = context.getIssuer();
@ -78,6 +109,7 @@ public class CommandManager {
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
validateLoadedData(bukkitCommandIssuer.getPlayer());
validatePlayerParty(bukkitCommandIssuer.getPlayer());
//TODO: Is there even a point in validating permission? look into this later
validatePermission("mcmmo.chat.partychat", bukkitCommandIssuer.getPlayer());
}
});

View File

@ -0,0 +1,31 @@
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.mcMMO;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@CommandPermission("mcmmo.commands.mmopower")
@CommandAlias("mmopowerlevel|powerlevel") //Kept for historical reasons
public class PowerLevelCommand extends BaseCommand {
private final @NotNull mcMMO pluginRef;
public PowerLevelCommand(@NotNull mcMMO pluginRef) {
this.pluginRef = pluginRef;
}
@Default
@Conditions(CommandManager.ADMIN_CONDITION)
public void processCommand(String[] args) {
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
Player player = bukkitCommandIssuer.getPlayer();
//TODO: impl
}
}

View File

@ -597,4 +597,5 @@ public class Config extends AutoUpdateConfigLoader {
public int getPowerLevelUpBroadcastRadius() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Broadcast_Targets.Distance_Restrictions.Restricted_Radius", 100); }
public int getPowerLevelUpBroadcastInterval() { return config.getInt("General.Level_Up_Chat_Broadcasts.Broadcast_Powerlevels.Milestone_Interval", 100); }
public boolean isMasterySystemEnabled() { return config.getBoolean( "General.PowerLevel.Skill_Mastery.Enabled"); }
}

View File

@ -11,16 +11,19 @@ public enum SubSkillType {
/* ACROBATICS */
ACROBATICS_DODGE(1),
ACROBATICS_ROLL,
ACROBATICS_MASTERY(1),
/* ALCHEMY */
ALCHEMY_CATALYSIS(1),
ALCHEMY_CONCOCTIONS(8),
ALCHEMY_MASTERY(1),
/* ARCHERY */
ARCHERY_ARROW_RETRIEVAL(1),
ARCHERY_DAZE,
ARCHERY_SKILL_SHOT(20),
ARCHERY_ARCHERY_LIMIT_BREAK(10),
ARCHERY_MASTERY(1),
/* Axes */
AXES_ARMOR_IMPACT(20),
@ -29,10 +32,12 @@ public enum SubSkillType {
AXES_CRITICAL_STRIKES(1),
AXES_GREATER_IMPACT(1),
AXES_SKULL_SPLITTER(1),
AXES_MASTERY(1),
/* Excavation */
EXCAVATION_ARCHAEOLOGY(8),
EXCAVATION_GIGA_DRILL_BREAKER(1),
EXCAVATION_MASTERY(1),
/* Fishing */
FISHING_FISHERMANS_DIET(5),
@ -41,6 +46,7 @@ public enum SubSkillType {
FISHING_MASTER_ANGLER(8),
FISHING_TREASURE_HUNTER(8),
FISHING_SHAKE(1),
FISHING_MASTERY(1),
/* Herbalism */
HERBALISM_DOUBLE_DROPS(1),
@ -49,6 +55,7 @@ public enum SubSkillType {
HERBALISM_GREEN_THUMB(4),
HERBALISM_HYLIAN_LUCK,
HERBALISM_SHROOM_THUMB,
HERBALISM_MASTERY(1),
/* Mining */
MINING_BIGGER_BOMBS(1),
@ -56,11 +63,13 @@ public enum SubSkillType {
MINING_DEMOLITIONS_EXPERTISE(1),
MINING_DOUBLE_DROPS(1),
MINING_SUPER_BREAKER(1),
MINING_MASTERY(1),
/* Repair */
REPAIR_ARCANE_FORGING(8),
REPAIR_REPAIR_MASTERY(1),
REPAIR_SUPER_REPAIR(1),
REPAIR_MASTERY(1),
/* Salvage */
SALVAGE_SCRAP_COLLECTOR(8),
@ -77,6 +86,7 @@ public enum SubSkillType {
SWORDS_SERRATED_STRIKES(1),
SWORDS_STAB(2),
SWORDS_SWORDS_LIMIT_BREAK(10),
SWORDS_MASTERY(1),
/* Taming */
TAMING_BEAST_LORE(1),
@ -89,6 +99,7 @@ public enum SubSkillType {
TAMING_SHARPENED_CLAWS(1),
TAMING_SHOCK_PROOF(1),
TAMING_THICK_FUR(1),
TAMING_MASTERY(1),
/* Unarmed */
UNARMED_ARROW_DEFLECT(1),
@ -98,6 +109,7 @@ public enum SubSkillType {
UNARMED_STEEL_ARM_STYLE(20),
UNARMED_IRON_GRIP(1),
UNARMED_UNARMED_LIMIT_BREAK(10),
UNARMED_MASTERY(1),
/* Woodcutting */
/* WOODCUTTING_BARK_SURGEON(3),*/
@ -106,7 +118,10 @@ public enum SubSkillType {
WOODCUTTING_LEAF_BLOWER(1),
/* WOODCUTTING_NATURES_BOUNTY(3),
WOODCUTTING_SPLINTER(3),*/
WOODCUTTING_TREE_FELLER(1);
WOODCUTTING_TREE_FELLER(1),
WOODCUTTING_MASTERY(1),
POWER_LEVEL_MASTERY(1);
private final int numRanks;
//TODO: SuperAbilityType should also contain flags for active by default? Not sure if it should work that way.

View File

@ -49,6 +49,9 @@ General:
RetroMode:
Enabled: true
Locale: en_US
PowerLevel:
Skill_Mastery:
Enabled: true
AprilFoolsEvent: true
MOTD_Enabled: true
EventBroadcasts: true

View File

@ -149,6 +149,10 @@ commands:
salvage:
description: Detailed mcMMO skill info
permission: mcmmo.commands.salvage
mmopower:
description: Shows skill mastery and power level info
permission: mcmmo.commands.mmopower
aliases: [mmopowerlevel, powerlevel]
adminchat:
aliases: [ac, a]
description: Toggle Admin chat or send admin chat messages
@ -825,6 +829,7 @@ permissions:
mcmmo.commands.taming: true
mcmmo.commands.unarmed: true
mcmmo.commands.woodcutting: true
mcmmo.commands.mmopower: true
mcmmo.commands.defaultsop:
description: Implies all default op mcmmo.commands permissions.
children: