Skip to content

Commit

Permalink
Fixed bug with queue menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Devlrxxh committed Feb 5, 2024
1 parent f8b724f commit f4d3b04
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
25 changes: 21 additions & 4 deletions src/main/java/me/funky/praxi/kit/command/KitCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,23 @@ public void setdescription(Player player, String kitName, String description) {
player.sendMessage(CC.GREEN + "You updated the kit's description.");
}

@Subcommand("setdescription")
@CommandCompletion("@kits")
@Syntax("<kit> <description>")
public void setdescription2(Player player, String kitName) {
if (!Kit.getKits().contains(Kit.getByName(kitName))) {
player.sendMessage(CC.translate("&4ERROR - &cKit doesn't exists!"));
return;
}
Kit kit = Kit.getByName(kitName);
if (kit == null) return;

kit.setDescription("none");
kit.save();

player.sendMessage(CC.GREEN + "You updated the kit's description.");
}

@Subcommand("build")
@CommandCompletion("@kits")
@Syntax("<kit>")
Expand All @@ -206,7 +223,7 @@ public void build(Player player, String kitName) {
kit.getGameRules().setBuild(!kit.getGameRules().isBuild());
kit.save();

player.sendMessage(CC.GREEN + "You updated the kit's build status to " + (kit.isEnabled() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
player.sendMessage(CC.GREEN + "You updated the kit's build status to " + (kit.getGameRules().isBuild() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
}

@Subcommand("spleef")
Expand All @@ -223,7 +240,7 @@ public void spleef(Player player, String kitName) {
kit.getGameRules().setSpleef(!kit.getGameRules().isSpleef());
kit.save();

player.sendMessage(CC.GREEN + "You updated the kit's spleef status to " + (kit.isEnabled() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
player.sendMessage(CC.GREEN + "You updated the kit's spleef status to " + (kit.getGameRules().isSpleef() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
}

@Subcommand("sumo")
Expand All @@ -240,7 +257,7 @@ public void sumo(Player player, String kitName) {
kit.getGameRules().setSumo(!kit.getGameRules().isSumo());
kit.save();

player.sendMessage(CC.GREEN + "You updated the kit's sumo status to " + (kit.isEnabled() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
player.sendMessage(CC.GREEN + "You updated the kit's sumo status to " + (kit.getGameRules().isSumo() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
}

@Subcommand("hpregen")
Expand All @@ -257,7 +274,7 @@ public void hpregen(Player player, String kitName) {
kit.getGameRules().setHealthRegeneration(!kit.getGameRules().isHealthRegeneration());
kit.save();

player.sendMessage(CC.GREEN + "You updated the kit's health regeneration status to " + (kit.isEnabled() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
player.sendMessage(CC.GREEN + "You updated the kit's health regeneration status to " + (kit.getGameRules().isShowHealth() ? "Enabled" : ChatColor.RED + "Disabled" + "."));
}

@Subcommand("hitdelay")
Expand Down
22 changes: 17 additions & 5 deletions src/main/java/me/funky/praxi/queue/menu/QueueSelectKitMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,31 @@ public ItemStack getButtonItem(Player player) {
for (String line : Praxi.getInstance().getMenusConfig().getStringList("QUEUES-MENUS.UNRANKED.LORE")) {
line = line.replaceAll("<playing>", String.valueOf(Match.getInFightsCount(queue)));
line = line.replaceAll("<queueing>", String.valueOf(queue.getKit().getQueuing()));
line = line.replaceAll("<description>", queue.getKit().getDescription());
lore.add(line);
if (line.contains("<description>")) {
if (!queue.getKit().getDescription().equalsIgnoreCase("none")) {
line = line.replaceAll("<description>", queue.getKit().getDescription());
lore.add(line);
}
} else {
lore.add(line);
}

}
} else {
for (String line : Praxi.getInstance().getMenusConfig().getStringList("QUEUES-MENUS.RANKED.LORE")) {
line = line.replaceAll("<playing>", String.valueOf(Match.getInFightsCount(queue)));
line = line.replaceAll("<queueing>", String.valueOf(queue.getKit().getQueuing()));
line = line.replaceAll("<description>", queue.getKit().getDescription());
lore.add(line);
if (line.contains("<description>")) {
if (!queue.getKit().getDescription().equalsIgnoreCase("none")) {
line = line.replaceAll("<description>", queue.getKit().getDescription());
lore.add(line);
}
} else {
lore.add(line);
}
}
}


if (!ranked) {
return new ItemBuilder(queue.getKit().getDisplayIcon())
.name(Praxi.getInstance().getMenusConfig().getString("QUEUES-MENUS.UNRANKED.KIT-NAME")
Expand Down

0 comments on commit f4d3b04

Please sign in to comment.