mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
initial work for commands that execute on level up
This commit is contained in:
parent
e8fdae9597
commit
efbacefdbf
43
src/main/java/com/gmail/nossr50/onlevel/LevelUpCommand.java
Normal file
43
src/main/java/com/gmail/nossr50/onlevel/LevelUpCommand.java
Normal file
@ -0,0 +1,43 @@
|
||||
package com.gmail.nossr50.onlevel;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface LevelUpCommand {
|
||||
|
||||
/**
|
||||
* Raw command input, this is before any processing is done (regex etc)
|
||||
*
|
||||
* @return the raw command input from the config file
|
||||
*/
|
||||
@NotNull String getRawInput();
|
||||
|
||||
/**
|
||||
* The command after regex operations etc
|
||||
*
|
||||
* @return the processed command
|
||||
*/
|
||||
@NotNull String getProcessedInput();
|
||||
|
||||
/**
|
||||
* Who should execute this level up command
|
||||
*
|
||||
* @return who should execute this level up command
|
||||
*/
|
||||
@NotNull SkillDispatcher getSender();
|
||||
|
||||
|
||||
/**
|
||||
* Get the {@link LevelUpCommandTriggers}'s for this command
|
||||
*
|
||||
* @return the {@link LevelUpCommandTriggers} for this command
|
||||
*/
|
||||
@NotNull LevelUpCommandTriggers getCommandTriggers();
|
||||
|
||||
/**
|
||||
* The permission node for this command
|
||||
*
|
||||
* @return the permission node for this command, null if not needed
|
||||
*/
|
||||
@Nullable String getPermissionNode();
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.gmail.nossr50.onlevel;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* This class will handle execution of {@link LevelUpCommand}'s
|
||||
* This class is invoked by our {@link com.gmail.nossr50.listeners.SelfListener}
|
||||
*/
|
||||
public class LevelUpCommandProcessor {
|
||||
@NotNull private HashMap<TargetSkill, LevelUpCommand> commandMap;
|
||||
|
||||
public LevelUpCommandProcessor() {
|
||||
commandMap = new HashMap<>();
|
||||
loadPayloads();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the {@link LevelUpCommand} payloads to be executed as needed
|
||||
*/
|
||||
private void loadPayloads() {
|
||||
//Load the payloads from the config file
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute any relevant {@link LevelUpCommand}'s for this player
|
||||
* @param mmoPlayer target player
|
||||
* @param primarySkillType target skill type
|
||||
*/
|
||||
public void onLevel(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.onlevel;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LevelUpCommandTriggers {
|
||||
/**
|
||||
* The {@link TargetSkill}'s that can trigger a {@link LevelUpCommand}
|
||||
*
|
||||
* @return the relevant target skills
|
||||
*/
|
||||
@NotNull List<TargetSkill> getTargetSkills();
|
||||
|
||||
/**
|
||||
* The levels at which this command will trigger
|
||||
*
|
||||
* @return the levels at which this command will trigger
|
||||
*/
|
||||
@NotNull List<Integer> getTargetLevels();
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.gmail.nossr50.onlevel;
|
||||
|
||||
public enum SkillDispatcher {
|
||||
CONSOLE,
|
||||
PLAYER;
|
||||
}
|
21
src/main/java/com/gmail/nossr50/onlevel/TargetSkill.java
Normal file
21
src/main/java/com/gmail/nossr50/onlevel/TargetSkill.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.gmail.nossr50.onlevel;
|
||||
|
||||
public enum TargetSkill {
|
||||
POWER_LEVEL,
|
||||
ANY,
|
||||
ACROBATICS,
|
||||
ALCHEMY,
|
||||
ARCHERY,
|
||||
AXES,
|
||||
EXCAVATION,
|
||||
FISHING,
|
||||
HERBALISM,
|
||||
MINING,
|
||||
REPAIR,
|
||||
SALVAGE,
|
||||
SMELTING,
|
||||
SWORDS,
|
||||
TAMING,
|
||||
UNARMED,
|
||||
WOODCUTTING;
|
||||
}
|
Loading…
Reference in New Issue
Block a user