NoFactionPrefix Fixed, Along with Small Enhancements!

This commit is contained in:
Driftay 2019-08-21 13:52:03 -04:00
parent b0ebe7ec1a
commit b91d13feea
11 changed files with 21 additions and 58 deletions

View File

@ -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<FancyMessage> getMap(FPlayer fPlayer, FLocation flocation, double inDegrees);
public abstract List<FancyMessage> getMap(FPlayer fPlayer, FLocation flocation, double inDegrees);
public abstract void forceSave();

View File

@ -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 {
}
}
/// <summary>
/// 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())
/// </summary>
/// <param name="player">The player entity which the check will be made upon</param>
/// <param name="me">The Faction player object related to the player</param>
/// <param name="loc">The World location where the action is being executed</param>
/// <param name="myFaction">The faction of the player being checked</param>
/// <param name="access">The current's faction access permission for the action</param>
/// <param name="shouldHurt">Determine whether we should hurt the player when access is denied</param>
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())))

View File

@ -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;
}
}

View File

@ -19,8 +19,7 @@ import java.util.List;
public class ShopClickPersistence implements Listener {
public void runCommands(List<String> 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);
}

View File

@ -127,7 +127,7 @@ public abstract class MCommand<T extends MPlugin> {
}
public void execute(CommandSender sender, List<String> args) {
execute(sender, args, new ArrayList<MCommand<?>>());
execute(sender, args, new ArrayList<>());
}
// This is where the command action is performed.

View File

@ -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;
}
}

View File

@ -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())));

View File

@ -45,26 +45,19 @@ public class FUpgradesGUI implements Listener {
List<Integer> redSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Redstone.RedstoneItem.slots");
List<Integer> 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) {

View File

@ -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

View File

@ -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) {

View File

@ -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
/**