Reformatted - F Paypal + Few Fixes w/F Alts

This commit is contained in:
Driftay 2019-07-04 01:12:39 -04:00
parent 9d40fec03b
commit 27a442681d
8 changed files with 100 additions and 50 deletions

View File

@ -568,7 +568,6 @@ public class SaberFactions extends MPlugin {
List<MCommand<?>> commandsList = cmdBase.subCommands; List<MCommand<?>> commandsList = cmdBase.subCommands;
if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())) == Factions.getInstance().getWarZone()) { if (Board.getInstance().getFactionAt(new FLocation(fPlayer.getPlayer().getLocation())) == Factions.getInstance().getWarZone()) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cYou cannot use autocomplete in warzone."));
return new ArrayList<>(); return new ArrayList<>();
} }

View File

@ -28,9 +28,7 @@ public class CmdAutoHelp extends MCommand<SaberFactions> {
} }
MCommand<?> pcmd = this.commandChain.get(this.commandChain.size() - 1); MCommand<?> pcmd = this.commandChain.get(this.commandChain.size() - 1);
ArrayList<String> lines = new ArrayList<>(); ArrayList<String> lines = new ArrayList<>(pcmd.helpLong);
lines.addAll(pcmd.helpLong);
for (MCommand<?> scmd : pcmd.subCommands) { for (MCommand<?> scmd : pcmd.subCommands) {
if (scmd.visibility == CommandVisibility.VISIBLE || (scmd.visibility == CommandVisibility.SECRET && scmd.validSenderPermissions(sender, false))) { if (scmd.visibility == CommandVisibility.VISIBLE || (scmd.visibility == CommandVisibility.SECRET && scmd.validSenderPermissions(sender, false))) {

View File

@ -8,12 +8,14 @@ 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("paypal");
requiredArgs.add("faction"); optionalArgs.put("faction", "yours");
permission = Permission.ADMIN.node; permission = Permission.PAYPAL.node;
disableOnLock = false; disableOnLock = false;
senderMustBePlayer = true; senderMustBePlayer = true;
senderMustBeMember = true; senderMustBeMember = true;
senderMustBeModerator = false; senderMustBeModerator = false;
@ -27,21 +29,30 @@ public class CmdPaypalSee extends FCommand {
fme.msg(TL.GENERIC_DISABLED); fme.msg(TL.GENERIC_DISABLED);
return; return;
} }
Faction faction = argAsFaction(0);
if (faction == null) if (args.size() == 0) {
return; if (myFaction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPAL_NOTSET);
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) { } else {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName()); msg(TL.PAYPALSEE_PLAYER_PAYPAL, myFaction.getPaypal());
return; }
} } else if (args.size() == 1) {
if (faction.getPaypal() != null) { if (fme.isAdminBypassing()) {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal()); Faction faction = argAsFaction(0);
if (faction != null) {
if (faction.getPaypal().isEmpty()) {
msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET, faction.getTag());
} else { } 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 @Override
public TL getUsageTranslation() { public TL getUsageTranslation() {

View File

@ -1,42 +1,70 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SaberFactions; import com.massivecraft.factions.SaberFactions;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
public class CmdPaypalSet extends FCommand { public class CmdPaypalSet extends FCommand {
public CmdPaypalSet() { public CmdPaypalSet() {
this.aliases.add("setpaypal"); this.aliases.add("setpaypal");
this.requiredArgs.add("email");
this.permission = Permission.PAYPALSET.node; this.optionalArgs.put("faction", "yours");
this.disableOnLock = false; this.requiredArgs.add("email");
this.senderMustBePlayer = true;
this.senderMustBeMember = true;
this.senderMustBeModerator = false;
this.senderMustBeColeader = false;
this.senderMustBeAdmin = true;
} this.permission = Permission.PAYPALSET.node;
@Override
public void perform() {
if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
return;
}
String paypal = this.argAsString(0); this.disableOnLock = false;
if(paypal == null) this.senderMustBePlayer = true;
return; this.senderMustBeMember = true;
myFaction.paypalSet(paypal); this.senderMustBeModerator = false;
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal); 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;
}
} }

View File

@ -32,6 +32,11 @@ public class CmdAltsList extends FCommand {
ArrayList<String> ret = new ArrayList<>(); ArrayList<String> ret = new ArrayList<>();
for (FPlayer fp : myFaction.getAltPlayers()) { 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 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 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; String power = ChatColor.YELLOW + String.valueOf(fp.getPowerRounded()) + " / " + fp.getPowerMaxRounded() + ChatColor.RESET;

View File

@ -70,6 +70,7 @@ public enum Permission {
SET_PERMANENT("setpermanent"), SET_PERMANENT("setpermanent"),
SET_PERMANENTPOWER("setpermanentpower"), SET_PERMANENTPOWER("setpermanentpower"),
SHOW_INVITES("showinvites"), SHOW_INVITES("showinvites"),
PAYPAL("paypal"),
PAYPALSET("setpaypal"), PAYPALSET("setpaypal"),
PERMISSIONS("permissions"), PERMISSIONS("permissions"),
POWERBOOST("powerboost"), POWERBOOST("powerboost"),
@ -80,6 +81,7 @@ public enum Permission {
RELOAD("reload"), RELOAD("reload"),
SAVE("save"), SAVE("save"),
SPAM("spam"), SPAM("spam"),
SATISTICS("statistics"),
SETHOME("sethome"), SETHOME("sethome"),
SETHOME_ANY("sethome.any"), SETHOME_ANY("sethome.any"),
SETSTRIKES("setstrikes"), SETSTRIKES("setstrikes"),

View File

@ -103,9 +103,9 @@ public abstract class MemoryFPlayer implements FPlayer {
this.autoWarZoneEnabled = false; this.autoWarZoneEnabled = false;
this.loginPvpDisabled = Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0; this.loginPvpDisabled = Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0;
this.powerBoost = 0.0; this.powerBoost = 0.0;
this.getKills();
this.getDeaths();
this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false); this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false);
this.kills = 0;
this.deaths = 0;
this.mapHeight = Conf.mapHeight; this.mapHeight = Conf.mapHeight;
if (!Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) { if (!Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) {
@ -130,13 +130,15 @@ public abstract class MemoryFPlayer implements FPlayer {
this.chatMode = other.chatMode; this.chatMode = other.chatMode;
this.spyingChat = other.spyingChat; this.spyingChat = other.spyingChat;
this.lastStoodAt = other.lastStoodAt; this.lastStoodAt = other.lastStoodAt;
this.getKills();
this.getDeaths();
this.isAdminBypassing = other.isAdminBypassing; this.isAdminBypassing = other.isAdminBypassing;
this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true); this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true);
this.kills = other.kills;
this.deaths = other.deaths;
this.mapHeight = Conf.mapHeight; this.mapHeight = Conf.mapHeight;
} }
public boolean isStealthEnabled() { public boolean isStealthEnabled() {
return this.isStealthEnabled; return this.isStealthEnabled;
} }

View File

@ -163,6 +163,7 @@ public enum TL {
COMMAND_ALTKICK_NOTALT("&c&l[!] &7Player is not an alt."), COMMAND_ALTKICK_NOTALT("&c&l[!] &7Player is not an alt."),
COMMAND_ALTKICK_NOTMEMBER("&c&l[!] &7This player is not a member of your faction."), COMMAND_ALTKICK_NOTMEMBER("&c&l[!] &7This player is not a member of your faction."),
COMMAND_ALTS_LIST_NOALTS("&c&l[!] &7You have no alts in your faction!"),
COMMAND_AUTOHELP_HELPFOR("Help for command \""), COMMAND_AUTOHELP_HELPFOR("Help for command \""),
COMMAND_BAN_DESCRIPTION("Ban players from joining your Faction."), COMMAND_BAN_DESCRIPTION("Ban players from joining your Faction."),
@ -521,6 +522,11 @@ public enum TL {
COMMAND_OWNERLIST_OWNERS("&c&l[!]&7 Current owner(s) of this land: %1$s"), COMMAND_OWNERLIST_OWNERS("&c&l[!]&7 Current owner(s) of this land: %1$s"),
COMMAND_OWNERLIST_DESCRIPTION("List owner(s) of this claimed land"), COMMAND_OWNERLIST_DESCRIPTION("List owner(s) of this claimed land"),
PAYPALSEE_PLAYER_PAYPAL("&c&l[!] &7You're factions paypal is: &b%1$s&7."),
COMMAND_PAYPAL_NOTSET("&c&l[!] &7Your faction does not have their paypal set!"),
COMMAND_PAYPALSET_ADMIN_SUCCESSFUL("&c&l[!] &7You have set &b%1$s's &7paypal to &b%2$s&7."),
COMMAND_PAYPALSET_ADMIN_FAILED("&c&l[!] &b%1$s &7is not an email!"),
COMMAND_PAYPALSET_NOTEMAIL("&c&l[!] &b%1$s &7is not an email!"),
COMMAND_PAYPALSET_DESCRIPTION("&c&l[!] &7Set the email of your faction to claim rewards."), COMMAND_PAYPALSET_DESCRIPTION("&c&l[!] &7Set the email of your faction to claim rewards."),
COMMAND_PAYPALSEE_DESCRIPTION("&c&l[!] &7View a specific factions paypal email with &b/f <seepaypal/getpaypal> <faction>&b."), COMMAND_PAYPALSEE_DESCRIPTION("&c&l[!] &7View a specific factions paypal email with &b/f <seepaypal/getpaypal> <faction>&b."),
COMMAND_PAYPALSET_CREATED("&c&l[!] &7Make sure to type &b/f <paypal/setpaypal> <email>&7!"), COMMAND_PAYPALSET_CREATED("&c&l[!] &7Make sure to type &b/f <paypal/setpaypal> <email>&7!"),
@ -661,7 +667,6 @@ public enum TL {
COMMAND_SETSTRIKES_SUCCESS("&c&l[!]&7 &c{faction}'s&7 new strikes are &c{strikes}"), COMMAND_SETSTRIKES_SUCCESS("&c&l[!]&7 &c{faction}'s&7 new strikes are &c{strikes}"),
COMMAND_SETSTRIKES_DESCRIPTION("Set a faction's strikes"), COMMAND_SETSTRIKES_DESCRIPTION("Set a faction's strikes"),
COMMAND_STRIKEREMOVE_DESCRIPTION("Remove a faction's strikes"), COMMAND_STRIKEREMOVE_DESCRIPTION("Remove a faction's strikes"),
COMMAND_STRIKE_MESSAGE("&c&l[!] &7{faction} has {strikes} strikes."), COMMAND_STRIKE_MESSAGE("&c&l[!] &7{faction} has {strikes} strikes."),
COMMAND_STRIKE_NOTFOUND("&c&l[!] &7{faction} does not exist."), COMMAND_STRIKE_NOTFOUND("&c&l[!] &7{faction} does not exist."),
COMMAND_STRIKE_NEEDFACTION("&c&l[!] &7&cYou need to join a faction to view your own!"), COMMAND_STRIKE_NEEDFACTION("&c&l[!] &7&cYou need to join a faction to view your own!"),