Fixing the comparator and starting to use the standardized version command.

This commit is contained in:
Olof Larsson 2013-04-16 13:17:42 +02:00
parent 4b9bdf0d94
commit 6ef15bc2db
4 changed files with 14 additions and 32 deletions

View File

@ -1,6 +1,7 @@
main: com.massivecraft.factions.Factions
name: Factions name: Factions
version: 2.0.0_dev version: 2.0.0_dev
main: com.massivecraft.factions.Factions website: http://massivecraft.com/factions
authors: [Olof "Cayorion" Larsson, Brett Flannigan] authors: [Olof "Cayorion" Larsson, Brett Flannigan]
depend: [mcore] depend: [mcore]
softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag] softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag]

View File

@ -22,24 +22,24 @@ public class FactionListComparator implements Comparator<Faction>
{ {
int ret = 0; int ret = 0;
// Null --> Low // Null
if (f1 == null && f2 == null) ret = 0; if (f1 == null && f2 == null) ret = 0;
if (f1 == null) ret = -1; if (f1 == null) ret = -1;
if (f2 == null) ret = +1; if (f2 == null) ret = +1;
if (ret != 0) return ret; if (ret != 0) return ret;
// None --> High // None
if (f1.isNone() && f2.isNone()) ret = 0; if (f1.isNone() && f2.isNone()) ret = 0;
if (f1.isNone()) ret = +1; if (f1.isNone()) ret = -1;
if (f2.isNone()) ret = -1; if (f2.isNone()) ret = +1;
if (ret != 0) return ret; if (ret != 0) return ret;
// Players Online --> High // Players Online
ret = f1.getFPlayersWhereOnline(true).size() - f2.getFPlayersWhereOnline(true).size(); ret = f2.getFPlayersWhereOnline(true).size() - f1.getFPlayersWhereOnline(true).size();
if (ret != 0) return ret; if (ret != 0) return ret;
// Players Total --> High // Players Total
ret = f1.getFPlayers().size() - f2.getFPlayers().size(); ret = f2.getFPlayers().size() - f1.getFPlayers().size();
if (ret != 0) return ret; if (ret != 0) return ret;
// Tie by Id // Tie by Id

View File

@ -3,7 +3,10 @@ package com.massivecraft.factions.cmd;
import java.util.Collections; import java.util.Collections;
import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.HelpCommand; import com.massivecraft.mcore.cmd.HelpCommand;
import com.massivecraft.mcore.cmd.VersionCommand;
public class CmdFactions extends FCommand public class CmdFactions extends FCommand
{ {
@ -44,7 +47,7 @@ public class CmdFactions extends FCommand
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle(); public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();
public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim(); public CmdFactionsUnclaim cmdFactionsUnclaim = new CmdFactionsUnclaim();
public CmdFactionsUnclaimall cmdFactionsUnclaimall = new CmdFactionsUnclaimall(); public CmdFactionsUnclaimall cmdFactionsUnclaimall = new CmdFactionsUnclaimall();
public CmdFactionsVersion cmdFactionsVersion = new CmdFactionsVersion(); public VersionCommand cmdFactionsVersion = new VersionCommand(Factions.get(), Perm.VERSION.node, "v", "version");
public CmdFactions() public CmdFactions()
{ {

View File

@ -1,22 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
public class CmdFactionsVersion extends FCommand
{
public CmdFactionsVersion()
{
this.addAliases("version");
this.addRequirements(ReqHasPerm.get(Perm.VERSION.node));
}
@Override
public void perform()
{
msg("<i>You are running "+Factions.get().getDescription().getFullName());
}
}