Skip to content

Commit

Permalink
Stop string instantiations
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenix-Starlight committed Dec 4, 2023
1 parent f6c6283 commit d6d5f1b
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/commands/CommandListGods.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/managers/GodManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/GiveItemTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/com/dogonfire/gods/tasks/GodSpeakTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ 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;
}

public GodSpeakTask(Gods instance, String gname, UUID playerId, String player, String type, int a, LANGUAGESTRING m)
{
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
{
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/HealPlayerTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/TaskGiveItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/com/dogonfire/gods/tasks/TaskGodSpeak.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/dogonfire/gods/tasks/TaskHealPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion src/com/dogonfire/gods/tasks/TaskSpawnHostileMobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d6d5f1b

Please sign in to comment.