Merge with master

This commit is contained in:
Olof Larsson 2011-10-23 20:53:56 +02:00
commit ac6870b770
18 changed files with 114 additions and 7 deletions

View File

@ -89,7 +89,7 @@ permissions:
factions.chat: factions.chat:
description: change chat mode description: change chat mode
factions.claim: factions.claim:
description: claim the land where you are standing description: claim land where you are standing
factions.config: factions.config:
description: change a conf.json setting description: change a conf.json setting
factions.create: factions.create:

View File

@ -81,6 +81,16 @@ public class Conf
public static boolean worldGuardChecking = false; public static boolean worldGuardChecking = false;
// server logging options
public static boolean logFactionCreate = true;
public static boolean logFactionDisband = true;
public static boolean logFactionJoin = true;
public static boolean logFactionKick = true;
public static boolean logFactionLeave = true;
public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true;
public static boolean homesEnabled = true; public static boolean homesEnabled = true;
public static boolean homesMustBeInClaimedTerritory = true; public static boolean homesMustBeInClaimedTerritory = true;
public static boolean homesTeleportToOnDeath = true; public static boolean homesTeleportToOnDeath = true;

View File

@ -611,6 +611,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
{ {
fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer)); fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer));
} }
if (Conf.logFactionLeave)
P.p.log(this.getName()+" left the faction: "+myFaction.getTag());
} }
this.resetFactionData(); this.resetFactionData();
@ -624,6 +627,8 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
} }
myFaction.detach(); myFaction.detach();
if (Conf.logFactionDisband)
P.p.log("The faction "+myFaction.getTag()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
} }
} }
@ -772,6 +777,10 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
Board.setFactionAt(forFaction, flocation); Board.setFactionAt(forFaction, flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation); SpoutFeatures.updateTerritoryDisplayLoc(flocation);
if (Conf.logLandClaims)
P.p.log(this.getName()+" claimed land at ("+flocation.getCoordString()+") for the faction: "+forFaction.getTag());
return true; return true;
} }

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.struct.Rel;
@ -75,6 +76,9 @@ public class CmdCreate extends FCommand
} }
msg("<i>You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate()); msg("<i>You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate());
if (Conf.logFactionCreate)
P.p.log(fme.getName()+" created a new faction: "+tag);
} }
} }

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
@ -69,6 +70,7 @@ public class CmdDisband extends FCommand
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer)); fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
} }
} }
if (Conf.logFactionDisband)
P.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+"."); P.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
if (Econ.shouldBeUsed()) if (Econ.shouldBeUsed())

View File

@ -160,9 +160,13 @@ public class CmdHelp extends FCommand
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();
pageLines.add("Finally some commands for the server admins:"); pageLines.add("Finally some commands for the server admins:");
pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdBypass.getUseageTemplate(true) );
pageLines.add(p.txt.parse("<c>/f claim safezone <i>claim land for the Safe Zone"));
pageLines.add(p.txt.parse("<c>/f claim warzone <i>claim land for the War Zone"));
pageLines.add(p.txt.parse("<c>/f autoclaim [safezone|warzone] <i>take a guess"));
pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdSafeunclaimall.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate(true) ); pageLines.add( p.cmdBase.cmdWarunclaimall.getUseageTemplate(true) );
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well.")); pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + P.p.txt.parse("<i>") + " works on safe/war zones as well."));
pageLines.add( p.cmdBase.cmdPeaceful.getUseageTemplate(true) );
helpPages.add(pageLines); helpPages.add(pageLines);
pageLines = new ArrayList<String>(); pageLines = new ArrayList<String>();

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class CmdJoin extends FCommand public class CmdJoin extends FCommand
@ -69,5 +70,8 @@ public class CmdJoin extends FCommand
fme.resetFactionData(); fme.resetFactionData();
fme.setFaction(faction); fme.setFaction(faction);
faction.deinvite(fme); faction.deinvite(fme);
if (Conf.logFactionJoin)
P.p.log(fme.getName()+" joined the faction: "+faction.getTag());
} }
} }

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.FactionFlag; import com.massivecraft.factions.struct.FactionFlag;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -78,6 +79,9 @@ public class CmdKick extends FCommand
yourFaction.deinvite(you); yourFaction.deinvite(you);
you.resetFactionData(); you.resetFactionData();
if (Conf.logFactionKick)
P.p.log(fme.getName()+" kicked "+you.getName()+" from the faction: "+yourFaction.getTag());
if (yourFaction.getFPlayers().isEmpty() && !yourFaction.getFlag(FactionFlag.PERMANENT)) if (yourFaction.getFPlayers().isEmpty() && !yourFaction.getFlag(FactionFlag.PERMANENT))
{ {
// Remove this faction // Remove this faction
@ -86,6 +90,9 @@ public class CmdKick extends FCommand
fplayer.msg("The faction %s<i> was disbanded.", yourFaction.getTag(fplayer)); fplayer.msg("The faction %s<i> was disbanded.", yourFaction.getTag(fplayer));
} }
yourFaction.detach(); yourFaction.detach();
if (Conf.logFactionDisband)
P.p.log("The faction "+yourFaction.getTag()+" ("+yourFaction.getId()+") was disbanded since the last player was kicked by "+(senderIsConsole ? "console command" : fme.getName())+".");
} }
} }

View File

@ -1,9 +1,13 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyDeposit extends FCommand public class CmdMoneyDeposit extends FCommand
{ {
@ -30,9 +34,12 @@ public class CmdMoneyDeposit extends FCommand
public void perform() public void perform()
{ {
double amount = this.argAsDouble(0, 0d); double amount = this.argAsDouble(0, 0d);
Faction faction = this.argAsFaction(1, myFaction); EconomyParticipator faction = this.argAsFaction(1, myFaction);
if (faction == null) return; if (faction == null) return;
Econ.transferMoney(fme, fme, faction, amount); Econ.transferMoney(fme, fme, faction, amount);
if (Conf.logMoneyTransactions)
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s deposited %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
} }
} }

View File

@ -1,9 +1,13 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferFf extends FCommand public class CmdMoneyTransferFf extends FCommand
{ {
@ -36,5 +40,8 @@ public class CmdMoneyTransferFf extends FCommand
if (to == null) return; if (to == null) return;
Econ.transferMoney(fme, from, to, amount); Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }

View File

@ -1,9 +1,13 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferFp extends FCommand public class CmdMoneyTransferFp extends FCommand
{ {
@ -36,5 +40,8 @@ public class CmdMoneyTransferFp extends FCommand
if (to == null) return; if (to == null) return;
Econ.transferMoney(fme, from, to, amount); Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }

View File

@ -1,9 +1,13 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyTransferPf extends FCommand public class CmdMoneyTransferPf extends FCommand
{ {
@ -36,5 +40,8 @@ public class CmdMoneyTransferPf extends FCommand
if (to == null) return; if (to == null) return;
Econ.transferMoney(fme, from, to, amount); Econ.transferMoney(fme, from, to, amount);
if (Conf.logMoneyTransactions)
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Econ.moneyString(amount), from.describeTo(null), to.describeTo(null))));
} }
} }

View File

@ -1,9 +1,14 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import org.bukkit.ChatColor;
public class CmdMoneyWithdraw extends FCommand public class CmdMoneyWithdraw extends FCommand
{ {
public CmdMoneyWithdraw() public CmdMoneyWithdraw()
@ -27,8 +32,11 @@ public class CmdMoneyWithdraw extends FCommand
public void perform() public void perform()
{ {
double amount = this.argAsDouble(0, 0d); double amount = this.argAsDouble(0, 0d);
Faction faction = this.argAsFaction(1, myFaction); EconomyParticipator faction = this.argAsFaction(1, myFaction);
if (faction == null) return; if (faction == null) return;
Econ.transferMoney(fme, faction, fme, amount); Econ.transferMoney(fme, faction, fme, amount);
if (Conf.logMoneyTransactions)
P.p.log(ChatColor.stripColor(P.p.txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
} }
} }

View File

@ -1,7 +1,9 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class CmdSafeunclaimall extends FCommand public class CmdSafeunclaimall extends FCommand
@ -31,6 +33,9 @@ public class CmdSafeunclaimall extends FCommand
{ {
Board.unclaimAll(Factions.i.getSafeZone().getId()); Board.unclaimAll(Factions.i.getSafeZone().getId());
msg("<i>You unclaimed ALL safe zone land."); msg("<i>You unclaimed ALL safe zone land.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed all safe zones.");
} }
} }

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.struct.Rel;
@ -41,6 +42,9 @@ public class CmdUnclaim extends FCommand
Board.removeAt(flocation); Board.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation); SpoutFeatures.updateTerritoryDisplayLoc(flocation);
msg("<i>Safe zone was unclaimed."); msg("<i>Safe zone was unclaimed.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
} }
else else
{ {
@ -55,6 +59,9 @@ public class CmdUnclaim extends FCommand
Board.removeAt(flocation); Board.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation); SpoutFeatures.updateTerritoryDisplayLoc(flocation);
msg("<i>War zone was unclaimed."); msg("<i>War zone was unclaimed.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
} }
else else
{ {
@ -70,6 +77,10 @@ public class CmdUnclaim extends FCommand
otherFaction.msg("%s<i> unclaimed some of your land.", fme.describeTo(otherFaction, true)); otherFaction.msg("%s<i> unclaimed some of your land.", fme.describeTo(otherFaction, true));
msg("<i>You unclaimed this land."); msg("<i>You unclaimed this land.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
return; return;
} }
@ -154,6 +165,9 @@ public class CmdUnclaim extends FCommand
Board.removeAt(flocation); Board.removeAt(flocation);
SpoutFeatures.updateTerritoryDisplayLoc(flocation); SpoutFeatures.updateTerritoryDisplayLoc(flocation);
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true)); myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
} }
} }

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import com.massivecraft.factions.P;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -44,6 +45,9 @@ public class CmdUnclaimall extends FCommand
Board.unclaimAll(myFaction.getId()); Board.unclaimAll(myFaction.getId());
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true)); myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
SpoutFeatures.updateTerritoryDisplayLoc(null); SpoutFeatures.updateTerritoryDisplayLoc(null);
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag());
} }
} }

View File

@ -1,7 +1,9 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Board; import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
public class CmdWarunclaimall extends FCommand public class CmdWarunclaimall extends FCommand
@ -31,6 +33,9 @@ public class CmdWarunclaimall extends FCommand
{ {
Board.unclaimAll(Factions.i.getWarZone().getId()); Board.unclaimAll(Factions.i.getWarZone().getId());
msg("<i>You unclaimed ALL war zone land."); msg("<i>You unclaimed ALL war zone land.");
if (Conf.logLandUnclaims)
P.p.log(fme.getName()+" unclaimed all war zones.");
} }
} }

View File

@ -220,6 +220,9 @@ public class SpoutFeatures
SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer()); SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer.getPlayer());
Player pViewed = viewed.getPlayer(); Player pViewed = viewed.getPlayer();
if (pViewed == null || viewer.getPlayer() == null)
return;
String viewedTitle = viewed.getTitle(); String viewedTitle = viewed.getTitle();
Rel viewedRole = viewed.getRole(); Rel viewedRole = viewed.getRole();