Scoreboard config part 1

This commit is contained in:
nossr50 2019-03-13 09:42:57 -07:00
parent 1c289cfcdf
commit f00601931d
38 changed files with 708 additions and 96 deletions

View File

@ -115,9 +115,28 @@ Version 2.1.16
Breaking Kelp should now count the whole plant for XP Breaking Kelp should now count the whole plant for XP
Spawned Mobs that are not supposed to award XP will no longer reward XP once transformed (ie: drowned) Spawned Mobs that are not supposed to award XP will no longer reward XP once transformed (ie: drowned)
mcMMO's config system has been rewritten mcMMO's config system has been rewritten
MySQL Settings can now be found in the new Database config file Many config files are now generated on demand instead of being copied from within the JAR
MySQL Settings now have more comments All config nodes that used to be styled with CamelCase now use underscores (_) as spaces for readability and consistency
All config nodes will now use Capital letters at the start of each nodes name and after each underscore (_)
All config nodes now include a comment with the default value of the node to use as reference
Scoreboard settings can now be found in "scoreboard.conf"
Scoreboard's "Allow_Keep" setting was removed because it was doing something permissions should be doing instead, and I don't see why such a thing even needs a permission!
Scoreboard's "Power_Level_Tags" renamed -> "Display_Power_Levels_Below_Player_Names"
Scoreboard's "Show_Stats_After_Login" renamed -> "Show_Stats_Scoreboard_On_Player_Login"
Scoreboard's "Rainbow" renamed -> "Use_Rainbow_Styling_For_Skill_Names"
Scoreboard's "Ability_Names" renamed -> "Use_Super_Ability_Name_Instead_Of_Generic_Name"
Scoreboard's "Print" renamed -> "Show_Command_Output_In_Chat"
Scoreboard's "Board" renamed -> "Show_Scoreboard"
Scoreboard's "Display_Time" renamed -> "Display_Time_In_Seconds"
Scoreboard.Misc.Ability locale entry renamed from "Ability" to "Super Ability", this is used only if scoreboards are enabled and super ability names are disabled in scoreboard.conf
MySQL Settings can now be found in "database_settings.conf"
MySQL User settings are now in the User Category instead of being in the Database category MySQL User settings are now in the User Category instead of being in the Database category
MySQL's "Enabled" renamed -> "Use_MySQL"
MySQL's "Name" renamed -> "Database_Name"
MySQL Pool and MaxConnection settings for Save/Load/Misc pools have had their names updated to include setting information
Repair and Salvage configs are now confined to a single file Repair and Salvage configs are now confined to a single file
mcMMO will no longer shutdown if it finds invalid config entries mcMMO will no longer shutdown if it finds invalid config entries
mcMMO will nag admins about invalid config entries when they join the server mcMMO will nag admins about invalid config entries when they join the server

View File

@ -31,7 +31,7 @@ public class McscoreboardCommand implements TabExecutor {
} }
if (args[0].equalsIgnoreCase("keep")) { if (args[0].equalsIgnoreCase("keep")) {
if (!MainConfig.getInstance().getAllowKeepBoard() || !MainConfig.getInstance().getScoreboardsEnabled()) { if (!mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
return true; return true;
} }

View File

@ -40,7 +40,7 @@ public class InspectCommand implements TabExecutor {
return true; return true;
} }
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) { if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile); ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
if (!MainConfig.getInstance().getInspectUseChat()) { if (!MainConfig.getInstance().getInspectUseChat()) {
@ -79,7 +79,7 @@ public class InspectCommand implements TabExecutor {
return true; return true;
} }
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) { if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile()); ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
if (!MainConfig.getInstance().getInspectUseChat()) { if (!MainConfig.getInstance().getInspectUseChat()) {

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
@ -30,7 +31,7 @@ public class MccooldownCommand implements TabExecutor {
case 0: case 0:
Player player = (Player) sender; Player player = (Player) sender;
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getCooldownUseBoard()) { if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && MainConfig.getInstance().getCooldownUseBoard()) {
ScoreboardManager.enablePlayerCooldownScoreboard(player); ScoreboardManager.enablePlayerCooldownScoreboard(player);
if (!MainConfig.getInstance().getCooldownUseChat()) { if (!MainConfig.getInstance().getCooldownUseChat()) {

View File

@ -8,6 +8,7 @@ import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -105,8 +106,8 @@ public class McrankCommand implements TabExecutor {
mcMMOPlayer.actualizeDatabaseATS(); mcMMOPlayer.actualizeDatabaseATS();
} }
boolean useBoard = MainConfig.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (MainConfig.getInstance().getRankUseBoard()); boolean useBoard = mcMMO.getScoreboardSettings().getScoreboardsEnabled() && (sender instanceof Player) && (MainConfig.getInstance().getRankUseBoard());
boolean useChat = !useBoard || MainConfig.getInstance().getRankUseChat(); boolean useChat = !useBoard || mcMMO.getScoreboardSettings().getScoreboardTypePrintToChatEnabled(ScoreboardManager.SidebarType.RANK_BOARD);
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
} }

View File

@ -28,7 +28,7 @@ public class McstatsCommand implements TabExecutor {
case 0: case 0:
Player player = (Player) sender; Player player = (Player) sender;
if (MainConfig.getInstance().getStatsUseBoard() && MainConfig.getInstance().getScoreboardsEnabled()) { if (MainConfig.getInstance().getStatsUseBoard() && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
ScoreboardManager.enablePlayerStatsScoreboard(player); ScoreboardManager.enablePlayerStatsScoreboard(player);
if (!MainConfig.getInstance().getStatsUseChat()) { if (!MainConfig.getInstance().getStatsUseChat()) {

View File

@ -106,7 +106,7 @@ public abstract class SkillCommand implements TabExecutor {
} }
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getSkillUseBoard()) { if (mcMMO.getScoreboardSettings().getScoreboardsEnabled() && MainConfig.getInstance().getSkillUseBoard()) {
ScoreboardManager.enablePlayerSkillScoreboard(player, skill); ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
} }

View File

@ -5,6 +5,7 @@ import com.gmail.nossr50.config.collectionconfigs.SalvageConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.hocon.SerializedConfigLoader; import com.gmail.nossr50.config.hocon.SerializedConfigLoader;
import com.gmail.nossr50.config.hocon.database.ConfigDatabase; import com.gmail.nossr50.config.hocon.database.ConfigDatabase;
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
import com.gmail.nossr50.config.party.ItemWeightConfig; import com.gmail.nossr50.config.party.ItemWeightConfig;
import com.gmail.nossr50.config.skills.alchemy.PotionConfig; import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig; import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig;
@ -61,6 +62,7 @@ public final class ConfigManager {
/* CONFIG INSTANCES */ /* CONFIG INSTANCES */
private SerializedConfigLoader<ConfigDatabase> configDatabase; private SerializedConfigLoader<ConfigDatabase> configDatabase;
private SerializedConfigLoader<ConfigScoreboard> configScoreboard;
private MainConfig mainConfig; private MainConfig mainConfig;
private FishingTreasureConfig fishingTreasureConfig; private FishingTreasureConfig fishingTreasureConfig;
private ExcavationTreasureConfig excavationTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig;
@ -91,7 +93,10 @@ public final class ConfigManager {
// I'm pretty these are supposed to be done in a specific order, so don't rearrange them willy nilly // I'm pretty these are supposed to be done in a specific order, so don't rearrange them willy nilly
//TODO: Not sure about the order of MainConfig //TODO: Not sure about the order of MainConfig
//Serialized Configs
configDatabase = new SerializedConfigLoader<>(ConfigDatabase.class, "database_settings.conf", null); configDatabase = new SerializedConfigLoader<>(ConfigDatabase.class, "database_settings.conf", null);
configScoreboard = new SerializedConfigLoader<>(ConfigScoreboard.class, "scoreboard.conf", null);
mainConfig = new MainConfig(); mainConfig = new MainConfig();
fishingTreasureConfig = new FishingTreasureConfig(); fishingTreasureConfig = new FishingTreasureConfig();
@ -306,4 +311,6 @@ public final class ConfigManager {
} }
public ConfigDatabase getConfigDatabase() { return configDatabase.getConfig(); } public ConfigDatabase getConfigDatabase() { return configDatabase.getConfig(); }
public ConfigScoreboard getConfigScoreboard() { return configScoreboard.getConfig(); }
} }

View File

@ -56,7 +56,7 @@ public class MainConfig extends ConfigValidated {
public static final String DISPLAY_TYPE = "Display_Type"; public static final String DISPLAY_TYPE = "Display_Type";
public static final String HEARTS = "HEARTS"; public static final String HEARTS = "HEARTS";
public static final String DISPLAY_TIME = "Display_Time"; public static final String DISPLAY_TIME = "Display_Time";
public static final String SCOREBOARD = "Scoreboard"; public static final String SCOREBOARD = "ConfigScoreboard";
public static final String USE_SCOREBOARDS = "UseScoreboards"; public static final String USE_SCOREBOARDS = "UseScoreboards";
public static final String POWER = "Power_"; public static final String POWER = "Power_";
public static final String POWER_LEVEL_TAGS = POWER + "Level_Tags"; public static final String POWER_LEVEL_TAGS = POWER + "Level_Tags";
@ -263,43 +263,43 @@ public class MainConfig extends ConfigValidated {
/* Scoreboards */ /* Scoreboards */
/*if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) { /*if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Rank.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
} }
if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) { if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Stats.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
} }
if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) { if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Top.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
} }
if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) { if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
} }
if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) { if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
} }
if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) { if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!"); reason.add("ConfigScoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
} }
if (!(getRankUseChat() || getRankUseBoard())) { if (!(getRankUseChat() || getRankUseBoard())) {
reason.add("Either Board or Print in Scoreboard.Types.Rank must be true!"); reason.add("Either Board or Print in ConfigScoreboard.Types.Rank must be true!");
} }
if (!(getTopUseChat() || getTopUseBoard())) { if (!(getTopUseChat() || getTopUseBoard())) {
reason.add("Either Board or Print in Scoreboard.Types.Top must be true!"); reason.add("Either Board or Print in ConfigScoreboard.Types.Top must be true!");
} }
if (!(getStatsUseChat() || getStatsUseBoard())) { if (!(getStatsUseChat() || getStatsUseBoard())) {
reason.add("Either Board or Print in Scoreboard.Types.Stats must be true!"); reason.add("Either Board or Print in ConfigScoreboard.Types.Stats must be true!");
} }
if (!(getInspectUseChat() || getInspectUseBoard())) { if (!(getInspectUseChat() || getInspectUseBoard())) {
reason.add("Either Board or Print in Scoreboard.Types.Inspect must be true!"); reason.add("Either Board or Print in ConfigScoreboard.Types.Inspect must be true!");
}*/ }*/
/* Database Purging */ /* Database Purging */
@ -540,30 +540,6 @@ public class MainConfig extends ConfigValidated {
return getBooleanValue(SCOREBOARD, USE_SCOREBOARDS); return getBooleanValue(SCOREBOARD, USE_SCOREBOARDS);
} }
public boolean getPowerLevelTagsEnabled() {
return getBooleanValue(SCOREBOARD, POWER_LEVEL_TAGS);
}
public boolean getAllowKeepBoard() {
return getBooleanValue(SCOREBOARD, ALLOW_KEEP);
}
public int getTipsAmount() {
return getIntValue(SCOREBOARD, TIPS_AMOUNT);
}
public boolean getShowStatsAfterLogin() {
return getBooleanValue(SCOREBOARD, SHOW_STATS_AFTER_LOGIN);
}
public boolean getScoreboardRainbows() {
return getBooleanValue(SCOREBOARD, RAINBOWS);
}
public boolean getShowAbilityNames() {
return getBooleanValue(SCOREBOARD, ABILITY_NAMES);
}
public boolean getRankUseChat() { public boolean getRankUseChat() {
return getBooleanValue(SCOREBOARD, TYPES, RANK, PRINT); return getBooleanValue(SCOREBOARD, TYPES, RANK, PRINT);
} }

View File

@ -1,7 +1,12 @@
package com.gmail.nossr50.config.hocon; package com.gmail.nossr50.config.hocon.antiexploit;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class AntiExploit { public class AntiExploit {
/*
* CONFIG NODES
*/
} }

View File

@ -10,12 +10,13 @@ public class ConfigDatabase {
* CONFIG NODES * CONFIG NODES
*/ */
@Setting(value = "MySQL", comment = "Settings for using MySQL or MariaDB database") @Setting(value = "MySQL", comment = "Settings for using MySQL or MariaDB database" +
"\nI recommend using MariaDB, its completely compatible with MySQL and runs a lot better" +
"\nI also recommend having the MySQL/MariaDB server in the same datacenter or LAN as your Minecraft server" +
"\nmcMMO uses ASYNC threaded requests for SQL, so the latency is not really a big deal," +
" but ideally you want low latency to your SQL server anyways!")
private ConfigSectionMySQL configSectionMySQL = new ConfigSectionMySQL(); private ConfigSectionMySQL configSectionMySQL = new ConfigSectionMySQL();
@Setting(value = "Enabled", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage")
private boolean enabled = true;
/* /*
* GETTER BOILERPLATE * GETTER BOILERPLATE
*/ */

View File

@ -6,6 +6,10 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigSectionDatabase { public class ConfigSectionDatabase {
/*
* CONFIG NODES
*/
@Setting(value = "Database_Name", comment = "The database name for your DB, this DB must already exist on the SQL server.") @Setting(value = "Database_Name", comment = "The database name for your DB, this DB must already exist on the SQL server.")
private String databaseName = "example_database_name"; private String databaseName = "example_database_name";

View File

@ -6,13 +6,22 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigSectionMaxConnections { public class ConfigSectionMaxConnections {
@Setting(value = "Misc_Connection_Limit") /* DEFAULT VALUES */
private static final int MISC_DEFAULT = 30;
private static final int LOAD_DEFAULT = 30;
private static final int SAVE_DEFAULT = 30;
/*
* CONFIG NODES
*/
@Setting(value = "Misc_Connection_Limit", comment = "Default value: "+MISC_DEFAULT)
private int misc = 30; private int misc = 30;
@Setting(value = "Load_Connection_Limit") @Setting(value = "Load_Connection_Limit", comment = "Default value: "+LOAD_DEFAULT)
private int load = 30; private int load = 30;
@Setting(value = "Save_Connection_Limit") @Setting(value = "Save_Connection_Limit", comment = "Default value: "+SAVE_DEFAULT)
private int save = 30; private int save = 30;
/* /*

View File

@ -5,13 +5,23 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigSectionMaxPoolSize { public class ConfigSectionMaxPoolSize {
@Setting(value = "Misc_Pool")
/* DEFAULT VALUES */
private static final int MISC_DEFAULT = 10;
private static final int LOAD_DEFAULT = 20;
private static final int SAVE_DEFAULT = 20;
/*
* CONFIG NODES
*/
@Setting(value = "Misc_Pool", comment = "Default value: "+MISC_DEFAULT)
private int misc = 10; private int misc = 10;
@Setting(value = "Load_Pool") @Setting(value = "Load_Pool", comment = "Default value: "+LOAD_DEFAULT)
private int load = 20; private int load = 20;
@Setting(value = "Save_Pool") @Setting(value = "Save_Pool", comment = "Default value: "+SAVE_DEFAULT)
private int save = 20; private int save = 20;
/* /*

View File

@ -7,8 +7,18 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigSectionMySQL { public class ConfigSectionMySQL {
@Setting(value = "Enabled", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage") /* DEFAULT VALUES */
private boolean enabled = true; private static final boolean USE_MYSQL_DEFAULT = false;
/*
* CONFIG NODES
*/
@Setting(value = "Use_MySQL", comment = "If set to true, mcMMO will use MySQL/MariaDB instead of FlatFile storage" +
"\nIt is highly recommended to use a MySQL/MariaDB server over FlatFile," +
" especially if the number of players on your Minecraft server is fairly high." +
"\nDefault value: "+USE_MYSQL_DEFAULT)
private boolean useMySQL = USE_MYSQL_DEFAULT;
@Setting(value = "User", comment = "Your MySQL User Settings") @Setting(value = "User", comment = "Your MySQL User Settings")
private ConfigSectionUser configSectionUser = new ConfigSectionUser(); private ConfigSectionUser configSectionUser = new ConfigSectionUser();
@ -24,7 +34,7 @@ public class ConfigSectionMySQL {
*/ */
public boolean isMySQLEnabled() { public boolean isMySQLEnabled() {
return enabled; return useMySQL;
} }
public ConfigSectionUser getConfigSectionUser() { public ConfigSectionUser getConfigSectionUser() {
@ -39,6 +49,10 @@ public class ConfigSectionMySQL {
return userConfigSectionServer; return userConfigSectionServer;
} }
/*
* HELPER METHODS
*/
public int getMaxPoolSize(SQLDatabaseManager.PoolIdentifier poolIdentifier) public int getMaxPoolSize(SQLDatabaseManager.PoolIdentifier poolIdentifier)
{ {
switch (poolIdentifier) switch (poolIdentifier)

View File

@ -6,7 +6,12 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class ConfigSectionUser { public class ConfigSectionUser {
@Setting(value = "User_Name", comment = "The authorized user for your MySQL/MariaDB DB") /*
* CONFIG NODES
*/
@Setting(value = "User_Name", comment = "The authorized user for your MySQL/MariaDB DB" +
"\nThis needs to be an existing user")
private String username = "example_user_name"; private String username = "example_user_name";
@Setting(value = "User_Password", comment = "The password for your authorized user") @Setting(value = "User_Password", comment = "The password for your authorized user")
@ -24,5 +29,4 @@ public class ConfigSectionUser {
return password; return password;
} }
} }

View File

@ -6,18 +6,30 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable @ConfigSerializable
public class UserConfigSectionServer { public class UserConfigSectionServer {
/* DEFAULT VALUES */
private static final boolean USE_SSL_DEFAULT = true;
private static final int SERVER_PORT_DEFAULT = 3306;
private static final String SERVER_ADDRESS_DEFAULT = "localhost";
/*
* CONFIG NODES
*/
@Setting(value = "Use_SSL", comment = "Enables SSL for MySQL/MariaDB connections." + @Setting(value = "Use_SSL", comment = "Enables SSL for MySQL/MariaDB connections." +
"\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." + "\nIf your SQL server supports SSL, it is recommended to have it on but not necessary." +
"\nIf you run into any issues involving SSL, its best to just turn this off.") "\nIf you run into any issues involving SSL, its best to just turn this off." +
private boolean useSSL = true; "\nDefault value: "+USE_SSL_DEFAULT)
private boolean useSSL = USE_SSL_DEFAULT;
@Setting(value = "Server_Port", comment = "Your MySQL/MariaDB server port" + @Setting(value = "Server_Port", comment = "Your MySQL/MariaDB server port" +
"\nThe default port is typically 3306 for MySQL, but every server configuration is different!") "\nThe default port is typically 3306 for MySQL, but every server configuration is different!" +
private int serverPort = 3306; "\nDefault value: "+SERVER_PORT_DEFAULT)
private int serverPort = SERVER_PORT_DEFAULT;
@Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server" + @Setting(value = "Server_Address", comment = "The address for your MySQL/MariaDB server" +
"If the MySQL server is hosted on the same machine, you can use the localhost alias") "If the MySQL server is hosted on the same machine, you can use the localhost alias" +
private String serverAddress = "localhost"; "\nDefault value: "+SERVER_ADDRESS_DEFAULT)
private String serverAddress = SERVER_ADDRESS_DEFAULT;
@Setting(value = "Max_Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." + @Setting(value = "Max_Connections", comment = "This setting is the max simultaneous MySQL/MariaDB connections allowed at a time." +
"\nThis needs to be high enough to support multiple player logins in quick succession, it is recommended that you do not lower these values") "\nThis needs to be high enough to support multiple player logins in quick succession, it is recommended that you do not lower these values")

View File

@ -0,0 +1,157 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigScoreboard {
/* DEFAULT VALUES */
private static final boolean USE_SCOREBOARDS_DEFAULT = false;
private static final boolean POWER_LEVEL_DISPLAY_DEFAULT = false;
private static final boolean SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT = false;
private static final boolean USE_RAINBOW_SKILL_COLORING_DEFAULT = true;
private static final boolean USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC = true;
private static final int SHOW_TIPS_LIMIT_DEFAULT = 10;
/*
* CONFIG NODES
*/
@Setting(value = "Use_Scoreboards", comment = "Whether or not mcMMO should use make use of scoreboards." +
"\nPersonally, I find scoreboards quite ugly, so I've disabled them by default." +
"\nMost of their functionality has been replaced by the new XP bars (Boss Bars)" +
"\nIf you still wish to use scoreboards, you can, just turn this setting on." +
"\nDefault value: "+ USE_SCOREBOARDS_DEFAULT)
private boolean useScoreboards = USE_SCOREBOARDS_DEFAULT;
@Setting(value = "Display_Power_Levels_Below_Player_Names",
comment = "Whether or not Player power levels should be displayed below " +
"their username (above their 3d model in the world)" +
"\nAlthough it doesn't seem related to scoreboards, displaying a power level for a Player is done" +
"through the use of scoreboards." +
"\nThis is off by default because a lot of Plugins for Minecraft make use of editing" +
" a players \"nameplate\" and that can cause compatibility issues" +
"\nDefault value: "+ POWER_LEVEL_DISPLAY_DEFAULT)
private boolean powerLevelTags = POWER_LEVEL_DISPLAY_DEFAULT;
@Setting(value = "Show_Stats_Scoreboard_On_Player_Login", comment = "Shows the player the /mcstats scoreboard" +
" display after they login." +
"\nDefault value: "+ SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT)
private boolean showStatsAfterLogin = SHOW_PLAYER_STATS_SCOREBOARD_AFTER_LOGIN_DEFAULT;
@Setting(value = "Show_Scoreboard_Tips_Only_This_Many_Times", comment = "This determines how many times players are" +
" given tips about how to use the scoreboard system before they are never tipped again." +
"\nPlayers are given tips once per login session." +
"\nDefault value: "+ SHOW_TIPS_LIMIT_DEFAULT)
private int tipsAmount = SHOW_TIPS_LIMIT_DEFAULT;
@Setting(value ="Use_Rainbow_Styling_For_Skill_Names", comment = "If true, skills names will use rainbow style" +
" colorings instead of having the same color" +
"\nDefault value: "+ USE_RAINBOW_SKILL_COLORING_DEFAULT)
private boolean useRainbows = USE_RAINBOW_SKILL_COLORING_DEFAULT;
@Setting(value = "Use_Super_Ability_Name_Instead_Of_Generic_Name",
comment = "If true, scoreboards displaying super ability cooldowns will use the super abilities name " +
"instead of using a generic word from the locale, which by default in the locale is defined as " +
"\"Ability\". The locale key for this entry is - Scoreboard.Misc.Ability " +
"\nExample: If true Tree Feller will be shown instead of Super Ability with default en_us locale entries" +
"\nDefault value: "+ USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC)
private boolean useAbilityNameInsteadOfGeneric = USE_SUPER_ABILITY_NAME_INSTEAD_OF_GENERIC;
@Setting(value = "Scoreboard_Specific_Settings", comment = "Settings for individual scoreboard displays")
private ConfigSectionScoreboardTypes configSectionScoreboardTypes = new ConfigSectionScoreboardTypes();
/*
* GETTER BOILERPLATE
*/
public boolean getScoreboardsEnabled() {
return useScoreboards;
}
public boolean getPowerLevelTagsEnabled() {
return powerLevelTags;
}
public boolean getShowStatsAfterLogin() {
return showStatsAfterLogin;
}
public int getTipsAmount() {
return tipsAmount;
}
public boolean getUseRainbowSkillStyling() {
return useRainbows;
}
public boolean getUseAbilityNamesOverGenerics() {
return useAbilityNameInsteadOfGeneric;
}
public ConfigSectionScoreboardTypes getConfigSectionScoreboardTypes() {
return configSectionScoreboardTypes;
}
/*
* HELPER METHODS
*/
public boolean getScoreboardTypeEnabled(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().isUseThisBoard();
case RANK_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionRankBoard().isUseThisBoard();
case STATS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionStatsBoard().isUseThisBoard();
case COOLDOWNS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionCooldownBoard().isUseThisBoard();
case SKILL_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().isUseThisBoard();
default:
return false;
}
}
public boolean getScoreboardTypePrintToChatEnabled(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().isPrintToChat();
case RANK_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionRankBoard().isPrintToChat();
case STATS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionStatsBoard().isPrintToChat();
case COOLDOWNS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionCooldownBoard().isPrintToChat();
//NOTE: SKILL_BOARD does not have a setting for this because it is always printed to chat
default:
return false;
}
}
public int getScoreboardTypeDisplayTime(ScoreboardManager.SidebarType sidebarType)
{
switch(sidebarType)
{
case TOP_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionTopBoard().getDisplayTimeInSeconds();
case RANK_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionRankBoard().getDisplayTimeInSeconds();
case STATS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionStatsBoard().getDisplayTimeInSeconds();
case COOLDOWNS_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionCooldownBoard().getDisplayTimeInSeconds();
case SKILL_BOARD:
return getConfigSectionScoreboardTypes().getConfigSectionSkillBoard().getDisplayTimeInSeconds();
default:
return 20;
}
}
}

View File

@ -0,0 +1,53 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionCooldownBoard {
/* DEFAULT VALUES*/
private static final boolean PRINT_TO_CHAT_DEFAULT = true;
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 40;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Command_Output_In_Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*
* GETTER BOILERPLATE
*/
public boolean isPrintToChat() {
return printToChat;
}
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
}

View File

@ -0,0 +1,53 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionInspectBoard {
/* DEFAULT VALUES*/
private static final boolean PRINT_TO_CHAT_DEFAULT = false;
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 20;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Command_Output_In_Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*
* GETTER BOILERPLATE
*/
public boolean isPrintToChat() {
return printToChat;
}
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
}

View File

@ -0,0 +1,53 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionRankBoard {
/* DEFAULT VALUES*/
private static final boolean PRINT_TO_CHAT_DEFAULT = false;
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 15;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Command_Output_In_Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*
* GETTER BOILERPLATE
*/
public boolean isPrintToChat() {
return printToChat;
}
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
}

View File

@ -0,0 +1,62 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionScoreboardTypes {
/*
* CONFIG NODES
*/
@Setting(value = "Rank_Scoreboard", comment = "Settings for /mcrank")
private ConfigSectionRankBoard configSectionRankBoard = new ConfigSectionRankBoard();
@Setting(value = "Top_Scoreboard", comment = "Settings for /mctop")
private ConfigSectionTopBoard configSectionTopBoard = new ConfigSectionTopBoard();
@Setting(value = "Stats_Scoreboard", comment = "Settings for /mcstats")
private ConfigSectionStatsBoard configSectionStatsBoard = new ConfigSectionStatsBoard();
@Setting(value = "Inspect_Scoreboard", comment = "Settings for /inspect")
private ConfigSectionInspectBoard configSectionInspectBoard = new ConfigSectionInspectBoard();
@Setting(value = "Cooldown_Scoreboard", comment = "Settings for /mccooldown")
private ConfigSectionCooldownBoard configSectionCooldownBoard = new ConfigSectionCooldownBoard();
@Setting(value = "Skill_Scoreboard_Settings",
comment = "Settings for /<skillname> (e.g. /mining, /unarmed)" +
"\nNo \"print\" option is given here; the information will always be displayed in chat." +
"\nThe functionality of this scoreboard overlaps heavily with the new XP bars," +
" so these scoreboards are disabled by default")
private ConfigSectionSkillBoard configSectionSkillBoard = new ConfigSectionSkillBoard();
/*
* GETTER BOILERPLATE
*/
public ConfigSectionRankBoard getConfigSectionRankBoard() {
return configSectionRankBoard;
}
public ConfigSectionTopBoard getConfigSectionTopBoard() {
return configSectionTopBoard;
}
public ConfigSectionStatsBoard getConfigSectionStatsBoard() {
return configSectionStatsBoard;
}
public ConfigSectionInspectBoard getConfigSectionInspectBoard() {
return configSectionInspectBoard;
}
public ConfigSectionCooldownBoard getConfigSectionCooldownBoard() {
return configSectionCooldownBoard;
}
public ConfigSectionSkillBoard getConfigSectionSkillBoard() {
return configSectionSkillBoard;
}
}

View File

@ -0,0 +1,62 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionSkillBoard {
/* DEFAULT VALUES*/
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 30;
private static final boolean SHOW_BOARD_ON_PLAYER_LEVELUP = true;
private static final int SHOW_BOARD_ON_LEVELUP_TIME = 5;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true," +
" which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
@Setting(value = "Show_Board_On_Player_Level_Up",
comment = "Show a skill scoreboard when the player levels up in that skill" +
"\nDefault value: "+SHOW_BOARD_ON_PLAYER_LEVELUP)
private boolean showBoardOnPlayerLevelUp = SHOW_BOARD_ON_PLAYER_LEVELUP;
@Setting(value = "Level_Up_Display_Time", comment = "How long to show a skill scoreboard when a player levels up?" +
"\nIs only shown if Show_Board_On_Player_Level_Up is true" +
"\nDefault value: "+SHOW_BOARD_ON_LEVELUP_TIME)
private int showBoardOnPlayerLevelUpTime = SHOW_BOARD_ON_LEVELUP_TIME;
/*
* GETTER BOILERPLATE
*/
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
public boolean getShowBoardOnPlayerLevelUp() {
return showBoardOnPlayerLevelUp;
}
public int getShowBoardOnPlayerLevelUpTime() {
return showBoardOnPlayerLevelUpTime;
}
}

View File

@ -0,0 +1,53 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionStatsBoard {
/* DEFAULT VALUES*/
private static final boolean PRINT_TO_CHAT_DEFAULT = true;
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 15;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Command_Output_In_Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*
* GETTER BOILERPLATE
*/
public boolean isPrintToChat() {
return printToChat;
}
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
}

View File

@ -0,0 +1,53 @@
package com.gmail.nossr50.config.hocon.scoreboard;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionTopBoard {
/* DEFAULT VALUES*/
private static final boolean PRINT_TO_CHAT_DEFAULT = true;
private static final boolean USE_THIS_SCOREBOARD_DEFAULT = true;
private static final int DISPLAY_TIME_SECONDS_DEFAULT = 15;
/*
* CONFIG NODES
*/
@Setting(value = "Show_Command_Output_In_Chat",
comment = "Should the commands normal chat output be shown in chat?" +
"\nIf you feel that the scoreboard does a good enough job at conveying the information, you can set this to false." +
"\nIf you'd like to show the chat anyways, turn this to true, the scoreboard will still be shown if its enabled." +
"\nDefault value: "+PRINT_TO_CHAT_DEFAULT)
private boolean printToChat = PRINT_TO_CHAT_DEFAULT;
@Setting(value = "Show_Scoreboard",
comment = "Whether or not you wish to enable the display of this scoreboard." +
"\nScoreboards are shown when the associated command is executed from the player." +
"\nThis setting will only work if \"Use_Scoreboards\" is set to true, which is found elsewhere in this configuration file." +
"\nDefault value: "+USE_THIS_SCOREBOARD_DEFAULT)
private boolean useThisBoard = USE_THIS_SCOREBOARD_DEFAULT;
@Setting(value = "Display_Time_In_Seconds",
comment = "How long to keep the scoreboard on a players screen after it is first shown." +
"\nThis setting is not related to the command that keeps scoreboards on screen." +
"\nDefault value: "+DISPLAY_TIME_SECONDS_DEFAULT)
private int displayTimeInSeconds = DISPLAY_TIME_SECONDS_DEFAULT;
/*
* GETTER BOILERPLATE
*/
public boolean isPrintToChat() {
return printToChat;
}
public boolean isUseThisBoard() {
return useThisBoard;
}
public int getDisplayTimeInSeconds() {
return displayTimeInSeconds;
}
}

View File

@ -1,7 +0,0 @@
package com.gmail.nossr50.config.hocon;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class Scoreboard {
}

View File

@ -429,7 +429,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
out.append(startingLevel); // Alchemy out.append(startingLevel); // Alchemy
out.append("0:"); // AlchemyXp out.append("0:"); // AlchemyXp
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
out.append("0:"); // Scoreboard tips shown out.append("0:"); // ConfigScoreboard tips shown
// Add more in the same format as the line above // Add more in the same format as the line above
out.newLine(); out.newLine();

View File

@ -998,7 +998,7 @@ public class McMMOPlayer {
UserManager.remove(thisPlayer); UserManager.remove(thisPlayer);
if(MainConfig.getInstance().getScoreboardsEnabled()) if(mcMMO.getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.teardownPlayer(thisPlayer); ScoreboardManager.teardownPlayer(thisPlayer);
if (inParty()) { if (inParty()) {

View File

@ -11,7 +11,7 @@ import org.bukkit.scoreboard.Scoreboard;
*/ */
abstract public class McMMOScoreboardEvent extends Event { abstract public class McMMOScoreboardEvent extends Event {
protected Scoreboard targetBoard; //Scoreboard involved in this event protected Scoreboard targetBoard; //ConfigScoreboard involved in this event
final Scoreboard currentBoard; //Can be null final Scoreboard currentBoard; //Can be null
protected Player targetPlayer; protected Player targetPlayer;

View File

@ -40,7 +40,7 @@ public class SelfListener implements Listener {
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained); UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
} }
if(MainConfig.getInstance().getScoreboardsEnabled()) if(mcMMO.getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.handleLevelUp(player, skill); ScoreboardManager.handleLevelUp(player, skill);
if (!MainConfig.getInstance().getLevelUpEffectsEnabled()) { if (!MainConfig.getInstance().getLevelUpEffectsEnabled()) {
@ -54,13 +54,13 @@ public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerXp(McMMOPlayerXpGainEvent event) { public void onPlayerXp(McMMOPlayerXpGainEvent event) {
if(MainConfig.getInstance().getScoreboardsEnabled()) if(mcMMO.getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill()); ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAbility(McMMOPlayerAbilityActivateEvent event) { public void onAbility(McMMOPlayerAbilityActivateEvent event) {
if(MainConfig.getInstance().getScoreboardsEnabled()) if(mcMMO.getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill()); ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
} }

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.hocon.database.ConfigSectionMySQL; import com.gmail.nossr50.config.hocon.database.ConfigSectionMySQL;
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory; import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
@ -224,7 +225,7 @@ public class mcMMO extends JavaPlugin {
PartyManager.saveParties(); // Save our parties PartyManager.saveParties(); // Save our parties
//TODO: Needed? //TODO: Needed?
if(MainConfig.getInstance().getScoreboardsEnabled()) if(mcMMO.getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.teardownAll(); ScoreboardManager.teardownAll();
formulaManager.saveFormula(); formulaManager.saveFormula();
@ -325,13 +326,22 @@ public class mcMMO extends JavaPlugin {
/** /**
* Returns settings for MySQL from the users config * Returns settings for MySQL from the users config
* @return returns settings for MySQL from the users config * @return settings for MySQL from the users config
*/ */
public static ConfigSectionMySQL getMySQLConfigSettings() public static ConfigSectionMySQL getMySQLConfigSettings()
{ {
return configManager.getConfigDatabase().getConfigSectionMySQL(); return configManager.getConfigDatabase().getConfigSectionMySQL();
} }
/**
* Returns settings for Scoreboards from the users config
* @return settings for Scoreboards from the users config
*/
public static ConfigScoreboard getScoreboardSettings()
{
return configManager.getConfigScoreboard();
}
/*public static ModManager getModManager() { /*public static ModManager getModManager() {
return modManager; return modManager;
}*/ }*/

View File

@ -30,7 +30,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (useBoard && MainConfig.getInstance().getScoreboardsEnabled()) { if (useBoard && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
displayBoard(); displayBoard();
} }

View File

@ -34,7 +34,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
if (useBoard && MainConfig.getInstance().getScoreboardsEnabled()) { if (useBoard && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
displayBoard(); displayBoard();
} }

View File

@ -77,10 +77,10 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
UserManager.track(mcMMOPlayer); UserManager.track(mcMMOPlayer);
mcMMOPlayer.actualizeRespawnATS(); mcMMOPlayer.actualizeRespawnATS();
if (MainConfig.getInstance().getScoreboardsEnabled()) { if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
ScoreboardManager.setupPlayer(player); ScoreboardManager.setupPlayer(player);
if (MainConfig.getInstance().getShowStatsAfterLogin()) { if (mcMMO.getScoreboardSettings().getShowStatsAfterLogin()) {
ScoreboardManager.enablePlayerStatsScoreboard(player); ScoreboardManager.enablePlayerStatsScoreboard(player);
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR); new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR);
} }

View File

@ -53,7 +53,7 @@ public class ScoreboardManager {
*/ */
static { static {
/* /*
* We need immutable objects for our Scoreboard's labels * We need immutable objects for our ConfigScoreboard's labels
*/ */
ImmutableMap.Builder<PrimarySkillType, String> skillLabelBuilder = ImmutableMap.builder(); ImmutableMap.Builder<PrimarySkillType, String> skillLabelBuilder = ImmutableMap.builder();
ImmutableMap.Builder<SuperAbilityType, String> abilityLabelBuilder = ImmutableMap.builder(); ImmutableMap.Builder<SuperAbilityType, String> abilityLabelBuilder = ImmutableMap.builder();
@ -64,7 +64,7 @@ public class ScoreboardManager {
* Stylizes the targetBoard in a Rainbow Pattern * Stylizes the targetBoard in a Rainbow Pattern
* This is off by default * This is off by default
*/ */
if (MainConfig.getInstance().getScoreboardRainbows()) { if (mcMMO.getScoreboardSettings().getUseRainbowSkillStyling()) {
// Everything but black, gray, gold // Everything but black, gray, gold
List<ChatColor> colors = Lists.newArrayList( List<ChatColor> colors = Lists.newArrayList(
ChatColor.WHITE, ChatColor.WHITE,
@ -145,7 +145,7 @@ public class ScoreboardManager {
} }
private static String formatAbility(ChatColor color, String abilityName) { private static String formatAbility(ChatColor color, String abilityName) {
if (MainConfig.getInstance().getShowAbilityNames()) { if (mcMMO.getScoreboardSettings().getUseAbilityNamesOverGenerics()) {
return getShortenedName(color + abilityName); return getShortenedName(color + abilityName);
} }
else { else {
@ -218,7 +218,7 @@ public class ScoreboardManager {
} }
} }
if (MainConfig.getInstance().getPowerLevelTagsEnabled() && !dirtyPowerLevels.contains(playerName)) { if (mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled() && !dirtyPowerLevels.contains(playerName)) {
dirtyPowerLevels.add(playerName); dirtyPowerLevels.add(playerName);
} }
@ -381,7 +381,7 @@ public class ScoreboardManager {
* @return the main targetBoard objective, or null if disabled * @return the main targetBoard objective, or null if disabled
*/ */
public static Objective getPowerLevelObjective() { public static Objective getPowerLevelObjective() {
if (!MainConfig.getInstance().getPowerLevelTagsEnabled()) { if (!mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled()) {
Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE); Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
if (objective != null) { if (objective != null) {

View File

@ -54,7 +54,7 @@ public class ScoreboardWrapper {
sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy"); sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy");
powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy"); powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy");
if (MainConfig.getInstance().getPowerLevelTagsEnabled()) { if (mcMMO.getScoreboardSettings().getPowerLevelTagsEnabled()) {
powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL); powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME); powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
@ -203,11 +203,11 @@ public class ScoreboardWrapper {
revertTask = new ScoreboardChangeTask().runTaskLater(mcMMO.p, ticks); revertTask = new ScoreboardChangeTask().runTaskLater(mcMMO.p, ticks);
// TODO is there any way to do the time that looks acceptable? // TODO is there any way to do the time that looks acceptable?
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F)); // player.sendMessage(LocaleLoader.getString("Commands.ConfigScoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F));
PlayerProfile profile = UserManager.getPlayer(player).getProfile(); PlayerProfile profile = UserManager.getPlayer(player).getProfile();
if (profile.getScoreboardTipsShown() >= MainConfig.getInstance().getTipsAmount()) { if (profile.getScoreboardTipsShown() >= mcMMO.getScoreboardSettings().getTipsAmount()) {
return; return;
} }

View File

@ -1066,7 +1066,7 @@ Scoreboard.Misc.CurrentXP=[[GREEN]]Current XP
Scoreboard.Misc.RemainingXP=[[YELLOW]]Remaining XP Scoreboard.Misc.RemainingXP=[[YELLOW]]Remaining XP
Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]Cooldown Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]Cooldown
Scoreboard.Misc.Overall=[[GOLD]]Overall Scoreboard.Misc.Overall=[[GOLD]]Overall
Scoreboard.Misc.Ability=Ability Scoreboard.Misc.Ability=Super Ability
#DATABASE RECOVERY #DATABASE RECOVERY
Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded. Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded.
Profile.Loading.Failure=[[RED]]mcMMO still cannot load your data. You may want to [[AQUA]]contact the server owner.\n[[YELLOW]]You can still play on the server, but you will have [[BOLD]]no mcMMO levels[[YELLOW]] and any XP you get [[BOLD]]will not be saved[[YELLOW]]. Profile.Loading.Failure=[[RED]]mcMMO still cannot load your data. You may want to [[AQUA]]contact the server owner.\n[[YELLOW]]You can still play on the server, but you will have [[BOLD]]no mcMMO levels[[YELLOW]] and any XP you get [[BOLD]]will not be saved[[YELLOW]].

View File

@ -154,7 +154,7 @@ commands:
permission: mcmmo.commands.mhd permission: mcmmo.commands.mhd
mcscoreboard: mcscoreboard:
aliases: [mcsb] aliases: [mcsb]
description: Manage your mcMMO Scoreboard description: Manage your mcMMO ConfigScoreboard
permission: mcmmo.commands.mcscoreboard permission: mcmmo.commands.mcscoreboard
mcfools: mcfools:
aliases: [macho, jumping, throwing, wrecking, crafting, walking, swimming, falling, climbing, flying, diving, piggy] aliases: [macho, jumping, throwing, wrecking, crafting, walking, swimming, falling, climbing, flying, diving, piggy]