fixes + uploads

This commit is contained in:
Matheus 2024-06-14 19:01:54 -04:00
parent 20a1658781
commit 4e6b65f5a3
17 changed files with 97 additions and 39 deletions

View File

@ -38,6 +38,7 @@ import land.battle.practice.shop.item.EffectShopItem;
import land.battle.practice.shop.item.message.KillMessageItem;
import land.battle.practice.shop.item.statreset.NameColorItem;
import land.battle.practice.shop.item.statreset.StatisticResetItem;
import land.battle.practice.util.Animation;
import land.battle.practice.util.CC;
import land.battle.practice.util.timer.TimerManager;
import land.battle.practice.util.timer.impl.EnderpearlTimer;
@ -104,7 +105,7 @@ public class Practice extends ExtendedJavaPlugin {
this.registerCommands();
this.registerListeners();
this.registerManagers();
Animation.init();
pracConfig = factory.fromFile("settings", PracticeConfig.class);
holanda = pracConfig.isHolanda();
// an alternative to bukkit's default entity hider system

View File

@ -28,10 +28,10 @@ public class PracticeConstants {
public static final Type STRING_INTEGER_MAP_TYPE = new TypeToken<Map<String, Integer>>(){}.getType();
public static final Type STRING_BOOLEAN_MAP_TYPE = new TypeToken<Map<String, Boolean>>(){}.getType();
public static final String PARTY_PREFIX = ChatColor.AQUA + ChatColor.BOLD.toString() + "Party " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String KIT_PREFIX = ChatColor.AQUA + ChatColor.BOLD.toString() + "Kit " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String ARENA_PREFIX = ChatColor.AQUA + ChatColor.BOLD.toString() + "Arena " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String TOURNAMENT_PREFIX = ChatColor.AQUA + ChatColor.BOLD.toString() + "Tournament " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String PARTY_PREFIX = ChatColor.GOLD + ChatColor.BOLD.toString() + "Party " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String KIT_PREFIX = ChatColor.GOLD + ChatColor.BOLD.toString() + "Kit " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String ARENA_PREFIX = ChatColor.GOLD + ChatColor.BOLD.toString() + "Arena " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String TOURNAMENT_PREFIX = ChatColor.GOLD + ChatColor.BOLD.toString() + "Tournament " + ChatColor.GRAY + ChatColor.BOLD + "»" + " ";
public static final String JEDIS_PRACTICE_SETTING_CATEGORY = "practice_settings";
public static final String JEDIS_DISCORD_REWARD_CATEGORY = "discord_rewards";
@ -39,12 +39,12 @@ public class PracticeConstants {
public static final int DEFAULT_ELO = 1000;
public static final List<String> CHANGELOG = Arrays.asList(
CC.GRAY + "Leaderboards " + CC.AQUA + "(/leaderboards)",
CC.GRAY + "Statistics " + CC.AQUA + "(/stats)",
CC.GRAY + "Guilds " + CC.AQUA + "(/guilds)",
CC.GRAY + "Friends " + CC.AQUA + "(/friends)",
CC.GRAY + "Win Streaks " + CC.AQUA + "(Top 10 win streaks viewable via /lb)",
CC.GRAY + "Ranked Divisions " + CC.AQUA + "(Learn more - discord.gg/nodebuff)"
CC.GRAY + "Leaderboards " + CC.GOLD + "(/leaderboards)",
CC.GRAY + "Statistics " + CC.GOLD + "(/stats)",
CC.GRAY + "Guilds " + CC.GOLD + "(/guilds)",
CC.GRAY + "Friends " + CC.GOLD + "(/friends)",
CC.GRAY + "Win Streaks " + CC.GOLD + "(Top 10 win streaks viewable via /lb)",
CC.GRAY + "Ranked Divisions " + CC.GOLD + "(Learn more - discord.gg/nodebuff)"
);
public static final Map<String, PlayerStateAdapter> BOARD_ADAPTERS = new HashMap<>();

View File

@ -1,17 +1,24 @@
package land.battle.practice.board;
import com.solexgames.core.CorePlugin;
import com.solexgames.core.player.PotPlayer;
import com.solexgames.core.util.Color;
import land.battle.practice.Practice;
import land.battle.practice.PracticeConstants;
import land.battle.practice.party.Party;
import land.battle.practice.player.PlayerData;
import land.battle.practice.player.PlayerState;
import land.battle.practice.settings.item.SidebarOptionsItemState;
import land.battle.practice.util.Animation;
import land.battle.practice.util.CC;
import io.github.nosequel.scoreboard.element.ScoreboardElement;
import io.github.nosequel.scoreboard.element.ScoreboardElementHandler;
import org.bukkit.entity.Player;
/**
* @author BattleLand Team
* @since 8/14/2021
*/
public class BoardAdapter implements ScoreboardElementHandler {
@Override
@ -61,14 +68,15 @@ public class BoardAdapter implements ScoreboardElementHandler {
switch (playerData.getOptions().getScoreboardStyle()) {
case MODERN:
element.add("");
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? "wtap.gg" : "battle.land") + " " + CC.GRAY + " " + CC.GRAY + " ");
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? CC.translate(Animation.getScoreboardFooter()) : "battle.land") + " " + CC.GRAY + " " + CC.GRAY + " ");
break;
case OLD:
element.add("");
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? "wtap.gg" : "battle.land"));
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? CC.translate(Animation.getScoreboardFooter()) : "battle.land"));
element.add(CC.SB_LINE);
break;
}
return element;
}

View File

@ -274,15 +274,15 @@ public class PartyCommand extends BaseCommand {
} else {
final List<UUID> members = new ArrayList<>(party.getMembers());
final String[] information = new String[]{
CC.GRAY + CC.STRIKE_THROUGH + "----------------------------------------------------",
CC.DARK_AQUA + CC.BOLD + "Party Information:",
"",
CC.GOLD + CC.BOLD + "Party Information:",
"",
CC.GRAY + "Members: " + members.stream()
.map(this.plugin.getServer()::getPlayer)
.map(player1 -> (player1.getUniqueId().equals(party.getLeader()) ? CC.GRAY + "*" : "") + player1.getDisplayName())
.collect(Collectors.joining(ChatColor.WHITE + ", ")),
CC.GRAY + "Status: " + CC.AQUA + (party.isOpen() ? CC.GREEN + "Public" : CC.PINK + "Private"),
CC.GRAY + CC.STRIKE_THROUGH + "----------------------------------------------------"
CC.GRAY + "Status: " + CC.GOLD + (party.isOpen() ? CC.GREEN + "Public" : CC.PINK + "Private"),
""
};
player.sendMessage(information);

View File

@ -25,7 +25,15 @@ public class TournamentCommand extends BaseCommand {
@HelpCommand
@Syntax("[page]")
public void onHelp(CommandHelp help) {
help.showHelp();
if (!help.getIssuer().isPlayer()) return;
help.getIssuer().sendMessage("");
help.getIssuer().sendMessage(CC.GOLD + "/tournament alert " + CC.GRAY + "<id>");
help.getIssuer().sendMessage(CC.GOLD + "/tournament start " + CC.GRAY + "<kit> <id> <teamSize> <maxSize>");
help.getIssuer().sendMessage(CC.GOLD + "/tournament end " + CC.GRAY + "<id>");
help.getIssuer().sendMessage(CC.GOLD + "/tournament forcestart " + CC.GRAY + "<id>");
help.getIssuer().sendMessage(CC.GOLD + "/tournament leave");
help.getIssuer().sendMessage(CC.GOLD + "/tournament join " + CC.GRAY + "<id>");
help.getIssuer().sendMessage("");
}
@Subcommand("start|create")

View File

@ -26,6 +26,7 @@ import land.battle.practice.party.Party;
import land.battle.practice.player.PlayerData;
import land.battle.practice.player.PlayerState;
import land.battle.practice.queue.QueueType;
import land.battle.practice.settings.PracticeSettingsMenu;
import land.battle.practice.util.CC;
import land.battle.practice.util.DeathUtils;
import land.battle.practice.util.PlayerUtil;
@ -396,6 +397,9 @@ public class PlayerListener implements Listener {
case PAINTING:
new LeaderboardsMenu().openMenu(player);
break;
case WATCH:
new PracticeSettingsMenu().openMenu(player);
break;
case SKULL_ITEM:
player.performCommand("party info");
break;

View File

@ -51,7 +51,7 @@ public class ItemManager {
null,
ItemUtil.createItem(Material.NETHER_STAR, CC.GOLD + "Create a Party" + CC.GRAY + " (Right Click)"),
null,
null,
ItemUtil.createItem(Material.WATCH, CC.GOLD + "Settings" + CC.GRAY + " (Right Click)"),
ItemUtil.createItem(Material.PAINTING, CC.GOLD + "Leaderboards" + CC.GRAY + " (Right Click)"),
ItemUtil.createItem(Material.BOOK, CC.GOLD + "Kit Editor" + CC.GRAY + " (Right Click)")
};

View File

@ -38,7 +38,7 @@ public class PlayerManager {
private Arena lastArenaPlayed;
private static final ItemStack REMATCH_ITEM = new ItemBuilder(Material.BLAZE_POWDER)
.setDisplayName(CC.AQUA + "Rematch " + CC.GRAY + "(Right Click)")
.setDisplayName(CC.GOLD + "Rematch " + CC.GRAY + "(Right Click)")
.addLore(
CC.GRAY + "Click to rematch your opponent."
)
@ -244,7 +244,7 @@ public class PlayerManager {
}
if (isRematching && !inParty && !inTournament) {
player.getInventory().setItem(4, PlayerManager.REMATCH_ITEM);
player.getInventory().setItem(2, PlayerManager.REMATCH_ITEM);
}
player.updateInventory();

View File

@ -63,7 +63,7 @@ public class QueueManager {
this.giveQueueItems(player);
final String message = CC.YELLOW + "You've been added to the " + CC.AQUA + type.getName() + " " + kitName + CC.YELLOW + " queue." + (type.isRanked() ? CC.GRAY + " (" + elo + " elo)" : "");
final String message = CC.WHITE + "You've been added to the " + CC.GOLD + type.getName() + " " + kitName + CC.WHITE + " queue." + (type.isRanked() ? CC.GRAY + " (" + elo + " elo)" : "");
player.sendMessage(message);
this.playerQueueTime.put(player.getUniqueId(), System.currentTimeMillis());

View File

@ -48,11 +48,15 @@ public class LeaderboardsMenu extends Menu {
globalEloLore.addAll(LeaderboardUpdateRunnable.GLOBAL_ELO_LEADERBOARD_LORE);
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(playerData.getGlobalElo());
if (rankedDivision != null) {
if (!Practice.getInstance().isHolanda()) {
if (rankedDivision != null) {
globalEloLore.add(" ");
globalEloLore.add(CC.GRAY + "Your current division is " + rankedDivision.getFancyName());
globalEloLore.add(CC.GRAY + "and you have " + CC.WHITE + playerData.getGlobalElo() + CC.GRAY + " elo.");
}
} else {
globalEloLore.add(" ");
globalEloLore.add(CC.GRAY + "Your current division is " + rankedDivision.getFancyName());
globalEloLore.add(CC.GRAY + "and you have " + CC.WHITE + playerData.getGlobalElo() + CC.GRAY + " elo.");
globalEloLore.add(CC.GRAY + "You currently have " + CC.WHITE + playerData.getGlobalElo() + CC.GRAY + " elo.");
}
buttonMap.put(4, new ItemBuilder(Material.NETHER_STAR)

View File

@ -41,9 +41,10 @@ public class StatisticsMenu extends Menu {
globalStats.add(CC.GRAY + "ELO: " + CC.WHITE + playerData.getGlobalElo());
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(playerData.getGlobalElo());
if (rankedDivision != null) {
globalStats.add(CC.GRAY + "Division: " + CC.WHITE + rankedDivision.getFancyName());
if (!Practice.getInstance().isHolanda()) {
if (rankedDivision != null) {
globalStats.add(CC.GRAY + "Division: " + CC.WHITE + rankedDivision.getFancyName());
}
}
globalStats.add(" ");
@ -71,7 +72,7 @@ public class StatisticsMenu extends Menu {
final String percentage = String.format("%.2f", (currentReality * 100.0f) / amountNeeded);
buttonMap.put(5, new ItemBuilder(Material.GLOWSTONE_DUST)
if (!Practice.getInstance().isHolanda()) buttonMap.put(5, new ItemBuilder(Material.GLOWSTONE_DUST)
.setDisplayName(CC.AQUA + CC.BOLD + "Division Statistics")
.addLore(
CC.GRAY + "Current Division: " + CC.WHITE + rankedDivision.getFancyName(),

View File

@ -103,7 +103,7 @@ public class DuelMenu extends Menu {
}
buttonMap.put(48, new ItemBuilder(this.arenaSelecting ? Material.CHEST : Material.PAPER)
.setDisplayName(this.arenaSelecting ? CC.AQUA + CC.BOLD + "Kit Selection" : CC.AQUA + CC.BOLD + "Arena Selection")
.setDisplayName(this.arenaSelecting ? CC.GOLD + CC.BOLD + "Kit Selection" : CC.GOLD + CC.BOLD + "Arena Selection")
.addLore(
CC.GRAY + "Click to switch inventories."
)
@ -118,7 +118,7 @@ public class DuelMenu extends Menu {
);
buttonMap.put(50, new ItemBuilder(Material.INK_SACK)
.setDisplayName(CC.AQUA + CC.BOLD + "Confirm Duel")
.setDisplayName(CC.GOLD + CC.BOLD + "Confirm Duel")
.addLore(
CC.GRAY + "Confirm your settings and send",
CC.GRAY + "the duel to out.",

View File

@ -4,7 +4,10 @@ import land.battle.practice.Practice;
import land.battle.practice.managers.ItemManager;
import land.battle.practice.player.PlayerData;
import land.battle.practice.player.PlayerState;
import land.battle.practice.util.CC;
import land.battle.practice.util.ItemUtil;
import lombok.RequiredArgsConstructor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.UUID;
@ -23,7 +26,7 @@ public class RematchRunnable implements Runnable {
final PlayerData playerData = this.plugin.getPlayerManager().getPlayerData(player.getUniqueId());
if (playerData != null && playerData.getPlayerState() == PlayerState.SPAWN && this.plugin.getMatchManager().isRematching(player.getUniqueId()) && this.plugin.getPartyManager().getParty(player.getUniqueId()) == null) {
player.getInventory().setItem(4, ItemManager.SHOP_ITEM);
player.getInventory().setItem(4, !Practice.getInstance().isHolanda() ? ItemManager.SHOP_ITEM : ItemUtil.createItem(Material.NETHER_STAR, CC.GOLD + "Create a Party" + CC.GRAY + " (Right Click)"));
player.updateInventory();
playerData.setRematchID(-1);

View File

@ -91,10 +91,10 @@ public class PracticeSettingsImpl implements ISettings {
.toUpdatingButton((player1, clickType) -> {
switch (data.getOptions().getScoreboardStyle()) {
case OLD:
data.getOptions().setScoreboardStyle(SidebarOptionsItemState.OLD);
data.getOptions().setScoreboardStyle(SidebarOptionsItemState.MODERN);
break;
case MODERN:
data.getOptions().setScoreboardStyle(SidebarOptionsItemState.MODERN);
data.getOptions().setScoreboardStyle(SidebarOptionsItemState.OLD);
break;
}
})

View File

@ -0,0 +1,29 @@
package land.battle.practice.util;
import land.battle.practice.Practice;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class Animation {
public static String footer;
public static void init() {
List<String> footers = Arrays.asList(" &7wtap.gg", " &7discord.wtap.gg");
AtomicInteger atomicInteger = new AtomicInteger();
Practice.getInstance().getServer().getScheduler().runTaskTimerAsynchronously(Practice.getInstance(), () -> {
if (atomicInteger.get() == footers.size()) atomicInteger.set(0);
footer = footers.get(atomicInteger.getAndIncrement());
}, 0L, (long) (5.0 * 20L));
}
public static String getScoreboardFooter() {
return footer;
}
}

View File

@ -31,7 +31,7 @@ public class EnderpearlTimer extends PlayerTimer implements Listener {
return;
}
player.sendMessage(CC.GRAY + "Your enderpearl cooldown timer has expired.");
player.sendMessage(CC.GREEN + "Your enderpearl cooldown timer has expired.");
}
@EventHandler

View File

@ -31,9 +31,9 @@ public class VoteManager {
public void sendVoteMessage(Player player, Arena arena) {
ChatComponentBuilder builder = new ChatComponentBuilder("");
builder.append(CC.AQUA + "Give us some feedback about ");
builder.append(CC.WHITE + "Give us some feedback about ");
builder.append(CC.GOLD + arena.getName());
builder.append(CC.PINK + " by clicking one of the stars: ");
builder.append(CC.WHITE + " by clicking one of the stars: ");
Arrays.stream(Vote.values()).forEach(rating -> builder.append(rating.getDisplayName() + " ")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rate " + rating.name()))