2011-07-25 20:16:14 +02:00
|
|
|
package com.massivecraft.factions.commands;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
2011-10-08 22:03:44 +02:00
|
|
|
import com.massivecraft.factions.P;
|
2011-07-25 20:16:14 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public class FCommandPower extends FCommand {
|
2011-07-25 20:16:14 +02:00
|
|
|
|
|
|
|
public FCommandPower() {
|
|
|
|
aliases.add("power");
|
|
|
|
aliases.add("pow");
|
|
|
|
|
|
|
|
senderMustBePlayer = false;
|
|
|
|
|
|
|
|
optionalParameters.add("player name");
|
|
|
|
|
|
|
|
helpDescription = "show player power info";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasPermission(CommandSender sender) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
FPlayer target;
|
|
|
|
if (parameters.size() > 0) {
|
2011-10-09 14:53:38 +02:00
|
|
|
if (!P.hasPermViewAnyPower(fme)) {
|
|
|
|
fme.sendMessage("You do not have the appropriate permission to view another player's power level.");
|
2011-07-25 20:16:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
target = findFPlayer(parameters.get(0), false);
|
|
|
|
} else if (!(sender instanceof Player)) {
|
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
|
|
|
sendMessage("From the console, you must specify a player (f power <player name>).");
|
2011-07-25 20:16:14 +02:00
|
|
|
return;
|
|
|
|
} else {
|
2011-10-09 14:53:38 +02:00
|
|
|
target = fme;
|
2011-07-25 20:16:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (target == 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
|
|
|
|
if (!payForCommand(Conf.econCostPower)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
sendMessage(target.getNameAndRelevant(fme)+Conf.colorChrome+" - Power / Maxpower: "+Conf.colorSystem+target.getPowerRounded()+" / "+target.getPowerMaxRounded());
|
2011-07-25 20:16:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|