Added F Discord
This commit is contained in:
parent
d47806b33a
commit
8338e21dd2
@ -23,6 +23,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public interface Faction extends EconomyParticipator {
|
public interface Faction extends EconomyParticipator {
|
||||||
|
|
||||||
|
String getDiscord();
|
||||||
|
|
||||||
|
void setDiscord(String link);
|
||||||
|
|
||||||
void checkPerms();
|
void checkPerms();
|
||||||
|
|
||||||
double getReinforcedArmor();
|
double getReinforcedArmor();
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
public class CmdSeeDiscord extends FCommand{
|
||||||
|
|
||||||
|
public CmdSeeDiscord() {
|
||||||
|
this.aliases.add("seediscord");
|
||||||
|
this.aliases.add("discord");
|
||||||
|
|
||||||
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.DISCORD)
|
||||||
|
.memberOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fdiscord.Enabled")) {
|
||||||
|
context.msg(TL.GENERIC_DISABLED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (context.args.size() == 0) {
|
||||||
|
if (context.fPlayer.getFaction().getDiscord() == null) {
|
||||||
|
context.msg(TL.COMMAND_DISCORD_NOTSET);
|
||||||
|
} else {
|
||||||
|
context.msg(TL.DISCORD_PLAYER_DISCORD, context.fPlayer.getFaction().getDiscord());
|
||||||
|
}
|
||||||
|
} else if (context.args.size() == 1) {
|
||||||
|
if (context.fPlayer.isAdminBypassing()) {
|
||||||
|
Faction faction = context.argAsFaction(0);
|
||||||
|
if (faction != null) {
|
||||||
|
if (faction.getDiscord() == null) {
|
||||||
|
context.msg(TL.COMMAND_DISCORDSEE_FACTION_NOTSET, faction.getTag());
|
||||||
|
} else {
|
||||||
|
context.msg(TL.COMMAND_DISCORDSEE_FACTION_DISCORD.toString(), faction.getTag(), faction.getDiscord());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(TL.GENERIC_NOPERMISSION, "see another factions discord.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(FactionsPlugin.getInstance().cmdBase.cmdSeeDiscord.getUsageTemplate(context));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DISCORDSEE_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
|
public class CmdSetDiscord extends FCommand {
|
||||||
|
|
||||||
|
public CmdSetDiscord(){
|
||||||
|
super();
|
||||||
|
this.aliases.add("setdiscord");
|
||||||
|
|
||||||
|
this.optionalArgs.put("faction", "yours");
|
||||||
|
|
||||||
|
this.requiredArgs.add("link");
|
||||||
|
this.requirements = new CommandRequirements.Builder(Permission.SETDISCORD)
|
||||||
|
.playerOnly()
|
||||||
|
.memberOnly()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void perform(CommandContext context) {
|
||||||
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fdiscord.Enabled")) {
|
||||||
|
context.fPlayer.msg(TL.GENERIC_DISABLED, "discord");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.args.size() == 1) {
|
||||||
|
if (isDiscordInvite(context.argAsString(0))) {
|
||||||
|
context.fPlayer.getFaction().setDiscord(context.argAsString(0));
|
||||||
|
context.msg(TL.COMMAND_DISCORDSET_SUCCESSFUL, context.argAsString(0));
|
||||||
|
} else {
|
||||||
|
context.msg(TL.COMMAND_DISCORDSET_NOTEMAIL, context.argAsString(0));
|
||||||
|
}
|
||||||
|
} else if (context.args.size() == 2) {
|
||||||
|
if (context.fPlayer.isAdminBypassing()) {
|
||||||
|
Faction faction = context.argAsFaction(1);
|
||||||
|
if (faction != null) {
|
||||||
|
if (isDiscordInvite(context.argAsString(0))) {
|
||||||
|
context.fPlayer.getFaction().setDiscord(context.argAsString(0));
|
||||||
|
context.msg(TL.COMMAND_DISCORDSET_ADMIN_SUCCESSFUL, faction.getTag(), context.argAsString(0));
|
||||||
|
} else {
|
||||||
|
context.msg(TL.COMMAND_DISCORDSET_ADMIN_FAILED, context.argAsString(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(TL.GENERIC_NOPERMISSION, "set another factions discord link!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(FactionsPlugin.getInstance().cmdBase.cmdSetDiscord.getUsageTemplate(context));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDiscordInvite(String invite){
|
||||||
|
return invite.contains("discord.gg") || invite.contains("discord.me");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TL getUsageTranslation() {
|
||||||
|
return TL.COMMAND_DISCORDSET_DESCRIPTION;
|
||||||
|
}
|
||||||
|
}
|
@ -147,6 +147,8 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
public CmdWeeWoo cmdWeeWoo = new CmdWeeWoo();
|
public CmdWeeWoo cmdWeeWoo = new CmdWeeWoo();
|
||||||
public CmdConvertConfig cmdConvertConfig = new CmdConvertConfig();
|
public CmdConvertConfig cmdConvertConfig = new CmdConvertConfig();
|
||||||
public CmdSpawnerLock cmdSpawnerLock = new CmdSpawnerLock();
|
public CmdSpawnerLock cmdSpawnerLock = new CmdSpawnerLock();
|
||||||
|
public CmdSetDiscord cmdSetDiscord = new CmdSetDiscord();
|
||||||
|
public CmdSeeDiscord cmdSeeDiscord = new CmdSeeDiscord();
|
||||||
|
|
||||||
public FCmdRoot() {
|
public FCmdRoot() {
|
||||||
super();
|
super();
|
||||||
@ -307,6 +309,12 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
|||||||
FactionsPlugin.getInstance().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.");
|
FactionsPlugin.getInstance().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 (FactionsPlugin.getInstance().getConfig().getBoolean("fdiscord.Enabled")) {
|
||||||
|
this.addSubCommand(this.cmdSetDiscord);
|
||||||
|
this.addSubCommand(this.cmdSeeDiscord);
|
||||||
|
}
|
||||||
|
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("fpaypal.Enabled")) {
|
||||||
this.addSubCommand(this.cmdPaypalSet);
|
this.addSubCommand(this.cmdPaypalSet);
|
||||||
this.addSubCommand(this.cmdPaypalSee);
|
this.addSubCommand(this.cmdPaypalSee);
|
||||||
|
@ -34,6 +34,7 @@ public enum Permission {
|
|||||||
DESCRIPTION("description"),
|
DESCRIPTION("description"),
|
||||||
DISBAND("disband"),
|
DISBAND("disband"),
|
||||||
DISBAND_ANY("disband.any"),
|
DISBAND_ANY("disband.any"),
|
||||||
|
DISCORD("discord"),
|
||||||
FLY("fly"),
|
FLY("fly"),
|
||||||
FOCUS("focus"),
|
FOCUS("focus"),
|
||||||
GLOBALCHAT("globalchat"),
|
GLOBALCHAT("globalchat"),
|
||||||
@ -90,6 +91,7 @@ public enum Permission {
|
|||||||
RELOAD("reload"),
|
RELOAD("reload"),
|
||||||
SAVE("save"),
|
SAVE("save"),
|
||||||
SPAM("spam"),
|
SPAM("spam"),
|
||||||
|
SETDISCORD("setdiscord"),
|
||||||
SETHOME("sethome"),
|
SETHOME("sethome"),
|
||||||
SETHOME_ANY("sethome.any"),
|
SETHOME_ANY("sethome.any"),
|
||||||
SETSTRIKES("setstrikes"),
|
SETSTRIKES("setstrikes"),
|
||||||
|
@ -84,6 +84,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private int warpLimit;
|
private int warpLimit;
|
||||||
private double reinforcedArmor;
|
private double reinforcedArmor;
|
||||||
private List<String> completedMissions;
|
private List<String> completedMissions;
|
||||||
|
protected String discord;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -217,6 +218,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return hasWarpPassword(warp) && warpPasswords.get(warp.toLowerCase()).equals(password);
|
return hasWarpPassword(warp) && warpPasswords.get(warp.toLowerCase()).equals(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDiscord() {
|
||||||
|
return this.discord;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDiscord(String link) {
|
||||||
|
this.discord = link;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPaypal() {
|
public String getPaypal() {
|
||||||
return this.paypal;
|
return this.paypal;
|
||||||
}
|
}
|
||||||
|
@ -566,6 +566,18 @@ 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_DISCORDSET_ADMIN_SUCCESSFUL("&c&l[!] &7You have set &b%1$s's &7discord to &b%2$s&7."),
|
||||||
|
COMMAND_DISCORDSET_ADMIN_FAILED("&c&l[!] &b%1$s &7is not an discord link!"),
|
||||||
|
COMMAND_DISCORDSET_NOTEMAIL("&c&l[!] &b%1$s &7is not an discord link!"),
|
||||||
|
COMMAND_DISCORDSET_DESCRIPTION("&c&l[!] &7Set the link of your factions discord."),
|
||||||
|
COMMAND_DISCORDSET_SUCCESSFUL("&c&l[!] &7Successfully set your factions discord link - &b%1$s&7."),
|
||||||
|
DISCORD_PLAYER_DISCORD("&c&l[!] &7You're factions discord link is: &b%1$s&7."),
|
||||||
|
COMMAND_DISCORD_NOTSET("&c&l[!] &7Your faction does not have their discord set!"),
|
||||||
|
COMMAND_DISCORDSEE_FACTION_NOTSET("&c&l[!] &b%1$s's &7discord has not yet been set!"),
|
||||||
|
COMMAND_DISCORDSEE_FACTION_DISCORD("&c&l[!] &b%1$s's &7faction has their discord link set to &b%2$s&7."),
|
||||||
|
COMMAND_DISCORDSEE_DESCRIPTION("&c&l[!] &7View a specific factions discord link with &b/f discord <faction>&b."),
|
||||||
|
|
||||||
|
|
||||||
PAYPALSEE_PLAYER_PAYPAL("&c&l[!] &7You're factions paypal is: &b%1$s&7."),
|
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_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_SUCCESSFUL("&c&l[!] &7You have set &b%1$s's &7paypal to &b%2$s&7."),
|
||||||
|
@ -649,6 +649,14 @@ ftnt:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
Bank-Limit: 250000
|
Bank-Limit: 250000
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
# +------------------------------------------------------+ #
|
||||||
|
# | Faction Discord | #
|
||||||
|
# +------------------------------------------------------+ #
|
||||||
|
############################################################
|
||||||
|
fdiscord:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | Faction PayPal | #
|
# | Faction PayPal | #
|
||||||
|
@ -158,6 +158,10 @@ permissions:
|
|||||||
description: create a new faction
|
description: create a new faction
|
||||||
factions.deinvite:
|
factions.deinvite:
|
||||||
description: remove a pending invitation
|
description: remove a pending invitation
|
||||||
|
factions.setdiscord:
|
||||||
|
description: set discord link
|
||||||
|
factions.discord:
|
||||||
|
description: view factions discord
|
||||||
factions.description:
|
factions.description:
|
||||||
description: change the faction description
|
description: change the faction description
|
||||||
factions.disband:
|
factions.disband:
|
||||||
|
Loading…
Reference in New Issue
Block a user