Not much work was done today because of testing & research

The real work begins soon
This commit is contained in:
nossr50
2018-12-28 06:29:08 -08:00
parent 55a4238030
commit a316bb7bd2
12 changed files with 210 additions and 62 deletions

View File

@ -83,7 +83,7 @@ public class StringUtils {
switch (secondaryAbility) {
case HERBALISM_DOUBLE_DROPS :
case MINING_DOUBLE_DROPS :
case WOODCUTTING_DOUBLE_DROPS :
case WOODCUTTING_HARVEST:
return "Double Drops";
case FISHING_TREASURE_HUNTER :
case EXCAVATION_TREASURE_HUNTER :

View File

@ -0,0 +1,30 @@
package com.gmail.nossr50.util.player;
import org.bukkit.entity.Player;
/**
* This class will manage all types of feedback for a player done through mcMMO
* Including
* 1) Audio Feedback
* 2) Visual Feedback (Anything on the screen that we use to convey information)
*/
public class FeedbackManager {
/**
* Used for sending specific sound cues to a player
* @param player The player who will be receiving the sound cues
*/
public void sendAudioFeedback(Player player)
{
}
/**
* Used for sending specific visual aides to a player
* @param player The player who will be receiving the visual feedback
*/
public void sendVisualFeedback(Player player)
{
}
}

View File

@ -0,0 +1,7 @@
package com.gmail.nossr50.util.player;
public enum VisualFeedbackType {
ADVANCEMENT,
CHAT_MESSAGE,
CUSTOM_SCOREBOARD
}

View File

@ -26,6 +26,9 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
/**
* Manages the Scoreboards used to display a variety of mcMMO related information to the player
*/
public class ScoreboardManager {
static final Map<String, ScoreboardWrapper> PLAYER_SCOREBOARDS = new HashMap<String, ScoreboardWrapper>();
@ -51,11 +54,22 @@ public class ScoreboardManager {
static final Map<AbilityType, String> abilityLabelsColored;
static final Map<AbilityType, String> abilityLabelsSkill;
/*
* Initializes the static properties of this class
*/
static {
/*
* We need immutable objects for our Scoreboard's labels
*/
ImmutableMap.Builder<SkillType, String> skillLabelBuilder = ImmutableMap.builder();
ImmutableMap.Builder<AbilityType, String> abilityLabelBuilder = ImmutableMap.builder();
ImmutableMap.Builder<AbilityType, String> abilityLabelSkillBuilder = ImmutableMap.builder();
/*
* Builds the labels for our ScoreBoards
* Stylizes the scoreboard in a Rainbow Pattern
* This is off by default
*/
if (Config.getInstance().getScoreboardRainbows()) {
// Everything but black, gray, gold
List<ChatColor> colors = Lists.newArrayList(
@ -93,6 +107,10 @@ public class ScoreboardManager {
}
}
}
/*
* Builds the labels for our ScoreBoards
* Stylizes the scoreboard using our normal color scheme
*/
else {
for (SkillType type : SkillType.values()) {
// Include child skills

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.util.scoreboards;
import java.util.List;
import java.util.Map;
import jdk.internal.jline.internal.Nullable;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -40,9 +41,13 @@ public class ScoreboardWrapper {
private Objective powerObjective;
// Parameter variables (May be null / invalid)
@Nullable
private Scoreboard oldBoard = null;
@Nullable
public String targetPlayer = null;
@Nullable
public SkillType targetSkill = null;
@Nullable
private PlayerProfile targetProfile = null;
public int leaderboardPage = -1;

View File

@ -0,0 +1,33 @@
package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType;
import java.util.HashMap;
/**
* This class will handle the following things
* 1) Informing the player of important milestones in a skill (Every 5 levels)
* 2) Getting lists of milestones (skill unlocks) a player has
* 3) Propagating events for milestones (API)
*
* By setting up a skill milestone system it will make managing the audio/visual feedback for progression a lot easier
*
*/
//TODO: Inform players of milestones
//TODO: Helper methods for getting milestones
//TODO: Propagate events when milestones are achieved
//TODO: Update existing parts of the codebase to use this where appropriate
public class SkillMilestoneManager {
public static final HashMap<SkillType, SecondaryAbility> subskillMilestones;
static {
//Init our maps
subskillMilestones = new HashMap<>();
for(SkillType skillType : SkillType.values())
{
//TODO: Setup these values
}
}
}