Reformatted - F Paypal + Few Fixes w/F Alts
This commit is contained in:
@@ -28,9 +28,7 @@ public class CmdAutoHelp extends MCommand<SaberFactions> {
|
||||
}
|
||||
MCommand<?> pcmd = this.commandChain.get(this.commandChain.size() - 1);
|
||||
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
|
||||
lines.addAll(pcmd.helpLong);
|
||||
ArrayList<String> lines = new ArrayList<>(pcmd.helpLong);
|
||||
|
||||
for (MCommand<?> scmd : pcmd.subCommands) {
|
||||
if (scmd.visibility == CommandVisibility.VISIBLE || (scmd.visibility == CommandVisibility.SECRET && scmd.validSenderPermissions(sender, false))) {
|
||||
|
||||
@@ -8,12 +8,14 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
public class CmdPaypalSee extends FCommand {
|
||||
public CmdPaypalSee() {
|
||||
aliases.add("seepaypal");
|
||||
aliases.add("paypal");
|
||||
|
||||
requiredArgs.add("faction");
|
||||
optionalArgs.put("faction", "yours");
|
||||
|
||||
permission = Permission.ADMIN.node;
|
||||
permission = Permission.PAYPAL.node;
|
||||
|
||||
disableOnLock = false;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
@@ -27,21 +29,30 @@ public class CmdPaypalSee extends FCommand {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
Faction faction = argAsFaction(0);
|
||||
|
||||
if (faction == null)
|
||||
return;
|
||||
|
||||
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
|
||||
return;
|
||||
}
|
||||
if (faction.getPaypal() != null) {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
|
||||
if (args.size() == 0) {
|
||||
if (myFaction.getPaypal().isEmpty()) {
|
||||
msg(TL.COMMAND_PAYPAL_NOTSET);
|
||||
} else {
|
||||
msg(TL.PAYPALSEE_PLAYER_PAYPAL, myFaction.getPaypal());
|
||||
}
|
||||
} else if (args.size() == 1) {
|
||||
if (fme.isAdminBypassing()) {
|
||||
Faction faction = argAsFaction(0);
|
||||
if (faction != null) {
|
||||
if (faction.getPaypal().isEmpty()) {
|
||||
msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal());
|
||||
msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msg(TL.GENERIC_NOPERMISSION, "see another factions paypal.");
|
||||
}
|
||||
} else {
|
||||
msg(SaberFactions.plugin.cmdBase.cmdPaypalSee.getUseageTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
|
||||
@@ -1,42 +1,70 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SaberFactions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdPaypalSet extends FCommand {
|
||||
|
||||
public CmdPaypalSet() {
|
||||
this.aliases.add("setpaypal");
|
||||
this.requiredArgs.add("email");
|
||||
public CmdPaypalSet() {
|
||||
this.aliases.add("setpaypal");
|
||||
|
||||
this.permission = Permission.PAYPALSET.node;
|
||||
this.optionalArgs.put("faction", "yours");
|
||||
|
||||
this.disableOnLock = false;
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeMember = true;
|
||||
this.senderMustBeModerator = false;
|
||||
this.senderMustBeColeader = false;
|
||||
this.senderMustBeAdmin = true;
|
||||
this.requiredArgs.add("email");
|
||||
|
||||
}
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
this.permission = Permission.PAYPALSET.node;
|
||||
|
||||
String paypal = this.argAsString(0);
|
||||
if(paypal == null)
|
||||
return;
|
||||
myFaction.paypalSet(paypal);
|
||||
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
|
||||
}
|
||||
this.disableOnLock = false;
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeMember = true;
|
||||
this.senderMustBeModerator = false;
|
||||
this.senderMustBeColeader = false;
|
||||
this.senderMustBeAdmin = true;
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_PAYPALSET_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
if (isEmail(argAsString(0))) {
|
||||
myFaction.paypalSet(argAsString(0));
|
||||
msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, argAsString(0));
|
||||
} else {
|
||||
msg(TL.COMMAND_PAYPALSET_NOTEMAIL, argAsString(0));
|
||||
}
|
||||
} else if (args.size() == 2) {
|
||||
if (fme.isAdminBypassing()) {
|
||||
Faction faction = argAsFaction(1);
|
||||
if (faction != null) {
|
||||
if (isEmail(argAsString(0))) {
|
||||
myFaction.paypalSet(argAsString(0));
|
||||
msg(TL.COMMAND_PAYPALSET_ADMIN_SUCCESSFUL, faction.getTag(), argAsString(0));
|
||||
} else {
|
||||
msg(TL.COMMAND_PAYPALSET_ADMIN_FAILED, argAsString(0));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msg(TL.GENERIC_NOPERMISSION, "set another factions paypal!");
|
||||
}
|
||||
} else {
|
||||
msg(SaberFactions.plugin.cmdBase.cmdPaypalSet.getUseageTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmail(String email) {
|
||||
return email.contains("@") && email.contains(".");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_PAYPALSET_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ public class CmdAltsList extends FCommand {
|
||||
|
||||
ArrayList<String> ret = new ArrayList<>();
|
||||
for (FPlayer fp : myFaction.getAltPlayers()) {
|
||||
if(myFaction.getAltPlayers().isEmpty()){
|
||||
fme.sendMessage(TL.COMMAND_ALTS_LIST_NOALTS.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fp.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
||||
String last = fp.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fp.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
||||
String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;
|
||||
|
||||
Reference in New Issue
Block a user