Customized formats when using different claim tools.
This commit is contained in:
parent
8f694e6277
commit
e3785a1790
@ -20,6 +20,10 @@ public class CmdFactionsSetCircle extends CmdFactionsSetXRadius
|
||||
// Aliases
|
||||
this.addAliases("c", "circle");
|
||||
|
||||
// Format
|
||||
this.setFormatOne(null);
|
||||
this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using circle near %s<i>.");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.SET_CIRCLE.node));
|
||||
|
@ -24,6 +24,10 @@ public class CmdFactionsSetFill extends CmdFactionsSetXSimple
|
||||
// Aliases
|
||||
this.addAliases("f", "fill");
|
||||
|
||||
// Format
|
||||
this.setFormatOne(null);
|
||||
this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using fill near %s<i>.");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.SET_FILL.node));
|
||||
|
@ -20,6 +20,10 @@ public class CmdFactionsSetSquare extends CmdFactionsSetXRadius
|
||||
// Aliases
|
||||
this.addAliases("s", "square");
|
||||
|
||||
// Format
|
||||
this.setFormatOne(null);
|
||||
this.setFormatMany("<h>%s<i> %s <h>%d <i>chunks using square near %s<i>.");
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqIsPlayer.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.SET_SQUARE.node));
|
||||
|
@ -8,6 +8,7 @@ import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARWorldId;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
|
||||
@ -44,6 +45,8 @@ public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer
|
||||
if (MUtil.list("a", "al", "all").contains(this.arg(0).toLowerCase()))
|
||||
{
|
||||
chunks = BoardColl.get().getChunks(oldFaction);
|
||||
this.setFormatOne("<h>%s<i> %s all <h>%d <i>chunks.");
|
||||
this.setFormatMany("<h>%s<i> %s all <h>%d <i>chunks.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -67,6 +70,9 @@ public class CmdFactionsSetTransfer extends CmdFactionsSetXTransfer
|
||||
}
|
||||
Board board = BoardColl.get().get(worldId);
|
||||
chunks = board.getChunks(oldFaction);
|
||||
String worldDisplayName = Mixin.getWorldDisplayName(worldId);
|
||||
this.setFormatOne("<h>%s<i> %s all <h>%d <i>chunks in <h>" + worldDisplayName + "<i>.");
|
||||
this.setFormatMany("<h>%s<i> %s all <h>%d <i>chunks in <h>" + worldDisplayName + "<i>.");
|
||||
}
|
||||
|
||||
// Return Ret
|
||||
|
@ -9,6 +9,18 @@ import com.massivecraft.massivecore.ps.PS;
|
||||
|
||||
public abstract class CmdFactionsSetX extends FactionsCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private String formatOne = null;
|
||||
public String getFormatOne() { return this.formatOne; }
|
||||
public void setFormatOne(String formatOne) { this.formatOne = formatOne; }
|
||||
|
||||
private String formatMany = null;
|
||||
public String getFormatMany() { return this.formatMany; }
|
||||
public void setFormatMany(String formatMany) { this.formatMany = formatMany; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
@ -24,7 +36,7 @@ public abstract class CmdFactionsSetX extends FactionsCommand
|
||||
if (chunks == null) return;
|
||||
|
||||
// Apply / Inform
|
||||
msender.tryClaim(newFaction, chunks);
|
||||
msender.tryClaim(newFaction, chunks, this.getFormatOne(), this.getFormatMany());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
@ -799,8 +799,15 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
|
||||
// NEW
|
||||
public boolean tryClaim(Faction newFaction, Collection<PS> pss)
|
||||
{
|
||||
return this.tryClaim(newFaction, pss, null, null);
|
||||
}
|
||||
public boolean tryClaim(Faction newFaction, Collection<PS> pss, String formatOne, String formatMany)
|
||||
{
|
||||
// Args
|
||||
if (formatOne == null) formatOne = "<h>%s<i> %s <h>%d <i>chunk %s<i>.";
|
||||
if (formatMany == null) formatMany = "<h>%s<i> %s <h>%d <i>chunks near %s<i>.";
|
||||
|
||||
if (newFaction == null) throw new NullPointerException("newFaction");
|
||||
|
||||
if (pss == null) throw new NullPointerException("pss");
|
||||
@ -849,7 +856,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
||||
|
||||
for (MPlayer informee : informees)
|
||||
{
|
||||
informee.msg("<h>%s<i> %s <h>%d <i>" + (oldChunks.size() == 1 ? "chunk" : "chunks") + " near %s", this.describeTo(informee, true), typeString, oldChunks.size(), chunkString);
|
||||
informee.msg((oldChunks.size() == 1 ? formatOne : formatMany), this.describeTo(informee, true), typeString, oldChunks.size(), chunkString);
|
||||
informee.msg(" <h>%s<i> --> <h>%s", oldFaction.describeTo(informee, true), newFaction.describeTo(informee, true));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user