Skip to content

Commit fe7af19

Browse files
Stop string instantiations
1 parent 5f3786d commit fe7af19

12 files changed

Lines changed: 17 additions & 18 deletions

src/com/dogonfire/gods/commands/CommandListGods.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class God
135135
God(String godName, int godPower, int godbelievers)
136136
{
137137
this.power = godPower;
138-
this.name = new String(godName);
138+
this.name = godName;
139139
this.believers = godbelievers;
140140
}
141141
}

src/com/dogonfire/gods/managers/GodManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ public String getGodDescription(String godName)
10131013
String description = this.godsConfig.getString(godName + ".Description");
10141014
if (description == null)
10151015
{
1016-
description = new String("No description :/");
1016+
description = "No description :/";
10171017
}
10181018
return description;
10191019
}

src/com/dogonfire/gods/tasks/GiveHolyArtifactTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public GiveHolyArtifactTask(Gods instance, String god, GodManager.GodType godTyp
2525
{
2626
this.plugin = instance;
2727
this.player = p;
28-
this.godName = new String(god);
28+
this.godName = god;
2929
this.godType = godType;
3030
this.speak = godspeak;
3131
}

src/com/dogonfire/gods/tasks/GiveItemTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public GiveItemTask(Gods instance, String god, Player p, Material material, bool
2525
{
2626
this.plugin = instance;
2727
this.player = p;
28-
this.godName = new String(god);
28+
this.godName = god;
2929
this.itemType = material;
3030
this.speak = godspeak;
3131
}

src/com/dogonfire/gods/tasks/GodSpeakTask.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ public GodSpeakTask(Gods instance, String gname, UUID playerId, String player, S
2424
{
2525
this.plugin = instance;
2626
this.playerId = playerId;
27-
this.godName = new String(gname);
27+
this.godName = gname;
2828
this.message = null;
2929
}
3030

3131
public GodSpeakTask(Gods instance, String gname, UUID playerId, String player, String type, int a, LANGUAGESTRING m)
3232
{
3333
this.plugin = instance;
3434
this.playerId = playerId;
35-
this.godName = new String(gname);
35+
this.godName = gname;
3636
this.message = m;
3737

38-
this.playerNameString = new String(player);
38+
this.playerNameString = player;
3939
this.amount = a;
4040
if (type != null)
4141
{
42-
this.typeString = new String(type);
42+
this.typeString = type;
4343
}
4444
else
4545
{

src/com/dogonfire/gods/tasks/HealPlayerTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public HealPlayerTask(Gods instance, String god, Player p, LANGUAGESTRING speak)
2222
{
2323
this.plugin = instance;
2424
this.player = p;
25-
this.godName = new String(god);
25+
this.godName = god;
2626
this.languageString = speak;
2727
}
2828

src/com/dogonfire/gods/tasks/SpawnHostileMobsTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public SpawnHostileMobsTask(Gods instance, String god, Player p, EntityType enti
1818
this.plugin = instance;
1919
this.numberOfMobs = n;
2020
this.player = p;
21-
this.godName = new String(god);
21+
this.godName = god;
2222
this.mobType = entityType;
2323
}
2424

src/com/dogonfire/gods/tasks/TaskGiveHolyArtifact.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class TaskGiveHolyArtifact extends Task
2323
public TaskGiveHolyArtifact(String god, GodType godType, Player p, boolean godspeak)
2424
{
2525
this.player = p;
26-
this.godName = new String(god);
26+
this.godName = god;
2727
this.godType = godType;
2828
this.speak = godspeak;
2929
}

src/com/dogonfire/gods/tasks/TaskGiveItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class TaskGiveItem extends Task {
2020

2121
public TaskGiveItem(String god, Player p, ItemStack item, boolean godspeak) {
2222
this.player = p;
23-
this.godName = new String(god);
23+
this.godName = god;
2424
this.item = item;
2525
this.speak = godspeak;
2626
}

src/com/dogonfire/gods/tasks/TaskGodSpeak.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ public class TaskGodSpeak extends Task {
1717

1818
public TaskGodSpeak(String gname, UUID playerId, String player, String type, int a) {
1919
this.playerId = playerId;
20-
this.godName = new String(gname);
20+
this.godName = gname;
2121
this.message = null;
2222
}
2323

2424
public TaskGodSpeak(String gname, UUID playerId, String player, String type, int a, LanguageManager.LANGUAGESTRING m) {
2525
this.playerId = playerId;
26-
this.godName = new String(gname);
26+
this.godName = gname;
2727
this.message = m;
2828

29-
this.playerNameString = new String(player);
29+
this.playerNameString = player;
3030
this.amount = a;
3131
if (type != null) {
32-
this.typeString = new String(type);
32+
this.typeString = type;
3333
} else {
3434
type = "";
3535
}

0 commit comments

Comments
 (0)