Add clean command

This commit is contained in:
Olof Larsson
2017-03-24 20:19:04 +01:00
parent 42fe618b6b
commit 59112577b8
8 changed files with 66 additions and 5 deletions

View File

@@ -69,6 +69,7 @@ public class CmdFactions extends FactionsCommand
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
public CmdFactionsSetpower cmdFactionsSetpower = new CmdFactionsSetpower();
public CmdFactionsConfig cmdFactionsConfig = new CmdFactionsConfig();
public CmdFactionsClean cmdFactionsClean = new CmdFactionsClean();
public MassiveCommandVersion cmdFactionsVersion = new MassiveCommandVersion(Factions.get()).setAliases("v", "version").addRequirements(RequirementHasPerm.get(Perm.VERSION));
// -------------------------------------------- //
@@ -125,6 +126,7 @@ public class CmdFactions extends FactionsCommand
this.addChild(this.cmdFactionsPowerBoost);
this.addChild(this.cmdFactionsSetpower);
this.addChild(this.cmdFactionsConfig);
this.addChild(this.cmdFactionsClean);
this.addChild(this.cmdFactionsVersion);
// Deprecated Commands

View File

@@ -0,0 +1,36 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsClean extends FactionsCommand
{
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
Object message;
// Apply
int chunks = BoardColl.get().clean();
int players = MPlayerColl.get().clean();
// Title
message = Txt.titleize("Factions Cleaner Results");
message(message);
// Chunks
message = Txt.parse("<h>%d<i> chunks were cleaned.", chunks);
message(message);
// Players
message = Txt.parse("<h>%d<i> players were cleaned.", players);
message(message);
}
}