diff --git a/src/main/java/com/massivecraft/factions/Board.java b/src/main/java/com/massivecraft/factions/Board.java index dbd7d8f4..9fda53df 100644 --- a/src/main/java/com/massivecraft/factions/Board.java +++ b/src/main/java/com/massivecraft/factions/Board.java @@ -4,7 +4,7 @@ import com.massivecraft.factions.zcore.persist.json.JSONBoard; import mkremins.fanciful.FancyMessage; import org.bukkit.World; -import java.util.ArrayList; +import java.util.List; import java.util.Set; @@ -80,7 +80,7 @@ public abstract class Board { * The map is relative to a coord and a faction north is in the direction of decreasing x east is in the direction * of decreasing z */ - public abstract ArrayList getMap(FPlayer fPlayer, FLocation flocation, double inDegrees); + public abstract List getMap(FPlayer fPlayer, FLocation flocation, double inDegrees); public abstract void forceSave(); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 8a8cb16e..e93282a6 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -332,7 +332,6 @@ public class FactionsBlockListener implements Listener { as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it as.setCustomName(P.p.color(P.p.getConfig().getString("fbanners.BannerHolo").replace("{Faction}", fme.getTag()))); //Set this to the text you want as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not - ArmorStand armorStand = as; String tag = fme.getTag(); Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, () -> bannerCooldownMap.remove(tag), Long.parseLong(bannerCooldown + "")); Block banner = e.getBlockPlaced(); @@ -512,20 +511,6 @@ public class FactionsBlockListener implements Listener { } } - /// - /// This checks if the current player can execute an action based on it's factions access and surroundings - /// It will grant access in the following priorities: - /// - If Faction Land is Owned and the Owner is the current player, or player is faction leader. - /// - If Faction Land is not Owned and my access value is not set to DENY - /// - If none of the filters above matches, then we consider access is set to ALLOW|UNDEFINED - /// This check does not performs any kind of bypass check (i.e.: me.isAdminBypassing()) - /// - /// The player entity which the check will be made upon - /// The Faction player object related to the player - /// The World location where the action is being executed - /// The faction of the player being checked - /// The current's faction access permission for the action - /// Determine whether we should hurt the player when access is denied private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean shouldHurt) { boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty()); if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId()))) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 1c742b5e..6d7fa16d 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -657,7 +657,6 @@ public class FactionsPlayerListener implements Listener { if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) { event.setCancelled(true); event.setUseInteractedBlock(Event.Result.DENY); - return; } } diff --git a/src/main/java/com/massivecraft/factions/shop/ShopClickPersistence.java b/src/main/java/com/massivecraft/factions/shop/ShopClickPersistence.java index c3c6c6e1..0b58462b 100644 --- a/src/main/java/com/massivecraft/factions/shop/ShopClickPersistence.java +++ b/src/main/java/com/massivecraft/factions/shop/ShopClickPersistence.java @@ -19,8 +19,7 @@ import java.util.List; public class ShopClickPersistence implements Listener { public void runCommands(List list, Player p) { - for (int a = 0; a < list.size(); a++) { - String cmd = list.get(a); + for (String cmd : list) { cmd = cmd.replace("%player%", p.getName()); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd); } diff --git a/src/main/java/com/massivecraft/factions/zcore/MCommand.java b/src/main/java/com/massivecraft/factions/zcore/MCommand.java index 8aba6288..a2a705d8 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MCommand.java +++ b/src/main/java/com/massivecraft/factions/zcore/MCommand.java @@ -127,7 +127,7 @@ public abstract class MCommand { } public void execute(CommandSender sender, List args) { - execute(sender, args, new ArrayList>()); + execute(sender, args, new ArrayList<>()); } // This is where the command action is performed. diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionFrame.java b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionFrame.java index 11da4f04..65867482 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionFrame.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionFrame.java @@ -21,10 +21,9 @@ import java.util.List; public class PermissableActionFrame { private Gui gui; - private ConfigurationSection section; public PermissableActionFrame(Faction f) { - section = P.p.getConfig().getConfigurationSection("fperm-gui.action"); + ConfigurationSection section = P.p.getConfig().getConfigurationSection("fperm-gui.action"); gui = new Gui(P.p, section.getInt("rows", 3), P.p.color(P.p.getConfig().getString("fperm-gui.action.name").replace("{faction}", f.getTag()))); @@ -100,6 +99,4 @@ public class PermissableActionFrame { item.setItemMeta(meta); return item; } - - } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationFrame.java b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationFrame.java index 3749a91d..3863b185 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationFrame.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableRelationFrame.java @@ -20,10 +20,9 @@ import java.util.List; public class PermissableRelationFrame { private Gui gui; - private ConfigurationSection section; public PermissableRelationFrame(Faction f) { - section = P.p.getConfig().getConfigurationSection("fperm-gui.relation"); + ConfigurationSection section = P.p.getConfig().getConfigurationSection("fperm-gui.relation"); gui = new Gui(P.p, section.getInt("rows", 3), P.p.color(P.p.getConfig().getString("fperm-gui.relation.name").replace("{faction}", f.getTag()))); diff --git a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java index 016a1728..320f19a6 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fupgrades/FUpgradesGUI.java @@ -45,26 +45,19 @@ public class FUpgradesGUI implements Listener { List redSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots"); List memberSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Members.MembersItem.slots"); - for (int i = 0; i < cropSlots.size(); i++) - if (cropSlots.get(i) != -1) inventory.setItem(cropSlots.get(i), items[2]); + for (Integer cropSlot : cropSlots) if (cropSlot != -1) inventory.setItem(cropSlot, items[2]); - for (int i = 0; i < spawnerSlots.size(); i++) - if (spawnerSlots.get(i) != -1) inventory.setItem(spawnerSlots.get(i), items[1]); + for (Integer spawnerSlot : spawnerSlots) if (spawnerSlot != -1) inventory.setItem(spawnerSlot, items[1]); - for (int i = 0; i < expSlots.size(); i++) - if (expSlots.get(i) != -1) inventory.setItem(expSlots.get(i), items[0]); + for (Integer expSlot : expSlots) if (expSlot != -1) inventory.setItem(expSlot, items[0]); - for (int i = 0; i < chestSlots.size(); i++) - if (chestSlots.get(i) != -1) inventory.setItem(chestSlots.get(i), items[3]); + for (Integer chestSlot : chestSlots) if (chestSlot != -1) inventory.setItem(chestSlot, items[3]); - for (int i = 0; i < powerSlots.size(); i++) - if (powerSlots.get(i) != -1) inventory.setItem(powerSlots.get(i), items[4]); + for (Integer powerSlot : powerSlots) if (powerSlot != -1) inventory.setItem(powerSlot, items[4]); - for (int i = 0; i < redSlots.size(); i++) - if (redSlots.get(i) != -1) inventory.setItem(redSlots.get(i), items[5]); + for (Integer redSlot : redSlots) if (redSlot != -1) inventory.setItem(redSlot, items[5]); - for (int i = 0; i < memberSlots.size(); i++) - if (memberSlots.get(i) != -1) inventory.setItem(memberSlots.get(i), items[6]); + for (Integer memberSlot : memberSlots) if (memberSlot != -1) inventory.setItem(memberSlot, items[6]); fme.getPlayer().openInventory(inventory); } @@ -422,9 +415,7 @@ public class FUpgradesGUI implements Listener { redItem.setAmount(redLevel); } - - ItemStack[] items = {expItem, spawnerItem, cropItem, chestItem, powerItem, redItem, memberItem}; - return items; + return new ItemStack[]{expItem, spawnerItem, cropItem, chestItem, powerItem, redItem, memberItem}; } private boolean hasMoney(FPlayer fme, int amt) { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index a24e9676..31e5243e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -914,10 +914,9 @@ public abstract class MemoryFPlayer implements FPlayer { public void setFFlying(boolean fly, boolean damage) { Player player = getPlayer(); if(player == null) return; - if (player != null) { - player.setAllowFlight(fly); - player.setFlying(fly); - } + + player.setAllowFlight(fly); + player.setFlying(fly); if (!damage) { msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled"); @@ -1288,8 +1287,7 @@ public abstract class MemoryFPlayer implements FPlayer { public String commas(final double amount) { final DecimalFormat formatter = new DecimalFormat("#,###.00"); - final String number = formatter.format(amount); - return number; + return formatter.format(amount); } @Override diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index d01f70aa..3f8c2f9b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -267,16 +267,11 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } public boolean altInvited(FPlayer fplayer) { - if (this.altinvites.contains(fplayer.getId())) - return true; - return false; + return this.altinvites.contains(fplayer.getId()); } public boolean isInvited(FPlayer fplayer) { - if (this.invites.contains(fplayer.getId()) || this.altinvites.contains(fplayer.getId())) { - return true; - } - return false; + return this.invites.contains(fplayer.getId()) || this.altinvites.contains(fplayer.getId()); } public void ban(FPlayer target, FPlayer banner) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 395f5d22..3adfe129 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -1078,7 +1078,7 @@ public enum TL { DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}]"), FACTION_LOGIN("faction-login", "&e%1$s &9logged in."), FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."), - NOFACTION_PREFIX("nofactions-prefix", "&6[&a4-&6]&r"), + NOFACTION_PREFIX("nofactions-prefix", "&6[&ano-faction&6]&r"), DATE_FORMAT("date-format", "MM/d/yy h:ma"), // 3/31/15 07:49AM /**