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;
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<>();
}

View File

@ -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))) {

View File

@ -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,19 +29,28 @@ 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 {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal());
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 {
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());
}
}

View File

@ -1,5 +1,6 @@
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;
@ -8,6 +9,9 @@ public class CmdPaypalSet extends FCommand {
public CmdPaypalSet() {
this.aliases.add("setpaypal");
this.optionalArgs.put("faction", "yours");
this.requiredArgs.add("email");
this.permission = Permission.PAYPALSET.node;
@ -20,6 +24,7 @@ public class CmdPaypalSet extends FCommand {
this.senderMustBeAdmin = true;
}
@Override
public void perform() {
if (!SaberFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
@ -27,11 +32,34 @@ public class CmdPaypalSet extends FCommand {
return;
}
String paypal = this.argAsString(0);
if(paypal == null)
return;
myFaction.paypalSet(paypal);
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
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

View File

@ -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;

View File

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

View File

@ -103,9 +103,9 @@ public abstract class MemoryFPlayer implements FPlayer {
this.autoWarZoneEnabled = false;
this.loginPvpDisabled = Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0;
this.powerBoost = 0.0;
this.getKills();
this.getDeaths();
this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", false);
this.kills = 0;
this.deaths = 0;
this.mapHeight = Conf.mapHeight;
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.spyingChat = other.spyingChat;
this.lastStoodAt = other.lastStoodAt;
this.getKills();
this.getDeaths();
this.isAdminBypassing = other.isAdminBypassing;
this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true);
this.kills = other.kills;
this.deaths = other.deaths;
this.mapHeight = Conf.mapHeight;
}
public boolean 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_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_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_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_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!"),
@ -661,7 +667,6 @@ public enum TL {
COMMAND_SETSTRIKES_SUCCESS("&c&l[!]&7 &c{faction}'s&7 new strikes are &c{strikes}"),
COMMAND_SETSTRIKES_DESCRIPTION("Set a faction's strikes"),
COMMAND_STRIKEREMOVE_DESCRIPTION("Remove a faction's strikes"),
COMMAND_STRIKE_MESSAGE("&c&l[!] &7{faction} has {strikes} strikes."),
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!"),