1.4-STABLE

------------------------------------------------------------------
No Enderpearls in fly fixed - The option was bugged, so if it was true it would do the opposite.
Improved /f map visuals and title!
Title fadeout time, showtime, and fadeintime options added for 1.9+ servers
Fixed Bug in /f upgrades where the slots option for exp would move the spawner instead.
Added Faction chest, an upgradable shared "enderchest" for factions to share!
Added some more entries into /f help in config.
Added Upgrade for faction chest
Banner pattern storage
------------------------------------------------------------------
This commit is contained in:
ProSavage 2018-05-11 17:47:58 -05:00
parent f30cd44b54
commit d95c80ae5b
18 changed files with 614 additions and 233 deletions

View File

@ -13,306 +13,315 @@ import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public interface Faction extends EconomyParticipator { public interface Faction extends EconomyParticipator {
public HashMap<String, List<String>> getAnnouncements(); HashMap<String, List<String>> getAnnouncements();
public ConcurrentHashMap<String, LazyLocation> getWarps(); ConcurrentHashMap<String, LazyLocation> getWarps();
public LazyLocation getWarp(String name); LazyLocation getWarp(String name);
public void setWarp(String name, LazyLocation loc); void setWarp(String name, LazyLocation loc);
public boolean isWarp(String name); boolean isWarp(String name);
public boolean hasWarpPassword(String warp); boolean hasWarpPassword(String warp);
public boolean isWarpPassword(String warp, String password); boolean isWarpPassword(String warp, String password);
public void setWarpPassword(String warp, String password); void setWarpPassword(String warp, String password);
public boolean removeWarp(String name); boolean removeWarp(String name);
public void clearWarps(); void clearWarps();
public int getMaxVaults(); int getMaxVaults();
public void setMaxVaults(int value); void setMaxVaults(int value);
public void addAnnouncement(FPlayer fPlayer, String msg); void addAnnouncement(FPlayer fPlayer, String msg);
public void sendUnreadAnnouncements(FPlayer fPlayer); void sendUnreadAnnouncements(FPlayer fPlayer);
public void removeAnnouncements(FPlayer fPlayer); void removeAnnouncements(FPlayer fPlayer);
public Set<String> getInvites(); Set<String> getInvites();
public String getId(); String getId();
public void invite(FPlayer fplayer); void setId(String id);
public void deinvite(FPlayer fplayer); void invite(FPlayer fplayer);
public void setUpgrades(String key, int level); void deinvite(FPlayer fplayer);
public int getUpgrade(String key); void setUpgrades(String key, int level);
public boolean isInvited(FPlayer fplayer); int getUpgrade(String key);
public void ban(FPlayer target, FPlayer banner); boolean isInvited(FPlayer fplayer);
public void unban(FPlayer player); void ban(FPlayer target, FPlayer banner);
public boolean isBanned(FPlayer player); void unban(FPlayer player);
public Set<BanInfo> getBannedPlayers(); boolean isBanned(FPlayer player);
public HashMap<Integer,String> getRulesMap(); Set<BanInfo> getBannedPlayers();
public void setRule(int index, String rule); HashMap<Integer, String> getRulesMap();
public void addRule(String rule); void setRule(int index, String rule);
public void removeRule(int index); void addRule(String rule);
public void clearRules(); void removeRule(int index);
public void setCheckpoint(Location location); void clearRules();
public Location getCheckpoint(); Location getCheckpoint();
public void addTnt(int amt); void setCheckpoint(Location location);
public void takeTnt(int amt); void addTnt(int amt);
public Location getVault(); void takeTnt(int amt);
public void setVault(Location vaultLocation); Location getVault();
public int getTnt(); void setVault(Location vaultLocation);
public String getRule(int index); Inventory getChest();
public boolean getOpen(); void setChest(Inventory inventory);
public void setOpen(boolean isOpen); void setBannerPattern(ItemStack banner);
public boolean isPeaceful(); ItemStack getBanner();
public void setPeaceful(boolean isPeaceful); int getTnt();
public void setPeacefulExplosionsEnabled(boolean val); String getRule(int index);
public boolean getPeacefulExplosionsEnabled(); boolean getOpen();
public boolean noExplosionsInTerritory(); void setOpen(boolean isOpen);
public boolean isPermanent(); boolean isPeaceful();
public void setPermanent(boolean isPermanent); void setPeaceful(boolean isPeaceful);
public String getTag(); boolean getPeacefulExplosionsEnabled();
public String getTag(String prefix); void setPeacefulExplosionsEnabled(boolean val);
public String getTag(Faction otherFaction); boolean noExplosionsInTerritory();
public String getTag(FPlayer otherFplayer); boolean isPermanent();
public void setTag(String str); void setPermanent(boolean isPermanent);
public String getComparisonTag(); String getTag();
public String getDescription(); void setTag(String str);
public void setDescription(String value); String getTag(String prefix);
public void setHome(Location home); String getTag(Faction otherFaction);
public boolean hasHome(); String getTag(FPlayer otherFplayer);
public Location getHome(); String getComparisonTag();
public long getFoundedDate(); String getDescription();
public void setFoundedDate(long newDate); void setDescription(String value);
public void confirmValidHome(); boolean hasHome();
public String getAccountId(); Location getHome();
public Integer getPermanentPower(); void setHome(Location home);
public void setPermanentPower(Integer permanentPower); long getFoundedDate();
public boolean hasPermanentPower(); void setFoundedDate(long newDate);
public double getPowerBoost(); void confirmValidHome();
public void setPowerBoost(double powerBoost); String getAccountId();
public boolean noPvPInTerritory(); Integer getPermanentPower();
public boolean noMonstersInTerritory(); void setPermanentPower(Integer permanentPower);
public boolean isNormal(); boolean hasPermanentPower();
double getPowerBoost();
void setPowerBoost(double powerBoost);
boolean noPvPInTerritory();
boolean noMonstersInTerritory();
boolean isNormal();
@Deprecated @Deprecated
public boolean isNone(); boolean isNone();
public boolean isWilderness(); boolean isWilderness();
public boolean isSafeZone(); boolean isSafeZone();
public boolean isWarZone(); boolean isWarZone();
public boolean isPlayerFreeType(); boolean isPlayerFreeType();
public boolean isPowerFrozen(); boolean isPowerFrozen();
public void setLastDeath(long time); void setLastDeath(long time);
public int getKills(); int getKills();
public int getDeaths(); int getDeaths();
public Access getAccess(Permissable permissable, PermissableAction permissableAction); Access getAccess(Permissable permissable, PermissableAction permissableAction);
public Access getAccess(FPlayer player, PermissableAction permissableAction); Access getAccess(FPlayer player, PermissableAction permissableAction);
public void setPermission(Permissable permissable, PermissableAction permissableAction, Access access); void setPermission(Permissable permissable, PermissableAction permissableAction, Access access);
public void resetPerms(); void resetPerms();
public Map<Permissable, Map<PermissableAction, Access>> getPermissions();
// ------------------------------- // -------------------------------
// Relation and relation colors // Relation and relation colors
// ------------------------------- // -------------------------------
@Override Map<Permissable, Map<PermissableAction, Access>> getPermissions();
public String describeTo(RelationParticipator that, boolean ucfirst);
@Override @Override
public String describeTo(RelationParticipator that); String describeTo(RelationParticipator that, boolean ucfirst);
@Override @Override
public Relation getRelationTo(RelationParticipator rp); String describeTo(RelationParticipator that);
@Override @Override
public Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful); Relation getRelationTo(RelationParticipator rp);
@Override @Override
public ChatColor getColorTo(RelationParticipator rp); Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
public Relation getRelationWish(Faction otherFaction); @Override
ChatColor getColorTo(RelationParticipator rp);
public void setRelationWish(Faction otherFaction, Relation relation); Relation getRelationWish(Faction otherFaction);
public int getRelationCount(Relation relation); void setRelationWish(Faction otherFaction, Relation relation);
int getRelationCount(Relation relation);
// ----------------------------------------------// // ----------------------------------------------//
// Power // Power
// ----------------------------------------------// // ----------------------------------------------//
public double getPower(); double getPower();
public double getPowerMax(); double getPowerMax();
public int getPowerRounded(); int getPowerRounded();
public int getPowerMaxRounded(); int getPowerMaxRounded();
public int getLandRounded(); int getLandRounded();
public int getLandRoundedInWorld(String worldName); int getLandRoundedInWorld(String worldName);
public boolean hasLandInflation();
// ------------------------------- // -------------------------------
// FPlayers // FPlayers
// ------------------------------- // -------------------------------
boolean hasLandInflation();
// maintain the reference list of FPlayers in this faction // maintain the reference list of FPlayers in this faction
public void refreshFPlayers(); void refreshFPlayers();
public boolean addFPlayer(FPlayer fplayer); boolean addFPlayer(FPlayer fplayer);
public boolean removeFPlayer(FPlayer fplayer); boolean removeFPlayer(FPlayer fplayer);
public int getSize(); int getSize();
public Set<FPlayer> getFPlayers(); Set<FPlayer> getFPlayers();
public Set<FPlayer> getFPlayersWhereOnline(boolean online); Set<FPlayer> getFPlayersWhereOnline(boolean online);
public Set<FPlayer> getFPlayersWhereOnline(boolean online, FPlayer viewer); Set<FPlayer> getFPlayersWhereOnline(boolean online, FPlayer viewer);
public FPlayer getFPlayerAdmin(); FPlayer getFPlayerAdmin();
public ArrayList<FPlayer> getFPlayersWhereRole(Role role); ArrayList<FPlayer> getFPlayersWhereRole(Role role);
public ArrayList<Player> getOnlinePlayers(); ArrayList<Player> getOnlinePlayers();
// slightly faster check than getOnlinePlayers() if you just want to see if // slightly faster check than getOnlinePlayers() if you just want to see if
// there are any players online // there are any players online
public boolean hasPlayersOnline(); boolean hasPlayersOnline();
public void memberLoggedOff(); void memberLoggedOff();
// used when current leader is about to be removed from the faction; // used when current leader is about to be removed from the faction;
// promotes new leader, or disbands faction if no other members left // promotes new leader, or disbands faction if no other members left
public void promoteNewLeader(); void promoteNewLeader();
public Role getDefaultRole(); Role getDefaultRole();
public void setDefaultRole(Role role); void setDefaultRole(Role role);
// ----------------------------------------------// // ----------------------------------------------//
// Messages // Messages
// ----------------------------------------------// // ----------------------------------------------//
public void msg(String message, Object... args); void msg(String message, Object... args);
public void sendMessage(String message); void sendMessage(String message);
public void sendMessage(List<String> messages);
// ----------------------------------------------// // ----------------------------------------------//
// Ownership of specific claims // Ownership of specific claims
// ----------------------------------------------// // ----------------------------------------------//
public Map<FLocation, Set<String>> getClaimOwnership(); void sendMessage(List<String> messages);
public void clearAllClaimOwnership(); Map<FLocation, Set<String>> getClaimOwnership();
public void clearClaimOwnership(FLocation loc); void clearAllClaimOwnership();
public void clearClaimOwnership(FPlayer player); void clearClaimOwnership(FLocation loc);
public int getCountOfClaimsWithOwners(); void clearClaimOwnership(FPlayer player);
public boolean doesLocationHaveOwnersSet(FLocation loc); int getCountOfClaimsWithOwners();
public boolean isPlayerInOwnerList(FPlayer player, FLocation loc); boolean doesLocationHaveOwnersSet(FLocation loc);
public void setPlayerAsOwner(FPlayer player, FLocation loc); boolean isPlayerInOwnerList(FPlayer player, FLocation loc);
public void removePlayerAsOwner(FPlayer player, FLocation loc); void setPlayerAsOwner(FPlayer player, FLocation loc);
public Set<String> getOwnerList(FLocation loc); void removePlayerAsOwner(FPlayer player, FLocation loc);
public String getOwnerListString(FLocation loc); Set<String> getOwnerList(FLocation loc);
public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc); String getOwnerListString(FLocation loc);
boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc);
// ----------------------------------------------// // ----------------------------------------------//
// Persistance and entity management // Persistance and entity management
// ----------------------------------------------// // ----------------------------------------------//
public void remove(); void remove();
public Set<FLocation> getAllClaims(); Set<FLocation> getAllClaims();
public void setId(String id);
} }

View File

@ -99,6 +99,9 @@ public class P extends MPlugin {
} }
public boolean mc17 = false; public boolean mc17 = false;
public boolean mc18 = false;
@Override @Override
public void onEnable() { public void onEnable() {
if (!preEnable()) { if (!preEnable()) {
@ -150,8 +153,11 @@ public class P extends MPlugin {
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]); int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) { if (version == 7) {
P.p.log("Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles."); P.p.log("Minecraft Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
mc17 = true; mc17 = true;
} else if (version == 8) {
P.p.log("Minecraft Version 1.8 found, Title Fadeouttime etc will not be configurable.");
mc18 = true;
} }
// Register Event Handlers // Register Event Handlers
@ -345,11 +351,6 @@ public class P extends MPlugin {
} }
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels, // Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
// local chat, or anything else which targets individual recipients, so Faction Chat can be done // local chat, or anything else which targets individual recipients, so Faction Chat can be done
public boolean isPlayerFactionChatting(Player player) { public boolean isPlayerFactionChatting(Player player) {

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
public class CmdBanner extends FCommand { public class CmdBanner extends FCommand {
public CmdBanner() { public CmdBanner() {
@ -39,11 +40,24 @@ public class CmdBanner extends FCommand {
return; return;
} }
takeMoney(fme, P.p.getConfig().getInt("fbanners.Banner-Cost", 5000)); takeMoney(fme, P.p.getConfig().getInt("fbanners.Banner-Cost", 5000));
ItemStack warBanner = P.p.createItem(Material.BANNER, 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore"));
me.getInventory().addItem(warBanner); //ItemStack warBanner = P.p.createItem(Material.BANNER, 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore"));
//BannerMeta bannerMeta = (BannerMeta) warBanner.getItemMeta();
ItemStack warBanner = fme.getFaction().getBanner();
if (warBanner != null) {
ItemMeta warmeta = warBanner.getItemMeta();
warmeta.setDisplayName(P.p.getConfig().getString("fbanners.Item.Name"));
warmeta.setLore(P.p.getConfig().getStringList("fbanners.Item.Lore"));
warBanner.setItemMeta(warmeta);
me.getInventory().addItem(warBanner);
} else {
warBanner = P.p.createItem(Material.BANNER, 1, (short) 1, P.p.getConfig().getString("fbanners.Item.Name"), P.p.getConfig().getStringList("fbanners.Item.Lore"));
}
fme.msg(TL.COMMAND_BANNER_SUCCESS); fme.msg(TL.COMMAND_BANNER_SUCCESS);
} }
public boolean hasMoney(FPlayer fme, int amt) { public boolean hasMoney(FPlayer fme, int amt) {
Economy econ = P.p.getEcon(); Economy econ = P.p.getEcon();
if (econ.getBalance(fme.getPlayer()) >= amt) { if (econ.getBalance(fme.getPlayer()) >= amt) {

View File

@ -0,0 +1,48 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
public class CmdChest extends FCommand {
public CmdChest() {
this.aliases.add("chest");
//this.requiredArgs.add("");
this.permission = Permission.CHEST.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fchest.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Access access = fme.getFaction().getAccess(fme, PermissableAction.CHEST);
if (access.equals(Access.DENY)) {
fme.msg(TL.GENERIC_NOPERMISSION, "chest");
}
//debug Bukkit.broadcastMessage(fme.getFaction().getUpgrade("Chest") + "");
me.openInventory(fme.getFaction().getChest());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
}

View File

@ -0,0 +1,39 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Material;
public class CmdSetBanner extends FCommand {
public CmdSetBanner() {
super();
aliases.add("setbanner");
permission = Permission.BANNER.node;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = true;
}
public void perform() {
if (me.getItemInHand().getType() != Material.BANNER) {
fme.msg(TL.COMMAND_SETBANNER_NOTBANNER);
return;
}
fme.getFaction().setBannerPattern(me.getItemInHand());
fme.msg(TL.COMMAND_SETBANNER_SUCCESS);
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETBANNER_DESCRIPTION;
}
}

View File

@ -3,7 +3,6 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import net.coreprotect.CoreProtect;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.util.Collections; import java.util.Collections;
@ -99,6 +98,7 @@ public class FCmdRoot extends FCommand {
public CmdShowClaims cmdShowClaims = new CmdShowClaims(); public CmdShowClaims cmdShowClaims = new CmdShowClaims();
public CmdLowPower cmdLowPower = new CmdLowPower(); public CmdLowPower cmdLowPower = new CmdLowPower();
public CmdTntFill cmdTntFill = new CmdTntFill(); public CmdTntFill cmdTntFill = new CmdTntFill();
public CmdChest cmdChest = new CmdChest();
@ -209,6 +209,7 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdShowClaims); this.addSubCommand(this.cmdShowClaims);
this.addSubCommand(this.cmdLowPower); this.addSubCommand(this.cmdLowPower);
this.addSubCommand(this.cmdTntFill); this.addSubCommand(this.cmdTntFill);
this.addSubCommand(this.cmdChest);
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){ if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){
P.p.log("Found CoreProtect, enabling Inspect"); P.p.log("Found CoreProtect, enabling Inspect");

View File

@ -70,6 +70,16 @@ public class FactionsBlockListener implements Listener {
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true); event.setCancelled(true);
return;
}
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (event.getBlock().getType() == Material.MOB_SPAWNER) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
if (access.equals(Access.DENY) || access.equals(Access.UNDEFINED)) {
fme.msg(TL.GENERIC_NOPERMISSION, "mine spawners");
event.setCancelled(true);
}
} }
} }

View File

@ -1,14 +1,12 @@
package com.massivecraft.factions.listeners; package com.massivecraft.factions.listeners;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.event.FPlayerJoinEvent;
import com.massivecraft.factions.event.PowerLossEvent; import com.massivecraft.factions.event.PowerLossEvent;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TravelAgent; import org.bukkit.TravelAgent;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.*; import org.bukkit.entity.*;
@ -21,7 +19,6 @@ import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause; import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@ -207,44 +204,37 @@ public class FactionsEntityListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
Location loc = event.getLocation();
Entity boomer = event.getEntity(); Entity boomer = event.getEntity();
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom)) { // Before we need to check the location where the block is placed
// faction is peaceful and has explosions set to disabled if (!this.checkExplosionForBlock(boomer, event.getLocation().getBlock())) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
boolean online = faction.hasPlayersOnline(); // Loop the blocklist to run checks on each aimed block
Iterator<Block> blockList = event.blockList().iterator();
//TODO: :( while (blockList.hasNext()) {
if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || Block block = blockList.next();
(faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockCreepers) || if (!this.checkExplosionForBlock(boomer, block)) {
faction.isSafeZone())) { // The block don't have to explode
// creeper which needs prevention blockList.remove();
event.setCancelled(true); }
} else if ( }
// it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
(boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || // Cancel the event if no block will explode
(faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || if (event.blockList().isEmpty()) {
(faction.isWarZone() && Conf.warZoneBlockFireballs) ||
faction.isSafeZone())) {
// ghast fireball which needs prevention
event.setCancelled(true);
} else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && ((faction.isWilderness() && Conf.wildernessBlockTNT && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockTNT) ||
(faction.isSafeZone() && Conf.safeZoneBlockTNT))) {
// TNT which needs prevention
event.setCancelled(true); event.setCancelled(true);
// Or handle the exploit of TNT in water/lava
} else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog) { } else if ((boomer instanceof TNTPrimed || boomer instanceof ExplosiveMinecart) && Conf.handleExploitTNTWaterlog) {
// TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior, but... // TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior, but...
// this change below provides workaround for waterwalling providing perfect protection, // this change below provides workaround for waterwalling providing perfect protection,
// and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots // and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots
Block center = loc.getBlock(); Block center = event.getLocation().getBlock();
if (center.isLiquid()) { if (center.isLiquid()) {
// a single surrounding block in all 6 directions is broken if the material is weak enough // a single surrounding block in all 6 directions is broken if the material is weak enough
List<Block> targets = new ArrayList<>(); List<Block> targets = new ArrayList<>();
@ -265,22 +255,42 @@ public class FactionsEntityListener implements Listener {
} }
} }
//For disabling enderpearl throws private boolean checkExplosionForBlock(Entity boomer, Block block) {
@EventHandler Faction faction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
public void onPearl(PlayerInteractEvent e) {
Player player = e.getPlayer(); if (faction.noExplosionsInTerritory() || (faction.isPeaceful() && Conf.peacefulTerritoryDisableBoom)) {
if (player.getItemInHand().getType() == Material.ENDER_PEARL) { // faction is peaceful and has explosions set to disabled
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); return false;
if (fPlayer.isFlying()){
if (!Conf.noEnderpearlsInFly){
fPlayer.msg(TL.COMMAND_FLY_NO_EPEARL);
e.setCancelled(true);
}
}
} }
boolean online = faction.hasPlayersOnline();
if (boomer instanceof Creeper && ((faction.isWilderness() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockCreepers) ||
faction.isSafeZone())) {
// creeper which needs prevention
return false;
} else if (
// it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever
(boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ((faction.isWilderness() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockFireballs) ||
faction.isSafeZone())) {
// ghast fireball which needs prevention
return false;
} else
return (!(boomer instanceof TNTPrimed) && !(boomer instanceof ExplosiveMinecart)) || ((!faction.isWilderness() || !Conf.wildernessBlockTNT || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) &&
(!faction.isNormal() || (online ? !Conf.territoryBlockTNT : !Conf.territoryBlockTNTWhenOffline)) &&
(!faction.isWarZone() || !Conf.warZoneBlockTNT) &&
(!faction.isSafeZone() || !Conf.safeZoneBlockTNT));
// No condition retained, destroy the block!
} }
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled // mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
@ -702,4 +712,4 @@ public class FactionsEntityListener implements Listener {
return false; return false;
} }
} }

View File

@ -300,7 +300,22 @@ public class FactionsPlayerListener implements Listener {
.replace("{player}",row.getPlayer()) .replace("{player}",row.getPlayer())
.replace("{block-type}",row.getType().toString().toLowerCase())); .replace("{block-type}",row.getType().toString().toLowerCase()));
} }
}
}
//For disabling enderpearl throws
@EventHandler
public void onPearl(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (player.getItemInHand().getType() == Material.ENDER_PEARL) {
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
if (fPlayer.isFlying()) {
if (Conf.noEnderpearlsInFly) {
fPlayer.msg(TL.COMMAND_FLY_NO_EPEARL);
e.setCancelled(true);
}
}
} }
} }
@ -310,6 +325,18 @@ public class FactionsPlayerListener implements Listener {
return (result.length() == 3 ? result + "0" : result) + "/hrs ago"; return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
} }
@EventHandler
public void onCloseChest(InventoryCloseEvent e) {
if (e.getInventory().getTitle() == null) {
return;
}
if (e.getInventory().getTitle().equalsIgnoreCase(P.p.color(P.p.getConfig().getString("fchest.Inventory-Title")))) {
FPlayers.getInstance().getByPlayer((Player) e.getPlayer()).getFaction().setChest(e.getInventory());
}
}
// Holds the next time a player can have a map shown. // Holds the next time a player can have a map shown.
private HashMap<UUID, Long> showTimes = new HashMap<>(); private HashMap<UUID, Long> showTimes = new HashMap<>();
@ -357,7 +384,15 @@ public class FactionsPlayerListener implements Listener {
String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
subTitle = parseAllPlaceholders(subTitle, factionTo); subTitle = parseAllPlaceholders(subTitle, factionTo);
if (!P.p.mc17) { if (!P.p.mc17) {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle)); if (!P.p.mc18) {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"),
P.p.getConfig().getInt("Title.Options.ShowTime"),
P.p.getConfig().getInt("Title.Options.FadeOutTime"));
} else {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle));
}
} }
} }

View File

@ -102,7 +102,8 @@ public enum Permission {
TNTFILL("tntfill"), TNTFILL("tntfill"),
COORD("coords"), COORD("coords"),
SHOWCLAIMS("showclaims"), SHOWCLAIMS("showclaims"),
WARP("warp"); WARP("warp"),
CHEST("Chest");
public final String node; public final String node;

View File

@ -27,7 +27,6 @@ public enum PermissableAction {
KICK("kick"), KICK("kick"),
ITEM("items"), // generic for most items ITEM("items"), // generic for most items
SETHOME("sethome"), SETHOME("sethome"),
WITHDRAW("withdraw"),
TERRITORY("territory"), TERRITORY("territory"),
ACCESS("access"), ACCESS("access"),
DISBAND("disband"), DISBAND("disband"),
@ -38,8 +37,9 @@ public enum PermissableAction {
VAULT("vault"), VAULT("vault"),
TNTBANK("tntbank"), TNTBANK("tntbank"),
TNTFILL("tntfill"), TNTFILL("tntfill"),
WIDTHDRAW("widthdraw"), WITHDRAW("withdraw"),
DEPOSIT("deposit"); CHEST("chest"),
SPAWNER("spawner");
private String name; private String name;

View File

@ -43,11 +43,15 @@ public class FUpgradesGUI implements Listener {
} }
List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots");
for (int i = 0; i <= spawnerSlots.size() - 1; i++) { for (int i = 0; i <= spawnerSlots.size() - 1; i++) {
inventory.setItem(spawnerSlots.get(i), items[0]); inventory.setItem(spawnerSlots.get(i), items[1]);
} }
List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots");
for (int i = 0; i <= expSlots.size() - 1; i++) { for (int i = 0; i <= expSlots.size() - 1; i++) {
inventory.setItem(expSlots.get(i), items[1]); inventory.setItem(expSlots.get(i), items[0]);
}
List<Integer> chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots");
for (int i = 0; i <= chestSlots.size() - 1; i++) {
inventory.setItem(chestSlots.get(i), items[3]);
} }
fme.getPlayer().openInventory(inventory); fme.getPlayer().openInventory(inventory);
} }
@ -63,6 +67,7 @@ public class FUpgradesGUI implements Listener {
ItemStack[] items = buildItems(fme); ItemStack[] items = buildItems(fme);
ItemStack cropItem = items[2]; ItemStack cropItem = items[2];
ItemStack expItem = items[0]; ItemStack expItem = items[0];
ItemStack chestitem = items[3];
ItemStack spawnerItem = items[1]; ItemStack spawnerItem = items[1];
int cropLevel = fme.getFaction().getUpgrade("Crop"); int cropLevel = fme.getFaction().getUpgrade("Crop");
if (e.getCurrentItem().equals(cropItem)) { if (e.getCurrentItem().equals(cropItem)) {
@ -164,9 +169,43 @@ public class FUpgradesGUI implements Listener {
fme.getPlayer().closeInventory(); fme.getPlayer().closeInventory();
} }
} }
int chestLevel = fme.getFaction().getUpgrade("Chest");
if (e.getCurrentItem().equals(chestitem)) {
if (expLevel == 3) {
return;
}
if (chestLevel == 2) {
int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3");
if (!hasMoney(fme, cost)) {
return;
}
takeMoney(fme, cost);
fme.getFaction().setUpgrades("Chest", 3);
fme.getPlayer().closeInventory();
}
if (chestLevel == 1) {
int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2");
if (!hasMoney(fme, cost)) {
return;
}
takeMoney(fme, cost);
fme.getFaction().setUpgrades("Chest", 2);
fme.getPlayer().closeInventory();
}
if (chestLevel == 0) {
int cost = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1");
if (!hasMoney(fme, cost)) {
return;
}
takeMoney(fme, cost);
fme.getFaction().setUpgrades("Chest", 1);
fme.getPlayer().closeInventory();
}
}
} }
} }
public ItemStack[] buildItems(FPlayer fme) { public ItemStack[] buildItems(FPlayer fme) {
@ -182,10 +221,7 @@ public class FUpgradesGUI implements Listener {
ItemStack expItem = P.p.createItem(expMaterial, expAmt, expData, expName, expLore); ItemStack expItem = P.p.createItem(expMaterial, expAmt, expData, expName, expLore);
if (expLevel >= 1) { if (expLevel >= 1) {
ItemMeta itemMeta = expItem.getItemMeta(); ItemMeta itemMeta = expItem.getItemMeta();
if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
expItem.setItemMeta(itemMeta); expItem.setItemMeta(itemMeta);
} }
@ -223,10 +259,7 @@ public class FUpgradesGUI implements Listener {
cropItem.getItemMeta().setLore(cropLore); cropItem.getItemMeta().setLore(cropLore);
if (cropLevel >= 1) { if (cropLevel >= 1) {
ItemMeta itemMeta = cropItem.getItemMeta(); ItemMeta itemMeta = cropItem.getItemMeta();
if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
cropItem.setItemMeta(itemMeta); cropItem.setItemMeta(itemMeta);
} }
@ -239,10 +272,7 @@ public class FUpgradesGUI implements Listener {
spawnerItem.getItemMeta().setLore(spawnerLore); spawnerItem.getItemMeta().setLore(spawnerLore);
if (spawnerLevel >= 1) { if (spawnerLevel >= 1) {
ItemMeta itemMeta = spawnerItem.getItemMeta(); ItemMeta itemMeta = spawnerItem.getItemMeta();
if (!P.p.mc17) { itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true); itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
spawnerItem.setItemMeta(itemMeta); spawnerItem.setItemMeta(itemMeta);
} }
@ -251,7 +281,35 @@ public class FUpgradesGUI implements Listener {
} else if (spawnerLevel == 3) { } else if (spawnerLevel == 3) {
spawnerItem.setAmount(3); spawnerItem.setAmount(3);
} }
ItemStack[] items = {expItem, spawnerItem, cropItem}; Material chestMaterial = Material.getMaterial(P.p.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Type"));
int chesttAmt = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Amount");
short chestData = Short.parseShort(P.p.getConfig().getInt("fupgrades.MainMenu.Chest.ChestItem.Damage") + "");
String chestName = P.p.color(P.p.getConfig().getString("fupgrades.MainMenu.Chest.ChestItem.Name", "&e&lUpgrade Chest Size"));
List<String> chestLore = P.p.colorList(P.p.getConfig().getStringList("fupgrades.MainMenu.Chest.ChestItem.Lore"));
int chestlevel = fme.getFaction().getUpgrade("Chest");
for (int i = 0; i <= chestLore.size() - 1; i++) {
String line = chestLore.get(i);
line = line.replace("{level}", chestlevel + "");
chestLore.set(i, line);
}
ItemStack chestItem = P.p.createItem(chestMaterial, chesttAmt, chestData, chestName, chestLore);
if (chestlevel >= 1) {
ItemMeta itemMeta = chestItem.getItemMeta();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
chestItem.setItemMeta(itemMeta);
}
if (chestlevel == 2) {
chestItem.setAmount(2);
} else if (chestlevel == 3) {
chestItem.setAmount(3);
}
ItemStack[] items = {expItem, spawnerItem, cropItem, chestItem};
return items; return items;
} }

View File

@ -249,12 +249,12 @@ public abstract class MemoryBoard extends Board {
Faction faction = fplayer.getFaction(); Faction faction = fplayer.getFaction();
ArrayList<FancyMessage> ret = new ArrayList<>(); ArrayList<FancyMessage> ret = new ArrayList<>();
Faction factionLoc = getFactionAt(flocation); Faction factionLoc = getFactionAt(flocation);
ret.add(new FancyMessage(P.p.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer)))); ret.add(new FancyMessage(ChatColor.DARK_GRAY + P.p.txt.titleize("(" + flocation.getCoordString() + ") " + factionLoc.getTag(fplayer))));
int buffer = P.p.getConfig().getInt("world-border.buffer", 0); int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
// Get the compass // Get the compass
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, P.p.txt.parse("<a>")); ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.DARK_GREEN, P.p.txt.parse("<gray>"));
int halfWidth = Conf.mapWidth / 2; int halfWidth = Conf.mapWidth / 2;
// Use player's value for height // Use player's value for height

View File

@ -15,11 +15,11 @@ import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.Permissable; import com.massivecraft.factions.zcore.fperms.Permissable;
import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.ChatColor; import org.bukkit.enchantments.Enchantment;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -237,6 +237,114 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
return 0; return 0;
} }
String chestSerialized = null;
Map<String, Object> bannerSerialized;
@Override
public Inventory getChest() {
int level = getUpgrade("Chest");
int size = 9;
if (level == 1) {
size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9;
} else if (level == 2) {
size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2") * 9;
} else if (level == 3) {
size = P.p.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9;
}
Inventory inventory = Bukkit.createInventory(null, size, P.p.color(P.p.getConfig().getString("fchest.Inventory-Title")));
if (chestSerialized == null) {
return inventory;
} else {
Inventory contents = StringToInventory(chestSerialized);
inventory.setContents(contents.getContents());
return inventory;
}
}
@Override
public void setChest(Inventory inventory) {
chestSerialized = InventoryToString(inventory);
}
public String InventoryToString(Inventory invInventory) {
String serialization = invInventory.getSize() + ";";
for (int i = 0; i < invInventory.getSize(); i++) {
ItemStack is = invInventory.getItem(i);
if (is != null) {
String serializedItemStack = new String();
String isType = String.valueOf(is.getType().getId());
serializedItemStack += "t@" + isType;
if (is.getDurability() != 0) {
String isDurability = String.valueOf(is.getDurability());
serializedItemStack += ":d@" + isDurability;
}
if (is.getAmount() != 1) {
String isAmount = String.valueOf(is.getAmount());
serializedItemStack += ":a@" + isAmount;
}
Map<Enchantment, Integer> isEnch = is.getEnchantments();
if (isEnch.size() > 0) {
for (Entry<Enchantment, Integer> ench : isEnch.entrySet()) {
serializedItemStack += ":e@" + ench.getKey().getId() + "@" + ench.getValue();
}
}
serialization += i + "#" + serializedItemStack + ";";
}
}
return serialization;
}
public Inventory StringToInventory(String invString) {
String[] serializedBlocks = invString.split(";");
String invInfo = serializedBlocks[0];
Inventory deserializedInventory = Bukkit.getServer().createInventory(null, Integer.valueOf(invInfo));
for (int i = 1; i < serializedBlocks.length; i++) {
String[] serializedBlock = serializedBlocks[i].split("#");
int stackPosition = Integer.valueOf(serializedBlock[0]);
if (stackPosition >= deserializedInventory.getSize()) {
continue;
}
ItemStack is = null;
Boolean createdItemStack = false;
String[] serializedItemStack = serializedBlock[1].split(":");
for (String itemInfo : serializedItemStack) {
String[] itemAttribute = itemInfo.split("@");
if (itemAttribute[0].equals("t")) {
is = new ItemStack(Material.getMaterial(Integer.valueOf(itemAttribute[1])));
createdItemStack = true;
} else if (itemAttribute[0].equals("d") && createdItemStack) {
is.setDurability(Short.valueOf(itemAttribute[1]));
} else if (itemAttribute[0].equals("a") && createdItemStack) {
is.setAmount(Integer.valueOf(itemAttribute[1]));
} else if (itemAttribute[0].equals("e") && createdItemStack) {
is.addEnchantment(Enchantment.getById(Integer.valueOf(itemAttribute[1])), Integer.valueOf(itemAttribute[2]));
}
}
deserializedInventory.setItem(stackPosition, is);
}
return deserializedInventory;
}
@Override
public void setBannerPattern(ItemStack banner) {
bannerSerialized = banner.serialize();
}
@Override
public ItemStack getBanner() {
return ItemStack.deserialize(bannerSerialized);
}
public void setUpgrades(String key,int level){ upgrades.put(key,level); } public void setUpgrades(String key,int level){ upgrades.put(key,level); }

View File

@ -548,6 +548,11 @@ public enum TL {
COMMAND_SCOREBOARD_DESCRIPTION("Scoreboardy things"), COMMAND_SCOREBOARD_DESCRIPTION("Scoreboardy things"),
COMMAND_SETBANNER_SUCCESS("&c&l[!] &7Banner Pattern Set!"),
COMMAND_SETBANNER_NOTBANNER("&c&l[!] &7The item is &cnot&7 a banner!"),
COMMAND_SETBANNER_DESCRIPTION("set banner pattern for your faction"),
COMMAND_SETDEFAULTROLE_DESCRIPTION("/f defaultrole <role> - set your Faction's default role."), COMMAND_SETDEFAULTROLE_DESCRIPTION("/f defaultrole <role> - set your Faction's default role."),
COMMAND_SETDEFAULTROLE_NOTTHATROLE("&c&l[!]&7 You cannot set the default to admin."), COMMAND_SETDEFAULTROLE_NOTTHATROLE("&c&l[!]&7 You cannot set the default to admin."),
COMMAND_SETDEFAULTROLE_SUCCESS("Set default role of your faction to %1$s"), COMMAND_SETDEFAULTROLE_SUCCESS("Set default role of your faction to %1$s"),

View File

@ -169,18 +169,18 @@ public class TextUtil {
// Paging and chrome-tools like titleize // Paging and chrome-tools like titleize
// -------------------------------------------- // // -------------------------------------------- //
private final static String titleizeLine = repeat("_", 52); private final static String titleizeLine = repeat("-", 52);
private final static int titleizeBalance = -1; private final static int titleizeBalance = -1;
public String titleize(String str) { public String titleize(String str) {
String center = ".[ " + parseTags("<l>") + str + parseTags("<a>") + " ]."; String center = ChatColor.DARK_GRAY + "< " + parseTags("<l>") + str + parseTags("<a>") + ChatColor.DARK_GRAY + " >";
int centerlen = ChatColor.stripColor(center).length(); int centerlen = ChatColor.stripColor(center).length();
int pivot = titleizeLine.length() / 2; int pivot = titleizeLine.length() / 2;
int eatLeft = (centerlen / 2) - titleizeBalance; int eatLeft = (centerlen / 2) - titleizeBalance;
int eatRight = (centerlen - eatLeft) + titleizeBalance; int eatRight = (centerlen - eatLeft) + titleizeBalance;
if (eatLeft < pivot) { if (eatLeft < pivot) {
return parseTags("<a>") + titleizeLine.substring(0, pivot - eatLeft) + center + titleizeLine.substring(pivot + eatRight); return parseTags("<a>") + ChatColor.DARK_GRAY + ChatColor.STRIKETHROUGH + titleizeLine.substring(0, pivot - eatLeft) + center + ChatColor.DARK_GRAY + ChatColor.STRIKETHROUGH + titleizeLine.substring(pivot + eatRight);
} else { } else {
return parseTags("<a>") + center; return parseTags("<a>") + center;
} }

View File

@ -349,6 +349,7 @@ help:
- '&e/f map &8- &7Map of the surrounding area, click chunks to claim.' - '&e/f map &8- &7Map of the surrounding area, click chunks to claim.'
- '&e/f sethome &8- &7Teleport to faction home.' - '&e/f sethome &8- &7Teleport to faction home.'
- '&e/f home &8- &7Set your faction home.' - '&e/f home &8- &7Set your faction home.'
- '&e/f title &f<playername> <title> &8- &7Set a player''s title, color codes supported.'
- '&e/f ban &8- &7Ban a member from your faction.' - '&e/f ban &8- &7Ban a member from your faction.'
- '&e/f unban &8- &7Unban a member from your faction.' - '&e/f unban &8- &7Unban a member from your faction.'
- '&e/f banlist &8- &7List banned players from your faction.' - '&e/f banlist &8- &7List banned players from your faction.'
@ -373,9 +374,11 @@ help:
- '&e/f warp &8- &7Opens the warp menu.' - '&e/f warp &8- &7Opens the warp menu.'
- '&e/f setwarp &8- &7Set a warp.' - '&e/f setwarp &8- &7Set a warp.'
- '&e/f perms &8- &7Change what players can do in your claims.' - '&e/f perms &8- &7Change what players can do in your claims.'
- '&e/f upgrades &8- &7Upgrade your factions core.' - '&e/f upgrades &8- &7Upgrade various perks in your faction.'
- '&e/f checkpoint &8- &7Set a faction checkpoint.' - '&e/f checkpoint &8- &7Set a faction checkpoint.'
- '&e/f tnt add/take <amount> &8- &7Faction Based TNT Bank.' - '&e/f tnt add/take &f<amount> &8- &7Faction Based TNT Bank.'
- '&e/f tntfill &f<radius> <amount> &8- &7Tnt fill integrated into the tntbank!'
- '&e/f chest &8- &7Open a virtual faction chest! '
- '&e/f version &8- &7Display current faction version.' - '&e/f version &8- &7Display current faction version.'
- '&7&m--------------------&r &e/f help 3 &7&m-----------------------' - '&7&m--------------------&r &e/f help 3 &7&m-----------------------'
############################################################ ############################################################
@ -486,7 +489,6 @@ fperm-gui:
relation: 4 relation: 4
# Back button slot # Back button slot
back: 0 back: 0
# Start action slots # Start action slots
build: 10 build: 10
destroy: 11 destroy: 11
@ -500,7 +502,7 @@ fperm-gui:
kick: 21 kick: 21
item: 22 item: 22
sethome: 23 sethome: 23
widthdraw: 24 withdraw: 24
territory: 25 territory: 25
access: 28 access: 28
promote: 29 promote: 29
@ -512,6 +514,8 @@ fperm-gui:
vault: 40 vault: 40
tntbank: 39 tntbank: 39
tntfill: 41 tntfill: 41
chest: 42
spawner: 38
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color # Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
materials: materials:
build: STAINED_GLASS build: STAINED_GLASS
@ -526,7 +530,7 @@ fperm-gui:
kick: STAINED_GLASS kick: STAINED_GLASS
item: STAINED_GLASS item: STAINED_GLASS
sethome: STAINED_GLASS sethome: STAINED_GLASS
widthdraw: STAINED_GLASS withdraw: STAINED_GLASS
territory: STAINED_GLASS territory: STAINED_GLASS
access: STAINED_GLASS access: STAINED_GLASS
promote: STAINED_GLASS promote: STAINED_GLASS
@ -538,6 +542,8 @@ fperm-gui:
vault: STAINED_GLASS vault: STAINED_GLASS
tntbank: STAINED_GLASS tntbank: STAINED_GLASS
tntfill: STAINED_GLASS tntfill: STAINED_GLASS
chest: STAINED_GLASS
spawner: STAINED_GLASS
# Same dummy items format as above # Same dummy items format as above
dummy-items: dummy-items:
'0': '0':
@ -581,15 +587,6 @@ fperm-gui:
- 42 - 42
- 43 - 43
- 44 - 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
# {action} Action name eg: Setwarp, Kick # {action} Action name eg: Setwarp, Kick
# {action-access} Access name eg: Allow, Deny # {action-access} Access name eg: Allow, Deny
# {action-access-color} Access color eg: Allow;GREEN # {action-access-color} Access color eg: Allow;GREEN
@ -735,6 +732,14 @@ fvault:
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Vault | #
# +------------------------------------------------------+ #
fchest:
Enabled: true
Inventory-Title: '&2&lFaction Chest'
# Vault size upgrades can be configured in the upgrades section of config
############################################################
# +------------------------------------------------------+ #
# | Faction Upgrades | # # | Faction Upgrades | #
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
############################################################ ############################################################
@ -873,6 +878,38 @@ fupgrades:
- '&e&lClick to &nUnlock' - '&e&lClick to &nUnlock'
slots: slots:
- 16 - 16
Chest:
Chest-Size:
# This is rows
level-1: 1
level-2: 2
level-3: 3
Cost:
level-1: 1000000
level-2: 2000000
level-3: 3000000
ChestItem:
Name: '&e&lUpgrade Faction Chest Size'
Type: CHEST
Amount: 1
Damage: 0
Lore:
- '&7Increased Faction Chest Size.'
- ''
- '&e&lTier'
- '&f&l* &7Current Level: &n{level}'
- ''
- '&e&lPerks'
- '&f&l* &7Level 1 - &f2 Rows'
- '&7 - Cost: $1,000,000'
- '&f&l* &7Level 2 - &f3 Rows'
- '&7 - Cost: $2,000,000'
- '&f&l* &7Level 3 - &f4 Rows'
- '&7 - Cost: $3,000,000'
- ''
- '&e&lClick to &nUnlock'
slots:
- 22
fbanners: fbanners:
Enabled: true Enabled: true
@ -897,6 +934,11 @@ fbanners:
#Title when moving between chunks #Title when moving between chunks
Title: Title:
Show-Title: true Show-Title: true
# You can configure the time in 1.9 or higher! The values are in seconds
Options:
FadeInTime: 1
ShowTime: 1
FadeOutTime: 1
Format: Format:
Title: '{Faction}' Title: '{Faction}'
Subtitle: '{Description}' Subtitle: '{Description}'

View File

@ -1,5 +1,5 @@
name: Factions name: Factions
version: ${project.version}-1.3-STABLE version: ${project.version}-1.4-STABLE
main: com.massivecraft.factions.P main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage] 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] 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]