Moving files around

This commit is contained in:
Olof Larsson 2013-04-22 09:37:53 +02:00
parent ae61ef4c37
commit 41bb3f6e05
92 changed files with 367 additions and 344 deletions

View File

@ -12,7 +12,8 @@ public class Const
// MStore Collection Names
public static final String COLLECTION_BASENAME = "factions";
public static final String COLLECTION_BASENAME_ = COLLECTION_BASENAME+"_";
public static final String COLLECTION_BASENAME_CONF = COLLECTION_BASENAME_+"conf";
public static final String COLLECTION_BASENAME_MCONF = COLLECTION_BASENAME_+"mconf";
public static final String COLLECTION_BASENAME_UCONF = COLLECTION_BASENAME_+"uconf";
public static final String COLLECTION_BASENAME_BOARD = COLLECTION_BASENAME_+"board";
public static final String COLLECTION_BASENAME_PLAYER = COLLECTION_BASENAME_+"player";
public static final String COLLECTION_BASENAME_FACTION = COLLECTION_BASENAME_+"faction";

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.iface;
package com.massivecraft.factions;
public interface EconomyParticipator extends RelationParticipator

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.util.extractor.Extractor;
public class ExtractorFactionAccountId implements Extractor

View File

@ -10,7 +10,10 @@ import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
/**

View File

@ -4,6 +4,8 @@ import java.io.Serializable;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.Predictate;
public class FactionEqualsPredictate implements Predictate<CommandSender>, Serializable

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions;
import java.util.Comparator;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.util.MUtil;
public class FactionListComparator implements Comparator<Faction>

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions;
import com.massivecraft.factions.adapters.BoardAdapter;
import com.massivecraft.factions.adapters.BoardMapAdapter;
import com.massivecraft.factions.adapters.FFlagAdapter;
import com.massivecraft.factions.adapters.FPermAdapter;
import com.massivecraft.factions.adapters.RelAdapter;
import com.massivecraft.factions.adapters.TerritoryAccessAdapter;
import com.massivecraft.factions.adapter.BoardAdapter;
import com.massivecraft.factions.adapter.BoardMapAdapter;
import com.massivecraft.factions.adapter.FFlagAdapter;
import com.massivecraft.factions.adapter.FPermAdapter;
import com.massivecraft.factions.adapter.RelAdapter;
import com.massivecraft.factions.adapter.TerritoryAccessAdapter;
import com.massivecraft.factions.chat.modifier.ChatModifierLc;
import com.massivecraft.factions.chat.modifier.ChatModifierLp;
import com.massivecraft.factions.chat.modifier.ChatModifierParse;
@ -19,7 +19,10 @@ import com.massivecraft.factions.chat.tag.ChatTagTag;
import com.massivecraft.factions.chat.tag.ChatTagTagforce;
import com.massivecraft.factions.chat.tag.ChatTagTitle;
import com.massivecraft.factions.cmd.*;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.entity.Board;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.integration.Worldguard;
@ -125,7 +128,6 @@ public class Factions extends MPlugin
this.integrate(HerochatFeatures.get());
SpoutFeatures.setup();
Econ.setup();
LWCFeatures.setup();
if (ConfServer.worldGuardChecking)

View File

@ -1,8 +1,7 @@
package com.massivecraft.factions.iface;
package com.massivecraft.factions;
import org.bukkit.ChatColor;
import com.massivecraft.factions.Rel;
public interface RelationParticipator
{

View File

@ -6,6 +6,11 @@ import java.util.Set;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
public class TerritoryAccess
{
// -------------------------------------------- //

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;
import java.util.Map;
@ -11,8 +11,8 @@ import com.massivecraft.mcore.xlib.gson.JsonParseException;
import com.massivecraft.mcore.xlib.gson.JsonSerializationContext;
import com.massivecraft.mcore.xlib.gson.JsonSerializer;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.Board;
public class BoardAdapter implements JsonDeserializer<Board>, JsonSerializer<Board>
{

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.adapters;
package com.massivecraft.factions.adapter;
import java.lang.reflect.Type;
import java.util.Iterator;

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
public class ChatTagRelcolor extends ChatTagAbstract
{

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.mcore.util.Txt;
public class ChatTagRole extends ChatTagAbstract

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
public class ChatTagRoleprefix extends ChatTagAbstract
{

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
public class ChatTagTag extends ChatTagAbstract
{

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
public class ChatTagTagforce extends ChatTagAbstract
{

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.chat.tag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.chat.ChatTagAbstract;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
public class ChatTagTitle extends ChatTagAbstract
{

View File

@ -1,13 +1,13 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;

View File

@ -1,9 +1,9 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.ps.PS;

View File

@ -5,8 +5,8 @@ import java.util.List;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
public abstract class CmdFactionsCapeAbstract extends FCommand
{

View File

@ -1,9 +1,9 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.task.SpiralTask;
import com.massivecraft.mcore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -3,13 +3,13 @@ package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.event.FactionsEventCreate;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;

View File

@ -1,9 +1,9 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsDemote extends FCommand

View File

@ -2,20 +2,21 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.event.FactionsEventDisband;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
public class CmdFactionsDisband extends FCommand
{
@ -75,15 +76,15 @@ public class CmdFactionsDisband extends FCommand
if (ConfServer.logFactionDisband)
Factions.get().log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
if (Econ.isEnabled() && ! senderIsConsole)
if (Econ.isEnabled(faction))
{
//Give all the faction's money to the disbander
double amount = Econ.getBalance(faction.getAccountId());
double amount = Money.get(faction);
Econ.transferMoney(fme, faction, fme, amount, false);
if (amount > 0.0)
{
String amountString = Econ.moneyString(amount);
String amountString = Money.format(faction, amount);
msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
Factions.get().log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
}

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFFlag;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;

View File

@ -4,16 +4,16 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventHomeTeleport;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.event.FactionsEventInvitedChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -2,13 +2,13 @@ package com.massivecraft.factions.cmd;
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.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.util.RelationUtil;

View File

@ -3,10 +3,10 @@ package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import java.util.List;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.FactionListComparator;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.mcore.cmd.arg.ARInteger;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -1,14 +1,15 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import org.bukkit.ChatColor;
@ -37,11 +38,12 @@ public class CmdFactionsMoneyDeposit extends FCommand
Faction faction = this.arg(1, ARFaction.get(), myFaction);
if (faction == null) return;
boolean success = Econ.transferMoney(fme, fme, faction, amount);
if (success && ConfServer.logMoneyTransactions)
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Money.format(fme, amount), faction.describeTo(null))));
}
}
}

View File

@ -1,14 +1,15 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import org.bukkit.ChatColor;
@ -43,6 +44,8 @@ public class CmdFactionsMoneyTransferFf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}
}
}

View File

@ -1,16 +1,17 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import org.bukkit.ChatColor;
@ -45,6 +46,8 @@ public class CmdFactionsMoneyTransferFp extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}
}
}

View File

@ -1,16 +1,17 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import org.bukkit.ChatColor;
@ -45,6 +46,8 @@ public class CmdFactionsMoneyTransferPf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}
}
}

View File

@ -1,14 +1,15 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
import org.bukkit.ChatColor;
@ -39,6 +40,8 @@ public class CmdFactionsMoneyWithdraw extends FCommand
boolean success = Econ.transferMoney(fme, faction, fme, amount);
if (success && ConfServer.logMoneyTransactions)
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(faction, amount), faction.describeTo(null))));
}
}
}

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsOfficer extends FCommand

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.event.FactionsEventOpenChange;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPerm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.arg.ARRel;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsPower extends FCommand

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -1,9 +1,9 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsPromote extends FCommand

View File

@ -2,11 +2,11 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventRelationChange;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;

View File

@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventHomeChange;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;

View File

@ -7,14 +7,15 @@ import java.util.Map;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.util.Txt;
public class CmdFactionsShow extends FCommand
@ -61,21 +62,21 @@ public class CmdFactionsShow extends FCommand
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
// show the land value
if (Econ.isEnabled())
if (Econ.isEnabled(faction))
{
double value = Econ.calculateTotalLandValue(faction.getLandCount());
double refund = value * ConfServer.econClaimRefundMultiplier;
if (value > 0)
{
String stringValue = Econ.moneyString(value);
String stringRefund = (refund > 0.0) ? (" ("+Econ.moneyString(refund)+" depreciated)") : "";
String stringValue = Money.format(faction, value);
String stringRefund = (refund > 0.0) ? (" ("+Money.format(faction, refund)+" depreciated)") : "";
msg("<a>Total land value: <i>" + stringValue + stringRefund);
}
//Show bank contents
if(ConfServer.bankEnabled)
{
msg("<a>Bank contains: <i>"+Econ.moneyString(Econ.getBalance(faction.getAccountId())));
msg("<a>Bank contains: <i>"+Money.format(faction, Money.get(faction)));
}
}

View File

@ -3,11 +3,11 @@ package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.event.FactionsEventTagChange;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.util.MiscUtil;

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.event.FactionsEventTitleChange;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.cmd.arg.ARString;

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventLandUnclaim;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -39,9 +39,9 @@ public class CmdFactionsUnclaim extends FCommand
if (event.isCancelled()) return;
//String moneyBack = "<i>";
if (Econ.isEnabled())
if (Econ.isEnabled(myFaction))
{
double refund = Econ.calculateClaimRefund(myFaction.getLandCount());
double refund = Econ.calculateClaimRefund(myFaction);
if (ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts)
{

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.event.FactionsEventLandUnclaimAll;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures;
@ -25,7 +25,7 @@ public class CmdFactionsUnclaimall extends FCommand
public void perform()
{
// TODO: Put this as a listener and not in here!
if (Econ.isEnabled())
if (Econ.isEnabled(myFaction))
{
double refund = Econ.calculateTotalLandRefund(myFaction.getLandCount());
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts)

View File

@ -1,9 +1,9 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.cmd.MCommand;
import com.massivecraft.mcore.util.Txt;

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd.arg;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.mcore.cmd.arg.ARSenderEntity;
import com.massivecraft.mcore.cmd.arg.ArgReader;

View File

@ -2,10 +2,10 @@ package com.massivecraft.factions.cmd.arg;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.mcore.cmd.arg.ArgReaderAbstract;
import com.massivecraft.mcore.cmd.arg.ArgResult;
import com.massivecraft.mcore.util.Txt;

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.cmd.req;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.mcore.cmd.MCommand;
import com.massivecraft.mcore.cmd.req.ReqAbstract;
import com.massivecraft.mcore.util.Txt;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.lang.reflect.Type;
import java.util.ArrayList;
@ -10,7 +10,11 @@ import java.util.concurrent.ConcurrentSkipListMap;
import org.bukkit.ChatColor;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.util.AsciiCompass;
import com.massivecraft.mcore.ps.PS;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.io.File;
import java.lang.reflect.Type;
@ -6,7 +6,11 @@ import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.ps.PSBuilder;
import com.massivecraft.mcore.store.Coll;

View File

@ -1,8 +1,9 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.util.ArrayList;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.mcore.ps.PS;
public interface BoardInterface

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.util.HashSet;
import java.util.Set;
@ -6,19 +6,27 @@ import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.EconomyParticipator;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Lang;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.event.FactionsEventLandClaim;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.factions.event.FactionsEventPowerChange;
import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.money.Money;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.store.SenderEntity;
import com.massivecraft.mcore.util.TimeUnit;
@ -705,8 +713,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
if (myFaction.getFPlayers().size() == 1)
{
// Transfer all money
if (Econ.isEnabled())
Econ.transferMoney(this, myFaction, this, Econ.getBalance(myFaction.getAccountId()));
if (Econ.isEnabled(this))
{
Econ.transferMoney(this, myFaction, this, Money.get(this));
}
}
if (myFaction.isNormal())

View File

@ -1,10 +1,14 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.io.File;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.Map.Entry;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.store.MStore;
import com.massivecraft.mcore.store.SenderColl;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.util.*;
import java.util.Map.Entry;
@ -8,8 +8,16 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.EconomyParticipator;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FactionEqualsPredictate;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Lang;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.util.*;
import com.massivecraft.mcore.mixin.Mixin;

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions;
package com.massivecraft.factions.entity;
import java.io.File;
import java.lang.reflect.Type;
@ -14,6 +14,12 @@ import com.massivecraft.mcore.util.DiscUtil;
import com.massivecraft.mcore.util.Txt;
import com.massivecraft.mcore.xlib.gson.reflect.TypeToken;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.util.MiscUtil;
@ -76,9 +82,12 @@ public class FactionColl extends Coll<Faction>
String ret = super.attach(faction, oid, noteChange);
// Factions start with 0 money.
if (!Money.exists(faction, faction))
// TODO: Can this be done here?
// TODO: Or will it be a to heavy operation to do this often?
if (!Money.exists(faction))
{
Money.set(faction, faction, 0);
Money.set(faction, 0);
}
return ret;
@ -203,7 +212,7 @@ public class FactionColl extends Coll<Faction>
public void econLandRewardRoutine()
{
if (!Econ.isEnabled()) return;
if (!Econ.isEnabled(this.getUniverse())) return;
if (ConfServer.econLandReward == 0.0) return;
Factions.get().log("Running econLandRewardRoutine...");

View File

@ -0,0 +1,22 @@
package com.massivecraft.factions.entity;
import com.massivecraft.mcore.MCore;
import com.massivecraft.mcore.store.Entity;
public class MConf extends Entity<MConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static MConf get()
{
return MConfColl.get().get(MCore.INSTANCE);
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
}

View File

@ -0,0 +1,34 @@
package com.massivecraft.factions.entity;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.Factions;
import com.massivecraft.mcore.MCore;
import com.massivecraft.mcore.store.Coll;
import com.massivecraft.mcore.store.MStore;
public class MConfColl extends Coll<MConf>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MConfColl i = new MConfColl();
public static MConfColl get() { return i; }
private MConfColl()
{
super(Const.COLLECTION_BASENAME_MCONF, MConf.class, MStore.getDb(ConfServer.dburi), Factions.get(), true, false);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void init()
{
super.init();
this.get(MCore.INSTANCE);
}
}

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.mcore.event.MCoreEvent;
public abstract class FactionsEventAbstractSender extends MCoreEvent

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventDescriptionChange extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventDisband extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
public class FactionsEventHomeChange extends FactionsEventAbstractSender

View File

@ -3,8 +3,8 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventInvitedChange extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
public class FactionsEventLandClaim extends FactionsEventAbstractSender

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
public class FactionsEventLandUnclaim extends FactionsEventAbstractSender

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventLandUnclaimAll extends FactionsEventAbstractSender
{

View File

@ -3,8 +3,8 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventMembershipChange extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventOpenChange extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.entity.FPlayer;
public class FactionsEventPowerChange extends FactionsEventAbstractSender
{

View File

@ -3,8 +3,8 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventRelationChange extends FactionsEventAbstractSender

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.entity.Faction;
public class FactionsEventTagChange extends FactionsEventAbstractSender
{

View File

@ -3,7 +3,7 @@ package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.entity.FPlayer;
public class FactionsEventTitleChange extends FactionsEventAbstractSender
{

View File

@ -4,68 +4,26 @@ import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.EconomyParticipator;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.util.RelationUtil;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import com.massivecraft.mcore.money.Money;
public class Econ
{
// -------------------------------------------- //
// DERPY OLDSCHOOL SETUP
// -------------------------------------------- //
public static void setup()
{
if (economy != null) return;
String integrationFail = "Economy integration is "+(ConfServer.econEnabled ? "enabled, but" : "disabled, and")+" the plugin \"Vault\" ";
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null)
{
Factions.get().log(integrationFail+"is not installed.");
return;
}
RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null)
{
Factions.get().log(integrationFail+"is not hooked into an economy plugin.");
return;
}
economy = rsp.getProvider();
Factions.get().log("Economy integration through Vault plugin successful.");
if (!ConfServer.econEnabled)
{
Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
}
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private static Economy economy = null;
// -------------------------------------------- //
// STATE
// -------------------------------------------- //
public static boolean isEnabled()
// TODO: Do we really need that config option?
// TODO: Could we not have it enabled as long as Money.enabled is true?
public static boolean isEnabled(Object universe)
{
return ConfServer.econEnabled && economy != null && economy.isEnabled();
return ConfServer.econEnabled && Money.enabled(universe);
}
// -------------------------------------------- //
@ -74,7 +32,7 @@ public class Econ
public static boolean payForAction(double cost, FPlayer fsender, String actionDescription)
{
if (!isEnabled()) return true;
if (!isEnabled(fsender)) return true;
if (cost == 0D) return true;
if (fsender.isUsingAdminMode()) return true;
@ -94,25 +52,27 @@ public class Econ
// ASSORTED
// -------------------------------------------- //
public static void modifyUniverseMoney(double delta)
public static void modifyUniverseMoney(Object universe, double delta)
{
if (!isEnabled()) return;
if (!isEnabled(universe)) return;
if (ConfServer.econUniverseAccount == null) return;
if (ConfServer.econUniverseAccount.length() == 0) return;
if ( ! economy.hasAccount(ConfServer.econUniverseAccount)) return;
deposit(ConfServer.econUniverseAccount, delta);
if (!Money.exists(universe, ConfServer.econUniverseAccount)) return;
Money.add(universe, ConfServer.econUniverseAccount, delta);
}
public static void sendBalanceInfo(FPlayer to, EconomyParticipator about)
{
if (!isEnabled())
if (!isEnabled(to))
{
Factions.get().log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
return;
}
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Econ.moneyString(economy.getBalance(about.getAccountId())));
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Money.format(about, Money.get(about)));
}
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you)
@ -148,7 +108,7 @@ public class Econ
}
public static boolean transferMoney(EconomyParticipator invoker, EconomyParticipator from, EconomyParticipator to, double amount, boolean notify)
{
if ( ! isEnabled()) return false;
if (!isEnabled(from)) return false;
// The amount must be positive.
// If the amount is negative we must flip and multiply amount with -1.
@ -164,23 +124,26 @@ public class Econ
if ( ! canIControllYou(invoker, from)) return false;
// Is there enough money for the transaction to happen?
if ( ! economy.has(from.getAccountId(), amount))
if (Money.get(from) < amount)
{
// There was not enough money to pay
if (invoker != null && notify)
{
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), Money.format(from, amount), to.describeTo(invoker));
}
return false;
}
// Transfer money
EconomyResponse erw = economy.withdrawPlayer(from.getAccountId(), amount);
if (erw.transactionSuccess())
if (Money.subtract(from, amount))
{
EconomyResponse erd = economy.depositPlayer(to.getAccountId(), amount);
if (erd.transactionSuccess())
if (Money.add(from, amount))
{
if (notify)
{
@ -190,18 +153,16 @@ public class Econ
}
else
{
// transaction failed, refund account
// TODO: This must be invalid thinking for sure!
// Atomicity should be built into the system implementing Vault. We are /not/ doing manual rollbacks.
// TODO: Re
economy.depositPlayer(from.getAccountId(), amount);
// We failed. Try a rollback
Money.add(from, amount);
}
}
// if we get here something with the transaction failed
if (notify)
invoker.msg("Unable to transfer %s<b> to <h>%s<b> from <h>%s<b>.", moneyString(amount), to.describeTo(invoker), from.describeTo(invoker, true));
{
invoker.msg("Unable to transfer %s<b> to <h>%s<b> from <h>%s<b>.", Money.format(from, amount), to.describeTo(invoker), from.describeTo(invoker, true));
}
return false;
}
@ -237,40 +198,42 @@ public class Econ
{
for (FPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
}
}
else if (invoker == from)
{
for (FPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), moneyString(amount), to.describeTo(recipient));
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), Money.format(from, amount), to.describeTo(recipient));
}
}
else if (invoker == to)
{
for (FPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient));
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient));
}
}
else
{
for (FPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
}
}
}
public static boolean hasAtLeast(EconomyParticipator ep, double delta, String toDoThis)
{
if (!isEnabled()) return true;
if (!isEnabled(ep)) return true;
if ( ! economy.has(ep.getAccountId(), delta))
if (Money.get(ep) < delta)
{
if (toDoThis != null && !toDoThis.isEmpty())
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), moneyString(delta), toDoThis);
{
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), Money.format(ep, delta), toDoThis);
}
return false;
}
return true;
@ -278,71 +241,50 @@ public class Econ
public static boolean modifyMoney(EconomyParticipator ep, double delta, String actionDescription)
{
if (!isEnabled()) return false;
if (!isEnabled(ep)) return false;
if (delta == 0) return true;
String accountId = ep.getAccountId();
String You = ep.describeTo(ep, true);
boolean hasActionDesctription = (actionDescription != null && !actionDescription.isEmpty());
if (Money.add(ep, delta))
{
modifyUniverseMoney(ep, -delta);
if (hasActionDesctription)
{
if (delta > 0)
{
// The player should gain money
// The account might not have enough space
EconomyResponse er = economy.depositPlayer(accountId, delta);
if (er.transactionSuccess())
ep.msg("<h>%s<i> gained <h>%s<i> since did %s.", You, Money.format(ep, delta), actionDescription);
}
else
{
modifyUniverseMoney(-delta);
if (hasActionDesctription)
{
ep.msg("<h>%s<i> gained <h>%s<i> since did %s.", You, moneyString(delta), actionDescription);
ep.msg("<h>%s<i> lost <h>%s<i> since did %s.", You, Money.format(ep, delta), actionDescription);
}
}
return true;
}
else
{
// transfer to account failed
if (hasActionDesctription)
{
ep.msg("<h>%s<i> would have gained <h>%s<i> since did %s, but the deposit failed.", You, moneyString(delta), actionDescription);
}
return false;
}
if (delta > 0)
{
ep.msg("<h>%s<i> would have gained <h>%s<i> since did %s, but the deposit failed.", You, Money.format(ep, delta), actionDescription);
}
else
{
// The player should loose money
// The player might not have enough.
EconomyResponse er = economy.withdrawPlayer(accountId, -delta);
if (er.transactionSuccess())
{
// There is enough money to pay
modifyUniverseMoney(-delta);
if (hasActionDesctription)
{
ep.msg("<h>%s<i> lost <h>%s<i> since did %s.", You, moneyString(delta), actionDescription);
ep.msg("<h>%s<i> can't afford <h>%s<i> to %s.", You, Money.format(ep, delta), actionDescription);
}
return true;
}
else
{
// There was not enough money to pay
if (hasActionDesctription)
{
ep.msg("<h>%s<i> can't afford <h>%s<i> to %s.", You, moneyString(-delta), actionDescription);
}
return false;
}
}
}
// calculate the cost for claiming land
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction)
{
if (!isEnabled()) return 0D;
// basic claim cost, plus land inflation cost, minus the potential bonus given for claiming from another faction
return ConfServer.econCostClaimWilderness
+ (ConfServer.econCostClaimWilderness * ConfServer.econClaimAdditionalMultiplier * ownedLand)
@ -350,9 +292,9 @@ public class Econ
}
// calculate refund amount for unclaiming land
public static double calculateClaimRefund(int ownedLand)
public static double calculateClaimRefund(Faction forFaction)
{
return calculateClaimCost(ownedLand - 1, false) * ConfServer.econClaimRefundMultiplier;
return calculateClaimCost(forFaction.getLandCount() - 1, false) * ConfServer.econClaimRefundMultiplier;
}
// calculate value of all owned land
@ -372,49 +314,4 @@ public class Econ
return calculateTotalLandValue(ownedLand) * ConfServer.econClaimRefundMultiplier;
}
// -------------------------------------------- //
// Standard account management methods
// -------------------------------------------- //
// format money string based on server's set currency type, like "24 gold" or "$24.50"
public static String moneyString(double amount)
{
return economy.format(amount);
}
public static boolean hasAccount(String name)
{
return economy.hasAccount(name);
}
public static double getBalance(String account)
{
return economy.getBalance(account);
}
public static boolean setBalance(String account, double amount)
{
// This is about as stupid as it seems.
// Vault does however not implement a set balance feature.
double current = economy.getBalance(account);
return deposit(account, amount - current);
}
public static boolean deposit(String account, double amount)
{
if (amount < 0)
{
return withdraw(account, -amount);
}
return economy.depositPlayer(account, amount).transactionSuccess();
}
public static boolean withdraw(String account, double amount)
{
if (amount < 0)
{
return deposit(account, -amount);
}
return economy.withdrawPlayer(account, amount).transactionSuccess();
}
}

View File

@ -14,9 +14,9 @@ import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin;
import com.griefcraft.model.Protection;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
public class LWCFeatures

View File

@ -6,9 +6,6 @@ import java.util.HashSet;
import java.util.Set;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import org.bukkit.Bukkit;
@ -16,6 +13,9 @@ import org.bukkit.ChatColor;
import org.bukkit.plugin.Plugin;
import org.bukkit.entity.Player;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.util.HealthBarUtil;
import com.massivecraft.mcore.ps.PS;

View File

@ -8,13 +8,13 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;
import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;

View File

@ -22,10 +22,10 @@ import com.dthielke.herochat.Herochat;
import com.dthielke.herochat.MessageFormatSupplier;
import com.dthielke.herochat.MessageNotFoundException;
import com.dthielke.herochat.util.Messaging;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
public abstract class FactionsChannelAbstract implements Channel
{

View File

@ -44,16 +44,16 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.FactionsEventPowerChange;
import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason;
import com.massivecraft.factions.util.VisualizeUtil;

View File

@ -14,13 +14,13 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.event.MCorePlayerLeaveEvent;
import com.massivecraft.mcore.ps.PS;

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.task;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.mcore.ModuloRepeatTask;
import com.massivecraft.mcore.util.TimeUnit;

View File

@ -1,7 +1,7 @@
package com.massivecraft.factions.task;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FactionColl;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.mcore.ModuloRepeatTask;
import com.massivecraft.mcore.util.TimeUnit;

View File

@ -4,10 +4,10 @@ import org.bukkit.ChatColor;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.RelationParticipator;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.util.Txt;
public class RelationUtil