MCorify the MPlugin class Factions slightly.

This commit is contained in:
Olof Larsson
2013-04-09 13:12:13 +02:00
parent ecefb44d10
commit c8870d10d4
44 changed files with 139 additions and 122 deletions

View File

@ -30,12 +30,12 @@ public class CmdAdmin extends FCommand
if ( fme.hasAdminMode())
{
fme.msg("<i>You have enabled admin bypass mode.");
Factions.p.log(fme.getName() + " has ENABLED admin bypass mode.");
Factions.get().log(fme.getName() + " has ENABLED admin bypass mode.");
}
else
{
fme.msg("<i>You have disabled admin bypass mode.");
Factions.p.log(fme.getName() + " DISABLED admin bypass mode.");
Factions.get().log(fme.getName() + " DISABLED admin bypass mode.");
}
}
}

View File

@ -10,7 +10,7 @@ public class CmdAutoHelp extends MCommand<Factions>
{
public CmdAutoHelp()
{
super(Factions.p);
super(Factions.get());
this.aliases.add("?");
this.aliases.add("h");
this.aliases.add("help");

View File

@ -30,7 +30,7 @@ public class CmdCape extends FCommand
public void perform()
{
this.commandChain.add(this);
Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
}
}

View File

@ -386,7 +386,7 @@ public class CmdConfig extends FCommand
sendMessage(success);
if (sender instanceof Player)
{
Factions.p.log(success + " Command was run by "+fme.getName()+".");
Factions.get().log(success + " Command was run by "+fme.getName()+".");
}
}
// save change to disk

View File

@ -98,7 +98,7 @@ public class CmdCreate extends FCommand
msg("<i>You should now: %s", p.cmdBase.cmdDescription.getUseageTemplate());
if (Conf.logFactionCreate)
Factions.p.log(fme.getName()+" created a new faction: "+tag);
Factions.get().log(fme.getName()+" created a new faction: "+tag);
}
}

View File

@ -73,7 +73,7 @@ public class CmdDisband extends FCommand
}
}
if (Conf.logFactionDisband)
Factions.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
Factions.get().log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
if (Econ.shouldBeUsed() && ! senderIsConsole)
{
@ -85,7 +85,7 @@ public class CmdDisband extends FCommand
{
String amountString = Econ.moneyString(amount);
msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
Factions.p.log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
Factions.get().log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
}
}

View File

@ -162,7 +162,7 @@ public class CmdHelp extends FCommand
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.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + Factions.p.txt.parse("<i>") + " works on safe/war zones as well."));
pageLines.add(p.txt.parse("<i>Note: " + p.cmdBase.cmdUnclaim.getUseageTemplate(false) + Factions.get().txt.parse("<i>") + " works on safe/war zones as well."));
helpPages.add(pageLines);
pageLines = new ArrayList<String>();

View File

@ -103,9 +103,9 @@ public class CmdJoin extends FCommand
if (Conf.logFactionJoin)
{
if (samePlayer)
Factions.p.log("%s joined the faction %s.", fplayer.getName(), faction.getTag());
Factions.get().log("%s joined the faction %s.", fplayer.getName(), faction.getTag());
else
Factions.p.log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag());
Factions.get().log("%s moved the player %s into the faction %s.", fme.getName(), fplayer.getName(), faction.getTag());
}
}
}

View File

@ -79,7 +79,7 @@ public class CmdKick extends FCommand
}
if (Conf.logFactionKick)
Factions.p.log((senderIsConsole ? "A console command" : fme.getName())+" kicked "+you.getName()+" from the faction: "+yourFaction.getTag());
Factions.get().log((senderIsConsole ? "A console command" : fme.getName())+" kicked "+you.getName()+" from the faction: "+yourFaction.getTag());
if (you.getRole() == Rel.LEADER)
yourFaction.promoteNewLeader();

View File

@ -41,7 +41,7 @@ public class CmdMoney extends FCommand
public void perform()
{
this.commandChain.add(this);
Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
}
}

View File

@ -39,7 +39,7 @@ public class CmdMoneyDeposit extends FCommand
boolean success = Econ.transferMoney(fme, fme, faction, amount);
if (success && Conf.logMoneyTransactions)
Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
}
}

View File

@ -42,6 +42,6 @@ public class CmdMoneyTransferFf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions)
Factions.p.log(ChatColor.stripColor(Factions.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))));
Factions.get().log(ChatColor.stripColor(Factions.get().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

@ -42,6 +42,6 @@ public class CmdMoneyTransferFp extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions)
Factions.p.log(ChatColor.stripColor(Factions.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))));
Factions.get().log(ChatColor.stripColor(Factions.get().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

@ -42,6 +42,6 @@ public class CmdMoneyTransferPf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && Conf.logMoneyTransactions)
Factions.p.log(ChatColor.stripColor(Factions.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))));
Factions.get().log(ChatColor.stripColor(Factions.get().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

@ -37,6 +37,6 @@ public class CmdMoneyWithdraw extends FCommand
boolean success = Econ.transferMoney(fme, faction, fme, amount);
if (success && Conf.logMoneyTransactions)
Factions.p.log(ChatColor.stripColor(Factions.p.txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Factions.get().txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Econ.moneyString(amount), faction.describeTo(null))));
}
}

View File

@ -67,6 +67,6 @@ public class CmdPowerBoost extends FCommand
msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
if (!senderIsConsole)
Factions.p.log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
}
}

View File

@ -65,7 +65,7 @@ public class CmdReload extends FCommand
}
else
{
Factions.p.log("RELOAD CANCELLED - SPECIFIED FILE INVALID");
Factions.get().log("RELOAD CANCELLED - SPECIFIED FILE INVALID");
msg("<b>Invalid file specified. <i>Valid files: all, conf, board, factions, players");
return;
}

View File

@ -64,7 +64,7 @@ public class CmdUnclaim extends FCommand
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
if (Conf.logLandUnclaims)
Factions.p.log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
Factions.get().log(fme.getName()+" unclaimed land at ("+flocation.getCoordString()+") from the faction: "+otherFaction.getTag());
}
}

View File

@ -54,7 +54,7 @@ public class CmdUnclaimall extends FCommand
SpoutFeatures.updateTerritoryDisplayLoc(null);
if (Conf.logLandUnclaims)
Factions.p.log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag());
Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag());
}
}

View File

@ -25,6 +25,6 @@ public class CmdVersion extends FCommand
@Override
public void perform()
{
msg("<i>You are running "+Factions.p.getDescription().getFullName());
msg("<i>You are running "+Factions.get().getDescription().getFullName());
}
}

View File

@ -69,7 +69,7 @@ public class FCmdRoot extends FCommand
this.setHelpShort("The faction base command");
this.helpLong.add(p.txt.parseTags("<i>This command contains all faction stuff."));
this.addSubCommand(Factions.p.cmdAutoHelp);
this.addSubCommand(Factions.get().cmdAutoHelp);
this.addSubCommand(this.cmdList);
this.addSubCommand(this.cmdShow);
this.addSubCommand(this.cmdPower);
@ -118,7 +118,7 @@ public class FCmdRoot extends FCommand
public void perform()
{
this.commandChain.add(this);
Factions.p.cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
Factions.get().cmdAutoHelp.execute(this.sender, this.args, this.commandChain);
}
}

View File

@ -32,7 +32,7 @@ public abstract class FCommand extends MCommand<Factions>
public FCommand()
{
super(Factions.p);
super(Factions.get());
// Due to safety reasons it defaults to disable on lock.
disableOnLock = true;