Skip to content

Commit

Permalink
Started on Hotbar code.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustBru00 committed Jul 21, 2020
1 parent f30a64d commit b3697f0
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 25 deletions.
10 changes: 9 additions & 1 deletion src/com/gmail/justbru00/nethercube/elytra/gui/GUIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class GUIManager {

private static ItemStack elyBorderGlassSide;
private static ItemStack elyBorderGlassCorner;
private static ItemStack elyBackToElytraLobby;

private static ItemStack okay;
private static ItemStack cancel;
Expand All @@ -32,10 +33,15 @@ public class GUIManager {
public static void init() {
elyBorderGlassSide = new ItemBuilder(Material.STAINED_GLASS_PANE).setDataValue(3).setName("&r").build();
elyBorderGlassCorner = new ItemBuilder(Material.STAINED_GLASS_PANE).setDataValue(11).setName("&r").build();
elyBackToElytraLobby = new ItemBuilder(Material.ELYTRA).setName("&eBack to elytra lobby").build();

okay = new ItemBuilder(Material.EMERALD_BLOCK).setName("&a&lOkay").build();
cancel = new ItemBuilder(Material.REDSTONE_BLOCK).setName("&c&lCancel").build();
cannotAffordMap = new ItemBuilder(Material.BARRIER).setName("&c&lYou can't afford that map").build();
}

public static ItemStack getElyBackToElytraLobby() {
return elyBackToElytraLobby;
}

public static ItemStack getElyBorderGlassSide() {
Expand Down Expand Up @@ -128,7 +134,7 @@ public static void openMainGUI(Player p) {
Inventory inv = Bukkit.createInventory(null, 54, Messager.color("&cCurrency: " + pd.getCurrency()));

// Set the border glass
Integer[] borderSideSlots = { 1, 2, 3, 4, 5, 6, 7, 9, 17, 18, 26, 27, 35, 36, 44, 46, 47, 48, 49, 50, 51, 52 };
Integer[] borderSideSlots = { 1, 2, 3, 5, 6, 7, 9, 17, 18, 26, 27, 35, 36, 44, 46, 47, 48, 49, 50, 51, 52 };
Integer[] borderCornerSlots = { 0, 8, 45, 53 };

for (Integer slot : borderSideSlots) {
Expand All @@ -138,6 +144,8 @@ public static void openMainGUI(Player p) {
for (Integer slot : borderCornerSlots) {
inv.setItem(slot, getElyBorderGlassCorner());
}

inv.setItem(4, getElyBackToElytraLobby());

// Fill the maps in
for (Map map : MapManager.getMaps()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
package com.gmail.justbru00.nethercube.elytra.gui;

import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import com.gmail.justbru00.nethercube.elytra.utils.ItemBuilder;

public class HotbarGUI {
public class HotbarGUIManager {
// Chapter back inactive
// /give @p skull 1 3 {display:{Name:"Chapter Back"},SkullOwner:{Id:"9d008ae1-9bfa-4d9c-a05d-46d4d9c9db4e",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGZlNjY4ZTBkMzE0MTk3OGI4YWUyN2JmMjExYjAxYjQ0ZjEwNmI5ZDY0NzQxN2I4NTIwYTBhZGJjZjJlZjM1ZiJ9fX0="}]}}}


// Chapter back active
// /give @p skull 1 3 {display:{Name:"Chapter Back (active)"},SkullOwner:{Id:"1835860f-4273-4093-8444-fd1549e02b34",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGE1M2QwNDc5N2I0N2E2ODQ4NGQxMTEwMjVkOTQwYTM0ODg2YTBmYThkYzgwNmU3NDU3MDI0YTg3ZjFhYmQ1NiJ9fX0="}]}}}
private static ItemStack elytra;
private static ItemStack restartCurrentMapItem;
private static ItemStack restartCurrentMapClickedItem;
private static ItemStack exitToElytraLobbyItem;
private static ItemStack hidePlayersItem;
private static ItemStack showPlayersItem;


private static ItemStack gamemodeSelectorHotbarItem;
private static ItemStack cosmeticsSelectorHotbarItem;
private static ItemStack optionsSelectorHotbarItem;
private static ItemStack fourmsSelectorHotbarItem;
private static ItemStack discordSelectorHotbarItem;
private static ItemStack donorRanksStoreSelectorItem;


/**
* Get the items ready.
*/
public static void init() {

ItemStack toBeElytra = new ItemBuilder(Material.ELYTRA).setName("&bElytra").setUnbreakable(true).build();
toBeElytra.addEnchantment(Enchantment.BINDING_CURSE, 1);

elytra = toBeElytra;

exitToElytraLobbyItem = new ItemBuilder(Material.NETHER_STAR).setName("&cExit to lobby &7[Right Click]").build();
hidePlayersItem = new ItemBuilder(Material.EYE_OF_ENDER).setName("&cHide Players &7[Right Click]").build();
showPlayersItem = new ItemBuilder(Material.ENDER_PEARL).setName("&aShow Players &7[Right Click]").build();
gamemodeSelectorHotbarItem = new ItemBuilder(Material.END_CRYSTAL).setName("&bGamemode Selector &7[Right Click]").build();
cosmeticsSelectorHotbarItem = new ItemBuilder(Material.CHORUS_FRUIT_POPPED).setName("&fCosmetics &7[Right Click]").build();
optionsSelectorHotbarItem = new ItemBuilder(Material.REDSTONE_COMPARATOR).setName("&fOptions &7[Right Click]").build();



}

/**
* Sets the correct items in the players inventory.
* @param p
*/
public static void setInventory(Player p) {
public static void setLobbyItems(Player p) {
}

public static void setElytraCourseItems(Player p) {

}

public static void setParkourCourseItems(Player p) {
// TODO HOOK INTO PARKOUR
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@ public void onInventoryClick(InventoryClickEvent e) {
e.setCancelled(true);

if (e.getCurrentItem() != null && e.getCurrentItem().getType() != Material.AIR) {
ItemStack item = e.getCurrentItem();
ItemStack item = e.getCurrentItem();

if (item.equals(GUIManager.getElyBackToElytraLobby())) {
if (!(e.getWhoClicked() instanceof Player)) {
return;
}

PlayerTimer.playerLeavingMap((Player) e.getWhoClicked(), true);
Messager.msgPlayer("&6Teleported you to the elytra lobby.", (Player) e.getWhoClicked());
return;
}

if (item.getItemMeta() == null || item.getItemMeta().getLore() == null) {
// Item doesn't have lore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.gmail.justbru00.nethercube.elytra.commands.ElytraLobbyCommand;
import com.gmail.justbru00.nethercube.elytra.commands.ElytraTpCommand;
import com.gmail.justbru00.nethercube.elytra.gui.GUIManager;
import com.gmail.justbru00.nethercube.elytra.gui.HotbarGUI;
import com.gmail.justbru00.nethercube.elytra.gui.HotbarGUIManager;
import com.gmail.justbru00.nethercube.elytra.leaderboards.LeaderboardManager;
import com.gmail.justbru00.nethercube.elytra.listeners.ConfirmGUIListener;
import com.gmail.justbru00.nethercube.elytra.listeners.MainGUIListener;
Expand Down Expand Up @@ -54,7 +54,7 @@ public void onEnable() {
MapManager.init();
dataFile = new PluginFile(this, "data.yml", "data.yml");
GUIManager.init();
HotbarGUI.init();
HotbarGUIManager.init();
PlayerTimer.init();
LeaderboardManager.loadLeaderboardLines();
prefix = Messager.color(getConfig().getString("prefix"));
Expand Down

0 comments on commit b3697f0

Please sign in to comment.