From 143714c9ebe03bff09ea4ff6303e9e9f64c7c042 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 6 Oct 2019 01:03:07 +0100 Subject: [PATCH 1/3] Remove deprecated PlayerProfile constructor --- .../gmail/nossr50/database/FlatFileDatabaseManager.java | 9 --------- .../com/gmail/nossr50/database/SQLDatabaseManager.java | 6 +++--- .../gmail/nossr50/datatypes/player/PlayerProfile.java | 6 ------ .../com/gmail/nossr50/util/commands/CommandTools.java | 2 +- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java index 8621d2f3b..7b087b9ac 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/database/FlatFileDatabaseManager.java @@ -530,11 +530,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager { // Didn't find the player, create a new one if (create) { - if (uuid == null) { - newUser(playerName, uuid); - return new PlayerProfile(pluginRef, playerName, true); - } - newUser(playerName, uuid); return new PlayerProfile(pluginRef, playerName, uuid, true); } @@ -554,10 +549,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager { } // Return unloaded profile - if (uuid == null) { - return new PlayerProfile(pluginRef, playerName); - } - return new PlayerProfile(pluginRef, playerName, uuid); } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index aed680223..e0ceaaebb 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -564,10 +564,10 @@ public final class SQLDatabaseManager implements DatabaseManager { id = newUser(connection, playerName, uuid); create = false; if (id == -1) { - return new PlayerProfile(pluginRef, playerName, false); + return new PlayerProfile(pluginRef, playerName, uuid, false); } } else { - return new PlayerProfile(pluginRef, playerName, false); + return new PlayerProfile(pluginRef, playerName, uuid,false); } } // There is such a user @@ -634,7 +634,7 @@ public final class SQLDatabaseManager implements DatabaseManager { // return unloaded profile if (!retry) { - return new PlayerProfile(pluginRef, playerName, false); + return new PlayerProfile(pluginRef, playerName, uuid, false); } // Retry, and abort on re-failure diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index fb47f187e..02b738950 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -60,12 +60,6 @@ public class PlayerProfile { uniquePlayerData.put(UniqueDataType.CHIMAERA_WING_DATS, 0); //Chimaera wing } - @Deprecated - public PlayerProfile(mcMMO pluginRef, String playerName, boolean isLoaded) { - this(pluginRef, playerName); - this.loaded = isLoaded; - } - public PlayerProfile(mcMMO pluginRef, String playerName, UUID uuid, boolean isLoaded) { this(pluginRef, playerName, uuid); this.loaded = isLoaded; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java index 6ff4a7f34..56a27f7ab 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java @@ -75,7 +75,7 @@ public final class CommandTools { return true; } - PlayerProfile profile = new PlayerProfile(pluginRef, playerName, false); + PlayerProfile profile = new PlayerProfile(pluginRef, playerName, null, false); if (unloadedProfile(sender, profile)) { return false; From b572494c9cc81a2cc3fabd26f3051dc136091642 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 6 Oct 2019 01:07:01 +0100 Subject: [PATCH 2/3] Remove the other deprecated PlayerProfile constructor --- .../com/gmail/nossr50/datatypes/player/PlayerProfile.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index 02b738950..877c7c9a6 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -34,11 +34,6 @@ public class PlayerProfile { private HashMap rollingSkillsXp = new HashMap(); private final mcMMO pluginRef; - @Deprecated - public PlayerProfile(mcMMO pluginRef, String playerName) { - this(pluginRef, playerName, null); - } - public PlayerProfile(mcMMO pluginRef, String playerName, UUID uuid) { this.pluginRef = pluginRef; this.uuid = uuid; From 7be849da2ad80cf440a1df29f23c9b4fdc1a8c98 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 6 Oct 2019 01:16:27 +0100 Subject: [PATCH 3/3] Fix compilation warnings --- .../com/gmail/nossr50/commands/skills/SkillCommand.java | 4 ++-- .../gmail/nossr50/util/player/NotificationManager.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index f78457075..68026f00c 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -223,10 +223,10 @@ public abstract class SkillCommand implements TabExecutor { String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription(pluginRef) : subSkillType.getLocaleKeyStatExtraDescription(pluginRef); if (isCustom) - return pluginRef.getLocaleManager().getString(templateKey, pluginRef.getLocaleManager().getString(statDescriptionKey, vars)); + return pluginRef.getLocaleManager().getString(templateKey, pluginRef.getLocaleManager().getString(statDescriptionKey, (Object[]) vars)); else { String[] mergedList = pluginRef.getNotificationManager().addItemToFirstPositionOfArray(pluginRef.getLocaleManager().getString(statDescriptionKey), vars); - return pluginRef.getLocaleManager().getString(templateKey, mergedList); + return pluginRef.getLocaleManager().getString(templateKey, (Object[]) mergedList); } } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 5978049d9..42546f032 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -214,12 +214,12 @@ public class NotificationManager { //Send the notification switch (sensitiveCommandType) { case XPRATE_MODIFY: - sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args))); - sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Self", args)); + sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Others", (Object[]) addItemToFirstPositionOfArray(senderName, args))); + sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.Start.Self", (Object[]) args)); break; case XPRATE_END: - sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Others", addItemToFirstPositionOfArray(senderName, args))); - sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Self", args)); + sendAdminNotification(pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Others", (Object[]) addItemToFirstPositionOfArray(senderName, args))); + sendAdminCommandConfirmation(commandSender, pluginRef.getLocaleManager().getString("Notifications.Admin.XPRate.End.Self", (Object[]) args)); break; } }