mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Don't force-tie groups to colors; resolves #516
This commit is contained in:
parent
63092b6d71
commit
cb26c414bd
@ -423,7 +423,7 @@ public class Announcer {
|
|||||||
|
|
||||||
boolean full = playerCount >= maxPlayersPerGroup;
|
boolean full = playerCount >= maxPlayersPerGroup;
|
||||||
|
|
||||||
DColor color = plugin.getMainConfig().getGroupColorPriority().get(groupCount);
|
DColor color = plugin.getMainConfig().getGroupColorPriority(groupCount);
|
||||||
ItemStack button = color.getWoolMaterial().toItemStack();
|
ItemStack button = color.getWoolMaterial().toItemStack();
|
||||||
ItemMeta meta = button.getItemMeta();
|
ItemMeta meta = button.getItemMeta();
|
||||||
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
||||||
|
@ -254,7 +254,7 @@ public class GroupCommand extends DCommand {
|
|||||||
|
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dGroup.getName() + " &4&l]");
|
MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dGroup.getName() + " &4&l]");
|
||||||
MessageUtil.sendMessage(sender, "&bCaptain: &e" + dGroup.getCaptain().getName());
|
MessageUtil.sendMessage(sender, "&bCaptain: &e" + dGroup.getCaptain().getName());
|
||||||
String players = new String();
|
String players = "";
|
||||||
for (String player : dGroup.getPlayers().getNames()) {
|
for (String player : dGroup.getPlayers().getNames()) {
|
||||||
players += (players.isEmpty() ? "" : "&b, &e") + player;
|
players += (players.isEmpty() ? "" : "&b, &e") + player;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class StatusCommand extends DCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void onExecute(String[] args, CommandSender sender) {
|
public void onExecute(String[] args, CommandSender sender) {
|
||||||
String minecraftVersion = compat.getVersion().toString();
|
String minecraftVersion = compat.getVersion().toString();
|
||||||
String bukkitVersion = Bukkit.getName() + (compat.isSpigot() ? " (Spigot)" : new String()) + " " + Bukkit.getBukkitVersion();
|
String bukkitVersion = Bukkit.getName() + (compat.isSpigot() ? " (Spigot)" : "") + " " + Bukkit.getBukkitVersion();
|
||||||
String internalsVersion = compat.getInternals().toString();
|
String internalsVersion = compat.getInternals().toString();
|
||||||
String dungeonsxlVersion = plugin.getDescription().getVersion();
|
String dungeonsxlVersion = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ public class MainConfig extends DREConfig {
|
|||||||
LIGHT_GREEN,
|
LIGHT_GREEN,
|
||||||
PURPLE,
|
PURPLE,
|
||||||
ORANGE,
|
ORANGE,
|
||||||
WHITE,
|
|
||||||
BLACK,
|
BLACK,
|
||||||
LIGHT_BLUE,
|
LIGHT_BLUE,
|
||||||
DARK_GREEN,
|
DARK_GREEN,
|
||||||
@ -83,7 +82,8 @@ public class MainConfig extends DREConfig {
|
|||||||
LIGHT_GRAY,
|
LIGHT_GRAY,
|
||||||
CYAN,
|
CYAN,
|
||||||
MAGENTA,
|
MAGENTA,
|
||||||
DARK_GRAY
|
DARK_GRAY,
|
||||||
|
PINK
|
||||||
));
|
));
|
||||||
private double announcementInterval = 30;
|
private double announcementInterval = 30;
|
||||||
|
|
||||||
@ -285,6 +285,14 @@ public class MainConfig extends DREConfig {
|
|||||||
return groupColorPriority;
|
return groupColorPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param count the group count
|
||||||
|
* @return the group color for the count
|
||||||
|
*/
|
||||||
|
public DColor getGroupColorPriority(int count) {
|
||||||
|
return (count < groupColorPriority.size() && count >= 0) ? groupColorPriority.get(count) : DColor.WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param colors the colors to set
|
* @param colors the colors to set
|
||||||
*/
|
*/
|
||||||
@ -583,24 +591,23 @@ public class MainConfig extends DREConfig {
|
|||||||
tutorialStartGroup = config.getString("tutorial.startgroup", tutorialStartGroup);
|
tutorialStartGroup = config.getString("tutorial.startgroup", tutorialStartGroup);
|
||||||
tutorialEndGroup = config.getString("tutorial.endgroup", tutorialEndGroup);
|
tutorialEndGroup = config.getString("tutorial.endgroup", tutorialEndGroup);
|
||||||
|
|
||||||
if (config.contains("groupColorPriority")) {
|
if (config.getStringList("groupColorPriority").size() < 14) {
|
||||||
if (config.getStringList("groupColorPriority").size() < 15) {
|
ArrayList<String> strings = new ArrayList<>();
|
||||||
ArrayList<String> strings = new ArrayList<>();
|
for (DColor color : groupColorPriority) {
|
||||||
for (DColor color : groupColorPriority) {
|
strings.add(color.toString());
|
||||||
strings.add(color.toString());
|
}
|
||||||
}
|
config.set("groupColorPriority", strings);
|
||||||
config.set("groupColorPriority", strings);
|
try {
|
||||||
try {
|
config.save(file);
|
||||||
config.save(file);
|
} catch (IOException exception) {
|
||||||
} catch (IOException exception) {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
groupColorPriority.clear();
|
groupColorPriority.clear();
|
||||||
for (String color : config.getStringList("groupColorPriority")) {
|
for (String color : config.getStringList("groupColorPriority")) {
|
||||||
if (EnumUtil.isValidEnum(DColor.class, color)) {
|
DColor dColor = EnumUtil.getEnum(DColor.class, color);
|
||||||
groupColorPriority.add(DColor.valueOf(color));
|
if (dColor != null && dColor != DColor.WHITE) {
|
||||||
}
|
groupColorPriority.add(dColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ public class DGroup {
|
|||||||
DungeonsXL plugin;
|
DungeonsXL plugin;
|
||||||
DPlayerCache dPlayers;
|
DPlayerCache dPlayers;
|
||||||
|
|
||||||
|
private static int counter;
|
||||||
|
|
||||||
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
private Player captain;
|
private Player captain;
|
||||||
private PlayerCollection players = new PlayerCollection();
|
private PlayerCollection players = new PlayerCollection();
|
||||||
@ -76,11 +79,11 @@ public class DGroup {
|
|||||||
private int lives = -1;
|
private int lives = -1;
|
||||||
|
|
||||||
public DGroup(DungeonsXL plugin, Player player) {
|
public DGroup(DungeonsXL plugin, Player player) {
|
||||||
this(plugin, "Group " + plugin.getDGroupCache().size(), player);
|
this(plugin, "Group#" + counter, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DGroup(DungeonsXL plugin, Player player, DColor color) {
|
public DGroup(DungeonsXL plugin, Player player, DColor color) {
|
||||||
this(plugin, color.toString().replace("_", " "), player);
|
this(plugin, color.toString() + "#" + counter, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DGroup(DungeonsXL plugin, String name, Player player) {
|
public DGroup(DungeonsXL plugin, String name, Player player) {
|
||||||
@ -95,10 +98,12 @@ public class DGroup {
|
|||||||
|
|
||||||
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, plugin.getMainConfig().getGroupColorPriority().get(plugin.getDGroupCache().size()).toString(), player, dungeon);
|
this(plugin, "Group#" + counter, player, dungeon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DGroup(DungeonsXL plugin, String name, Player player, Dungeon dungeon) {
|
public DGroup(DungeonsXL plugin, String name, Player player, Dungeon dungeon) {
|
||||||
@ -129,14 +134,23 @@ public class DGroup {
|
|||||||
setDungeon(dungeon);
|
setDungeon(dungeon);
|
||||||
playing = false;
|
playing = false;
|
||||||
floorCount = 0;
|
floorCount = 0;
|
||||||
|
|
||||||
|
id = counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters and setters
|
// Getters and setters
|
||||||
|
/**
|
||||||
|
* @return the group ID
|
||||||
|
*/
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name; formatted
|
* @return the name; formatted
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return (color != null ? color.getChatColor().toString() : new String()) + name;
|
return getDColor().getChatColor() + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,7 +171,7 @@ public class DGroup {
|
|||||||
* @param color the color to fetch the name from
|
* @param color the color to fetch the name from
|
||||||
*/
|
*/
|
||||||
public void setName(DColor color) {
|
public void setName(DColor color) {
|
||||||
name = color.toString().replace("_", " ");
|
name = color.toString() + "#" + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -520,7 +534,7 @@ public class DGroup {
|
|||||||
* @return if the group has been customized with a command
|
* @return if the group has been customized with a command
|
||||||
*/
|
*/
|
||||||
public boolean isCustom() {
|
public boolean isCustom() {
|
||||||
return !name.matches("Group_[0-9]{1,}");
|
return !name.matches("Group#[0-9]{1,}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -544,7 +558,7 @@ public class DGroup {
|
|||||||
if (color != null) {
|
if (color != null) {
|
||||||
return color;
|
return color;
|
||||||
} else {
|
} else {
|
||||||
return DColor.DEFAULT;
|
return DColor.WHITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +780,9 @@ public class DGroup {
|
|||||||
GameRuleProvider rules = game.getRules();
|
GameRuleProvider rules = game.getRules();
|
||||||
gameWorld.setWeather(rules);
|
gameWorld.setWeather(rules);
|
||||||
|
|
||||||
color = plugin.getMainConfig().getGroupColorPriority().get(game.getDGroups().indexOf(this));
|
if (color == null) {
|
||||||
|
color = plugin.getMainConfig().getGroupColorPriority((game.getDGroups().indexOf(this)));
|
||||||
|
}
|
||||||
|
|
||||||
for (DGroup dGroup : game.getDGroups()) {
|
for (DGroup dGroup : game.getDGroups()) {
|
||||||
if (dGroup == null) {
|
if (dGroup == null) {
|
||||||
|
@ -43,7 +43,7 @@ public enum DColor {
|
|||||||
LIGHT_RED(ChatColor.RED, DyeColor.RED, VanillaItem.RED_WOOL),
|
LIGHT_RED(ChatColor.RED, DyeColor.RED, VanillaItem.RED_WOOL),
|
||||||
ORANGE(ChatColor.GOLD, DyeColor.ORANGE, VanillaItem.ORANGE_WOOL),
|
ORANGE(ChatColor.GOLD, DyeColor.ORANGE, VanillaItem.ORANGE_WOOL),
|
||||||
YELLOW(ChatColor.YELLOW, DyeColor.YELLOW, VanillaItem.YELLOW_WOOL),
|
YELLOW(ChatColor.YELLOW, DyeColor.YELLOW, VanillaItem.YELLOW_WOOL),
|
||||||
DEFAULT(ChatColor.BLUE, DyeColor.PINK, VanillaItem.PINK_WOOL);
|
PINK(ChatColor.BLUE, DyeColor.PINK, VanillaItem.PINK_WOOL);
|
||||||
|
|
||||||
private ChatColor chat;
|
private ChatColor chat;
|
||||||
private DyeColor dye;
|
private DyeColor dye;
|
||||||
|
Loading…
Reference in New Issue
Block a user