Changes Adding

This commit is contained in:
Driftay 2018-09-21 02:29:28 -04:00
parent ed91f58dc9
commit 1ee8089ca5
10 changed files with 122 additions and 2 deletions

View File

@ -326,4 +326,8 @@ public interface Faction extends EconomyParticipator {
void remove(); void remove();
Set<FLocation> getAllClaims(); Set<FLocation> getAllClaims();
String getPaypal();
void paypalSet(String paypal);
} }

View File

@ -100,6 +100,9 @@ public class CmdCreate extends FCommand {
if (Conf.logFactionCreate) { if (Conf.logFactionCreate) {
P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag); P.p.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag);
} }
if (P.p.getConfig().getBoolean("fpaypal.Enabled")) {
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
}
} }
@Override @Override

View File

@ -1,4 +1,50 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
public class CmdPaypalSee { import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor;
public class CmdPaypalSee extends FCommand{
public CmdPaypalSee() {
aliases.add("seepaypal");
aliases.add("getpaypal");
requiredArgs.add("faction");
permission = Permission.ADMIN.node;
disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
} }
public void perform() {
if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
} else {
Faction faction = argAsFaction(0);
String paypal = argAsString(1);
if (faction != null) {
if (!faction.isWilderness() && !faction.isSafeZone() && !faction.isWarZone()) {
if (faction.getPaypal() != null) {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_PAYPAL.toString(), faction.getTag(), faction.getPaypal());
} else {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOTSET.toString(), faction.getTag(), faction.getPaypal());
}
} else {
fme.msg(TL.COMMAND_PAYPALSEE_FACTION_NOFACTION.toString(), me.getName());
}
}
}
}
public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSEE_DESCRIPTION;
}
}

View File

@ -1,4 +1,38 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
public class CmdPaypalSet { import com.massivecraft.factions.P;
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.aliases.add("paypal");
this.requiredArgs.add("email");
this.permission = Permission.PAYPALSET.node;
this.disableOnLock = false;
this.senderMustBePlayer = true;
this.senderMustBeMember = false;
this.senderMustBeModerator = false;
this.senderMustBeColeader = true;
this.senderMustBeAdmin = false;
} }
public void perform() {
if (!P.p.getConfig().getBoolean("fpaypal.Enabled")) {
fme.msg(TL.GENERIC_DISABLED);
} else {
String paypal = argAsString(0);
if (paypal != null) {
myFaction.paypalSet(paypal);
fme.msg(TL.COMMAND_PAYPALSET_SUCCESSFUL, paypal);
}
}
}
public TL getUsageTranslation() {
return TL.COMMAND_PAYPALSET_DESCRIPTION;
}
}

View File

@ -63,6 +63,8 @@ public class FCmdRoot extends FCommand {
public CmdSB cmdSB = new CmdSB(); public CmdSB cmdSB = new CmdSB();
public CmdShowInvites cmdShowInvites = new CmdShowInvites(); public CmdShowInvites cmdShowInvites = new CmdShowInvites();
public CmdAnnounce cmdAnnounce = new CmdAnnounce(); public CmdAnnounce cmdAnnounce = new CmdAnnounce();
public CmdPaypalSet cmdPaypalSet = new CmdPaypalSet();
public CmdPaypalSee cmdPaypalSee = new CmdPaypalSee();
public CmdSeeChunk cmdSeeChunk = new CmdSeeChunk(); public CmdSeeChunk cmdSeeChunk = new CmdSeeChunk();
public CmdConvert cmdConvert = new CmdConvert(); public CmdConvert cmdConvert = new CmdConvert();
public CmdFWarp cmdFWarp = new CmdFWarp(); public CmdFWarp cmdFWarp = new CmdFWarp();
@ -231,6 +233,10 @@ public class FCmdRoot extends FCommand {
P.p.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc."); P.p.log(Level.INFO, "Enabling FactionsTop command, this is a very basic /f top please get a dedicated /f top resource if you want land calculation etc.");
this.addSubCommand(this.cmdTop); this.addSubCommand(this.cmdTop);
} }
if (P.p.getConfig().getBoolean("fpaypal.Enabled")) {
this.addSubCommand(this.cmdPaypalSet);
this.addSubCommand(this.cmdPaypalSee);
}
} }

View File

@ -64,6 +64,7 @@ public enum Permission {
SET_PERMANENT("setpermanent"), SET_PERMANENT("setpermanent"),
SET_PERMANENTPOWER("setpermanentpower"), SET_PERMANENTPOWER("setpermanentpower"),
SHOW_INVITES("showinvites"), SHOW_INVITES("showinvites"),
PAYPALSET("setpaypal"),
PERMISSIONS("permissions"), PERMISSIONS("permissions"),
POWERBOOST("powerboost"), POWERBOOST("powerboost"),
POWER("power"), POWER("power"),

View File

@ -51,6 +51,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
protected transient long lastPlayerLoggedOffTime; protected transient long lastPlayerLoggedOffTime;
protected double money; protected double money;
protected double powerBoost; protected double powerBoost;
protected String paypal;
protected Map<String, Relation> relationWish = new HashMap<>(); protected Map<String, Relation> relationWish = new HashMap<>();
protected Map<FLocation, Set<String>> claimOwnership = new ConcurrentHashMap<>(); protected Map<FLocation, Set<String>> claimOwnership = new ConcurrentHashMap<>();
protected transient Set<FPlayer> fplayers = new HashSet<>(); protected transient Set<FPlayer> fplayers = new HashSet<>();
@ -164,6 +165,13 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public boolean isWarpPassword(String warp, String password) { public boolean isWarpPassword(String warp, String password) {
return hasWarpPassword(warp) && warpPasswords.get(warp.toLowerCase()).equals(password); return hasWarpPassword(warp) && warpPasswords.get(warp.toLowerCase()).equals(password);
} }
public String getPaypal() {
return this.paypal;
}
public void paypalSet(String paypal) {
this.paypal = paypal;
}
public boolean hasWarpPassword(String warp) { public boolean hasWarpPassword(String warp) {
return warpPasswords.containsKey(warp.toLowerCase()); return warpPasswords.containsKey(warp.toLowerCase());

View File

@ -470,6 +470,14 @@ 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"),
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!"),
COMMAND_PAYPALSET_SUCCESSFUL("&c&l[!] &7Successfully set your factions email - &b%1$s&7."),
COMMAND_PAYPALSEE_FACTION_PAYPAL("&c&l[!] &b%1$s's &7faction has their paypal set to &b%2$s&7."),
COMMAND_PAYPALSEE_FACTION_NOTSET("&c&l[!] &b%1$s's &7paypal has not yet been set!"),
COMMAND_PAYPALSEE_FACTION_NOFACTION("&c&l[!] &b%1$s &7does not have a faction!"),
COMMAND_PEACEFUL_DESCRIPTION("&c&l[!]&7Set a faction to peaceful"), COMMAND_PEACEFUL_DESCRIPTION("&c&l[!]&7Set a faction to peaceful"),
COMMAND_PEACEFUL_YOURS("&c&l[!]&7%1$s has %2$s your faction"), COMMAND_PEACEFUL_YOURS("&c&l[!]&7%1$s has %2$s your faction"),
COMMAND_PEACEFUL_OTHER("&c&l[!]&7%s has %s the faction '%s<i>'."), COMMAND_PEACEFUL_OTHER("&c&l[!]&7%s has %s the faction '%s<i>'."),

View File

@ -716,6 +716,14 @@ ftnt:
Enabled: true Enabled: true
Bank-Limit: 10000 Bank-Limit: 10000
############################################################
# +------------------------------------------------------+ #
# | Faction PayPal | #
# +------------------------------------------------------+ #
############################################################
fpaypal:
Enabled: true
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Checkpoints | # # | Faction Checkpoints | #

View File

@ -227,6 +227,8 @@ permissions:
description: set permanent power for a faction description: set permanent power for a faction
factions.stuck: factions.stuck:
description: teleports player outside a faction description: teleports player outside a faction
factions.setpaypal:
description: set paypal to faction
factions.power: factions.power:
description: show player power info description: show player power info
factions.power.any: factions.power.any: