mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-23 18:55:25 +01:00
rename getOpen --> isOpen and remove old money migration code.
This commit is contained in:
parent
bdd71fa86e
commit
e45592432a
@ -34,8 +34,8 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
|
||||
// FIELD: open
|
||||
private boolean open;
|
||||
public boolean getOpen() { return open; }
|
||||
public void setOpen(boolean isOpen) { open = isOpen; }
|
||||
public boolean isOpen() { return this.open; }
|
||||
public void setOpen(boolean open) { this.open = open; }
|
||||
|
||||
// FIELD: tag
|
||||
private String tag;
|
||||
@ -84,16 +84,17 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
|
||||
// FIELD: account (fake field)
|
||||
// Bank functions
|
||||
public double money;
|
||||
public String getAccountId()
|
||||
{
|
||||
String aid = "faction-"+this.getId();
|
||||
String accountId = "faction-"+this.getId();
|
||||
|
||||
// We need to override the default money given to players.
|
||||
if ( ! Econ.hasAccount(aid))
|
||||
Econ.setBalance(aid, 0);
|
||||
if ( ! Econ.hasAccount(accountId))
|
||||
{
|
||||
Econ.setBalance(accountId, 0);
|
||||
}
|
||||
|
||||
return aid;
|
||||
return accountId;
|
||||
}
|
||||
|
||||
// FIELD: cape
|
||||
@ -196,7 +197,6 @@ public class Faction extends Entity implements EconomyParticipator
|
||||
this.open = ConfServer.newFactionsDefaultOpen;
|
||||
this.tag = "???";
|
||||
this.description = "Default faction description :(";
|
||||
this.money = 0.0;
|
||||
this.powerBoost = 0.0;
|
||||
this.flagOverrides = new LinkedHashMap<FFlag, Boolean>();
|
||||
this.permOverrides = new LinkedHashMap<FPerm, Set<Rel>>();
|
||||
|
@ -68,7 +68,7 @@ public class CmdFactionsJoin extends FCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! (faction.getOpen() || faction.isInvited(fplayer) || fme.hasAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.hasAdminMode() || Perm.JOIN_ANY.has(sender, false)))
|
||||
{
|
||||
msg("<i>This faction requires invitation.");
|
||||
if (samePlayer)
|
||||
|
@ -30,9 +30,9 @@ public class CmdFactionsOpen extends FCommand
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if ( ! payForCommand(ConfServer.econCostOpen, "to open or close the faction", "for opening or closing the faction")) return;
|
||||
|
||||
myFaction.setOpen(this.argAsBool(0, ! myFaction.getOpen()));
|
||||
myFaction.setOpen(this.argAsBool(0, ! myFaction.isOpen()));
|
||||
|
||||
String open = myFaction.getOpen() ? "open" : "closed";
|
||||
String open = myFaction.isOpen() ? "open" : "closed";
|
||||
|
||||
// Inform
|
||||
myFaction.msg("%s<i> changed the faction to <h>%s<i>.", fme.describeTo(myFaction, true), open);
|
||||
|
@ -66,7 +66,7 @@ public class CmdFactionsShow extends FCommand
|
||||
msg("<a>This faction is peaceful - in truce with everyone.");
|
||||
}
|
||||
|
||||
msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required"));
|
||||
msg("<a>Joining: <i>"+(faction.isOpen() ? "no invitation is needed" : "invitation is required"));
|
||||
|
||||
double powerBoost = faction.getPowerBoost();
|
||||
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")";
|
||||
|
@ -11,7 +11,6 @@ import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.FPerm;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionColl;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.util.RelationUtil;
|
||||
@ -48,8 +47,6 @@ public class Econ
|
||||
|
||||
if ( ! ConfServer.econEnabled)
|
||||
Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
|
||||
oldMoneyDoTransfer();
|
||||
}
|
||||
|
||||
public static boolean shouldBeUsed()
|
||||
@ -294,20 +291,6 @@ public class Econ
|
||||
{
|
||||
return econ.format(amount);
|
||||
}
|
||||
|
||||
public static void oldMoneyDoTransfer()
|
||||
{
|
||||
if ( ! shouldBeUsed()) return;
|
||||
|
||||
for (Faction faction : FactionColl.i.get())
|
||||
{
|
||||
if (faction.money > 0)
|
||||
{
|
||||
econ.depositPlayer(faction.getAccountId(), faction.money);
|
||||
faction.money = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the cost for claiming land
|
||||
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction)
|
||||
|
@ -29,6 +29,10 @@ import com.massivecraft.mcore.ps.PS;
|
||||
|
||||
public class FactionsBlockListener implements Listener
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FLAG: FIRE SPREAD
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void blockFireSpread(Block block, Cancellable cancellable)
|
||||
{
|
||||
// If the faction at the block has firespread disabled ...
|
||||
@ -70,6 +74,9 @@ public class FactionsBlockListener implements Listener
|
||||
blockFireSpread(event.getBlock(), event);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean playerCanBuildDestroyBlock(Player player, Block block, String action, boolean justCheck)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user