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;
|
|
|
|
|
|
|
|
|
|
|
|
public class FCommandPower extends FBaseCommand {
|
|
|
|
|
|
|
|
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-08 22:03:44 +02:00
|
|
|
if (!P.hasPermViewAnyPower(player)) {
|
2011-07-25 20:16:14 +02:00
|
|
|
me.sendMessage("You do not have the appropriate permission to view another player's power level.");
|
|
|
|
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 {
|
|
|
|
target = me;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-07-25 20:16:14 +02:00
|
|
|
sendMessage(target.getNameAndRelevant(me)+Conf.colorChrome+" - Power / Maxpower: "+Conf.colorSystem+target.getPowerRounded()+" / "+target.getPowerMaxRounded());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|