Removing player index to reduce complexity since I doubt its required. Decouble and nullify faction descriptions.

This commit is contained in:
Olof Larsson
2013-04-17 08:49:43 +02:00
parent 6ef15bc2db
commit 1ccefc93b5
13 changed files with 187 additions and 173 deletions

View File

@ -7,7 +7,6 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.util.Txt;
public class CmdFactionsDescription extends FCommand
{
@ -28,22 +27,21 @@ public class CmdFactionsDescription 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.econCostDesc, "to change faction description", "for changing faction description")) return;
// TODO: This must be an invalid replace-approach. The call order is wrong somehow?
myFaction.setDescription(Txt.implode(args, " ").replaceAll("(&([a-f0-9]))", "& $2")); // since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
if ( ! ConfServer.broadcastDescriptionChanges)
if (ConfServer.broadcastDescriptionChanges)
{
// Broadcast the description to everyone
for (FPlayer fplayer : FPlayerColl.get().getAllOnline())
{
fplayer.msg("<h>%s<i> changed their description to:", myFaction.describeTo(fplayer));
fplayer.sendMessage(myFaction.getDescription());
}
}
else
{
fme.msg("You have changed the description for <h>%s<i> to:", myFaction.describeTo(fme));
fme.sendMessage(myFaction.getDescription());
return;
}
// Broadcast the description to everyone
for (FPlayer fplayer : FPlayerColl.get().getAllOnline())
{
fplayer.msg("<h>%s<i> changed their description to:", myFaction.describeTo(fplayer));
fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description, thus exploitable (masquerade as server messages or whatever); by the way, &k is particularly interesting looking
}
}
}

View File

@ -35,7 +35,7 @@ public class CmdFactionsLeader extends FCommand
Faction targetFaction = this.arg(1, ARFaction.get(), myFaction);
if (targetFaction == null) return;
FPlayer targetFactionCurrentLeader = targetFaction.getFPlayerLeader();
FPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have fplayer and the target faction
if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))

View File

@ -64,7 +64,7 @@ public class CmdFactionsList extends FCommand
faction.getTag(fme),
faction.getFPlayersWhereOnline(true).size(),
faction.getFPlayers().size(),
faction.getLandRounded(),
faction.getLandCount(),
faction.getPowerRounded(),
faction.getPowerMaxRounded())
);

View File

@ -61,12 +61,12 @@ public class CmdFactionsShow extends FCommand
double powerBoost = faction.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")";
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d %s", faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost);
// show the land value
if (Econ.shouldBeUsed())
{
double value = Econ.calculateTotalLandValue(faction.getLandRounded());
double value = Econ.calculateTotalLandValue(faction.getLandCount());
double refund = value * ConfServer.econClaimRefundMultiplier;
if (value > 0)
{

View File

@ -40,7 +40,7 @@ public class CmdFactionsUnclaim extends FCommand
//String moneyBack = "<i>";
if (Econ.shouldBeUsed())
{
double refund = Econ.calculateClaimRefund(myFaction.getLandRounded());
double refund = Econ.calculateClaimRefund(myFaction.getLandCount());
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts)
{

View File

@ -28,7 +28,7 @@ public class CmdFactionsUnclaimall extends FCommand
{
if (Econ.shouldBeUsed())
{
double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded());
double refund = Econ.calculateTotalLandRefund(myFaction.getLandCount());
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts)
{
if ( ! Econ.modifyMoney(myFaction, refund, "to unclaim all faction land", "for unclaiming all faction land")) return;

View File

@ -66,7 +66,7 @@ public abstract class FCommand extends MCommand
{
if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isUsingAdminMode()) return true;
if(ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction())
if (ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction())
return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
else
return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);