From 5218878575fa592b2f472b4ea034fd0fbbef214b Mon Sep 17 00:00:00 2001 From: Brianna Date: Sun, 5 May 2019 22:49:44 -0400 Subject: [PATCH] Final --- .gitlab-ci.yml | 2 +- .../com/songoda/epicheads/gui/GUIHeads.java | 6 +++--- .../com/songoda/epicheads/gui/GUIOverview.java | 18 +++++++++++------- .../java/com/songoda/epicheads/head/Head.java | 4 ++-- .../epicheads/listeners/ItemListeners.java | 2 -- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 081b0be..1294cfb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicHeads" path: "/builds/$CI_PROJECT_PATH" - version: "2.3.3" + version: "3" build: stage: build diff --git a/src/main/java/com/songoda/epicheads/gui/GUIHeads.java b/src/main/java/com/songoda/epicheads/gui/GUIHeads.java index 92e821d..4adb39b 100644 --- a/src/main/java/com/songoda/epicheads/gui/GUIHeads.java +++ b/src/main/java/com/songoda/epicheads/gui/GUIHeads.java @@ -138,8 +138,8 @@ public class GUIHeads extends AbstractGUI { if (head.getName() == null) continue; - boolean free = (!player.hasPermission("epicheads.freeheads") && - (SettingsManager.Setting.FREE_IN_CREATIVE.getBoolean() && player.getGameMode() == GameMode.CREATIVE)); + boolean free = player.hasPermission("epicheads.bypasscost") + || (SettingsManager.Setting.FREE_IN_CREATIVE.getBoolean() && player.getGameMode() == GameMode.CREATIVE); ItemStack item = head.asItemStack(favorites.contains(head.getId()), free); @@ -163,7 +163,7 @@ public class GUIHeads extends AbstractGUI { item.setItemMeta(meta); - if (!player.hasPermission("epicheads.bypasscost") && free) { + if (!free) { if (plugin.getServer().getPluginManager().getPlugin("Vault") != null) { RegisteredServiceProvider rsp = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); net.milkbowl.vault.economy.Economy econ = rsp.getProvider(); diff --git a/src/main/java/com/songoda/epicheads/gui/GUIOverview.java b/src/main/java/com/songoda/epicheads/gui/GUIOverview.java index f9cef85..5cbea42 100644 --- a/src/main/java/com/songoda/epicheads/gui/GUIOverview.java +++ b/src/main/java/com/songoda/epicheads/gui/GUIOverview.java @@ -63,7 +63,9 @@ public class GUIOverview extends AbstractGUI { Tag tag = plugin.getHeadManager().getTags().get(i); - if (!player.hasPermission("epicheads.category." + tag.getName())) return; + player.sendMessage("epicheads.category." + tag.getName()); + + if (!player.hasPermission("epicheads.category." + tag.getName())) continue; TagInfo tagInfo = TagInfo.valueOf(tag.getName().toUpperCase()); @@ -77,7 +79,7 @@ public class GUIOverview extends AbstractGUI { new GUIHeads(plugin, player, null, plugin.getHeadManager().getHeadsByTag(tag)))); } - createButton(39, Material.COMPASS, plugin.getLocale().getMessage("gui.overview.search")); + createButton(SettingsManager.Setting.DISCORD.getBoolean() ? 39 : 40, Material.COMPASS, plugin.getLocale().getMessage("gui.overview.search")); if (SettingsManager.Setting.DISCORD.getBoolean()) { @@ -102,13 +104,15 @@ public class GUIOverview extends AbstractGUI { new GUIHeads(plugin, player, plugin.getLocale().getMessage("general.word.favorites"), plugin.getPlayerManager().getPlayer(player).getFavoritesAsHeads()))); - registerClickable(39, ((player1, inventory1, cursor, slot, type) -> + registerClickable(SettingsManager.Setting.DISCORD.getBoolean() ? 39 : 40, ((player1, inventory1, cursor, slot, type) -> GUIHeads.doSearch(player1))); - registerClickable(41, ((player1, inventory1, cursor, slot, type) -> { - player.sendMessage(Methods.formatText(plugin.getReferences().getPrefix() + "&9https://discord.gg/A9TRJQb")); - player.closeInventory(); - })); + if (SettingsManager.Setting.DISCORD.getBoolean()) { + registerClickable(41, ((player1, inventory1, cursor, slot, type) -> { + player.sendMessage(Methods.formatText(plugin.getReferences().getPrefix() + "&9https://discord.gg/A9TRJQb")); + player.closeInventory(); + })); + } } @Override diff --git a/src/main/java/com/songoda/epicheads/head/Head.java b/src/main/java/com/songoda/epicheads/head/Head.java index dbb47dc..6749e64 100644 --- a/src/main/java/com/songoda/epicheads/head/Head.java +++ b/src/main/java/com/songoda/epicheads/head/Head.java @@ -55,7 +55,7 @@ public class Head { public ItemStack asItemStack(boolean favorite) { return asItemStack(favorite, false); } - public ItemStack asItemStack(boolean favorite, boolean includeCost) { + public ItemStack asItemStack(boolean favorite, boolean free) { EpicHeads plugin = EpicHeads.getInstance(); ItemStack item = Methods.addTexture(new ItemStack(plugin.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.PLAYER_HEAD : Material.valueOf("SKULL_ITEM"), 1, (byte) 3), this.URL); @@ -67,7 +67,7 @@ public class Head { if (this.staffPicked == 1) lore.add(Methods.formatText(plugin.getLocale().getMessage("general.head.staffpicked"))); lore.add(Methods.formatText(plugin.getLocale().getMessage("general.head.id", this.id))); - if (includeCost) + if (!free) lore.add(plugin.getLocale().getMessage("general.head.cost", cost)); meta.setLore(lore); diff --git a/src/main/java/com/songoda/epicheads/listeners/ItemListeners.java b/src/main/java/com/songoda/epicheads/listeners/ItemListeners.java index d00a903..af99968 100644 --- a/src/main/java/com/songoda/epicheads/listeners/ItemListeners.java +++ b/src/main/java/com/songoda/epicheads/listeners/ItemListeners.java @@ -50,8 +50,6 @@ public class ItemListeners implements Listener { meta.setLore(new ArrayList<>()); itemNew.setItemMeta(meta); - event.getItem().getWorld().dropItemNaturally(event.getPlayer().getLocation().add(1, 1, 0), itemNew.clone()); - event.getItem().setItemStack(itemNew); } }