From d6d5f1b0d78107c5e61a4c3c65e4198bb8edb3e0 Mon Sep 17 00:00:00 2001 From: Fury_Phoenix <64714532+Phoenix-Starlight@users.noreply.github.com> Date: Wed, 29 Nov 2023 07:58:40 -0800 Subject: [PATCH] Stop string instantiations --- src/com/dogonfire/gods/commands/CommandListGods.java | 2 +- src/com/dogonfire/gods/managers/GodManager.java | 2 +- src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java | 2 +- src/com/dogonfire/gods/tasks/GiveItemTask.java | 2 +- src/com/dogonfire/gods/tasks/GodSpeakTask.java | 8 ++++---- src/com/dogonfire/gods/tasks/HealPlayerTask.java | 2 +- src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java | 2 +- src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java | 2 +- src/com/dogonfire/gods/tasks/TaskGiveItem.java | 2 +- src/com/dogonfire/gods/tasks/TaskGodSpeak.java | 8 ++++---- src/com/dogonfire/gods/tasks/TaskHealPlayer.java | 2 +- src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java | 1 - 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/com/dogonfire/gods/commands/CommandListGods.java b/src/com/dogonfire/gods/commands/CommandListGods.java index 3888237..77f515b 100644 --- a/src/com/dogonfire/gods/commands/CommandListGods.java +++ b/src/com/dogonfire/gods/commands/CommandListGods.java @@ -135,7 +135,7 @@ class God God(String godName, int godPower, int godbelievers) { this.power = godPower; - this.name = new String(godName); + this.name = godName; this.believers = godbelievers; } } diff --git a/src/com/dogonfire/gods/managers/GodManager.java b/src/com/dogonfire/gods/managers/GodManager.java index 2c01f0a..0c1d878 100644 --- a/src/com/dogonfire/gods/managers/GodManager.java +++ b/src/com/dogonfire/gods/managers/GodManager.java @@ -1043,7 +1043,7 @@ public String getGodDescription(String godName) String description = this.godsConfig.getString(godName + ".Description"); if (description == null) { - description = new String("No description :/"); + description = "No description :/"; } return description; } diff --git a/src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java b/src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java index c0961e2..a278f19 100644 --- a/src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java +++ b/src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java @@ -25,7 +25,7 @@ public GiveHolyArtifactTask(Gods instance, String god, GodManager.GodType godTyp { this.plugin = instance; this.player = p; - this.godName = new String(god); + this.godName = god; this.godType = godType; this.speak = godspeak; } diff --git a/src/com/dogonfire/gods/tasks/GiveItemTask.java b/src/com/dogonfire/gods/tasks/GiveItemTask.java index 41ffce1..8dcebf1 100644 --- a/src/com/dogonfire/gods/tasks/GiveItemTask.java +++ b/src/com/dogonfire/gods/tasks/GiveItemTask.java @@ -25,7 +25,7 @@ public GiveItemTask(Gods instance, String god, Player p, Material material, bool { this.plugin = instance; this.player = p; - this.godName = new String(god); + this.godName = god; this.itemType = material; this.speak = godspeak; } diff --git a/src/com/dogonfire/gods/tasks/GodSpeakTask.java b/src/com/dogonfire/gods/tasks/GodSpeakTask.java index c7f592c..87fa388 100644 --- a/src/com/dogonfire/gods/tasks/GodSpeakTask.java +++ b/src/com/dogonfire/gods/tasks/GodSpeakTask.java @@ -24,7 +24,7 @@ public GodSpeakTask(Gods instance, String gname, UUID playerId, String player, S { this.plugin = instance; this.playerId = playerId; - this.godName = new String(gname); + this.godName = gname; this.message = null; } @@ -32,14 +32,14 @@ public GodSpeakTask(Gods instance, String gname, UUID playerId, String player, S { this.plugin = instance; this.playerId = playerId; - this.godName = new String(gname); + this.godName = gname; this.message = m; - this.playerNameString = new String(player); + this.playerNameString = player; this.amount = a; if (type != null) { - this.typeString = new String(type); + this.typeString = type; } else { diff --git a/src/com/dogonfire/gods/tasks/HealPlayerTask.java b/src/com/dogonfire/gods/tasks/HealPlayerTask.java index 98901a9..29e0f4d 100644 --- a/src/com/dogonfire/gods/tasks/HealPlayerTask.java +++ b/src/com/dogonfire/gods/tasks/HealPlayerTask.java @@ -22,7 +22,7 @@ public HealPlayerTask(Gods instance, String god, Player p, LANGUAGESTRING speak) { this.plugin = instance; this.player = p; - this.godName = new String(god); + this.godName = god; this.languageString = speak; } diff --git a/src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java b/src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java index 1329223..d19296d 100644 --- a/src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java +++ b/src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java @@ -18,7 +18,7 @@ public SpawnHostileMobsTask(Gods instance, String god, Player p, EntityType enti this.plugin = instance; this.numberOfMobs = n; this.player = p; - this.godName = new String(god); + this.godName = god; this.mobType = entityType; } diff --git a/src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java b/src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java index 18b2252..1a0fdb7 100644 --- a/src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java +++ b/src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java @@ -23,7 +23,7 @@ public class TaskGiveHolyArtifact extends Task public TaskGiveHolyArtifact(String god, GodType godType, Player p, boolean godspeak) { this.player = p; - this.godName = new String(god); + this.godName = god; this.godType = godType; this.speak = godspeak; } diff --git a/src/com/dogonfire/gods/tasks/TaskGiveItem.java b/src/com/dogonfire/gods/tasks/TaskGiveItem.java index 96a9a3c..d2a3fdd 100644 --- a/src/com/dogonfire/gods/tasks/TaskGiveItem.java +++ b/src/com/dogonfire/gods/tasks/TaskGiveItem.java @@ -20,7 +20,7 @@ public class TaskGiveItem extends Task { public TaskGiveItem(String god, Player p, ItemStack item, boolean godspeak) { this.player = p; - this.godName = new String(god); + this.godName = god; this.item = item; this.speak = godspeak; } diff --git a/src/com/dogonfire/gods/tasks/TaskGodSpeak.java b/src/com/dogonfire/gods/tasks/TaskGodSpeak.java index fa8ee50..f48604a 100644 --- a/src/com/dogonfire/gods/tasks/TaskGodSpeak.java +++ b/src/com/dogonfire/gods/tasks/TaskGodSpeak.java @@ -17,19 +17,19 @@ public class TaskGodSpeak extends Task { public TaskGodSpeak(String gname, UUID playerId, String player, String type, int a) { this.playerId = playerId; - this.godName = new String(gname); + this.godName = gname; this.message = null; } public TaskGodSpeak(String gname, UUID playerId, String player, String type, int a, LanguageManager.LANGUAGESTRING m) { this.playerId = playerId; - this.godName = new String(gname); + this.godName = gname; this.message = m; - this.playerNameString = new String(player); + this.playerNameString = player; this.amount = a; if (type != null) { - this.typeString = new String(type); + this.typeString = type; } else { type = ""; } diff --git a/src/com/dogonfire/gods/tasks/TaskHealPlayer.java b/src/com/dogonfire/gods/tasks/TaskHealPlayer.java index d57ca5d..db1ab13 100644 --- a/src/com/dogonfire/gods/tasks/TaskHealPlayer.java +++ b/src/com/dogonfire/gods/tasks/TaskHealPlayer.java @@ -19,7 +19,7 @@ public class TaskHealPlayer extends Task public TaskHealPlayer(String god, Player p, LanguageManager.LANGUAGESTRING speak) { this.player = p; - this.godName = new String(god); + this.godName = god; this.languageString = speak; } diff --git a/src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java b/src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java index a099d8d..c32d017 100644 --- a/src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java +++ b/src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java @@ -12,7 +12,6 @@ public class TaskSpawnHostileMobs extends Task { public TaskSpawnHostileMobs(String god, Player p, EntityType entityType, int n) { this.numberOfMobs = n; this.player = p; - new String(god); this.mobType = entityType; }