upload v3
This commit is contained in:
parent
c341ed3132
commit
005332b48a
BIN
lib/Scandium.jar
BIN
lib/Scandium.jar
Binary file not shown.
@ -1,46 +1,47 @@
|
|||||||
package com.solexgames.practice;
|
package land.battle.practice;
|
||||||
|
|
||||||
import com.solexgames.core.CorePlugin;
|
import com.solexgames.core.CorePlugin;
|
||||||
import com.solexgames.lib.acf.ConditionFailedException;
|
import com.solexgames.lib.acf.ConditionFailedException;
|
||||||
import com.solexgames.lib.acf.PaperCommandManager;
|
import com.solexgames.lib.acf.PaperCommandManager;
|
||||||
import com.solexgames.lib.commons.command.context.CommonsPlayer;
|
import com.solexgames.lib.commons.command.context.CommonsPlayer;
|
||||||
import com.solexgames.lib.processor.config.ConfigFactory;
|
import com.solexgames.lib.processor.config.ConfigFactory;
|
||||||
import com.solexgames.practice.arena.Arena;
|
|
||||||
import com.solexgames.practice.board.BoardAdapter;
|
|
||||||
import com.solexgames.practice.commands.*;
|
|
||||||
import com.solexgames.practice.commands.administration.*;
|
|
||||||
import com.solexgames.practice.commands.duel.AcceptCommand;
|
|
||||||
import com.solexgames.practice.commands.duel.DuelCommand;
|
|
||||||
import com.solexgames.practice.commands.duel.SpectateCommand;
|
|
||||||
import com.solexgames.practice.commands.spawn.SpawnCommand;
|
|
||||||
import com.solexgames.practice.commands.time.TimeCommand;
|
|
||||||
import com.solexgames.practice.comphenix.EntityHider;
|
|
||||||
import com.solexgames.practice.config.PracticeConfig;
|
|
||||||
import com.solexgames.practice.ffa.FFAManager;
|
|
||||||
import com.solexgames.practice.kit.Kit;
|
|
||||||
import com.solexgames.practice.listeners.*;
|
|
||||||
import com.solexgames.practice.managers.*;
|
|
||||||
import com.solexgames.practice.runnable.ExpBarRunnable;
|
|
||||||
import com.solexgames.practice.runnable.LeaderboardUpdateRunnable;
|
|
||||||
import com.solexgames.practice.runnable.SaveDataRunnable;
|
|
||||||
import com.solexgames.practice.runnable.cache.StatusCache;
|
|
||||||
import com.solexgames.practice.settings.PracticeSettingsImpl;
|
|
||||||
import com.solexgames.practice.shop.category.KillMessageShopCategory;
|
|
||||||
import com.solexgames.practice.shop.category.MiscellaneousShopCategory;
|
|
||||||
import com.solexgames.practice.shop.data.KillMessageDataType;
|
|
||||||
import com.solexgames.practice.shop.data.NameColorDataType;
|
|
||||||
import com.solexgames.practice.shop.data.StatsResetDataType;
|
|
||||||
import com.solexgames.practice.shop.item.EffectShopItem;
|
|
||||||
import com.solexgames.practice.shop.data.EffectDataType;
|
|
||||||
import com.solexgames.practice.shop.item.message.KillMessageItem;
|
|
||||||
import com.solexgames.practice.shop.item.statreset.NameColorItem;
|
|
||||||
import com.solexgames.practice.shop.item.statreset.StatisticResetItem;
|
|
||||||
import com.solexgames.practice.util.CC;
|
|
||||||
import com.solexgames.practice.util.timer.TimerManager;
|
|
||||||
import com.solexgames.practice.util.timer.impl.EnderpearlTimer;
|
|
||||||
import com.solexgames.shop.Shop;
|
import com.solexgames.shop.Shop;
|
||||||
import com.solexgames.shop.category.impl.configurable.KillEffectShopCategory;
|
import com.solexgames.shop.category.impl.configurable.KillEffectShopCategory;
|
||||||
import io.github.nosequel.scoreboard.ScoreboardHandler;
|
import io.github.nosequel.scoreboard.ScoreboardHandler;
|
||||||
|
import land.battle.practice.arena.Arena;
|
||||||
|
import land.battle.practice.board.BoardAdapter;
|
||||||
|
import land.battle.practice.commands.*;
|
||||||
|
import land.battle.practice.commands.administration.*;
|
||||||
|
import land.battle.practice.commands.duel.AcceptCommand;
|
||||||
|
import land.battle.practice.commands.duel.DuelCommand;
|
||||||
|
import land.battle.practice.commands.duel.SpectateCommand;
|
||||||
|
import land.battle.practice.commands.spawn.SpawnCommand;
|
||||||
|
import land.battle.practice.commands.time.TimeCommand;
|
||||||
|
import land.battle.practice.comphenix.EntityHider;
|
||||||
|
import land.battle.practice.config.PracticeConfig;
|
||||||
|
import land.battle.practice.ffa.FFAManager;
|
||||||
|
import land.battle.practice.kit.Kit;
|
||||||
|
import land.battle.practice.listeners.*;
|
||||||
|
import land.battle.practice.managers.*;
|
||||||
|
import land.battle.practice.runnable.ExpBarRunnable;
|
||||||
|
import land.battle.practice.runnable.LeaderboardUpdateRunnable;
|
||||||
|
import land.battle.practice.runnable.SaveDataRunnable;
|
||||||
|
import land.battle.practice.runnable.cache.StatusCache;
|
||||||
|
import land.battle.practice.settings.PracticeSettingsImpl;
|
||||||
|
import land.battle.practice.shop.category.KillMessageShopCategory;
|
||||||
|
import land.battle.practice.shop.category.MiscellaneousShopCategory;
|
||||||
|
import land.battle.practice.shop.data.EffectDataType;
|
||||||
|
import land.battle.practice.shop.data.KillMessageDataType;
|
||||||
|
import land.battle.practice.shop.data.NameColorDataType;
|
||||||
|
import land.battle.practice.shop.data.StatsResetDataType;
|
||||||
|
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.CC;
|
||||||
|
import land.battle.practice.util.timer.TimerManager;
|
||||||
|
import land.battle.practice.util.timer.impl.EnderpearlTimer;
|
||||||
|
import land.battle.practice.vote.VoteManager;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.lucko.helper.Commands;
|
import me.lucko.helper.Commands;
|
||||||
@ -75,14 +76,14 @@ public class Practice extends ExtendedJavaPlugin {
|
|||||||
private PartyManager partyManager;
|
private PartyManager partyManager;
|
||||||
private QueueManager queueManager;
|
private QueueManager queueManager;
|
||||||
private FunManager effectManager;
|
private FunManager effectManager;
|
||||||
private ItemManager itemManager;
|
private land.battle.practice.managers.ItemManager itemManager;
|
||||||
private KitManager kitManager;
|
private KitManager kitManager;
|
||||||
private SpawnManager spawnManager;
|
private SpawnManager spawnManager;
|
||||||
private TournamentManager tournamentManager;
|
private TournamentManager tournamentManager;
|
||||||
private ChunkManager chunkManager;
|
private ChunkManager chunkManager;
|
||||||
private TimerManager timerManager;
|
private TimerManager timerManager;
|
||||||
private FFAManager ffaManager;
|
private FFAManager ffaManager;
|
||||||
|
private VoteManager voteManager;
|
||||||
private EntityHider entityHider;
|
private EntityHider entityHider;
|
||||||
|
|
||||||
private boolean rankedEnabled = true;
|
private boolean rankedEnabled = true;
|
||||||
@ -112,7 +113,7 @@ public class Practice extends ExtendedJavaPlugin {
|
|||||||
this.loadingString.equals(".") ? ".." :
|
this.loadingString.equals(".") ? ".." :
|
||||||
this.loadingString.equals("..") ? "..." : ".", 10L, 10L);
|
this.loadingString.equals("..") ? "..." : ".", 10L, 10L);
|
||||||
|
|
||||||
new ScoreboardHandler(this, new BoardAdapter(), 10L);
|
new ScoreboardHandler(this, new BoardAdapter(), 2L);
|
||||||
|
|
||||||
CorePlugin.getInstance().addNewSettingHandler(new PracticeSettingsImpl());
|
CorePlugin.getInstance().addNewSettingHandler(new PracticeSettingsImpl());
|
||||||
|
|
||||||
@ -305,7 +306,8 @@ public class Practice extends ExtendedJavaPlugin {
|
|||||||
this.followManager = new FollowManager();
|
this.followManager = new FollowManager();
|
||||||
this.chunkManager = new ChunkManager();
|
this.chunkManager = new ChunkManager();
|
||||||
this.editorManager = new EditorManager();
|
this.editorManager = new EditorManager();
|
||||||
this.itemManager = new ItemManager();
|
this.itemManager = new land.battle.practice.managers.ItemManager();
|
||||||
|
this.voteManager = new VoteManager(this);
|
||||||
this.kitManager = new KitManager();
|
this.kitManager = new KitManager();
|
||||||
this.matchManager = new MatchManager();
|
this.matchManager = new MatchManager();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class BoardAdapter implements ScoreboardElementHandler {
|
|||||||
final PlayerData playerData = Practice.getInstance().getPlayerManager()
|
final PlayerData playerData = Practice.getInstance().getPlayerManager()
|
||||||
.getPlayerData(player.getUniqueId());
|
.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
element.setTitle(CC.GOLD + CC.BOLD + "Battle " + CC.GRAY + "⏐" + CC.WHITE + " Practice");
|
element.setTitle(CC.GOLD + CC.BOLD + (!Practice.getInstance().isHolanda() ? "Battle " + CC.GRAY + "⏐" + CC.WHITE + " Practice" : "Practice"));
|
||||||
|
|
||||||
if (playerData == null || !playerData.getOptions().isScoreboardEnabled()) {
|
if (playerData == null || !playerData.getOptions().isScoreboardEnabled()) {
|
||||||
return element;
|
return element;
|
||||||
@ -58,7 +58,7 @@ public class BoardAdapter implements ScoreboardElementHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
element.add(" ");
|
element.add(" ");
|
||||||
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? "www.wtap.gg" : "battle.land"));
|
element.add(CC.GOLD + (Practice.getInstance().isHolanda() ? "wtap.gg" : "battle.land"));
|
||||||
element.add(CC.SB_LINE);
|
element.add(CC.SB_LINE);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
|
@ -2,8 +2,6 @@ package land.battle.practice.comphenix;
|
|||||||
|
|
||||||
import static com.comphenix.protocol.PacketType.Play.Server.*;
|
import static com.comphenix.protocol.PacketType.Play.Server.*;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -20,7 +18,6 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
@ -92,7 +89,7 @@ public class EntityHider implements Listener {
|
|||||||
/**
|
/**
|
||||||
* Set the visibility status of a given entity for a particular observer.
|
* Set the visibility status of a given entity for a particular observer.
|
||||||
* @param observer - the observer player.
|
* @param observer - the observer player.
|
||||||
* @param entity - ID of the entity that will be hidden or made visible.
|
* @param entityID - ID of the entity that will be hidden or made visible.
|
||||||
* @param visible - TRUE if the entity should be made visible, FALSE if not.
|
* @param visible - TRUE if the entity should be made visible, FALSE if not.
|
||||||
* @return TRUE if the entity was visible before this method call, FALSE otherwise.
|
* @return TRUE if the entity was visible before this method call, FALSE otherwise.
|
||||||
*/
|
*/
|
@ -1,4 +1,4 @@
|
|||||||
package com.solexgames.practice.config;
|
package land.battle.practice.config;
|
||||||
|
|
||||||
import com.solexgames.lib.processor.config.comment.Comment;
|
import com.solexgames.lib.processor.config.comment.Comment;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -418,7 +418,6 @@ public class MatchListener implements Listener {
|
|||||||
|
|
||||||
TaskUtil.runAsync(() -> this.plugin.getVoteManager().sendVoteMessage(player, match.getArena()));
|
TaskUtil.runAsync(() -> this.plugin.getVoteManager().sendVoteMessage(player, match.getArena()));
|
||||||
|
|
||||||
|
|
||||||
if (!playerData.canPlayRanked() && !player.hasPermission("practice.ranked.bypass")) {
|
if (!playerData.canPlayRanked() && !player.hasPermission("practice.ranked.bypass")) {
|
||||||
player.sendMessage(Color.SECONDARY_COLOR + "You need to win " + Color.MAIN_COLOR + playerData.winsUntilRankedUnlocked() + Color.SECONDARY_COLOR + " more matches to play ranked.");
|
player.sendMessage(Color.SECONDARY_COLOR + "You need to win " + Color.MAIN_COLOR + playerData.winsUntilRankedUnlocked() + Color.SECONDARY_COLOR + " more matches to play ranked.");
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.solexgames.practice.listeners;
|
package land.battle.practice.listeners;
|
||||||
|
|
||||||
import com.solexgames.core.CorePlugin;
|
import com.solexgames.core.CorePlugin;
|
||||||
import com.solexgames.core.menu.impl.SettingsMenu;
|
import com.solexgames.core.menu.impl.SettingsMenu;
|
||||||
@ -6,28 +6,28 @@ import com.solexgames.core.player.PotPlayer;
|
|||||||
import com.solexgames.core.player.prefixes.Prefix;
|
import com.solexgames.core.player.prefixes.Prefix;
|
||||||
import com.solexgames.core.util.Color;
|
import com.solexgames.core.util.Color;
|
||||||
import com.solexgames.core.util.StringUtil;
|
import com.solexgames.core.util.StringUtil;
|
||||||
import com.solexgames.practice.Practice;
|
import land.battle.practice.Practice;
|
||||||
import com.solexgames.practice.PracticeConstants;
|
import land.battle.practice.PracticeConstants;
|
||||||
import com.solexgames.practice.PracticeServerType;
|
import land.battle.practice.PracticeServerType;
|
||||||
import com.solexgames.practice.ffa.killstreak.KillStreak;
|
import land.battle.practice.ffa.killstreak.KillStreak;
|
||||||
import com.solexgames.practice.flags.Flag;
|
import land.battle.practice.flags.Flag;
|
||||||
import com.solexgames.practice.kit.Kit;
|
import land.battle.practice.kit.Kit;
|
||||||
import com.solexgames.practice.kit.PlayerKit;
|
import land.battle.practice.kit.PlayerKit;
|
||||||
import com.solexgames.practice.match.Match;
|
import land.battle.practice.match.Match;
|
||||||
import com.solexgames.practice.match.MatchState;
|
import land.battle.practice.match.MatchState;
|
||||||
import com.solexgames.practice.menu.EventHostMenu;
|
import land.battle.practice.menu.EventHostMenu;
|
||||||
import com.solexgames.practice.menu.JoinQueueMenu;
|
import land.battle.practice.menu.JoinQueueMenu;
|
||||||
import com.solexgames.practice.menu.LeaderboardsMenu;
|
import land.battle.practice.menu.LeaderboardsMenu;
|
||||||
import com.solexgames.practice.menu.SpectateMenu;
|
import land.battle.practice.menu.SpectateMenu;
|
||||||
import com.solexgames.practice.menu.editor.KitEditorMainMenu;
|
import land.battle.practice.menu.editor.KitEditorMainMenu;
|
||||||
import com.solexgames.practice.menu.editor.KitEditorMenu;
|
import land.battle.practice.menu.editor.KitEditorMenu;
|
||||||
import com.solexgames.practice.menu.party.PartyEventsMenu;
|
import land.battle.practice.menu.party.PartyEventsMenu;
|
||||||
import com.solexgames.practice.party.Party;
|
import land.battle.practice.party.Party;
|
||||||
import com.solexgames.practice.player.PlayerData;
|
import land.battle.practice.player.PlayerData;
|
||||||
import com.solexgames.practice.player.PlayerState;
|
import land.battle.practice.player.PlayerState;
|
||||||
import com.solexgames.practice.queue.QueueType;
|
import land.battle.practice.queue.QueueType;
|
||||||
import com.solexgames.practice.util.CC;
|
import land.battle.practice.util.CC;
|
||||||
import com.solexgames.practice.util.PlayerUtil;
|
import land.battle.practice.util.PlayerUtil;
|
||||||
import com.solexgames.shop.menu.ShopCategoryMenu;
|
import com.solexgames.shop.menu.ShopCategoryMenu;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -306,7 +306,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (event.getAction().name().startsWith("RIGHT_")) {
|
if (event.getAction().name().startsWith("RIGHT_")) {
|
||||||
final ItemStack item = event.getItem();
|
final ItemStack item = event.getItem();
|
||||||
final Party party = this.plugin.getPartyManager().getParty(player.getUniqueId());
|
final Party party = this.plugin.getPartyManager().getParty(player.getUniqueId());
|
||||||
|
if (Practice.getInstance().isHolanda()) {
|
||||||
switch (playerData.getPlayerState()) {
|
switch (playerData.getPlayerState()) {
|
||||||
case LOADING:
|
case LOADING:
|
||||||
player.sendMessage(CC.RED + "Please wait until your player data is loaded.");
|
player.sendMessage(CC.RED + "Please wait until your player data is loaded.");
|
||||||
@ -497,6 +497,198 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
switch (playerData.getPlayerState()) {
|
||||||
|
case LOADING:
|
||||||
|
player.sendMessage(CC.RED + "Please wait until your player data is loaded.");
|
||||||
|
break;
|
||||||
|
case FIGHTING:
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Match match = this.plugin.getMatchManager().getMatch(playerData);
|
||||||
|
|
||||||
|
switch (item.getType()) {
|
||||||
|
case ENDER_PEARL:
|
||||||
|
if (match.getMatchState() == MatchState.STARTING) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(CC.RED + "You cannot throw enderpearls right now.");
|
||||||
|
player.updateInventory();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ENCHANTED_BOOK:
|
||||||
|
Kit kit = match.getKit();
|
||||||
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
|
int kitIndex = inventory.getHeldItemSlot();
|
||||||
|
|
||||||
|
if (kitIndex == 8) {
|
||||||
|
kit.applyToPlayer(player);
|
||||||
|
player.sendMessage(CC.GREEN + "You've equipped the default " + CC.YELLOW + kit.getName() + CC.GREEN + " loadout.");
|
||||||
|
} else {
|
||||||
|
Map<Integer, PlayerKit> kits = playerData.getPlayerKits(kit.getName());
|
||||||
|
PlayerKit playerKit = kits.get(kitIndex + 1);
|
||||||
|
|
||||||
|
if (playerKit != null) {
|
||||||
|
playerKit.applyToPlayer(player);
|
||||||
|
player.sendMessage(CC.GREEN + "You've equipped the default " + CC.YELLOW + playerKit.getDisplayName() + CC.GREEN + " loadout.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPAWN:
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (item.getType()) {
|
||||||
|
case DIAMOND_SWORD:
|
||||||
|
if (!Practice.getInstance().isRankedEnabled()) {
|
||||||
|
player.sendMessage(CC.RED + "Ranked queues are currently disabled.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!playerData.canPlayRanked() && !player.hasPermission("practice.ranked.bypass")) {
|
||||||
|
player.sendMessage(ChatColor.RED + "You need " + playerData.winsUntilRankedUnlocked() + " more wins to join ranked queues.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new JoinQueueMenu(QueueType.RANKED).openMenu(player);
|
||||||
|
break;
|
||||||
|
case IRON_SWORD:
|
||||||
|
new JoinQueueMenu(QueueType.UNRANKED).openMenu(player);
|
||||||
|
break;
|
||||||
|
case BLAZE_POWDER:
|
||||||
|
final UUID rematching = this.plugin.getMatchManager().getRematcher(player.getUniqueId());
|
||||||
|
|
||||||
|
if (rematching == null) {
|
||||||
|
player.sendMessage(CC.RED + "The rematch request has expired.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Player toRematch = this.plugin.getServer().getPlayer(rematching);
|
||||||
|
|
||||||
|
if (toRematch != null) {
|
||||||
|
if (this.plugin.getMatchManager().getMatchRequest(toRematch.getUniqueId(), player.getUniqueId()) != null) {
|
||||||
|
this.plugin.getServer().dispatchCommand(player, "accept " + toRematch.getName());
|
||||||
|
} else {
|
||||||
|
this.plugin.getServer().dispatchCommand(player, "duel " + toRematch.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.sendMessage(CC.RED + "That player is now offline.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GOLD_INGOT:
|
||||||
|
new ShopCategoryMenu().openMenu(player);
|
||||||
|
break;
|
||||||
|
case EMERALD:
|
||||||
|
new LeaderboardsMenu().openMenu(player);
|
||||||
|
break;
|
||||||
|
case SKULL_ITEM:
|
||||||
|
player.performCommand("party info");
|
||||||
|
break;
|
||||||
|
case BOOK:
|
||||||
|
new KitEditorMainMenu().openMenu(player);
|
||||||
|
break;
|
||||||
|
case REDSTONE_COMPARATOR:
|
||||||
|
new SettingsMenu(player).openMenu(player);
|
||||||
|
break;
|
||||||
|
case GOLD_AXE:
|
||||||
|
if (party != null && !this.plugin.getPartyManager().isLeader(player.getUniqueId())) {
|
||||||
|
player.sendMessage(CC.RED + "You're not the leader of this party.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new PartyEventsMenu().openMenu(player);
|
||||||
|
break;
|
||||||
|
case NETHER_STAR:
|
||||||
|
if (this.plugin.getPartyManager().getParty(player.getUniqueId()) == null) {
|
||||||
|
this.plugin.getPartyManager().createParty(player);
|
||||||
|
} else {
|
||||||
|
this.plugin.getPartyManager().leaveParty(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.getFollowManager().stopFollowing(player);
|
||||||
|
this.plugin.getTournamentManager().leaveTournament(player);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case QUEUE:
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getType() == Material.INK_SACK) {
|
||||||
|
if (party == null) {
|
||||||
|
this.plugin.getQueueManager().removePlayerFromQueue(player);
|
||||||
|
} else {
|
||||||
|
this.plugin.getQueueManager().removePartyFromQueue(party);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SPECTATING:
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getType() == Material.NETHER_STAR) {
|
||||||
|
if (party == null) {
|
||||||
|
this.plugin.getMatchManager().removeSpectator(player, false);
|
||||||
|
} else {
|
||||||
|
this.plugin.getPartyManager().leaveParty(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getType() == Material.COMPASS) {
|
||||||
|
new SpectateMenu().openMenu(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getType() == Material.EMERALD) {
|
||||||
|
final Match spectating = this.plugin.getMatchManager()
|
||||||
|
.getSpectatingMatch(player.getUniqueId());
|
||||||
|
|
||||||
|
if (spectating != null) {
|
||||||
|
final Player pvp = Bukkit.getPlayer(spectating.getTeams().get(0).getLeader());
|
||||||
|
|
||||||
|
if (pvp != null) {
|
||||||
|
PaperLib.teleportAsync(player, pvp.getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case EDITING:
|
||||||
|
if (event.getClickedBlock() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (event.getClickedBlock().getType()) {
|
||||||
|
case WALL_SIGN:
|
||||||
|
case SIGN:
|
||||||
|
case SIGN_POST:
|
||||||
|
this.plugin.getEditorManager().removeEditor(player.getUniqueId());
|
||||||
|
this.plugin.getPlayerManager().sendToSpawnAndReset(player);
|
||||||
|
break;
|
||||||
|
case CHEST:
|
||||||
|
final Kit kit = this.plugin.getEditorManager().getEditingKit(player.getUniqueId());
|
||||||
|
|
||||||
|
if (kit.getKitEditContents()[0] != null) {
|
||||||
|
final Inventory editorInventory = this.plugin.getServer().createInventory(null, 36);
|
||||||
|
|
||||||
|
editorInventory.setContents(kit.getContents());
|
||||||
|
player.openInventory(editorInventory);
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ANVIL:
|
||||||
|
new KitEditorMenu(Practice.getInstance().getEditorManager().getEditingKit(player.getUniqueId())).openMenu(player);
|
||||||
|
event.setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package com.solexgames.practice.managers;
|
package land.battle.practice.managers;
|
||||||
|
|
||||||
import com.solexgames.core.util.Color;
|
import com.solexgames.core.util.Color;
|
||||||
import com.solexgames.core.util.builder.ItemBuilder;
|
import com.solexgames.core.util.builder.ItemBuilder;
|
||||||
import com.solexgames.practice.util.CC;
|
import land.battle.practice.Practice;
|
||||||
import com.solexgames.practice.util.ItemUtil;
|
import land.battle.practice.util.CC;
|
||||||
|
import land.battle.practice.util.ItemUtil;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -17,6 +18,7 @@ public class ItemManager {
|
|||||||
public static final ItemStack SHOP_ITEM = ItemUtil.createItem(Material.GOLD_INGOT, CC.GOLD + "Shop" + CC.GRAY + " (Right Click)");
|
public static final ItemStack SHOP_ITEM = ItemUtil.createItem(Material.GOLD_INGOT, CC.GOLD + "Shop" + CC.GRAY + " (Right Click)");
|
||||||
|
|
||||||
private final ItemStack[] spawnItems;
|
private final ItemStack[] spawnItems;
|
||||||
|
private final ItemStack[] holandaItems;
|
||||||
private final ItemStack[] queueItems;
|
private final ItemStack[] queueItems;
|
||||||
private final ItemStack[] partyItems;
|
private final ItemStack[] partyItems;
|
||||||
private final ItemStack[] partyNonLeaderItems;
|
private final ItemStack[] partyNonLeaderItems;
|
||||||
@ -30,7 +32,19 @@ public class ItemManager {
|
|||||||
private final ItemStack defaultBook;
|
private final ItemStack defaultBook;
|
||||||
|
|
||||||
public ItemManager() {
|
public ItemManager() {
|
||||||
this.spawnItems = new ItemStack[]{
|
this.spawnItems =
|
||||||
|
new ItemStack[] {
|
||||||
|
ItemUtil.createItem(Material.IRON_SWORD, CC.GOLD + "Join Unranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
||||||
|
ItemUtil.createItem(Material.DIAMOND_SWORD, CC.GOLD + "Join Ranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
||||||
|
ItemUtil.createItem(Material.NETHER_STAR, CC.GOLD + "Create a Party" + CC.GRAY + " (Right Click)"),
|
||||||
|
null,
|
||||||
|
ItemUtil.createItem(Material.GOLD_INGOT, CC.GOLD + "Shop" + CC.GRAY + " (Right Click)"),
|
||||||
|
null,
|
||||||
|
ItemUtil.createItem(Material.EMERALD, CC.GOLD + "Open Leaderboards" + CC.GRAY + " (Right Click)"),
|
||||||
|
ItemUtil.createItem(Material.BOOK, CC.GOLD + "Kit Editor" + CC.GRAY + " (Right Click)"),
|
||||||
|
ItemUtil.createItem(Material.REDSTONE_COMPARATOR, CC.GOLD + "Settings" + CC.GRAY + " (Right Click)")
|
||||||
|
};
|
||||||
|
this.holandaItems = new ItemStack[] {
|
||||||
ItemUtil.createItem(Material.IRON_SWORD, CC.GOLD + "Join Unranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
ItemUtil.createItem(Material.IRON_SWORD, CC.GOLD + "Join Unranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
||||||
ItemUtil.createItem(Material.DIAMOND_SWORD, CC.GOLD + "Join Ranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
ItemUtil.createItem(Material.DIAMOND_SWORD, CC.GOLD + "Join Ranked Matchmaking" + CC.GRAY + " (Right Click)"),
|
||||||
null,
|
null,
|
||||||
@ -137,7 +151,7 @@ public class ItemManager {
|
|||||||
null,
|
null,
|
||||||
};
|
};
|
||||||
this.stickFightItems = new ItemStack[]{
|
this.stickFightItems = new ItemStack[]{
|
||||||
new com.solexgames.practice.util.ItemBuilder(Material.STICK)
|
new land.battle.practice.util.ItemBuilder(Material.STICK)
|
||||||
.enchantment(Enchantment.KNOCKBACK, 1)
|
.enchantment(Enchantment.KNOCKBACK, 1)
|
||||||
.unbreakable()
|
.unbreakable()
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -28,7 +28,7 @@ public class MongoManager {
|
|||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
this.client = CorePlugin.getInstance().getCoreDatabase().getClient();
|
this.client = CorePlugin.getInstance().getCoreDatabase().getClient();
|
||||||
this.database = this.client.getDatabase("Practice");
|
this.database = this.client.getDatabase("SGSoftware");
|
||||||
|
|
||||||
this.players = this.database.getCollection("practice_profiles");
|
this.players = this.database.getCollection("practice_profiles");
|
||||||
this.matchOverviews = this.database.getCollection("practice_matches");
|
this.matchOverviews = this.database.getCollection("practice_matches");
|
||||||
|
@ -225,7 +225,7 @@ public class PlayerManager {
|
|||||||
final PotPlayer potPlayer = CorePlugin.getInstance().getPlayerManager().getPlayer(player);
|
final PotPlayer potPlayer = CorePlugin.getInstance().getPlayerManager().getPlayer(player);
|
||||||
final boolean isModMode = potPlayer != null && potPlayer.isStaffMode();
|
final boolean isModMode = potPlayer != null && potPlayer.isStaffMode();
|
||||||
|
|
||||||
ItemStack[] items = this.plugin.getItemManager().getSpawnItems();
|
ItemStack[] items = !Practice.getInstance().isHolanda() ? this.plugin.getItemManager().getSpawnItems() : plugin.getItemManager().getHolandaItems();
|
||||||
|
|
||||||
if (inTournament) {
|
if (inTournament) {
|
||||||
items = this.plugin.getItemManager().getTournamentItems();
|
items = this.plugin.getItemManager().getTournamentItems();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package land.battle.practice.menu;
|
package land.battle.practice.menu;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
import com.solexgames.core.util.Color;
|
import com.solexgames.core.util.Color;
|
||||||
import com.solexgames.core.util.builder.ItemBuilder;
|
import com.solexgames.core.util.builder.ItemBuilder;
|
||||||
import com.solexgames.core.util.external.Button;
|
import com.solexgames.core.util.external.Button;
|
||||||
@ -15,6 +16,7 @@ import land.battle.practice.runnable.cache.StatusCache;
|
|||||||
import land.battle.practice.util.CC;
|
import land.battle.practice.util.CC;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -45,17 +47,30 @@ public class JoinQueueMenu extends Menu {
|
|||||||
final Map<Integer, Button> buttonMap = new HashMap<>();
|
final Map<Integer, Button> buttonMap = new HashMap<>();
|
||||||
final PlayerData data = Practice.getInstance().getPlayerManager().getPlayerData(player.getUniqueId());
|
final PlayerData data = Practice.getInstance().getPlayerManager().getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
|
for (int i = 9; i < 18; i++) {
|
||||||
|
buttonMap.put(i, new ItemBuilder(XMaterial.GRAY_STAINED_GLASS_PANE.parseMaterial()).setDurability(15).setDisplayName(" ").toButton());
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonMap.put(2, new Button() {
|
||||||
|
@Override
|
||||||
|
public ItemStack getButtonItem(Player player) {
|
||||||
|
return new ItemBuilder(XMaterial.EMERALD.parseMaterial()).setDisplayName("&eAll Kits").addLore(Arrays.asList("&7View all of our kits!", "", "&aClick to view!")).create();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buttonMap.put(11, new ItemBuilder(XMaterial.GREEN_STAINED_GLASS_PANE.parseMaterial()).setDurability(5).setDisplayName(" ").toButton());
|
||||||
|
|
||||||
|
|
||||||
if (this.queueType.isRanked()) {
|
if (this.queueType.isRanked()) {
|
||||||
Practice.getInstance().getKitManager().getKits().stream()
|
Practice.getInstance().getKitManager().getKits().stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(Kit::isRanked)
|
.filter(Kit::isRanked)
|
||||||
.filter(Kit::isEnabled)
|
.filter(Kit::isEnabled)
|
||||||
.forEachOrdered(kit -> buttonMap.put(kit.getQueueMenu() + 10, new KitButton(kit, data)));
|
.forEachOrdered(kit -> buttonMap.put(kit.getQueueMenu() + 19, new KitButton(kit, data)));
|
||||||
} else {
|
} else {
|
||||||
Practice.getInstance().getKitManager().getKits().stream()
|
Practice.getInstance().getKitManager().getKits().stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(Kit::isEnabled)
|
.filter(Kit::isEnabled)
|
||||||
.forEachOrdered(kit -> buttonMap.put(kit.getQueueMenu() + 10, new KitButton(kit, data)));
|
.forEachOrdered(kit -> buttonMap.put(kit.getQueueMenu() + 19, new KitButton(kit, data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return buttonMap;
|
return buttonMap;
|
||||||
@ -72,8 +87,8 @@ public class JoinQueueMenu extends Menu {
|
|||||||
final List<String> lore = new ArrayList<>();
|
final List<String> lore = new ArrayList<>();
|
||||||
final int playing = StatusCache.getInstance().getFightingKits().get(this.queue);
|
final int playing = StatusCache.getInstance().getFightingKits().get(this.queue);
|
||||||
|
|
||||||
lore.add("&7In Queue: &f" + Practice.getInstance().getQueueManager().getQueueSize(this.queue.getName(), JoinQueueMenu.this.queueType));
|
lore.add("&7In Queue: &f" + getQueued(queue));
|
||||||
lore.add("&7In Fights: &f" + playing);
|
lore.add("&7In Fights: &f" + getFighting(queue));
|
||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
lore.add("&6&lDaily Winstreaks:");
|
lore.add("&6&lDaily Winstreaks:");
|
||||||
lore.addAll(LeaderboardUpdateRunnable.KIT_SPECIFIC_WIN_STREAK_LORE_SHORT.getOrDefault(this.queue, Collections.emptyList()));
|
lore.addAll(LeaderboardUpdateRunnable.KIT_SPECIFIC_WIN_STREAK_LORE_SHORT.getOrDefault(this.queue, Collections.emptyList()));
|
||||||
@ -88,6 +103,38 @@ public class JoinQueueMenu extends Menu {
|
|||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getQueued(Kit kit) {
|
||||||
|
int i = 0;
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
PlayerData data = Practice.getInstance().getPlayerManager().getPlayerData(player.getUniqueId());
|
||||||
|
if (data.getPlayerState() == PlayerState.QUEUE) {
|
||||||
|
if (Objects.equals(Practice.getInstance().getQueueManager().getQueueEntry(player.getUniqueId()).getKitName(), kit.getName()) && Practice.getInstance().getQueueManager().getQueueEntry(player.getUniqueId()).getQueueType() == queueType) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFighting(Kit kit) {
|
||||||
|
int i = 0;
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
PlayerData data = Practice.getInstance().getPlayerManager().getPlayerData(player.getUniqueId());
|
||||||
|
if (data.getPlayerState() == PlayerState.FIGHTING) {
|
||||||
|
if (Objects.equals(Practice.getInstance().getMatchManager().getMatch(data.getCurrentMatchID()).getKit().getName(), kit.getName()) && Practice.getInstance().getMatchManager().getMatch(data.getCurrentMatchID()).getType() == queueType) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clicked(Player player, ClickType clickType) {
|
public void clicked(Player player, ClickType clickType) {
|
||||||
final Party party = Practice.getInstance().getPartyManager().getParty(player.getUniqueId());
|
final Party party = Practice.getInstance().getPartyManager().getParty(player.getUniqueId());
|
||||||
@ -111,7 +158,7 @@ public class JoinQueueMenu extends Menu {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return 36;
|
return 45;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,4 +79,6 @@ public class StatusCache extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,11 @@ import land.battle.practice.settings.item.ProfileOptionsItemState;
|
|||||||
import land.battle.practice.util.CC;
|
import land.battle.practice.util.CC;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,4 +176,19 @@ public class PracticeSettingsImpl implements ISettings {
|
|||||||
|
|
||||||
return buttonList;
|
return buttonList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Button getCategoryButton() {
|
||||||
|
return new Button() {
|
||||||
|
@Override
|
||||||
|
public ItemStack getButtonItem(Player player) {
|
||||||
|
return new ItemBuilder(Material.STAINED_GLASS_PANE).setDurability(1).setDisplayName("&6Practice Settings").addLore(Arrays.asList("&7The settings for the Practice.", "", "&aClick to browse!")).create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clicked(Player player, int slot, ClickType clickType, int hotbarSlot) {
|
||||||
|
new PracticeSettingsMenu().openMenu(player);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package land.battle.practice.settings;
|
||||||
|
|
||||||
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
|
import com.solexgames.core.CorePlugin;
|
||||||
|
import com.solexgames.core.player.PotPlayer;
|
||||||
|
import com.solexgames.core.util.Color;
|
||||||
|
import com.solexgames.core.util.builder.ItemBuilder;
|
||||||
|
import com.solexgames.core.util.external.Button;
|
||||||
|
import com.solexgames.core.util.external.Menu;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class PracticeSettingsMenu extends Menu {
|
||||||
|
@Override
|
||||||
|
public String getTitle(Player var1) {
|
||||||
|
return "Settings ";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, com.solexgames.core.util.external.Button> getButtons(Player player) {
|
||||||
|
Map<Integer, com.solexgames.core.util.external.Button> buttonMap = new HashMap();
|
||||||
|
PotPlayer potPlayer = CorePlugin.getInstance().getPlayerManager().getPlayer(player);
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; ++i) {
|
||||||
|
buttonMap.put(i, (new ItemBuilder(XMaterial.GRAY_STAINED_GLASS_PANE.parseMaterial())).setDurability(15).setDisplayName(" ").toButton());
|
||||||
|
}
|
||||||
|
|
||||||
|
AtomicInteger integer2 = new AtomicInteger(9);
|
||||||
|
AtomicInteger integer = new AtomicInteger(0);
|
||||||
|
CorePlugin.getInstance().getSettingsList().forEach((settings -> buttonMap.put(integer.getAndIncrement(), settings.getCategoryButton())));
|
||||||
|
for (com.solexgames.core.util.external.Button button : new PracticeSettingsImpl().getButtons(player)) buttonMap.put(integer2.getAndIncrement(), button);
|
||||||
|
|
||||||
|
return buttonMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -29,12 +29,8 @@ public class MatchBoardAdapter implements PlayerStateAdapter {
|
|||||||
public List<String> handleBoard(Player player, PlayerData playerData, Party party) {
|
public List<String> handleBoard(Player player, PlayerData playerData, Party party) {
|
||||||
final List<String> stringList = new ArrayList<>();
|
final List<String> stringList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final Match match = this.plugin.getMatchManager().getMatch(player.getUniqueId());
|
final Match match = this.plugin.getMatchManager().getMatch(player.getUniqueId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import land.battle.practice.queue.QueueEntry;
|
|||||||
import land.battle.practice.queue.QueueType;
|
import land.battle.practice.queue.QueueType;
|
||||||
import land.battle.practice.state.PlayerStateAdapter;
|
import land.battle.practice.state.PlayerStateAdapter;
|
||||||
import land.battle.practice.util.CC;
|
import land.battle.practice.util.CC;
|
||||||
|
import land.battle.practice.util.TimeUtil;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -29,6 +30,7 @@ public class QueueBoardAdapter implements PlayerStateAdapter {
|
|||||||
this.plugin.getQueueManager().getQueueEntry(party.getLeader());
|
this.plugin.getQueueManager().getQueueEntry(party.getLeader());
|
||||||
|
|
||||||
stringList.add(" ");
|
stringList.add(" ");
|
||||||
|
if (!Practice.getInstance().isHolanda()) {
|
||||||
stringList.add(CC.GOLD + "Queued for:");
|
stringList.add(CC.GOLD + "Queued for:");
|
||||||
stringList.add(" " + queueEntry.getQueueType().getName() + " " + queueEntry.getKitName());
|
stringList.add(" " + queueEntry.getQueueType().getName() + " " + queueEntry.getKitName());
|
||||||
|
|
||||||
@ -56,6 +58,17 @@ public class QueueBoardAdapter implements PlayerStateAdapter {
|
|||||||
|
|
||||||
stringList.add(" " + eloRangeString);
|
stringList.add(" " + eloRangeString);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
stringList.add(CC.GOLD + "Queue:");
|
||||||
|
stringList.add(queueEntry.getQueueType().getName() + " " + queueEntry.getKitName());
|
||||||
|
final long queueTime = System.currentTimeMillis() -
|
||||||
|
(party == null ? this.plugin.getQueueManager().getPlayerQueueTime(player
|
||||||
|
.getUniqueId())
|
||||||
|
: this.plugin.getQueueManager().getPlayerQueueTime(party.getLeader()));
|
||||||
|
|
||||||
|
int seconds = Math.round((float) queueTime / 1000L);
|
||||||
|
stringList.add("Time: " + CC.GOLD + TimeUtil.formatIntoSimpleString(seconds));
|
||||||
|
}
|
||||||
|
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package land.battle.practice.state.impl;
|
|||||||
|
|
||||||
import com.solexgames.core.CorePlugin;
|
import com.solexgames.core.CorePlugin;
|
||||||
import com.solexgames.core.player.PotPlayer;
|
import com.solexgames.core.player.PotPlayer;
|
||||||
|
import land.battle.practice.Practice;
|
||||||
import land.battle.practice.party.Party;
|
import land.battle.practice.party.Party;
|
||||||
import land.battle.practice.player.PlayerData;
|
import land.battle.practice.player.PlayerData;
|
||||||
import land.battle.practice.runnable.cache.StatusCache;
|
import land.battle.practice.runnable.cache.StatusCache;
|
||||||
@ -26,11 +27,14 @@ public class SpawnBoardAdapter implements PlayerStateAdapter {
|
|||||||
final List<String> stringList = new ArrayList<>();
|
final List<String> stringList = new ArrayList<>();
|
||||||
final PotPlayer potPlayer = CorePlugin.getInstance().getPlayerManager().getPlayer(player);
|
final PotPlayer potPlayer = CorePlugin.getInstance().getPlayerManager().getPlayer(player);
|
||||||
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(playerData.getGlobalElo());
|
final RankedDivision rankedDivision = RankedDivision.getByGlobalElo(playerData.getGlobalElo());
|
||||||
|
if (!Practice.getInstance().isHolanda()) {
|
||||||
stringList.add(CC.GRAY + "Online: " + CC.AQUA + Bukkit.getOnlinePlayers().size());
|
stringList.add(CC.GRAY + "Online: " + CC.AQUA + Bukkit.getOnlinePlayers().size());
|
||||||
stringList.add(CC.GRAY + "In Fights: " + CC.AQUA + StatusCache.getInstance().getFighting());
|
stringList.add(CC.GRAY + "In Fights: " + CC.AQUA + StatusCache.getInstance().getFighting());
|
||||||
stringList.add(CC.GRAY + "Division: " + CC.BLUE + rankedDivision.getFancyName());
|
stringList.add(CC.GRAY + "Division: " + CC.BLUE + rankedDivision.getFancyName());
|
||||||
|
} else {
|
||||||
|
stringList.add(CC.WHITE + "Online: " + CC.GOLD + Bukkit.getOnlinePlayers().size());
|
||||||
|
stringList.add(CC.WHITE + "In Fights: " + CC.GOLD + StatusCache.getInstance().getFighting());
|
||||||
|
}
|
||||||
|
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,23 @@ public class TimeUtil {
|
|||||||
|
|
||||||
return ((hr > 0) ? String.format("%02d:", hr) : "") + String.format("%02d:%02d", min, sec);
|
return ((hr > 0) ? String.format("%02d:", hr) : "") + String.format("%02d:%02d", min, sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatIntoSimpleString(int secs) {
|
||||||
|
if (secs == 0) {
|
||||||
|
return "0s";
|
||||||
|
}
|
||||||
|
int remainder = secs % 86400;
|
||||||
|
|
||||||
|
int days = secs / 86400;
|
||||||
|
int hours = remainder / 3600;
|
||||||
|
int minutes = (remainder / 60) - (hours * 60);
|
||||||
|
int seconds = (remainder % 3600) - (minutes * 60);
|
||||||
|
|
||||||
|
String fDays = (days > 0 ? " " + days + "d" : "");
|
||||||
|
String fHours = (hours > 0 ? " " + hours + "h" : "");
|
||||||
|
String fMinutes = (minutes > 0 ? " " + minutes + "m" : "");
|
||||||
|
String fSeconds = (seconds > 0 ? " " + seconds + "s" : "");
|
||||||
|
|
||||||
|
return ((fDays + fHours + fMinutes + fSeconds).trim());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ public class VoteManager {
|
|||||||
private final Practice plugin;
|
private final Practice plugin;
|
||||||
private final List<UUID> pendingVotes = new ArrayList<>();
|
private final List<UUID> pendingVotes = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
public void sendVoteMessage(Player player, Arena arena) {
|
public void sendVoteMessage(Player player, Arena arena) {
|
||||||
|
|
||||||
ChatComponentBuilder builder = new ChatComponentBuilder("");
|
ChatComponentBuilder builder = new ChatComponentBuilder("");
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package land.battle.practice.vote.commands;
|
package land.battle.practice.vote.commands;
|
||||||
|
|
||||||
import com.solexgames.lib.acf.BaseCommand;
|
import com.solexgames.lib.acf.BaseCommand;
|
||||||
import com.solexgames.lib.acf.annotation.CommandAlias;
|
import com.solexgames.lib.acf.annotation.*;
|
||||||
import com.solexgames.lib.acf.annotation.CommandPermission;
|
import com.solexgames.lib.commons.command.context.CommonsPlayer;
|
||||||
import com.solexgames.lib.acf.annotation.Default;
|
|
||||||
import land.battle.practice.Practice;
|
import land.battle.practice.Practice;
|
||||||
|
import land.battle.practice.arena.Arena;
|
||||||
import land.battle.practice.player.PlayerData;
|
import land.battle.practice.player.PlayerData;
|
||||||
import land.battle.practice.player.PlayerState;
|
import land.battle.practice.player.PlayerState;
|
||||||
import land.battle.practice.util.CC;
|
import land.battle.practice.util.CC;
|
||||||
@ -13,33 +13,26 @@ import land.battle.practice.util.TaskUtil;
|
|||||||
|
|
||||||
import land.battle.practice.vote.Vote;
|
import land.battle.practice.vote.Vote;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BattleLand Team
|
* @author BattleLand Team
|
||||||
* @since 5/17/2021
|
* @since 5/17/2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@CommandAlias("rate")
|
@CommandAlias("rate")
|
||||||
public class RateCommand extends BaseCommand {
|
public class RateCommand extends BaseCommand {
|
||||||
|
|
||||||
@Default
|
@Default
|
||||||
public void onDefault(CommandArgs command) {
|
@Syntax("<vote>")
|
||||||
|
@CommandCompletion("@unvanished")
|
||||||
Player player = command.getPlayer();
|
public void onDefault(Player player, String v) {
|
||||||
String[] args = command.getArgs();
|
|
||||||
|
|
||||||
if (args.length != 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final PlayerData playerData = Practice.getInstance().getPlayerManager()
|
final PlayerData playerData = Practice.getInstance().getPlayerManager()
|
||||||
.getPlayerData(player.getUniqueId());
|
.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
|
|
||||||
Vote vote;
|
Vote vote;
|
||||||
try {
|
try {
|
||||||
vote = Vote.valueOf(args[0]);
|
vote = Vote.valueOf(v);
|
||||||
}
|
}
|
||||||
catch (Exception unused) {
|
catch (Exception unused) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user