1.3-STABLE

------------------------------------------------------------------
1.7 Support Added
- Titles disabled in 1.7
- Banners disabled in 1.7
- Itemflags disabled in 1.7 for /f warp, /f perms, and /f upgrades
/f perms GUI has been redesigned ( Reset your config.yml or Change it from the config differences )

Reset conf.json for the following.
Default color for members set to light green ( &a )
Default color for wilderness set to gray ( &7 )
------------------------------------------------------------------
This commit is contained in:
ProSavage 2018-05-03 09:03:16 -05:00
parent 6bf4598d57
commit f30cd44b54
18 changed files with 368 additions and 283 deletions

View File

@ -14,14 +14,14 @@ public class Conf {
public static boolean allowNoSlashCommand = true;
// Colors
public static ChatColor colorMember = ChatColor.DARK_GREEN;
public static ChatColor colorMember = ChatColor.GREEN;
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
public static ChatColor colorTruce = ChatColor.DARK_PURPLE;
public static ChatColor colorNeutral = ChatColor.WHITE;
public static ChatColor colorEnemy = ChatColor.RED;
public static ChatColor colorPeaceful = ChatColor.GOLD;
public static ChatColor colorWilderness = ChatColor.DARK_GREEN;
public static ChatColor colorWilderness = ChatColor.GRAY;
public static ChatColor colorSafezone = ChatColor.GOLD;
public static ChatColor colorWar = ChatColor.DARK_RED;

View File

@ -27,308 +27,312 @@ import java.util.List;
*/
public interface FPlayer extends EconomyParticipator {
public void login();
void login();
public void logout();
void logout();
public Faction getFaction();
Faction getFaction();
public String getFactionId();
void setFaction(Faction faction);
public boolean hasFaction();
String getFactionId();
public void setFaction(Faction faction);
boolean hasFaction();
public boolean willAutoLeave();
boolean willAutoLeave();
public void setAutoLeave(boolean autoLeave);
void setAutoLeave(boolean autoLeave);
public long getLastFrostwalkerMessage();
long getLastFrostwalkerMessage();
public void setLastFrostwalkerMessage();
void setLastFrostwalkerMessage();
public void setMonitorJoins(boolean monitor);
void setMonitorJoins(boolean monitor);
public boolean isMonitoringJoins();
boolean isMonitoringJoins();
public Role getRole();
Role getRole();
public void setRole(Role role);
void setRole(Role role);
public boolean shouldTakeFallDamage();
boolean shouldTakeFallDamage();
public void setTakeFallDamage(boolean fallDamage);
void setTakeFallDamage(boolean fallDamage);
public double getPowerBoost();
double getPowerBoost();
public void setPowerBoost(double powerBoost);
void setPowerBoost(double powerBoost);
public Faction getAutoClaimFor();
Faction getAutoClaimFor();
public void setAutoClaimFor(Faction faction);
void setAutoClaimFor(Faction faction);
public boolean isAutoSafeClaimEnabled();
boolean isAutoSafeClaimEnabled();
public void setIsAutoSafeClaimEnabled(boolean enabled);
void setIsAutoSafeClaimEnabled(boolean enabled);
public boolean isAutoWarClaimEnabled();
boolean isAutoWarClaimEnabled();
public void setIsAutoWarClaimEnabled(boolean enabled);
void setIsAutoWarClaimEnabled(boolean enabled);
public boolean isAdminBypassing();
boolean isAdminBypassing();
public boolean isVanished();
boolean isVanished();
public void setIsAdminBypassing(boolean val);
void setIsAdminBypassing(boolean val);
public void setChatMode(ChatMode chatMode);
ChatMode getChatMode();
public ChatMode getChatMode();
void setChatMode(ChatMode chatMode);
public void setIgnoreAllianceChat(boolean ignore);
boolean isIgnoreAllianceChat();
public boolean isIgnoreAllianceChat();
void setIgnoreAllianceChat(boolean ignore);
public void setSpyingChat(boolean chatSpying);
boolean isSpyingChat();
public boolean isSpyingChat();
void setSpyingChat(boolean chatSpying);
public boolean showScoreboard();
boolean showScoreboard();
public void setShowScoreboard(boolean show);
void setShowScoreboard(boolean show);
// FIELD: account
public String getAccountId();
String getAccountId();
public void resetFactionData(boolean doSpoutUpdate);
void resetFactionData(boolean doSpoutUpdate);
public void resetFactionData();
void resetFactionData();
public long getLastLoginTime();
long getLastLoginTime();
public void setLastLoginTime(long lastLoginTime);
void setLastLoginTime(long lastLoginTime);
public boolean isMapAutoUpdating();
boolean isMapAutoUpdating();
public void setMapAutoUpdating(boolean mapAutoUpdating);
void setMapAutoUpdating(boolean mapAutoUpdating);
public boolean hasLoginPvpDisabled();
boolean hasLoginPvpDisabled();
public FLocation getLastStoodAt();
FLocation getLastStoodAt();
public void setLastStoodAt(FLocation flocation);
void setLastStoodAt(FLocation flocation);
public String getTitle();
String getTitle();
public void setTitle(CommandSender sender, String title);
void setTitle(CommandSender sender, String title);
public String getName();
String getName();
public String getTag();
String getTag();
// Base concatenations:
public String getNameAndSomething(String something);
String getNameAndSomething(String something);
public String getNameAndTitle();
String getNameAndTitle();
public String getNameAndTag();
String getNameAndTag();
// Colored concatenations:
// These are used in information messages
public String getNameAndTitle(Faction faction);
String getNameAndTitle(Faction faction);
public String getNameAndTitle(FPlayer fplayer);
String getNameAndTitle(FPlayer fplayer);
// Chat Tag:
// These are injected into the format of global chat messages.
public String getChatTag();
String getChatTag();
// Colored Chat Tag
public String getChatTag(Faction faction);
String getChatTag(Faction faction);
public String getChatTag(FPlayer fplayer);
String getChatTag(FPlayer fplayer);
public int getKills();
int getKills();
public int getDeaths();
int getDeaths();
public void takeMoney(int amt);
void takeMoney(int amt);
public boolean hasMoney(int amt);
boolean hasMoney(int amt);
//inspect Stuff
public boolean isInspectMode();
boolean isInspectMode();
public void setInspectMode(boolean status);
void setInspectMode(boolean status);
// Fly Checks
public Boolean canflyinWilderness();
Boolean canflyinWilderness();
public Boolean canflyinWarzone();
Boolean canflyinWarzone();
public Boolean canflyinSafezone();
Boolean canflyinSafezone();
public Boolean canflyinEnemy();
Boolean canflyinEnemy();
public Boolean canflyinAlly();
Boolean canflyinAlly();
public Boolean canflyinTruce();
Boolean canflyinTruce();
public Boolean canflyinNeutral();
Boolean canflyinNeutral();
// -------------------------------
// Relation and relation colors
// -------------------------------
@Override
public String describeTo(RelationParticipator that, boolean ucfirst);
String describeTo(RelationParticipator that, boolean ucfirst);
@Override
public String describeTo(RelationParticipator that);
String describeTo(RelationParticipator that);
@Override
public Relation getRelationTo(RelationParticipator rp);
Relation getRelationTo(RelationParticipator rp);
@Override
public Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
Relation getRelationTo(RelationParticipator rp, boolean ignorePeaceful);
public Relation getRelationToLocation();
Relation getRelationToLocation();
@Override
public ChatColor getColorTo(RelationParticipator rp);
ChatColor getColorTo(RelationParticipator rp);
public String getRolePrefix();
String getRolePrefix();
//----------------------------------------------//
// Health
//----------------------------------------------//
public void heal(int amnt);
void heal(int amnt);
//----------------------------------------------//
// Power
//----------------------------------------------//
public double getPower();
double getPower();
public void alterPower(double delta);
void alterPower(double delta);
public double getPowerMax();
double getPowerMax();
public double getPowerMin();
double getPowerMin();
public int getPowerRounded();
int getPowerRounded();
public int getPowerMaxRounded();
int getPowerMaxRounded();
public int getPowerMinRounded();
int getPowerMinRounded();
public void updatePower();
void updatePower();
public void losePowerFromBeingOffline();
void losePowerFromBeingOffline();
public void onDeath();
void onDeath();
//----------------------------------------------//
// Territory
//----------------------------------------------//
public boolean isInOwnTerritory();
boolean isInOwnTerritory();
public boolean isInOthersTerritory();
boolean isInOthersTerritory();
public boolean isInAllyTerritory();
boolean isInAllyTerritory();
public boolean isInNeutralTerritory();
boolean isInNeutralTerritory();
public boolean isInEnemyTerritory();
boolean isInEnemyTerritory();
public void sendFactionHereMessage(Faction from);
void sendFactionHereMessage(Faction from);
// -------------------------------
// Actions
// -------------------------------
public void leave(boolean makePay);
void leave(boolean makePay);
public boolean canClaimForFaction(Faction forFaction);
boolean canClaimForFaction(Faction forFaction);
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
public boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
public boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
public void setInVault(boolean status);
boolean isInVault();
public boolean isInVault();
void setInVault(boolean status);
public void msg(String str, Object... args);
void msg(String str, Object... args);
public String getId();
String getId();
public Player getPlayer();
void setId(String id);
public boolean isOnline();
Player getPlayer();
public void sendMessage(String message);
boolean isOnline();
public void sendMessage(List<String> messages);
void sendMessage(String message);
public void sendFancyMessage(FancyMessage message);
void sendMessage(List<String> messages);
public void sendFancyMessage(List<FancyMessage> message);
void sendFancyMessage(FancyMessage message);
public int getMapHeight();
void sendFancyMessage(List<FancyMessage> message);
public void setMapHeight(int height);
int getMapHeight();
public boolean isOnlineAndVisibleTo(Player me);
void setMapHeight(int height);
public void remove();
boolean isOnlineAndVisibleTo(Player me);
public boolean isOffline();
void remove();
public void setId(String id);
boolean isOffline();
public boolean isFlying();
boolean isFlying();
public void setFlying(boolean fly);
void setFlying(boolean fly);
public void setFFlying(boolean fly, boolean damage);
void setFFlying(boolean fly, boolean damage);
public boolean canFlyAtLocation();
boolean canFlyAtLocation();
public boolean canFlyAtLocation(FLocation location);
boolean canFlyAtLocation(FLocation location);
public boolean isEnteringPassword();
boolean isEnteringPassword();
public void setEnteringPassword(boolean toggle, String warp);
void setEnteringPassword(boolean toggle, String warp);
public String getEnteringWarp();
String getEnteringWarp();
public boolean checkIfNearbyEnemies();
boolean checkIfNearbyEnemies();
// -------------------------------
// Warmups
// -------------------------------
public boolean isWarmingUp();
boolean isWarmingUp();
WarmUpUtil.Warmup getWarmupType();
void addWarmup(WarmUpUtil.Warmup warmup, int taskId);
void stopWarmup();
void clearWarmup();
public WarmUpUtil.Warmup getWarmupType();
public void addWarmup(WarmUpUtil.Warmup warmup, int taskId);
public void stopWarmup();
public void clearWarmup();
}

View File

@ -21,8 +21,6 @@ import com.massivecraft.factions.zcore.fupgrades.EXPUpgrade;
import com.massivecraft.factions.zcore.fupgrades.FUpgradesGUI;
import com.massivecraft.factions.zcore.fupgrades.SpawnerUpgrades;
import com.massivecraft.factions.zcore.util.TextUtil;
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.*;
@ -152,7 +150,7 @@ public class P extends MPlugin {
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (version == 7) {
P.p.log("Version 1.7 found, disabling banner placement.");
P.p.log("Version 1.7 found, disabling banners, itemflags inside GUIs, and Titles.");
mc17 = true;
}

View File

@ -15,13 +15,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
public class CmdFly extends FCommand {
public static HashMap<String,Boolean> flyMap = new HashMap<String,Boolean>();
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
public static int id = -1;
public static int flyid = -1;
public CmdFly() {

View File

@ -50,7 +50,7 @@ public class CmdInvite extends FCommand {
Access access = myFaction.getAccess(target, PermissableAction.INVITE);
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
fme.msg(TL.GENERIC_NOPERMISSION, "invite");
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "invite");
return;
}

View File

@ -31,6 +31,7 @@ public class CmdMoneyWithdraw extends FCommand {
@Override
public void perform() {
double amount = this.argAsDouble(0, 0d);
EconomyParticipator faction = this.argAsFaction(1, myFaction);
if (faction == null) {

View File

@ -293,7 +293,7 @@ public class FactionsPlayerListener implements Listener {
.replace("{z}",e.getClickedBlock().getZ() + ""));
String rowFormat = TL.COMMAND_INSPECT_ROW.toString();
for (int i = 0; i < info.size(); i++){
CoreProtectAPI.ParseResult row = coAPI.parseResult((String[])info.get(0));
CoreProtectAPI.ParseResult row = coAPI.parseResult(info.get(0));
player.sendMessage(rowFormat
.replace("{time}",convertTime(row.getTime()))
.replace("{action}",row.getActionString())
@ -356,7 +356,10 @@ public class FactionsPlayerListener implements Listener {
title = parseAllPlaceholders(title, factionTo);
String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
subTitle = parseAllPlaceholders(subTitle, factionTo);
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle));
if (!P.p.mc17) {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle));
}
}
// enable fly :)
if (me.hasFaction() && !me.isFlying()) {

View File

@ -134,7 +134,10 @@ public enum Role implements Permissable {
itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore);
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
}
item.setItemMeta(itemMeta);
return item;

View File

@ -247,7 +247,10 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', dummySection.getString("name", " ")));

View File

@ -37,7 +37,9 @@ public enum PermissableAction {
FLY("fly"),
VAULT("vault"),
TNTBANK("tntbank"),
TNTFILL("tntfill");
TNTFILL("tntfill"),
WIDTHDRAW("widthdraw"),
DEPOSIT("deposit");
private String name;
@ -117,7 +119,10 @@ public enum PermissableAction {
lore.add(replacePlaceholders(loreLine, fme, permissable));
}
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore);
item.setItemMeta(itemMeta);

View File

@ -232,7 +232,10 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
}
ItemMeta meta = dummyItem.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
dummyItem.setItemMeta(meta);
List<Integer> dummySlots = section.getIntegerList("dummy-items." + key);
@ -284,7 +287,10 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
}
itemMeta.setLore(lore);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
itemStack.setItemMeta(itemMeta);

View File

@ -145,7 +145,10 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
}
ItemMeta meta = dummyItem.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
dummyItem.setItemMeta(meta);
List<Integer> dummySlots = section.getIntegerList("dummy-items." + key);
@ -196,7 +199,10 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
}
itemMeta.setLore(lore);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
}
itemStack.setItemMeta(itemMeta);

View File

@ -182,7 +182,10 @@ public class FUpgradesGUI implements Listener {
ItemStack expItem = P.p.createItem(expMaterial, expAmt, expData, expName, expLore);
if (expLevel >= 1) {
ItemMeta itemMeta = expItem.getItemMeta();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
expItem.setItemMeta(itemMeta);
}
@ -220,7 +223,10 @@ public class FUpgradesGUI implements Listener {
cropItem.getItemMeta().setLore(cropLore);
if (cropLevel >= 1) {
ItemMeta itemMeta = cropItem.getItemMeta();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
cropItem.setItemMeta(itemMeta);
}
@ -233,7 +239,10 @@ public class FUpgradesGUI implements Listener {
spawnerItem.getItemMeta().setLore(spawnerLore);
if (spawnerLevel >= 1) {
ItemMeta itemMeta = spawnerItem.getItemMeta();
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
if (!P.p.mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
itemMeta.addEnchant(Enchantment.DURABILITY, 3, true);
spawnerItem.setItemMeta(itemMeta);
}
@ -248,7 +257,7 @@ public class FUpgradesGUI implements Listener {
public boolean hasMoney(FPlayer fme, int amt) {
Economy econ = P.p.getEcon();
if (econ.getBalance((Player) fme.getPlayer()) >= amt) {
if (econ.getBalance(fme.getPlayer()) >= amt) {
return true;
} else {
fme.getPlayer().closeInventory();

View File

@ -794,73 +794,7 @@ public abstract class MemoryFPlayer implements FPlayer {
return attemptClaim(forFaction, new FLocation(location), notifyFailure);
}
public boolean attemptClaim(Faction forFaction, FLocation flocation, boolean notifyFailure) {
// notifyFailure is false if called by auto-claim; no need to notify on every failure for it
// return value is false on failure, true on success
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
int ownedLand = forFaction.getLandRounded();
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) {
return false;
}
// if economy is enabled and they're not on the bypass list, make sure they can pay
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone();
double cost = 0.0;
EconomyParticipator payee = null;
if (mustPay) {
cost = Econ.calculateClaimCost(ownedLand, currentFaction.isNormal());
if (Conf.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, forFaction)) {
cost += Conf.econClaimUnconnectedFee;
}
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts && this.hasFaction()) {
payee = this.getFaction();
} else {
payee = this;
}
if (!Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) {
return false;
}
}
LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this);
Bukkit.getServer().getPluginManager().callEvent(claimEvent);
if (claimEvent.isCancelled()) {
return false;
}
// then make 'em pay (if applicable)
if (mustPay && !Econ.modifyMoney(payee, -cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString())) {
return false;
}
// Was an over claim
if (currentFaction.isNormal() && currentFaction.hasLandInflation()) {
// Give them money for over claiming.
Econ.modifyMoney(payee, Conf.econOverclaimRewardMultiplier, TL.CLAIM_TOOVERCLAIM.toString(), TL.CLAIM_FOROVERCLAIM.toString());
}
// announce success
Set<FPlayer> informTheseFPlayers = new HashSet<>();
informTheseFPlayers.add(this);
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
for (FPlayer fp : informTheseFPlayers) {
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
}
Board.getInstance().setFactionAt(forFaction, flocation);
if (Conf.logLandClaims) {
P.p.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag());
}
return true;
}
boolean playerAlerts = false;
public boolean shouldBeSaved() {
return this.hasFaction() || (this.getPowerRounded() != this.getPowerMaxRounded() && this.getPowerRounded() != (int) Math.round(Conf.powerPlayerStarting));
@ -1180,8 +1114,74 @@ public abstract class MemoryFPlayer implements FPlayer {
inspectMode = status;
}
public boolean attemptClaim(Faction forFaction, FLocation flocation, boolean notifyFailure) {
// notifyFailure is false if called by auto-claim; no need to notify on every failure for it
// return value is false on failure, true on success
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
int ownedLand = forFaction.getLandRounded();
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) {
return false;
}
// if economy is enabled and they're not on the bypass list, make sure they can pay
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone();
double cost = 0.0;
EconomyParticipator payee = null;
if (mustPay) {
cost = Econ.calculateClaimCost(ownedLand, currentFaction.isNormal());
if (Conf.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0 && !Board.getInstance().isConnectedLocation(flocation, forFaction)) {
cost += Conf.econClaimUnconnectedFee;
}
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts && this.hasFaction()) {
payee = this.getFaction();
} else {
payee = this;
}
if (!Econ.hasAtLeast(payee, cost, TL.CLAIM_TOCLAIM.toString())) {
return false;
}
}
LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this);
Bukkit.getServer().getPluginManager().callEvent(claimEvent);
if (claimEvent.isCancelled()) {
return false;
}
// then make 'em pay (if applicable)
if (mustPay && !Econ.modifyMoney(payee, -cost, TL.CLAIM_TOCLAIM.toString(), TL.CLAIM_FORCLAIM.toString())) {
return false;
}
// Was an over claim
if (currentFaction.isNormal() && currentFaction.hasLandInflation()) {
// Give them money for over claiming.
Econ.modifyMoney(payee, Conf.econOverclaimRewardMultiplier, TL.CLAIM_TOOVERCLAIM.toString(), TL.CLAIM_FOROVERCLAIM.toString());
}
// announce success
Set<FPlayer> informTheseFPlayers = new HashSet<>();
informTheseFPlayers.add(this);
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
for (FPlayer fp : informTheseFPlayers) {
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
}
Board.getInstance().setFactionAt(forFaction, flocation);
if (Conf.logLandClaims) {
P.p.log(TL.CLAIM_CLAIMEDLOG.toString(), this.getName(), flocation.getCoordString(), forFaction.getTag());
}
return true;
}
@Override

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.PermissableAction;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.*;
import java.util.Map.Entry;
@ -550,7 +550,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
this.powerBoost = 0.0;
this.foundedDate = System.currentTimeMillis();
this.maxVaults = Conf.defaultMaxVaults;
this.defaultRole = Role.NORMAL;
this.defaultRole = Role.RECRUIT;
resetPerms(); // Reset on new Faction so it has default values.
}

View File

@ -706,7 +706,7 @@ public enum TL {
COMMAND_UNCLAIMALL_DESCRIPTION("Unclaim all of your factions land"),
COMMAND_UNCLAIM_CLICKTOUNCLAIM("Click to unclaim &2(%1$d, %2$d)"),
COMMAND_VERSION_NAME("&c&l[!]&7 SavageFactions &c» &7By ProSavage"),
COMMAND_VERSION_NAME("&c&l[!]&7 &c&k||| &r&4SavageFactions&7 &c&k|||&r &c» &7By ProSavage"),
COMMAND_VERSION_VERSION("&7Version &c» &7%1$s"),
COMMAND_VERSION_DESCRIPTION("Show plugin and translation version information"),
@ -778,6 +778,7 @@ public enum TL {
GENERIC_YOU("you"),
GENERIC_YOURFACTION("your faction"),
GENERIC_NOPERMISSION("<b>You don't have permission to %1$s."),
GENERIC_FPERM_NOPERMISSION("&7Your faction leader does not allow you to %1$s."),
GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit
GENERIC_NOPLAYERMATCH("<b>No player match found for \"<p>%1$s<b>\"."),
GENERIC_NOPLAYERFOUND("<b>No player \"<p>%1$s<b>\" could not be found."),

View File

@ -414,13 +414,13 @@ fperm-gui:
#Setting a slot to -1 will disable it
slots:
recruit: 10
normal: 11
moderator: 12
coleader: 13
truce: 21
ally: 20
enemy: 22
neutral: 19
normal: 12
moderator: 14
coleader: 16
truce: 19
ally: 21
enemy: 23
neutral: 25
# Material to be displayed
materials:
recruit: WOOD_SWORD
@ -444,6 +444,14 @@ fperm-gui:
- 7
- 8
- 9
- 11
- 13
- 15
- 17
- 20
- 22
- 24
- 26
- 17
- 18
- 19
@ -466,7 +474,7 @@ fperm-gui:
-
action:
name: 'Faction Permissions'
rows: 4
rows: 6
# If this field exists colorable materials will be updated
# https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/DyeColor.html
access:
@ -480,56 +488,56 @@ fperm-gui:
back: 0
# Start action slots
build: 9
destroy: 10
frost-walk: 11
pain-build: 12
door: 13
button: 14
lever: 15
container: 16
invite: 17
kick: 18
item: 19
sethome: 20
withdraw: 21
territory: 22
access: 23
promote: 24
setwarp: 25
warp: 26
ban: 27
disband: 28
fly: 29
vault: 30
tntbank: 31
tntfill: 32
build: 10
destroy: 11
frost-walk: 12
pain-build: 13
door: 14
button: 15
lever: 16
container: 19
invite: 20
kick: 21
item: 22
sethome: 23
widthdraw: 24
territory: 25
access: 28
promote: 29
setwarp: 30
warp: 31
ban: 32
disband: 33
fly: 34
vault: 40
tntbank: 39
tntfill: 41
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
materials:
build: STAINED_CLAY
destroy: STAINED_CLAY
frost-walk: STAINED_CLAY
pain-build: STAINED_CLAY
door: STAINED_CLAY
button: STAINED_CLAY
lever: STAINED_CLAY
container: STAINED_CLAY
invite: STAINED_CLAY
kick: STAINED_CLAY
item: STAINED_CLAY
sethome: STAINED_CLAY
withdraw: STAINED_CLAY
territory: STAINED_CLAY
access: STAINED_CLAY
promote: STAINED_CLAY
setwarp: STAINED_CLAY
warp: STAINED_CLAY
ban: STAINED_CLAY
disband: STAINED_CLAY
fly: STAINED_CLAY
vault: STAINED_CLAY
tntbank: STAINED_CLAY
tntfill: STAINED_CLAY
build: STAINED_GLASS
destroy: STAINED_GLASS
frost-walk: STAINED_GLASS
pain-build: STAINED_GLASS
door: STAINED_GLASS
button: STAINED_GLASS
lever: STAINED_GLASS
container: STAINED_GLASS
invite: STAINED_GLASS
kick: STAINED_GLASS
item: STAINED_GLASS
sethome: STAINED_GLASS
widthdraw: STAINED_GLASS
territory: STAINED_GLASS
access: STAINED_GLASS
promote: STAINED_GLASS
setwarp: STAINED_GLASS
warp: STAINED_GLASS
ban: STAINED_GLASS
disband: STAINED_GLASS
fly: STAINED_GLASS
vault: STAINED_GLASS
tntbank: STAINED_GLASS
tntfill: STAINED_GLASS
# Same dummy items format as above
dummy-items:
'0':
@ -540,10 +548,48 @@ fperm-gui:
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 10
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
# {action} Action name eg: Setwarp, Kick
# {action-access} Access name eg: Allow, Deny
# {action-access-color} Access color eg: Allow;GREEN
@ -613,7 +659,7 @@ fwarp-gui:
- 25
- 26
warp-item:
material: STONE
material: EYE_OF_ENDER
name: "&e&l(!) &eFaction Warp: &6&n{warp}"
# {warp-protected} Warp protection by password, Enabled & Disabled
# {warp-cost} Warp cost

View File

@ -1,5 +1,5 @@
name: Factions
version: ${project.version}-SF-1.2-STABLE
version: ${project.version}-1.3-STABLE
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]