fixed your bull shit

This commit is contained in:
Trixkz 2021-11-22 07:28:22 -05:00
parent fea257f914
commit 1b022e25a9
5 changed files with 57 additions and 9 deletions

View File

@ -124,7 +124,7 @@ public final class BedWars extends JavaPlugin {
private void loadListeners() { private void loadListeners() {
Arrays.asList( Arrays.asList(
new PlayerDataListener(), new RandomListeners(), new InteractListener(), new ButtonListener(), new PlayerDataListener(), new RandomListeners(), new InteractListener(), new ButtonListener(), new MenuListener(),
new GameStartListener(), new GameEndListener(), new WorldListener(), new MovementListener(), new GameStartListener(), new GameEndListener(), new WorldListener(), new MovementListener(),
new PlayerKillListener() new PlayerKillListener()
).forEach(listener -> this.getServer().getPluginManager().registerEvents(listener, this)); ).forEach(listener -> this.getServer().getPluginManager().registerEvents(listener, this));

View File

@ -10,8 +10,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.TrapDoor; import org.bukkit.material.TrapDoor;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.GameType;
import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem; import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem;
import rip.tilly.bedwars.menus.queue.QueueMenu; import rip.tilly.bedwars.menus.queue.QueueMenu;
import rip.tilly.bedwars.menusystem.menu.PlayAGameMenu;
import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.playerdata.PlayerState; import rip.tilly.bedwars.playerdata.PlayerState;
@ -75,7 +77,9 @@ public class InteractListener implements Listener {
case SPAWN: case SPAWN:
switch (hotbarItem.getActionType()) { switch (hotbarItem.getActionType()) {
case QUEUE_MENU: case QUEUE_MENU:
new QueueMenu().openMenu(player); for (GameType gameType : GameType.values()) {
new PlayAGameMenu(this.plugin.getPlayerMenuUtil(player), gameType).open();
}
break; break;
case SETTINGS_MENU: case SETTINGS_MENU:

View File

@ -0,0 +1,27 @@
package rip.tilly.bedwars.listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.InventoryHolder;
import rip.tilly.bedwars.menusystem.Menu;
public class MenuListener implements Listener {
@EventHandler
public void onMenuClick(InventoryClickEvent event) {
InventoryHolder holder = event.getInventory().getHolder();
if (holder instanceof Menu) {
event.setCancelled(true);
if (event.getCurrentItem() == null) {
return;
}
Menu menu = (Menu) holder;
menu.handleMenu(event);
}
}
}

View File

@ -4,6 +4,8 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.game.GameType;
import rip.tilly.bedwars.menusystem.Menu; import rip.tilly.bedwars.menusystem.Menu;
import rip.tilly.bedwars.menusystem.PlayerMenuUtil; import rip.tilly.bedwars.menusystem.PlayerMenuUtil;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
@ -14,8 +16,14 @@ import java.util.List;
public class PlayAGameMenu extends Menu { public class PlayAGameMenu extends Menu {
public PlayAGameMenu(PlayerMenuUtil playerMenuUtil) { private BedWars main = BedWars.getInstance();
private GameType gameType;
public PlayAGameMenu(PlayerMenuUtil playerMenuUtil, GameType gameType) {
super(playerMenuUtil); super(playerMenuUtil);
this.gameType = gameType;
} }
@Override @Override
@ -54,6 +62,8 @@ public class PlayAGameMenu extends Menu {
bedWars1v1Lore.add(CC.translate("")); bedWars1v1Lore.add(CC.translate(""));
bedWars1v1Lore.add(CC.translate("&9You have to start somewhere,")); bedWars1v1Lore.add(CC.translate("&9You have to start somewhere,"));
bedWars1v1Lore.add(CC.translate("&9so why not start here?")); bedWars1v1Lore.add(CC.translate("&9so why not start here?"));
bedWars1v1Lore.add(CC.translate(""));
bedWars1v1Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType)));
ItemStack bedWars1v1ItemStack = new ItemBuilder(Material.WOOD_SWORD).name(CC.translate("&dBedWars 1v1")).lore(bedWars1v1Lore).build(); ItemStack bedWars1v1ItemStack = new ItemBuilder(Material.WOOD_SWORD).name(CC.translate("&dBedWars 1v1")).lore(bedWars1v1Lore).build();
@ -61,6 +71,8 @@ public class PlayAGameMenu extends Menu {
bedWars2v2Lore.add(CC.translate("")); bedWars2v2Lore.add(CC.translate(""));
bedWars2v2Lore.add(CC.translate("&9Adapt, overcome, and conquer,")); bedWars2v2Lore.add(CC.translate("&9Adapt, overcome, and conquer,"));
bedWars2v2Lore.add(CC.translate("&9you are advancing rapidly")); bedWars2v2Lore.add(CC.translate("&9you are advancing rapidly"));
bedWars2v2Lore.add(CC.translate(""));
bedWars2v2Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType)));
ItemStack bedWars2v2ItemStack = new ItemBuilder(Material.STONE_SWORD).name(CC.translate("&dBedWars 2v2")).lore(bedWars2v2Lore).build(); ItemStack bedWars2v2ItemStack = new ItemBuilder(Material.STONE_SWORD).name(CC.translate("&dBedWars 2v2")).lore(bedWars2v2Lore).build();
@ -69,6 +81,9 @@ public class PlayAGameMenu extends Menu {
bedWars3v3Lore.add(CC.translate("&9How crazy is this,")); bedWars3v3Lore.add(CC.translate("&9How crazy is this,"));
bedWars3v3Lore.add(CC.translate("&9it seems like it was just yesterday")); bedWars3v3Lore.add(CC.translate("&9it seems like it was just yesterday"));
bedWars3v3Lore.add(CC.translate("&9since you started")); bedWars3v3Lore.add(CC.translate("&9since you started"));
bedWars3v3Lore.add(CC.translate(""));
bedWars3v3Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType)));
ItemStack bedWars3v3ItemStack = new ItemBuilder(Material.IRON_SWORD).name(CC.translate("&dBedWars 3v3")).lore(bedWars3v3Lore).build(); ItemStack bedWars3v3ItemStack = new ItemBuilder(Material.IRON_SWORD).name(CC.translate("&dBedWars 3v3")).lore(bedWars3v3Lore).build();
@ -77,6 +92,8 @@ public class PlayAGameMenu extends Menu {
bedWars4v4Lore.add(CC.translate("&9You are now a master,")); bedWars4v4Lore.add(CC.translate("&9You are now a master,"));
bedWars4v4Lore.add(CC.translate("&9you can go up against")); bedWars4v4Lore.add(CC.translate("&9you can go up against"));
bedWars4v4Lore.add(CC.translate("&9the undefeated PvP bot &7(Coming soon)")); bedWars4v4Lore.add(CC.translate("&9the undefeated PvP bot &7(Coming soon)"));
bedWars4v4Lore.add(CC.translate(""));
bedWars4v4Lore.add(CC.translate("&fPlaying: &b" + this.main.getGameManager().getPlayingByType(this.gameType)));
ItemStack bedWars4v4ItemStack = new ItemBuilder(Material.DIAMOND_SWORD).name(CC.translate("&dBedWars 4v4")).lore(bedWars4v4Lore).build(); ItemStack bedWars4v4ItemStack = new ItemBuilder(Material.DIAMOND_SWORD).name(CC.translate("&dBedWars 4v4")).lore(bedWars4v4Lore).build();

View File

@ -48,28 +48,28 @@ public class ScoreboardProvider implements AssembleAdapter {
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
lines.add(CC.scoreboardBar); lines.add(CC.scoreboardBar);
boolean inParty = this.main.getPartyManager().getParty(playerData.getUniqueId()) != null;
if (inParty) { if (this.main.getPartyManager().getParty(playerData.getUniqueId()) != null) {
Party party = this.main.getPartyManager().getParty(playerData.getUniqueId()); Party party = this.main.getPartyManager().getParty(playerData.getUniqueId());
lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName()); lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName());
lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit()); lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit());
lines.add(CC.scoreboardBar); lines.add(CC.scoreboardBar);
} }
lines.add("&fOnline: &d" + this.main.getServer().getOnlinePlayers().size());
lines.add("&fPlaying: &d" + this.main.getGameManager().getPlaying());
if (playerData.getPlayerState() == PlayerState.QUEUE) { if (playerData.getPlayerState() == PlayerState.QUEUE) {
QueueEntry queueEntry = this.main.getQueueManager().getQueueEntry(playerData.getUniqueId()); QueueEntry queueEntry = this.main.getQueueManager().getQueueEntry(playerData.getUniqueId());
if (queueEntry != null) { if (queueEntry != null) {
long queueTime = System.currentTimeMillis() - (this.main.getQueueManager().getPlayerQueueTime(playerData.getUniqueId())); long queueTime = System.currentTimeMillis() - (this.main.getQueueManager().getPlayerQueueTime(playerData.getUniqueId()));
String formattedQueueTime = TimeUtils.formatIntoMMSS(Math.round(queueTime / 1000L)); String formattedQueueTime = TimeUtils.formatIntoMMSS(Math.round(queueTime / 1000L));
lines.add(CC.scoreboardBar);
lines.add("&e" + queueEntry.getGameType().getName() + " Queue"); lines.add("&e" + queueEntry.getGameType().getName() + " Queue");
lines.add("&fTime: &d" + formattedQueueTime); lines.add("&fTime: &d" + formattedQueueTime);
lines.add(CC.scoreboardBar);
} }
} }
lines.add("&fOnline: &d" + this.main.getServer().getOnlinePlayers().size());
lines.add("&fPlaying: &d" + this.main.getGameManager().getPlaying());
lines.add(" "); lines.add(" ");
lines.add("&fLevel: &d" + playerData.getLevel()); lines.add("&fLevel: &d" + playerData.getLevel());