Fixed F PayPal

This commit is contained in:
Driftay 2019-03-23 02:02:46 -04:00
parent 9bbb3b35ab
commit 6cd2a80c36
2 changed files with 24 additions and 20 deletions

View File

@ -8,9 +8,11 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdPaypalSee extends FCommand { public class CmdPaypalSee extends FCommand {
public CmdPaypalSee() { public CmdPaypalSee() {
aliases.add("seepaypal"); aliases.add("seepaypal");
aliases.add("getpaypal");
requiredArgs.add("faction"); requiredArgs.add("faction");
permission = Permission.ADMIN.node; permission = Permission.ADMIN.node;
disableOnLock = false; disableOnLock = false;
senderMustBePlayer = false; senderMustBePlayer = false;
senderMustBeMember = false; senderMustBeMember = false;
@ -19,28 +21,29 @@ public class CmdPaypalSee extends FCommand {
senderMustBeAdmin = false; senderMustBeAdmin = false;
} }
@Override
public void perform() { public void perform() {
if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED); fme.msg(TL.GENERIC_DISABLED);
} else { return;
}
Faction faction = argAsFaction(0); Faction faction = argAsFaction(0);
if (faction != null) { if (faction != null)
return;
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) { if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
return;
}
if (faction.getPaypal() != null) { if (faction.getPaypal() != null) {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal()); fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
} else { } else {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal()); fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal());
} }
} else {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
} }
}
}
}
@Override
public TL getUsageTranslation() { public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSEE_DESCRIPTION; return TL.COMMAND_PAYPALSEE_DESCRIPTION;
} }

View File

@ -8,30 +8,31 @@ public class CmdPaypalSet extends FCommand {
public CmdPaypalSet() { public CmdPaypalSet() {
this.aliases.add("setpaypal"); this.aliases.add("setpaypal");
this.aliases.add("paypal");
this.requiredArgs.add("email"); this.requiredArgs.add("email");
this.permission = Permission.PAYPALSET.node; this.permission = Permission.PAYPALSET.node;
this.disableOnLock = false; this.disableOnLock = false;
this.senderMustBePlayer = true; this.senderMustBePlayer = true;
this.senderMustBeMember = false; this.senderMustBeMember = false;
this.senderMustBeModerator = false; this.senderMustBeModerator = false;
this.senderMustBeColeader = true; this.senderMustBeColeader = false;
this.senderMustBeAdmin = false; this.senderMustBeAdmin = true;
} }
@Override
public void perform() { public void perform() {
if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) { if (!SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED); fme.msg(TL.GENERIC_DISABLED);
} else { return;
String paypal = argAsString(0);
if (paypal != null) {
myFaction.paypalSet(paypal);
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
}
} }
String paypal = this.argAsString(0);
if(paypal == null)
return;
myFaction.paypalSet(paypal);
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
} }
@Override
public TL getUsageTranslation() { public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSET_DESCRIPTION; return TL.COMMAND_PAYPALSET_DESCRIPTION;
} }