From 7a241af596410e78ef64c0381b481f9d1e661528 Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 11 Jun 2020 17:14:07 -0500 Subject: [PATCH 1/5] Use the CompatibleMaterial class correctly. --- .../challenge/challenge/ChallengeCategory.java | 5 +---- .../skyblock/challenge/challenge/ItemChallenge.java | 10 ++++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/challenge/challenge/ChallengeCategory.java b/src/main/java/com/songoda/skyblock/challenge/challenge/ChallengeCategory.java index 709e3c2a..ddc31195 100644 --- a/src/main/java/com/songoda/skyblock/challenge/challenge/ChallengeCategory.java +++ b/src/main/java/com/songoda/skyblock/challenge/challenge/ChallengeCategory.java @@ -57,10 +57,7 @@ public class ChallengeCategory { CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(strItem); if (compatibleMaterial == null) throw new IllegalArgumentException("Item " + strItem + " isn't a correct material"); - Material item = compatibleMaterial.getMaterial(); - if (item == null) - throw new IllegalArgumentException("Item " + strItem + " isn't a correct material"); - ItemChallenge ic = new ItemChallenge(show, row, col, item, amount, lore); + ItemChallenge ic = new ItemChallenge(show, row, col, compatibleMaterial, amount, lore); Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic); challenges.put(id, c); } catch (IllegalArgumentException ex) { diff --git a/src/main/java/com/songoda/skyblock/challenge/challenge/ItemChallenge.java b/src/main/java/com/songoda/skyblock/challenge/challenge/ItemChallenge.java index 61bb7812..8f000cdc 100644 --- a/src/main/java/com/songoda/skyblock/challenge/challenge/ItemChallenge.java +++ b/src/main/java/com/songoda/skyblock/challenge/challenge/ItemChallenge.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.List; import java.util.UUID; +import com.songoda.core.compatibility.CompatibleMaterial; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; @@ -18,13 +19,13 @@ public class ItemChallenge { private boolean show; private int row; private int col; - private Material type; + private CompatibleMaterial type; private int amount; private List lore; private String itemTitle; - public ItemChallenge(boolean show, int row, int col, Material type, int amount, List lore) { + public ItemChallenge(boolean show, int row, int col, CompatibleMaterial type, int amount, List lore) { this.show = show; this.row = row; this.col = col; @@ -39,7 +40,8 @@ public class ItemChallenge { } public ItemStack createItem(UUID player, int amount) { - ItemStack is = new ItemStack(type, this.amount); + ItemStack is = type.getItem(); + is.setAmount(this.amount); // Air ItemMeta im = is.getItemMeta(); if (im != null) { @@ -73,7 +75,7 @@ public class ItemChallenge { return col; } - public Material getType() { + public CompatibleMaterial getType() { return type; } From 00dc6c6ee70b740a37599abc9ea6950849ca2acf Mon Sep 17 00:00:00 2001 From: Brianna Date: Sun, 14 Jun 2020 13:38:31 -0500 Subject: [PATCH 2/5] Fix exit button. --- .../java/com/songoda/skyblock/gui/GuiPermissionsSelector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/skyblock/gui/GuiPermissionsSelector.java b/src/main/java/com/songoda/skyblock/gui/GuiPermissionsSelector.java index f7ecb428..7bc4abee 100644 --- a/src/main/java/com/songoda/skyblock/gui/GuiPermissionsSelector.java +++ b/src/main/java/com/songoda/skyblock/gui/GuiPermissionsSelector.java @@ -46,7 +46,7 @@ public class GuiPermissionsSelector extends Gui { setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE, TextUtils.formatText(configLoad.getString("Menu.Settings.Categories.Item.Exit.Displayname"))), (event) -> { CompatibleSound.BLOCK_CHEST_CLOSE.play(event.player); - guiManager.showGUI(event.player, returnGui); + event.player.closeInventory(); }); if (isCoop) From ea6befaada3413761d173a83e8b042bb715cba74 Mon Sep 17 00:00:00 2001 From: Giacomello Nathan <0ddlyokoOfficial@gmail.com> Date: Sat, 13 Jun 2020 16:05:06 +0200 Subject: [PATCH 3/5] Try to fix Challenge --- .../com/songoda/skyblock/challenge/challenge/Challenge.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/skyblock/challenge/challenge/Challenge.java b/src/main/java/com/songoda/skyblock/challenge/challenge/Challenge.java index 2ccb1a0d..d44267e8 100644 --- a/src/main/java/com/songoda/skyblock/challenge/challenge/Challenge.java +++ b/src/main/java/com/songoda/skyblock/challenge/challenge/Challenge.java @@ -150,7 +150,8 @@ public class Challenge { public boolean has(Player p, Object obj) { // Check if player has specific item in his inventory ItemStack is = (ItemStack) obj; - return p.getInventory().contains(is.getType(), is.getAmount()); + return p.getInventory().containsAtLeast(new ItemStack(is.getType()), is.getAmount()); +// return p.getInventory().contains(is.getType(), is.getAmount()); } @Override From 1af2a4eadf54808e306c18c0ef239a6759e23a5b Mon Sep 17 00:00:00 2001 From: Brianna Date: Sun, 14 Jun 2020 13:59:27 -0500 Subject: [PATCH 4/5] Fix for overriding settings. --- .../java/com/songoda/skyblock/permission/BasicPermission.java | 2 +- .../java/com/songoda/skyblock/permission/PermissionManager.java | 2 +- .../permission/permissions/listening/HungerPermission.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/permission/BasicPermission.java b/src/main/java/com/songoda/skyblock/permission/BasicPermission.java index 2644a769..f8284349 100644 --- a/src/main/java/com/songoda/skyblock/permission/BasicPermission.java +++ b/src/main/java/com/songoda/skyblock/permission/BasicPermission.java @@ -65,7 +65,7 @@ public abstract class BasicPermission { * * @return */ - public boolean extraCheck() { + public boolean overridingCheck() { return true; } diff --git a/src/main/java/com/songoda/skyblock/permission/PermissionManager.java b/src/main/java/com/songoda/skyblock/permission/PermissionManager.java index 558a71df..32adb7fe 100644 --- a/src/main/java/com/songoda/skyblock/permission/PermissionManager.java +++ b/src/main/java/com/songoda/skyblock/permission/PermissionManager.java @@ -154,7 +154,7 @@ public class PermissionManager { BasicPermission permission = wrapper.getPermission(); - if (permission.extraCheck() && hasPermission(player, island, permission)) + if (permission.overridingCheck() || hasPermission(player, island, permission)) continue; try { diff --git a/src/main/java/com/songoda/skyblock/permission/permissions/listening/HungerPermission.java b/src/main/java/com/songoda/skyblock/permission/permissions/listening/HungerPermission.java index fde5cc42..abed5a99 100644 --- a/src/main/java/com/songoda/skyblock/permission/permissions/listening/HungerPermission.java +++ b/src/main/java/com/songoda/skyblock/permission/permissions/listening/HungerPermission.java @@ -22,7 +22,7 @@ public class HungerPermission extends ListeningPermission { } @Override - public boolean extraCheck() { + public boolean overridingCheck() { return plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")) .getFileConfiguration().getBoolean("Island.Settings.Hunger.Enable"); } From 77d5997d4451e86ef556c3c0e69f749b19d94730 Mon Sep 17 00:00:00 2001 From: Brianna Date: Sun, 14 Jun 2020 14:05:41 -0500 Subject: [PATCH 5/5] version 2.2.16 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 33df1295..517031a1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.songoda skyblock - 2.2.15 + 2.2.16 jar clean install