From 7d65b9422a04f0d5dd23b4fedb0d924842bf56d6 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 31 Jul 2014 23:16:43 +0200 Subject: [PATCH] Make the profile loaded message optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit People will complain if we don’t --- src/main/java/com/gmail/nossr50/config/Config.java | 1 + .../runnables/player/PlayerProfileLoadingTask.java | 11 +++++------ src/main/resources/config.yml | 2 ++ src/main/resources/locale/locale_en_US.properties | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 1bade8a2a..f7ce43726 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -232,6 +232,7 @@ public class Config extends AutoUpdateConfigLoader { /* General Settings */ public String getLocale() { return config.getString("General.Locale", "en_us"); } public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } + public boolean getShowProfileLoadedMessage() { return config.getBoolean("General.Show_Profile_Loaded", true); } public boolean getDonateMessageEnabled() { return config.getBoolean("Commands.mcmmo.Donate_Message", true); } public int getSaveInterval() { return config.getInt("General.Save_Interval", 10); } public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java index 5b8990265..a8ed02ffa 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java @@ -46,13 +46,9 @@ public class PlayerProfileLoadingTask extends BukkitRunnable { return; } - // Send the message that we're doing the recovery - if (attempt == 0) { - player.sendMessage(LocaleLoader.getString("Profile.Loading.Start")); - } - // Increment attempt counter and try attempt++; + PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getName(), player.getUniqueId(), true); // If successful, schedule the apply if (profile.isLoaded()) { @@ -94,10 +90,13 @@ public class PlayerProfileLoadingTask extends BukkitRunnable { McMMOPlayer mcMMOPlayer = new McMMOPlayer(player, profile); UserManager.track(mcMMOPlayer); - player.sendMessage(LocaleLoader.getString("Profile.Loading.Success")); mcMMOPlayer.actualizeRespawnATS(); ScoreboardManager.setupPlayer(player); + if (Config.getInstance().getShowProfileLoadedMessage()) { + player.sendMessage(LocaleLoader.getString("Profile.Loading.Success")); + } + if (Config.getInstance().getShowStatsAfterLogin()) { ScoreboardManager.enablePlayerStatsScoreboard(player); new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5fb25cd49..aee39c6f2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -10,6 +10,8 @@ General: Locale: en_US MOTD_Enabled: true + # Send a message to the player when his profile was successfully loaded + Show_Profile_Loaded: false # Amount of time (in minutes) to wait between saves of player information Save_Interval: 10 # Allow mcMMO to report on basic anonymous usage diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 04729f5d5..7b894fa84 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -960,7 +960,6 @@ Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]Cooldown Scoreboard.Misc.Overall=[[GOLD]]Overall #DATABASE RECOVERY -Profile.Loading.Start=[[GREEN]]Notice: mcMMO is now loading your profile. Stats and skills will not function until loaded... -Profile.Loading.Success=[[GREEN]]Success! Your mcMMO data was 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.AdminFailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup.