Tag all group names with their ID

This commit is contained in:
Daniel Saukel 2021-01-10 15:29:07 +01:00
parent 8d7e0a552e
commit c980074201

View File

@ -89,11 +89,11 @@ public class DGroup implements PlayerGroup {
private int lives = -1; private int lives = -1;
public DGroup(DungeonsXL plugin, Player player) { public DGroup(DungeonsXL plugin, Player player) {
this(plugin, "Group#" + counter, player); this(plugin, "Group", player);
} }
public DGroup(DungeonsXL plugin, Player player, Color color) { public DGroup(DungeonsXL plugin, Player player, Color color) {
this(plugin, color.toString() + "#" + counter, player); this(plugin, color.toString(), player);
} }
public DGroup(DungeonsXL plugin, String name, Player player) { public DGroup(DungeonsXL plugin, String name, Player player) {
@ -101,7 +101,8 @@ public class DGroup implements PlayerGroup {
dPlayers = plugin.getPlayerCache(); dPlayers = plugin.getPlayerCache();
plugin.getGroupCache().add(name, this); plugin.getGroupCache().add(name, this);
this.name = name; id = counter++;
this.name = name + "#" + id;
GroupPlayerJoinEvent event = new GroupPlayerJoinEvent(this, dPlayers.get(player), true); GroupPlayerJoinEvent event = new GroupPlayerJoinEvent(this, dPlayers.get(player), true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
@ -115,12 +116,10 @@ public class DGroup implements PlayerGroup {
playing = false; playing = false;
floorCount = 0; floorCount = 0;
id = counter++;
} }
public DGroup(DungeonsXL plugin, Player player, Dungeon dungeon) { public DGroup(DungeonsXL plugin, Player player, Dungeon dungeon) {
this(plugin, "Group#" + counter, player, dungeon); this(plugin, "Group", player, dungeon);
} }
public DGroup(DungeonsXL plugin, String name, Player player, Dungeon dungeon) { public DGroup(DungeonsXL plugin, String name, Player player, Dungeon dungeon) {
@ -132,7 +131,8 @@ public class DGroup implements PlayerGroup {
dPlayers = plugin.getPlayerCache(); dPlayers = plugin.getPlayerCache();
plugin.getGroupCache().add(name, this); plugin.getGroupCache().add(name, this);
this.name = name; id = counter++;
this.name = name + "#" + id;
GroupPlayerJoinEvent event = new GroupPlayerJoinEvent(this, dPlayers.get(captain), true); GroupPlayerJoinEvent event = new GroupPlayerJoinEvent(this, dPlayers.get(captain), true);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
@ -154,8 +154,6 @@ public class DGroup implements PlayerGroup {
setDungeon(dungeon); setDungeon(dungeon);
playing = false; playing = false;
floorCount = 0; floorCount = 0;
id = counter++;
} }
// Getters and setters // Getters and setters