mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Scoreboard config pt 2
This commit is contained in:
parent
bbe9b92c15
commit
307340bea3
@ -40,10 +40,11 @@ public class InspectCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player
|
||||
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
||||
|
||||
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||
if (!mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -79,10 +80,10 @@ public class InspectCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isUseThisBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
|
||||
|
||||
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||
if (!mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().isPrintToChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ public class MccooldownCommand implements TabExecutor {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && MainConfig.getInstance().getCooldownUseBoard()) {
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) {
|
||||
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
||||
|
||||
if (!MainConfig.getInstance().getCooldownUseChat()) {
|
||||
if (!mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.COOLDOWNS_BOARD)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -106,8 +106,9 @@ public class McrankCommand implements TabExecutor {
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
boolean useBoard = mcMMO.getScoreboardSettings().getScoreboardsEnabled() && (sender instanceof Player) && (MainConfig.getInstance().getRankUseBoard());
|
||||
boolean useChat = !useBoard || mcMMO.getScoreboardSettings().getScoreboardTypePrintToChatEnabled(ScoreboardManager.SidebarType.RANK_BOARD);
|
||||
boolean useBoard = mcMMO.getScoreboardSettings().getScoreboardsEnabled() && (sender instanceof Player)
|
||||
&& (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.RANK_BOARD));
|
||||
boolean useChat = !useBoard || mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.RANK_BOARD);
|
||||
|
||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.commands.player;
|
||||
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
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.scoreboards.ScoreboardManager;
|
||||
@ -28,10 +29,10 @@ public class McstatsCommand implements TabExecutor {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (MainConfig.getInstance().getStatsUseBoard() && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
|
||||
if (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
|
||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||
|
||||
if (!MainConfig.getInstance().getStatsUseChat()) {
|
||||
if (!mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.STATS_BOARD)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -113,8 +114,8 @@ public class MctopCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
private void display(int page, PrimarySkillType skill, CommandSender sender) {
|
||||
boolean useBoard = (sender instanceof Player) && (MainConfig.getInstance().getTopUseBoard());
|
||||
boolean useChat = !useBoard || MainConfig.getInstance().getTopUseChat();
|
||||
boolean useBoard = (sender instanceof Player) && (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.TOP_BOARD));
|
||||
boolean useChat = !useBoard || mcMMO.getScoreboardSettings().isScoreboardPrinting(ScoreboardManager.SidebarType.TOP_BOARD);
|
||||
|
||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
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.StringUtils;
|
||||
@ -106,7 +107,9 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && MainConfig.getInstance().getSkillUseBoard()) {
|
||||
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()
|
||||
&& mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes()
|
||||
.getConfigSectionSkillBoard().isUseThisBoard()) {
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
}
|
||||
|
||||
|
@ -535,87 +535,6 @@ public class MainConfig extends ConfigValidated {
|
||||
return getIntValue(MOB_HEALTHBAR, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
/* Scoreboards */
|
||||
public boolean getScoreboardsEnabled() {
|
||||
return getBooleanValue(SCOREBOARD, USE_SCOREBOARDS);
|
||||
}
|
||||
|
||||
public boolean getRankUseChat() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, RANK, PRINT);
|
||||
}
|
||||
|
||||
public boolean getRankUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, RANK, BOARD);
|
||||
}
|
||||
|
||||
public int getRankScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, RANK, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getTopUseChat() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, TOP, PRINT);
|
||||
}
|
||||
|
||||
public boolean getTopUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, TOP, BOARD);
|
||||
}
|
||||
|
||||
public int getTopScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, TOP, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getStatsUseChat() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, STATS, PRINT);
|
||||
}
|
||||
|
||||
public boolean getStatsUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, STATS, BOARD);
|
||||
}
|
||||
|
||||
public int getStatsScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, STATS, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getInspectUseChat() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, INSPECT, PRINT);
|
||||
}
|
||||
|
||||
public boolean getInspectUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, INSPECT, BOARD);
|
||||
}
|
||||
|
||||
public int getInspectScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, INSPECT, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getCooldownUseChat() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, COOLDOWN, PRINT);
|
||||
}
|
||||
|
||||
public boolean getCooldownUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, COOLDOWN, BOARD);
|
||||
}
|
||||
|
||||
public int getCooldownScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, COOLDOWN, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getSkillUseBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, SKILL, BOARD);
|
||||
}
|
||||
|
||||
public int getSkillScoreboardTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, SKILL, DISPLAY_TIME);
|
||||
}
|
||||
|
||||
public boolean getSkillLevelUpBoard() {
|
||||
return getBooleanValue(SCOREBOARD, TYPES, SKILL, LEVEL_UP + BOARD);
|
||||
}
|
||||
|
||||
public int getSkillLevelUpTime() {
|
||||
return getIntValue(SCOREBOARD, TYPES, SKILL, LEVEL_UP + TIME);
|
||||
}
|
||||
|
||||
/* Database Purging */
|
||||
public int getPurgeInterval() {
|
||||
return getIntValue(DATABASE + PURGING, PURGE_INTERVAL);
|
||||
|
@ -99,7 +99,7 @@ public class ConfigScoreboard {
|
||||
* HELPER METHODS
|
||||
*/
|
||||
|
||||
public boolean getScoreboardTypeEnabled(ScoreboardManager.SidebarType sidebarType)
|
||||
public boolean isScoreboardEnabled(ScoreboardManager.SidebarType sidebarType)
|
||||
{
|
||||
switch(sidebarType)
|
||||
{
|
||||
@ -118,7 +118,7 @@ public class ConfigScoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getScoreboardTypePrintToChatEnabled(ScoreboardManager.SidebarType sidebarType)
|
||||
public boolean isScoreboardPrinting(ScoreboardManager.SidebarType sidebarType)
|
||||
{
|
||||
switch(sidebarType)
|
||||
{
|
||||
@ -136,7 +136,7 @@ public class ConfigScoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
public int getScoreboardTypeDisplayTime(ScoreboardManager.SidebarType sidebarType)
|
||||
public int getScoreboardDisplayTime(ScoreboardManager.SidebarType sidebarType)
|
||||
{
|
||||
switch(sidebarType)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ public class ScoreboardManager {
|
||||
dirtyPowerLevels.add(playerName);
|
||||
}
|
||||
|
||||
if (MainConfig.getInstance().getSkillLevelUpBoard()) {
|
||||
if (mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().isUseThisBoard()) {
|
||||
enablePlayerSkillLevelUpScoreboard(player, skill);
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class ScoreboardManager {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(skill);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getSkillScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.SKILL_BOARD));
|
||||
}
|
||||
|
||||
public static void enablePlayerSkillLevelUpScoreboard(Player player, PrimarySkillType skill) {
|
||||
@ -269,7 +269,7 @@ public class ScoreboardManager {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(skill);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getSkillLevelUpTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().getShowBoardOnPlayerLevelUpTime());
|
||||
}
|
||||
|
||||
public static void enablePlayerStatsScoreboard(Player player) {
|
||||
@ -278,7 +278,7 @@ public class ScoreboardManager {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSelfStats();
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getStatsScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.STATS_BOARD));
|
||||
}
|
||||
|
||||
public static void enablePlayerInspectScoreboard(Player player, PlayerProfile targetProfile) {
|
||||
@ -287,7 +287,7 @@ public class ScoreboardManager {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectStats(targetProfile);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getInspectScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getConfigSectionScoreboardTypes().getConfigSectionInspectBoard().getDisplayTimeInSeconds());
|
||||
}
|
||||
|
||||
public static void enablePlayerCooldownScoreboard(Player player) {
|
||||
@ -296,7 +296,7 @@ public class ScoreboardManager {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeCooldowns();
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getCooldownScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.COOLDOWNS_BOARD));
|
||||
}
|
||||
|
||||
public static void showPlayerRankScoreboard(Player player, Map<PrimarySkillType, Integer> rank) {
|
||||
@ -306,7 +306,7 @@ public class ScoreboardManager {
|
||||
wrapper.setTypeSelfRank();
|
||||
wrapper.acceptRankData(rank);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getRankScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
|
||||
}
|
||||
|
||||
public static void showPlayerRankScoreboardOthers(Player player, String targetName, Map<PrimarySkillType, Integer> rank) {
|
||||
@ -316,7 +316,7 @@ public class ScoreboardManager {
|
||||
wrapper.setTypeInspectRank(targetName);
|
||||
wrapper.acceptRankData(rank);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getRankScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.RANK_BOARD));
|
||||
}
|
||||
|
||||
public static void showTopScoreboard(Player player, PrimarySkillType skill, int pageNumber, List<PlayerStat> stats) {
|
||||
@ -326,7 +326,7 @@ public class ScoreboardManager {
|
||||
wrapper.setTypeTop(skill, pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getTopScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
|
||||
}
|
||||
|
||||
public static void showTopPowerScoreboard(Player player, int pageNumber, List<PlayerStat> stats) {
|
||||
@ -336,7 +336,7 @@ public class ScoreboardManager {
|
||||
wrapper.setTypeTopPower(pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
|
||||
changeScoreboard(wrapper, MainConfig.getInstance().getTopScoreboardTime());
|
||||
changeScoreboard(wrapper, mcMMO.getScoreboardSettings().getScoreboardDisplayTime(SidebarType.TOP_BOARD));
|
||||
}
|
||||
|
||||
// **** Helper methods **** //
|
||||
|
Loading…
Reference in New Issue
Block a user