2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
2011-07-18 22:06:02 +02:00
|
|
|
import com.massivecraft.factions.Conf;
|
2011-10-05 12:13:54 +02:00
|
|
|
import com.massivecraft.factions.integration.Econ;
|
2011-07-18 22:06:02 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.Faction;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.Factions;
|
2011-10-24 02:33:30 +02:00
|
|
|
import com.massivecraft.factions.struct.FFlag;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-10-23 17:30:41 +02:00
|
|
|
import com.massivecraft.factions.struct.Rel;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public class CmdShow extends FCommand
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public CmdShow()
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
|
|
|
this.aliases.add("show");
|
|
|
|
this.aliases.add("who");
|
2011-03-22 18:48:09 +01:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
//this.requiredArgs.add("");
|
|
|
|
this.optionalArgs.put("faction tag", "yours");
|
2011-06-30 12:56:02 +02:00
|
|
|
|
2011-10-09 21:57:43 +02:00
|
|
|
this.permission = Permission.SHOW.node;
|
|
|
|
this.disableOnLock = false;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = false;
|
2011-10-23 17:55:53 +02:00
|
|
|
senderMustBeOfficer = false;
|
|
|
|
senderMustBeLeader = false;
|
2011-03-23 17:39:56 +01:00
|
|
|
}
|
2011-06-30 12:56:02 +02:00
|
|
|
|
2011-10-09 18:35:39 +02:00
|
|
|
@Override
|
|
|
|
public void perform()
|
|
|
|
{
|
2011-10-10 01:43:21 +02:00
|
|
|
Faction faction = myFaction;
|
|
|
|
if (this.argIsSet(0))
|
|
|
|
{
|
|
|
|
faction = this.argAsFaction(0);
|
|
|
|
if (faction == null) return;
|
|
|
|
}
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
|
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
2011-10-12 18:48:47 +02:00
|
|
|
if ( ! payForCommand(Conf.econCostShow, "to show faction information", "for showing faction information")) return;
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
|
2011-10-23 17:30:41 +02:00
|
|
|
Collection<FPlayer> admins = faction.getFPlayersWhereRole(Rel.LEADER);
|
|
|
|
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Rel.OFFICER);
|
|
|
|
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-10-10 13:40:24 +02:00
|
|
|
msg(p.txt.titleize(faction.getTag(fme)));
|
|
|
|
msg("<a>Description: <i>%s", faction.getDescription());
|
2011-10-24 02:33:30 +02:00
|
|
|
/*if ( ! faction.isNormal())
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
return;
|
2011-10-24 02:33:30 +02:00
|
|
|
}*/
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-08-05 10:50:47 +02:00
|
|
|
String peaceStatus = "";
|
2011-10-24 02:33:30 +02:00
|
|
|
if (faction.getFlag(FFlag.PEACEFUL))
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-10-23 22:08:57 +02:00
|
|
|
peaceStatus = " "+Conf.colorTruce+"This faction is Peaceful";
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
2011-08-05 10:50:47 +02:00
|
|
|
|
2011-10-10 13:40:24 +02:00
|
|
|
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());
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
|
2011-10-24 02:33:30 +02:00
|
|
|
if (faction.getFlag(FFlag.PERMANENT))
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-10-10 13:40:24 +02:00
|
|
|
msg("<a>This faction is permanent, remaining even with no members.");
|
2011-09-13 20:14:09 +02:00
|
|
|
}
|
|
|
|
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
// show the land value
|
2011-10-12 17:25:01 +02:00
|
|
|
if (Econ.shouldBeUsed())
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
double value = Econ.calculateTotalLandValue(faction.getLandRounded());
|
|
|
|
double refund = value * Conf.econClaimRefundMultiplier;
|
2011-10-09 18:35:39 +02:00
|
|
|
if (value > 0)
|
|
|
|
{
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
String stringValue = Econ.moneyString(value);
|
|
|
|
String stringRefund = (refund > 0.0) ? (" ("+Econ.moneyString(refund)+" depreciated)") : "";
|
2011-10-10 13:40:24 +02:00
|
|
|
msg("<a>Total land value: <i>" + stringValue + stringRefund);
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
}
|
2011-09-26 17:44:20 +02:00
|
|
|
|
|
|
|
//Show bank contents
|
|
|
|
if(Conf.bankEnabled) {
|
2011-10-12 17:25:01 +02:00
|
|
|
msg("<a>Bank contains: <i>"+Econ.moneyString(faction.getAccount().balance()));
|
2011-09-26 17:44:20 +02:00
|
|
|
}
|
Added basic support for iConomy, where most Factions commands can be made to cost (or give) money. For claiming land, there are some extra features. Each additional land claimed by default costs more than the last, with the multiplier being configurable. For example, the first claim might cost $30, the 2nd $45, the third $60, and so forth. When land is claimed from a weakened faction, there is a configurable bonus amount of money deducted from the cost of claiming the land, as an incentive; this number can be changed to a negative value to instead make it cost more to claim such land. When land is unclaimed, a configurable percentage of the cost of claiming the land can be refunded (defaults to 70% of the cost). The total value of a faction's claimed land is now shown in the info given by /f who [faction tag], along with the depreciated (refund) value.
2011-08-02 01:05:01 +02:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
String listpart;
|
|
|
|
|
|
|
|
// List relation
|
2011-10-09 18:35:39 +02:00
|
|
|
String allyList = p.txt.parse("<a>Allies: ");
|
|
|
|
String enemyList = p.txt.parse("<a>Enemies: ");
|
|
|
|
for (Faction otherFaction : Factions.i.get())
|
|
|
|
{
|
|
|
|
if (otherFaction == faction)
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
listpart = otherFaction.getTag(fme)+p.txt.parse("<i>")+", ";
|
2011-10-23 17:30:41 +02:00
|
|
|
if (otherFaction.getRelationTo(faction) == Rel.ALLY)
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
allyList += listpart;
|
2011-10-09 18:35:39 +02:00
|
|
|
}
|
2011-10-23 17:30:41 +02:00
|
|
|
else if (otherFaction.getRelationTo(faction) == Rel.ENEMY)
|
2011-10-09 18:35:39 +02:00
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
enemyList += listpart;
|
|
|
|
}
|
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
if (allyList.endsWith(", "))
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
allyList = allyList.substring(0, allyList.length()-2);
|
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
if (enemyList.endsWith(", "))
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
enemyList = enemyList.substring(0, enemyList.length()-2);
|
|
|
|
}
|
|
|
|
|
|
|
|
sendMessage(allyList);
|
|
|
|
sendMessage(enemyList);
|
|
|
|
|
|
|
|
// List the members...
|
2011-10-09 18:35:39 +02:00
|
|
|
String onlineList = p.txt.parse("<a>")+"Members online: ";
|
|
|
|
String offlineList = p.txt.parse("<a>")+"Members offline: ";
|
|
|
|
for (FPlayer follower : admins)
|
|
|
|
{
|
|
|
|
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
|
|
|
if (follower.isOnline())
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
onlineList += listpart;
|
2011-10-09 18:35:39 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
offlineList += listpart;
|
|
|
|
}
|
|
|
|
}
|
2011-10-09 18:35:39 +02:00
|
|
|
for (FPlayer follower : mods)
|
|
|
|
{
|
|
|
|
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
|
|
|
if
|
|
|
|
(follower.isOnline())
|
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
onlineList += listpart;
|
|
|
|
} else {
|
|
|
|
offlineList += listpart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (FPlayer follower : normals) {
|
2011-10-09 18:35:39 +02:00
|
|
|
listpart = follower.getNameAndTitle(fme)+p.txt.parse("<i>")+", ";
|
2011-03-22 15:45:41 +01:00
|
|
|
if (follower.isOnline()) {
|
|
|
|
onlineList += listpart;
|
|
|
|
} else {
|
|
|
|
offlineList += listpart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (onlineList.endsWith(", ")) {
|
|
|
|
onlineList = onlineList.substring(0, onlineList.length()-2);
|
|
|
|
}
|
|
|
|
if (offlineList.endsWith(", ")) {
|
|
|
|
offlineList = offlineList.substring(0, offlineList.length()-2);
|
|
|
|
}
|
|
|
|
|
|
|
|
sendMessage(onlineList);
|
|
|
|
sendMessage(offlineList);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|