From 1df8faf488823c0d21d015c1676b1bcb2f897126 Mon Sep 17 00:00:00 2001 From: ProSavage Date: Mon, 14 May 2018 10:59:23 -0500 Subject: [PATCH] Spawner Perm issue fix, and Warbanners now functional again ( was broken in 1.4-BETA-1 ) --- .../listeners/FactionsBlockListener.java | 5 ++++- .../listeners/FactionsPlayerListener.java | 17 ++++++++++++++--- src/main/resources/config.yml | 6 +++--- src/main/resources/plugin.yml | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 0849291a..db992628 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -73,9 +73,12 @@ public class FactionsBlockListener implements Listener { return; } FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer()); + if (!fme.hasFaction()) { + return; + } if (event.getBlock().getType() == Material.MOB_SPAWNER) { Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER); - if (access.equals(Access.DENY) || access.equals(Access.UNDEFINED)) { + if (access.equals(Access.DENY)) { fme.msg(TL.GENERIC_NOPERMISSION, "mine spawners"); event.setCancelled(true); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 30f3dfbe..8a03536b 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -42,6 +42,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.player.*; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.NumberConversions; @@ -506,11 +507,21 @@ public class FactionsPlayerListener implements Listener { if (P.p.mc17) { return; } + if (e.getItemInHand().getType() == Material.BANNER){ ItemStack bannerInHand = e.getItemInHand(); - ItemStack warBanner = P.p.createItem(bannerInHand.getType(),1,bannerInHand.getDurability(),P.p.getConfig().getString("fbanners.Item.Name"),P.p.getConfig().getStringList("fbanners.Item.Lore")); - if (warBanner.isSimilar(bannerInHand)){ - FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); + FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); + ItemStack warBanner = fme.getFaction().getBanner(); + if (warBanner != null) { + ItemMeta warmeta = warBanner.getItemMeta(); + warmeta.setDisplayName(P.p.color(P.p.getConfig().getString("fbanners.Item.Name"))); + warmeta.setLore(P.p.colorList(P.p.getConfig().getStringList("fbanners.Item.Lore"))); + warBanner.setItemMeta(warmeta); + } else { + warBanner = P.p.createItem(Material.BANNER, 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore")); + } + if (warBanner.isSimilar(bannerInHand)) { + if (fme.getFaction().isWilderness()){ fme.msg(TL.WARBANNER_NOFACTION); e.setCancelled(true); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index bea4955a..c6115d21 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -881,9 +881,9 @@ fupgrades: Chest: Chest-Size: # This is rows - level-1: 1 - level-2: 2 - level-3: 3 + level-1: 2 + level-2: 3 + level-3: 4 Cost: level-1: 1000000 level-2: 2000000 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 44d65824..305d9b7a 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: Factions -version: ${project.version}-1.4-STABLE +version: ${project.version}-1.4-BETA-2 main: com.massivecraft.factions.P authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage] softdepend: [CoreProtect, PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]