Update Discord.java

stuff to disable or enable discord verification
This commit is contained in:
SupItsDillon 2020-12-08 16:08:31 +00:00 committed by GitHub
parent 4a3ce64412
commit 2037775276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank; 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.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
@ -59,9 +59,17 @@ public class Discord extends FreedomService
public static JDA bot = null; public static JDA bot = null;
public Boolean enabled = false; public Boolean enabled = false;
public Boolean enableBot = false;
public void startBot() 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()); enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString());
if (!enabled) if (!enabled)
{ {
@ -298,7 +306,7 @@ public class Discord extends FreedomService
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) 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" + "**"); messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**");
} }
@ -307,7 +315,7 @@ public class Discord extends FreedomService
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLeave(PlayerQuitEvent event) 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" + "**"); messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**");
} }
@ -428,7 +436,7 @@ public class Discord extends FreedomService
return true; return true;
} }
public static boolean syncRoles(Admin admin, String discordID) public static boolean syncRoles(StaffMember staffMember, String discordID)
{ {
if (discordID == null) if (discordID == null)
{ {
@ -462,7 +470,7 @@ public class Discord extends FreedomService
return false; return false;
} }
if (!admin.isActive()) if (!staffMember.isActive())
{ {
if (member.getRoles().contains(adminRole)) if (member.getRoles().contains(adminRole))
{ {
@ -475,7 +483,7 @@ public class Discord extends FreedomService
return true; return true;
} }
if (admin.getRank().equals(Rank.ADMIN)) if (staffMember.getRank().equals(Rank.ADMIN))
{ {
if (!member.getRoles().contains(adminRole)) if (!member.getRoles().contains(adminRole))
{ {
@ -487,7 +495,7 @@ public class Discord extends FreedomService
} }
return true; return true;
} }
else if (admin.getRank().equals(Rank.SENIOR_ADMIN)) else if (staffMember.getRank().equals(Rank.SENIOR_ADMIN))
{ {
if (!member.getRoles().contains(senioradminRole)) if (!member.getRoles().contains(senioradminRole))
{ {
@ -501,4 +509,4 @@ public class Discord extends FreedomService
} }
return false; return false;
} }
} }