From 203777527695990456ec6973c9ca8d52c81c59f9 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 16:08:31 +0000 Subject: [PATCH 01/16] Update Discord.java stuff to disable or enable discord verification --- .../totalfreedommod/discord/Discord.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index 7f419f51..ae5453c3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -17,7 +17,7 @@ import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.staff.StaffMember; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import net.dv8tion.jda.api.EmbedBuilder; @@ -59,9 +59,17 @@ public class Discord extends FreedomService public static JDA bot = null; public Boolean enabled = false; + public Boolean enableBot = false; public void startBot() + { + enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); + if (enableBot == false) + { + FLog.info("Discord Verification has been manually disabled."); + return; + } enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString()); if (!enabled) { @@ -298,7 +306,7 @@ public class Discord extends FreedomService @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { - if (!plugin.al.isVanished(event.getPlayer().getName())) + if (!plugin.sl.isVanished(event.getPlayer().getName())) { messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**"); } @@ -307,7 +315,7 @@ public class Discord extends FreedomService @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLeave(PlayerQuitEvent event) { - if (!plugin.al.isVanished(event.getPlayer().getName())) + if (!plugin.sl.isVanished(event.getPlayer().getName())) { messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**"); } @@ -428,7 +436,7 @@ public class Discord extends FreedomService return true; } - public static boolean syncRoles(Admin admin, String discordID) + public static boolean syncRoles(StaffMember staffMember, String discordID) { if (discordID == null) { @@ -462,7 +470,7 @@ public class Discord extends FreedomService return false; } - if (!admin.isActive()) + if (!staffMember.isActive()) { if (member.getRoles().contains(adminRole)) { @@ -475,7 +483,7 @@ public class Discord extends FreedomService return true; } - if (admin.getRank().equals(Rank.ADMIN)) + if (staffMember.getRank().equals(Rank.ADMIN)) { if (!member.getRoles().contains(adminRole)) { @@ -487,7 +495,7 @@ public class Discord extends FreedomService } return true; } - else if (admin.getRank().equals(Rank.SENIOR_ADMIN)) + else if (staffMember.getRank().equals(Rank.SENIOR_ADMIN)) { if (!member.getRoles().contains(senioradminRole)) { @@ -501,4 +509,4 @@ public class Discord extends FreedomService } return false; } -} \ No newline at end of file +} From 7a11c9062d311a1004f369ac6443c76c3301f042 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 16:09:26 +0000 Subject: [PATCH 02/16] Update ConfigEntry.java config option for verification --- .../java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index bc86279f..578a0731 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -69,6 +69,7 @@ public enum ConfigEntry SERVER_WHITELIST_MOTD(String.class, "server.motds.whitelist"), SERVER_FULL_MOTD(String.class, "server.motds.full"), // + DISCORD_VERIFICATION(Boolean.class, "discord.verification"), DISCORD_TOKEN(String.class, "discord.token"), DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"), DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"), From 79c8ea301dac2b2de0d18befda8468ccbb999a4f Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 16:10:14 +0000 Subject: [PATCH 03/16] Update config.yml config option for discord verification --- src/main/resources/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e1adeda8..f80bb375 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -53,6 +53,8 @@ server: # Discord discord: + # Do you want to enable the bot? (Disabled by default) + verification: false # If you do not have a token, make a bot account and get one at https://discordapp.com/developers/applications/me token: '' # The official discord server's ID for this server From 950c975e8fcfdc51ead01c507adf1496b278f27e Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:15:17 +0000 Subject: [PATCH 04/16] Update Command_verify.java discord verification config --- .../totalfreedommod/command/Command_verify.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java index b215a4ef..cc217138 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; @@ -10,19 +11,25 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH) -@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code. Admins can manually verify a player impostor.", usage = "/ >") +@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code. Staff can manually verify a player impostor.", usage = "/ >") public class Command_verify extends FreedomCommand { @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); if (!plugin.dc.enabled) { msg("The Discord verification system is currently disabled", ChatColor.RED); return true; } - + if (!enableBot) + { + msg("The Discord verification system is currently disabled", ChatColor.RED); + return true; + } if (senderIsConsole) { msg("/manuallyverify ", ChatColor.WHITE); @@ -90,4 +97,4 @@ public class Command_verify extends FreedomCommand } return true; } -} \ No newline at end of file +} From fb3cdf36037e62509b705b623275693c6f803ad1 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:15:55 +0000 Subject: [PATCH 05/16] Update Command_playerverification.java discord enable disable verification --- .../command/Command_playerverification.java | 226 +++++++++--------- 1 file changed, 114 insertions(+), 112 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java index 89a62a28..77e761d3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -20,129 +22,129 @@ public class Command_playerverification extends FreedomCommand public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { PlayerData target = plugin.pl.getData(playerSender); - + boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); List ips = new ArrayList<>(); ips.addAll(target.getIps()); - - if (args.length == 1) + + if (enableBot == true) { - if (args[0].equalsIgnoreCase("clearips")) + if (args.length == 1) { - int cleared = 0; - for (String ip : ips) + if (args[0].equalsIgnoreCase("clearips")) { - if (!ip.equals(FUtil.getIp(playerSender))) + int cleared = 0; + for (String ip : ips) { - target.removeIp(ip); - cleared++; + if (!ip.equals(FUtil.getIp(playerSender))) + { + target.removeIp(ip); + cleared++; + } } - } - msg("Cleared all IP's except your current IP \"" + FUtil.getIp(playerSender) + "\""); - msg("Cleared " + cleared + " IP's."); - plugin.pl.save(target); - plugin.pl.syncIps(target); - return true; + msg("Cleared all IP's except your current IP \"" + FUtil.getIp(playerSender) + "\""); + msg("Cleared " + cleared + " IP's."); + plugin.pl.save(target); + plugin.pl.syncIps(target); + return true; + } + else if (args[0].equalsIgnoreCase("clearip")) + { + if (args.length < 2) + { + return false; + } + target.removeIp(args[1]); + msg("Removed" + args[1] + " from your list of IPs"); + plugin.pl.save(target); + plugin.pl.syncIps(target); + return true; + } } - else if (args[0].equalsIgnoreCase("clearip")) + + if (args.length < 1) { - if (args.length < 2) - { - return false; - } - target.removeIp(args[1]); - msg("Removed" + args[1] + " from your list of IPs"); - plugin.pl.save(target); - plugin.pl.syncIps(target); - return true; - } - } - - if (args.length < 1) - { - return false; - } - - PlayerData data = plugin.pl.getData(playerSender); - - switch (args[0].toLowerCase()) - { - case "enable": - { - if (!plugin.dc.enabled) - { - msg("The Discord verification system is currently disabled.", ChatColor.RED); - return true; - } - else if (data.hasVerification()) - { - msg("Discord verification is already enabled for you.", ChatColor.RED); - return true; - } - else if (data.getDiscordID() == null) - { - msg("Please link a discord account with /linkdiscord.", ChatColor.RED); - return true; - } - data.setVerification(true); - plugin.pl.save(data); - msg("Re-enabled Discord verification.", ChatColor.GREEN); - return true; - } - - case "disable": - { - if (!data.hasVerification()) - { - msg("Discord verification is already disabled for you.", ChatColor.RED); - return true; - } - data.setVerification(false); - plugin.pl.save(data); - msg("Disabled Discord verification.", ChatColor.GREEN); - return true; - } - - case "status": - { - boolean enabled = target.hasVerification(); - boolean specified = target.getDiscordID() != null; - msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false")); - msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordID() : ChatColor.RED + "not set")); - msg(ChatColor.GRAY + "Backup Codes: " + data.getBackupCodes().size() + "/" + "10"); - return true; - } - - case "genbackupcodes": - { - if (!plugin.dc.enabled) - { - msg("The Discord verification system is currently disabled.", ChatColor.RED); - return true; - } - else if (!data.hasVerification()) - { - msg("Discord verification is not enabled for you.", ChatColor.RED); - return true; - } - - boolean generated = plugin.dc.sendBackupCodes(data); - - if (generated) - { - msg("Your backup codes have been sent to your discord account. They can be re-generated at anytime.", ChatColor.GREEN); - } - else - { - msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED); - } - return true; - } - default: return false; - } - } + } + PlayerData data = plugin.pl.getData(playerSender); + switch (args[0].toLowerCase()) + { + + case "enable": + if (!plugin.dc.enabled) + { + msg("The Discord verification system is currently disabled.", ChatColor.RED); + return true; + } + else if (data.hasVerification()) + { + msg("Discord verification is already enabled for you.", ChatColor.RED); + return true; + } + else if (data.getDiscordID() == null) + { + msg("Please link a discord account with /linkdiscord.", ChatColor.RED); + return true; + } + data.setVerification(true); + plugin.pl.save(data); + msg("Re-enabled Discord verification.", ChatColor.GREEN); + return true; + + case "disable": + if (!data.hasVerification()) + { + msg("Discord verification is already disabled for you.", ChatColor.RED); + return true; + } + data.setVerification(false); + plugin.pl.save(data); + msg("Disabled Discord verification.", ChatColor.GREEN); + return true; + + case "status": + boolean enabled = target.hasVerification(); + boolean specified = target.getDiscordID() != null; + msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false")); + msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordID() : ChatColor.RED + "not set")); + msg(ChatColor.GRAY + "Backup Codes: " + data.getBackupCodes().size() + "/" + "10"); + return true; + + case "genbackupcodes": + if (!plugin.dc.enabled) + { + msg("The Discord verification system is currently disabled.", ChatColor.RED); + return true; + } + else if (!data.hasVerification()) + { + msg("Discord verification is not enabled for you.", ChatColor.RED); + return true; + } + + boolean generated = plugin.dc.sendBackupCodes(data); + + if (generated) + { + msg("Your backup codes have been sent to your discord account. They can be re-generated at anytime.", ChatColor.GREEN); + } + else + { + msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED); + } + return true; + + default: + return false; + } + } + else + { + msg("The Discord verification system is currently disabled", ChatColor.RED); + } + return true; + } @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { @@ -153,4 +155,4 @@ public class Command_playerverification extends FreedomCommand return Collections.emptyList(); } -} \ No newline at end of file +} From b0c0f1704367298285addbc2ed2201aaf2a56b42 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:16:28 +0000 Subject: [PATCH 06/16] Update Command_manuallyverify.java discord verify enable disable --- .../command/Command_manuallyverify.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java index f4983fd1..3f47f23b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; @@ -8,18 +9,23 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Manually verify someone", usage = "/ ", aliases = "mv") +@CommandParameters(description = "Manually verify someone", usage = "/ ", aliases="mv") public class Command_manuallyverify extends FreedomCommand { @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - + boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); if (!plugin.dc.enabled) { msg("The Discord verification system is currently disabled", ChatColor.RED); return true; } + if (!enableBot) + { + msg("The Discord verification system is currently disabled", ChatColor.RED); + return true; + } if (args.length == 0) { @@ -39,7 +45,7 @@ public class Command_manuallyverify extends FreedomCommand return true; } - FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false); + FUtil.staffAction(sender.getName(), "Manually verifying player " + player.getName(), false); player.setOp(true); player.sendMessage(YOU_ARE_OP); @@ -54,4 +60,4 @@ public class Command_manuallyverify extends FreedomCommand return true; } -} \ No newline at end of file +} From 81ef3d624a35dfbe68500716f24cf6012c41a9f3 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:17:06 +0000 Subject: [PATCH 07/16] Update Discord.java cant remember if i changed anything since last commit --- .../java/me/totalfreedom/totalfreedommod/discord/Discord.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index ae5453c3..a3d9fe3b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -68,7 +68,6 @@ public class Discord extends FreedomService if (enableBot == false) { FLog.info("Discord Verification has been manually disabled."); - return; } enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString()); if (!enabled) From 8b1cef3b8337beeebbdb44813fc05b0af70e757a Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:26:00 +0000 Subject: [PATCH 08/16] Update Discord.java whoops i did change something i didnt want to --- .../java/me/totalfreedom/totalfreedommod/discord/Discord.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index a3d9fe3b..ae5453c3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -68,6 +68,7 @@ public class Discord extends FreedomService if (enableBot == false) { FLog.info("Discord Verification has been manually disabled."); + return; } enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString()); if (!enabled) From 1fedb1fad35b9022ca9a8d77ecb6c7cf25310f44 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:28:47 +0000 Subject: [PATCH 09/16] Update Discord.java forgot to change this aswell --- .../java/me/totalfreedom/totalfreedommod/discord/Discord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index ae5453c3..27097996 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -65,7 +65,7 @@ public class Discord extends FreedomService { enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); - if (enableBot == false) + if (!enableBot) { FLog.info("Discord Verification has been manually disabled."); return; From 6441deceab714fc4f00369d7021544894625f9b9 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Tue, 8 Dec 2020 19:35:02 +0000 Subject: [PATCH 10/16] Update Command_playerverification.java codacy is being fussy --- .../totalfreedommod/command/Command_playerverification.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java index 77e761d3..68dc2c9c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java @@ -7,7 +7,6 @@ import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; From 777a66f8da9b551d6a10cd96ef3a03f49f8ae080 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 15:37:31 +0000 Subject: [PATCH 11/16] Update Discord.java correct updated file --- .../totalfreedommod/discord/Discord.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index 27097996..e0cbbe85 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -17,7 +17,7 @@ import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import net.dv8tion.jda.api.EmbedBuilder; @@ -59,12 +59,11 @@ public class Discord extends FreedomService public static JDA bot = null; public Boolean enabled = false; - public Boolean enableBot = false; + public Boolean enableBot = false; public void startBot() - { - enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); + enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); if (!enableBot) { FLog.info("Discord Verification has been manually disabled."); @@ -306,7 +305,7 @@ public class Discord extends FreedomService @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { - if (!plugin.sl.isVanished(event.getPlayer().getName())) + if (!plugin.al.isVanished(event.getPlayer().getName())) { messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**"); } @@ -315,7 +314,7 @@ public class Discord extends FreedomService @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLeave(PlayerQuitEvent event) { - if (!plugin.sl.isVanished(event.getPlayer().getName())) + if (!plugin.al.isVanished(event.getPlayer().getName())) { messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**"); } @@ -436,7 +435,7 @@ public class Discord extends FreedomService return true; } - public static boolean syncRoles(StaffMember staffMember, String discordID) + public static boolean syncRoles(Admin admin, String discordID) { if (discordID == null) { @@ -470,7 +469,7 @@ public class Discord extends FreedomService return false; } - if (!staffMember.isActive()) + if (!admin.isActive()) { if (member.getRoles().contains(adminRole)) { @@ -483,7 +482,7 @@ public class Discord extends FreedomService return true; } - if (staffMember.getRank().equals(Rank.ADMIN)) + if (admin.getRank().equals(Rank.ADMIN)) { if (!member.getRoles().contains(adminRole)) { @@ -495,7 +494,7 @@ public class Discord extends FreedomService } return true; } - else if (staffMember.getRank().equals(Rank.SENIOR_ADMIN)) + else if (admin.getRank().equals(Rank.SENIOR_ADMIN)) { if (!member.getRoles().contains(senioradminRole)) { From b9d608222e20907b1da16982a391fbb567581486 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 15:48:27 +0000 Subject: [PATCH 12/16] Update Command_playerverification.java fixed codacy issue --- .../totalfreedommod/command/Command_playerverification.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java index 68dc2c9c..7025aac2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java @@ -7,6 +7,7 @@ import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -25,7 +26,7 @@ public class Command_playerverification extends FreedomCommand List ips = new ArrayList<>(); ips.addAll(target.getIps()); - if (enableBot == true) + if (enableBot) { if (args.length == 1) { From cbc3795ef20abb73fd66dc85648626e6b15f51f1 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 15:55:45 +0000 Subject: [PATCH 13/16] Update Command_playerverification.java i should really keep my files updates --- .../command/Command_playerverification.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java index 7025aac2..ea1a3926 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playerverification.java @@ -7,7 +7,6 @@ import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -25,8 +24,8 @@ public class Command_playerverification extends FreedomCommand boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); List ips = new ArrayList<>(); ips.addAll(target.getIps()); - - if (enableBot) + + if(enableBot) { if (args.length == 1) { @@ -68,10 +67,11 @@ public class Command_playerverification extends FreedomCommand } PlayerData data = plugin.pl.getData(playerSender); + switch (args[0].toLowerCase()) { - case "enable": + { if (!plugin.dc.enabled) { msg("The Discord verification system is currently disabled.", ChatColor.RED); @@ -91,8 +91,10 @@ public class Command_playerverification extends FreedomCommand plugin.pl.save(data); msg("Re-enabled Discord verification.", ChatColor.GREEN); return true; + } case "disable": + { if (!data.hasVerification()) { msg("Discord verification is already disabled for you.", ChatColor.RED); @@ -102,16 +104,20 @@ public class Command_playerverification extends FreedomCommand plugin.pl.save(data); msg("Disabled Discord verification.", ChatColor.GREEN); return true; + } case "status": + { boolean enabled = target.hasVerification(); boolean specified = target.getDiscordID() != null; msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false")); msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordID() : ChatColor.RED + "not set")); msg(ChatColor.GRAY + "Backup Codes: " + data.getBackupCodes().size() + "/" + "10"); return true; + } case "genbackupcodes": + { if (!plugin.dc.enabled) { msg("The Discord verification system is currently disabled.", ChatColor.RED); @@ -134,7 +140,7 @@ public class Command_playerverification extends FreedomCommand msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED); } return true; - + } default: return false; } @@ -145,6 +151,7 @@ public class Command_playerverification extends FreedomCommand } return true; } + @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { From 98ead06355bda2f3ca09134e8c6093a84ef1dffe Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 15:59:12 +0000 Subject: [PATCH 14/16] Update Command_manuallyverify.java ood file --- .../totalfreedommod/command/Command_manuallyverify.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java index 3f47f23b..0c88622e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java @@ -1,15 +1,15 @@ package me.totalfreedom.totalfreedommod.command; -import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "Manually verify someone", usage = "/ ", aliases="mv") +@CommandParameters(description = "Manually verify someone", usage = "/ ", aliases = "mv") public class Command_manuallyverify extends FreedomCommand { @Override @@ -26,7 +26,6 @@ public class Command_manuallyverify extends FreedomCommand msg("The Discord verification system is currently disabled", ChatColor.RED); return true; } - if (args.length == 0) { return false; @@ -45,7 +44,7 @@ public class Command_manuallyverify extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Manually verifying player " + player.getName(), false); + FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false); player.setOp(true); player.sendMessage(YOU_ARE_OP); From 687166e0a4d576379bc912cbeded48a43f943d63 Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 16:00:18 +0000 Subject: [PATCH 15/16] Update Discord.java formatting screwed up --- .../java/me/totalfreedom/totalfreedommod/discord/Discord.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index e0cbbe85..9aa673bb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -59,7 +59,7 @@ public class Discord extends FreedomService public static JDA bot = null; public Boolean enabled = false; - public Boolean enableBot = false; + public Boolean enableBot = false; public void startBot() { From 50643eb9ffc8f0f9490ef899d96b685466eb64eb Mon Sep 17 00:00:00 2001 From: SupItsDillon Date: Wed, 9 Dec 2020 16:03:40 +0000 Subject: [PATCH 16/16] Update Command_verify.java ood code again --- .../totalfreedom/totalfreedommod/command/Command_verify.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java index cc217138..c0eb9474 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_verify.java @@ -11,13 +11,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH) -@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code. Staff can manually verify a player impostor.", usage = "/ >") +@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code. Admins can manually verify a player impostor.", usage = "/ >") public class Command_verify extends FreedomCommand { @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { boolean enableBot = (ConfigEntry.DISCORD_VERIFICATION.getBoolean()); if (!plugin.dc.enabled)