This commit is contained in:
Trixkz 2021-11-22 08:14:39 -05:00
parent e0418654bb
commit 093ec17f0c
6 changed files with 29 additions and 134 deletions

View File

@ -23,11 +23,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="998d5e92-ac1f-4423-8aef-5f389ab213de" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/listeners/GameStartListener.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/BedWars.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/BedWars.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameState.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameState.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/events/GameStartEvent.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameType.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/game/GameType.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/listeners/InteractListener.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menus/queue/QueueMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menus/queue/PlayAGameMenu.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/menusystem/menu/PlayAGameMenu.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -165,21 +166,21 @@
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="499" y="159" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637505947686" />
<state width="1493" height="204" key="GridCell.Tab.0.bottom" timestamp="1637531590753">
<state width="1493" height="204" key="GridCell.Tab.0.bottom" timestamp="1637586640339">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637531590753" />
<state width="1493" height="204" key="GridCell.Tab.0.center" timestamp="1637531590753">
<state width="1493" height="204" key="GridCell.Tab.0.bottom/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.center" timestamp="1637586640339">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637531590753" />
<state width="1493" height="204" key="GridCell.Tab.0.left" timestamp="1637531590753">
<state width="1493" height="204" key="GridCell.Tab.0.center/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.left" timestamp="1637586640339">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637531590753" />
<state width="1493" height="204" key="GridCell.Tab.0.right" timestamp="1637531590753">
<state width="1493" height="204" key="GridCell.Tab.0.left/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
<state width="1493" height="204" key="GridCell.Tab.0.right" timestamp="1637586640339">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1493" height="204" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637531590753" />
<state width="1493" height="204" key="GridCell.Tab.0.right/0.0.1536.824/1920.0.800.560@0.0.1536.824" timestamp="1637586640339" />
</component>
</project>

View File

@ -11,16 +11,16 @@ import java.util.List;
@RequiredArgsConstructor
public enum GameType {
V1(10, "1v1", Arrays.asList(" ", "&9You have to start somewhere,", "&9so why not start here?"),
V1(10, "BedWars 1v1", Arrays.asList(" ", "&9You have to start somewhere,", "&9so why not start here?"),
Material.WOOD_SWORD,
0, 2),
V2(12, "2v2", Arrays.asList(" ", "&9Adapt, overcome and conquer,", "&9you are advancing rapidly."),
V2(12, "BedWars 2v2", Arrays.asList(" ", "&9Adapt, overcome and conquer,", "&9you are advancing rapidly"),
Material.STONE_SWORD,
0, 4),
V3(14, "3v3", Arrays.asList(" ", "&9How crazy is this, it seems", "&9like it was just yesterday", "&9since you started."),
V3(14, "BedWars 3v3", Arrays.asList(" ", "&9How crazy is this,", "&9it seems like it was just yesterday", "&9since you started"),
Material.IRON_SWORD,
0, 6),
V4(16, "4v4", Arrays.asList(" ", "&9You are now a master of BedWars,", "&9you are now capable of going", "&9up against the undefeated PvP Bot", "&7(Coming soon...)"),
V4(16, "BedWars 4v4", Arrays.asList(" ", "&9You are now a master,", "&9you can go up against", "&9the undefeated PvP bot &7(Coming soon)"),
Material.DIAMOND_SWORD, 0, 8);
private final int slot;

View File

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

View File

@ -17,7 +17,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class QueueMenu extends Menu {
public class PlayAGameMenu extends Menu {
@Override
public boolean isUpdateAfterClick() {
@ -34,17 +34,17 @@ public class QueueMenu extends Menu {
Map<Integer, Button> buttons = new HashMap<>();
for (GameType type : GameType.values()) {
buttons.put(type.getSlot(), new QueueButton("&d&l" + type.getName(), type.getLore(), type, type.getMaterial(), type.getData()));
buttons.put(type.getSlot(), new QueueButton("&d" + type.getName(), type.getLore(), type, type.getMaterial(), type.getData()));
}
fillEmptySlots(buttons, new ItemBuilder(Material.STAINED_GLASS_PANE).durability(7).name(" ").build());
fillEmptySlots(buttons, new ItemBuilder(Material.STAINED_GLASS_PANE).durability(7).name("").build());
return buttons;
}
@Override
public int getSize() {
return 3 * 9;
return 27;
}
@AllArgsConstructor
@ -62,19 +62,12 @@ public class QueueMenu extends Menu {
loreList.add(" ");
loreList.add("&fPlaying: &b" + BedWars.getInstance().getGameManager().getPlayingByType(gameType));
return new ItemBuilder(material)
.name(name)
.durability(data)
.amount(BedWars.getInstance().getGameManager().getPlayingByType(gameType) > 0 ? BedWars.getInstance().getGameManager().getPlayingByType(gameType) : 1)
.lore(loreList)
.hideFlags()
.build();
return new ItemBuilder(material).name(name).durability(data).amount(BedWars.getInstance().getGameManager().getPlayingByType(gameType) > 0 ? BedWars.getInstance().getGameManager().getPlayingByType(gameType) : 1).lore(loreList).build();
}
@Override
public void clicked(Player player, int slot, ClickType clickType, int hotbarButton) {
BedWars.getInstance().getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), gameType);
playNeutral(player);
}
}
}

View File

@ -1,98 +0,0 @@
package rip.tilly.bedwars.menusystem.menu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
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.PlayerMenuUtil;
import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.ItemBuilder;
import java.util.ArrayList;
import java.util.List;
public class PlayAGameMenu extends Menu {
private BedWars main = BedWars.getInstance();
private GameType gameType;
public PlayAGameMenu(PlayerMenuUtil playerMenuUtil, GameType gameType) {
super(playerMenuUtil);
this.gameType = gameType;
}
@Override
public String getMenuName() {
return CC.translate("&eSelect a game to play...");
}
@Override
public int getSlots() {
return 27;
}
@Override
public void handleMenu(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (event.getView().getTitle().equalsIgnoreCase(CC.translate("&eSelect a game to play..."))) {
this.main.getQueueManager().addPlayerToQueue(player, BedWars.getInstance().getPlayerDataManager().getPlayerData(player.getUniqueId()), this.gameType);
player.closeInventory();
}
}
@Override
public void setMenuItems() {
List<String> bedWars1v1Lore = new ArrayList<String>();
bedWars1v1Lore.add(CC.translate(""));
bedWars1v1Lore.add(CC.translate("&9You have to start somewhere,"));
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();
List<String> bedWars2v2Lore = new ArrayList<String>();
bedWars2v2Lore.add(CC.translate(""));
bedWars2v2Lore.add(CC.translate("&9Adapt, overcome, and conquer,"));
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();
List<String> bedWars3v3Lore = new ArrayList<String>();
bedWars3v3Lore.add(CC.translate(""));
bedWars3v3Lore.add(CC.translate("&9How crazy is this,"));
bedWars3v3Lore.add(CC.translate("&9it seems like it was just yesterday"));
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();
List<String> bedWars4v4Lore = new ArrayList<String>();
bedWars4v4Lore.add(CC.translate(""));
bedWars4v4Lore.add(CC.translate("&9You are now a master,"));
bedWars4v4Lore.add(CC.translate("&9you can go up against"));
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();
this.inventory.setItem(10, bedWars1v1ItemStack);
this.inventory.setItem(12, bedWars2v2ItemStack);
this.inventory.setItem(14, bedWars3v3ItemStack);
this.inventory.setItem(16, bedWars4v4ItemStack);
this.setFillerGlass();
}
}

View File

@ -51,6 +51,7 @@ public class ScoreboardProvider implements AssembleAdapter {
if (this.main.getPartyManager().getParty(playerData.getUniqueId()) != null) {
Party party = this.main.getPartyManager().getParty(playerData.getUniqueId());
lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName());
lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit());
lines.add(CC.scoreboardBar);
@ -58,9 +59,12 @@ public class ScoreboardProvider implements AssembleAdapter {
if (playerData.getPlayerState() == PlayerState.QUEUE) {
QueueEntry queueEntry = this.main.getQueueManager().getQueueEntry(playerData.getUniqueId());
if (queueEntry != null) {
long queueTime = System.currentTimeMillis() - (this.main.getQueueManager().getPlayerQueueTime(playerData.getUniqueId()));
String formattedQueueTime = TimeUtils.formatIntoMMSS(Math.round(queueTime / 1000L));
lines.add("&e" + queueEntry.getGameType().getName() + " Queue");
lines.add("&fTime: &d" + formattedQueueTime);
lines.add(CC.scoreboardBar);