New SeeChunk command and cleanup of the show command.
This commit is contained in:
@ -1,19 +1,21 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.FFlag;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Rel;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
|
||||
public class CmdShow extends FCommand
|
||||
{
|
||||
|
||||
public CmdShow()
|
||||
{
|
||||
this.aliases.add("show");
|
||||
@ -50,24 +52,21 @@ public class CmdShow extends FCommand
|
||||
|
||||
msg(p.txt.titleize(faction.getTag(fme)));
|
||||
msg("<a>Description: <i>%s", faction.getDescription());
|
||||
/*if ( ! faction.isNormal())
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
String peaceStatus = "";
|
||||
if (faction.getFlag(FFlag.PEACEFUL))
|
||||
{
|
||||
peaceStatus = " "+Conf.colorTruce+"This faction is Peaceful";
|
||||
}
|
||||
|
||||
msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required")+peaceStatus);
|
||||
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded());
|
||||
|
||||
// Display important flags
|
||||
// TODO: Find the non default flags, and display them instead.
|
||||
if (faction.getFlag(FFlag.PERMANENT))
|
||||
{
|
||||
msg("<a>This faction is permanent, remaining even with no members.");
|
||||
}
|
||||
|
||||
if (faction.getFlag(FFlag.PEACEFUL))
|
||||
{
|
||||
sendMessage(Conf.colorTruce+"This faction is peaceful - in truce with everyone.");
|
||||
}
|
||||
|
||||
msg("<a>Joining: <i>"+(faction.getOpen() ? "no invitation is needed" : "invitation is required"));
|
||||
msg("<a>Land / Power / Maxpower: <i> %d/%d/%d", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded());
|
||||
|
||||
// show the land value
|
||||
if (Econ.shouldBeUsed())
|
||||
@ -82,88 +81,62 @@ public class CmdShow extends FCommand
|
||||
}
|
||||
|
||||
//Show bank contents
|
||||
if(Conf.bankEnabled) {
|
||||
if(Conf.bankEnabled)
|
||||
{
|
||||
msg("<a>Bank contains: <i>"+Econ.moneyString(faction.getAccount().balance()));
|
||||
}
|
||||
}
|
||||
|
||||
String listpart;
|
||||
String sepparator = p.txt.parse("<i>")+", ";
|
||||
|
||||
// List relation
|
||||
String allyList = p.txt.parse("<a>Allies: ");
|
||||
String enemyList = p.txt.parse("<a>Enemies: ");
|
||||
for (Faction otherFaction : Factions.i.get())
|
||||
{
|
||||
if (otherFaction == faction)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
listpart = otherFaction.getTag(fme)+p.txt.parse("<i>")+", ";
|
||||
if (otherFaction.getRelationTo(faction) == Rel.ALLY)
|
||||
{
|
||||
allyList += listpart;
|
||||
}
|
||||
else if (otherFaction.getRelationTo(faction) == Rel.ENEMY)
|
||||
{
|
||||
enemyList += listpart;
|
||||
}
|
||||
}
|
||||
if (allyList.endsWith(", "))
|
||||
{
|
||||
allyList = allyList.substring(0, allyList.length()-2);
|
||||
}
|
||||
if (enemyList.endsWith(", "))
|
||||
{
|
||||
enemyList = enemyList.substring(0, enemyList.length()-2);
|
||||
}
|
||||
|
||||
sendMessage(allyList);
|
||||
sendMessage(enemyList);
|
||||
// List the relations to other factions
|
||||
Map<Rel, List<String>> relationTags = faction.getFactionTagsPerRelation();
|
||||
sendMessage(p.txt.parse("<a>In Truce with: ") + TextUtil.implode(relationTags.get(Rel.TRUCE), sepparator));
|
||||
sendMessage(p.txt.parse("<a>Allied to: ") + TextUtil.implode(relationTags.get(Rel.ALLY), sepparator));
|
||||
sendMessage(p.txt.parse("<a>Enemies: ") + TextUtil.implode(relationTags.get(Rel.ENEMY), sepparator));
|
||||
|
||||
// List the members...
|
||||
String onlineList = p.txt.parse("<a>")+"Members online: ";
|
||||
String offlineList = p.txt.parse("<a>")+"Members offline: ";
|
||||
List<String> memberOnlineNames = new ArrayList<String>();
|
||||
List<String> memberOfflineNames = new ArrayList<String>();
|
||||
|
||||
for (FPlayer follower : admins)
|
||||
{
|
||||
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
||||
if (follower.isOnline())
|
||||
{
|
||||
onlineList += listpart;
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
else
|
||||
{
|
||||
offlineList += listpart;
|
||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
}
|
||||
|
||||
for (FPlayer follower : mods)
|
||||
{
|
||||
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
||||
if
|
||||
(follower.isOnline())
|
||||
if (follower.isOnline())
|
||||
{
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
offlineList += listpart;
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
}
|
||||
for (FPlayer follower : normals) {
|
||||
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
||||
if (follower.isOnline()) {
|
||||
onlineList += listpart;
|
||||
} else {
|
||||
offlineList += listpart;
|
||||
else
|
||||
{
|
||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineList.endsWith(", ")) {
|
||||
onlineList = onlineList.substring(0, onlineList.length()-2);
|
||||
}
|
||||
if (offlineList.endsWith(", ")) {
|
||||
offlineList = offlineList.substring(0, offlineList.length()-2);
|
||||
for (FPlayer follower : normals)
|
||||
{
|
||||
if (follower.isOnline())
|
||||
{
|
||||
memberOnlineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
else
|
||||
{
|
||||
memberOfflineNames.add(follower.getNameAndTitle(fme));
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(onlineList);
|
||||
sendMessage(offlineList);
|
||||
sendMessage(p.txt.parse("<a>Members online: ") + TextUtil.implode(memberOnlineNames, sepparator));
|
||||
sendMessage(p.txt.parse("<a>Members offline: ") + TextUtil.implode(memberOfflineNames, sepparator));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user