Stage 3 of IP -> UUID migration: completely removing the verification system

This commit is contained in:
Video 2022-04-15 07:52:06 -06:00
parent 05745c4210
commit 6af9f240f4
26 changed files with 35 additions and 828 deletions

View File

@ -120,13 +120,6 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
@ -427,7 +420,6 @@
<includes> <includes>
<include>commons-io:commons-io</include> <include>commons-io:commons-io</include>
<include>org.apache.commons:commons-lang3</include> <include>org.apache.commons:commons-lang3</include>
<include>commons-codec:commons-codec</include>
<include>org.reflections:reflections</include> <include>org.reflections:reflections</include>
<include>org.javassist:javassist</include> <include>org.javassist:javassist</include>
<include>io.papermc:paperlib</include> <include>io.papermc:paperlib</include>

View File

@ -179,14 +179,11 @@ public class LoginProcess extends FreedomService
} }
// Whitelist // Whitelist
if (server.isWhitelistEnforced()) if (server.isWhitelistEnforced() && !player.isWhitelisted())
{
if (!player.isWhitelisted())
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
} }
} }
}
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
@ -225,7 +222,7 @@ public class LoginProcess extends FreedomService
return; return;
} }
if (!playerData.hasVerification() && !playerData.getIps().contains(FUtil.getIp(player))) if (!playerData.getIps().contains(FUtil.getIp(player)))
{ {
playerData.addIp(FUtil.getIp(player)); playerData.addIp(FUtil.getIp(player));
plugin.pl.save(playerData); plugin.pl.save(playerData);

View File

@ -18,7 +18,6 @@ import org.bukkit.entity.Player;
public class AdminList extends FreedomService public class AdminList extends FreedomService
{ {
public static final List<String> vanished = new ArrayList<>(); public static final List<String> vanished = new ArrayList<>();
public final Map<String, List<String>> verifiedNoAdmin = Maps.newHashMap();
private final Set<Admin> allAdmins = Sets.newHashSet(); // Includes disabled admins private final Set<Admin> allAdmins = Sets.newHashSet(); // Includes disabled admins
// Only active admins below // Only active admins below
private final Set<Admin> activeAdmins = Sets.newHashSet(); private final Set<Admin> activeAdmins = Sets.newHashSet();
@ -189,27 +188,6 @@ public class AdminList extends FreedomService
save(admin); save(admin);
} }
public boolean isAdminImpostor(Player player)
{
return getEntryByUuid(player.getUniqueId()) != null && !isAdmin(player) && !isVerifiedAdmin(player);
}
public boolean isVerifiedAdmin(Player player)
{
return verifiedNoAdmin.containsKey(player.getName()) && verifiedNoAdmin.get(player.getName()).contains(FUtil.getIp(player));
}
public boolean isIdentityMatched(Player player)
{
if (Bukkit.getOnlineMode())
{
return true;
}
Admin admin = getAdmin(player);
return admin != null && admin.getName().equalsIgnoreCase(player.getName());
}
public boolean addAdmin(Admin admin) public boolean addAdmin(Admin admin)
{ {
if (!admin.isValid()) if (!admin.isValid())
@ -358,9 +336,4 @@ public class AdminList extends FreedomService
{ {
return ipTable; return ipTable;
} }
public Map<String, List<String>> getVerifiedNoAdmin()
{
return verifiedNoAdmin;
}
} }

View File

@ -18,7 +18,7 @@ public class Command_linkdiscord extends FreedomCommand
{ {
if (!plugin.dc.enabled) if (!plugin.dc.enabled)
{ {
msg("The Discord verification system is currently disabled.", ChatColor.RED); msg("The Discord integration system is currently disabled.", ChatColor.RED);
return true; return true;
} }
@ -32,7 +32,7 @@ public class Command_linkdiscord extends FreedomCommand
} }
playerData.setDiscordID(args[1]); playerData.setDiscordID(args[1]);
msg("Linked " + args[0] + "'s discord account.", ChatColor.GREEN); msg("Linked " + args[0] + "'s Discord account.", ChatColor.GREEN);
return true; return true;
} }

View File

@ -15,8 +15,8 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH) @CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -i | -f | -v]", aliases = "who,lsit") @CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -f | -v]", aliases = "who,lsit")
public class Command_list extends FreedomCommand public class Command_list extends FreedomCommand
{ {
@ -63,11 +63,6 @@ public class Command_list extends FreedomCommand
listFilter = ListFilter.TELNET_SESSIONS; listFilter = ListFilter.TELNET_SESSIONS;
break; break;
} }
case "-i":
{
listFilter = ListFilter.IMPOSTORS;
break;
}
case "-f": case "-f":
{ {
listFilter = ListFilter.FAMOUS_PLAYERS; listFilter = ListFilter.FAMOUS_PLAYERS;
@ -122,10 +117,6 @@ public class Command_list extends FreedomCommand
{ {
continue; continue;
} }
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
{
continue;
}
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase())) if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase()))
{ {
continue; continue;
@ -164,7 +155,6 @@ public class Command_list extends FreedomCommand
ADMINS, ADMINS,
VANISHED_ADMINS, VANISHED_ADMINS,
TELNET_SESSIONS, TELNET_SESSIONS,
FAMOUS_PLAYERS, FAMOUS_PLAYERS
IMPOSTORS
} }
} }

View File

@ -1,63 +0,0 @@
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;
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 = "/<command> <playername>", 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 verificationEnabled = ConfigEntry.DISCORD_VERIFICATION.getBoolean();
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
if (!verificationEnabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
if (args.length == 0)
{
return false;
}
final Player player = getPlayer(args[0]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
if (!plugin.pl.IsImpostor(player))
{
msg("That player is not an impostor.");
return true;
}
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false);
player.setOp(true);
msg(player, YOU_ARE_OP);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
msg(player, "You have been unfrozen.");
}
plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player);
return true;
}
}

View File

@ -116,39 +116,21 @@ public class Command_mbconfig extends FreedomCommand
return true; return true;
} }
if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player)) if (!data.isMasterBuilder())
{
FUtil.adminAction(sender.getName(), "Re-adding " + data.getName() + " to the Master Builder list", true);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
}
if (player != null)
{
plugin.pl.verify(player, null);
plugin.rm.updateDisplay(player);
player.setOp(true);
msg(player, YOU_ARE_OP);
}
}
else if (!data.isMasterBuilder())
{ {
FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true); FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
data.setMasterBuilder(true); data.setMasterBuilder(true);
data.setVerification(true);
plugin.pl.save(data); plugin.pl.save(data);
if (player != null) if (player != null)
{ {
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);
} }
return true;
} }
else else
{ {
msg("That player is already on the Master Builder list."); msg("That player is already on the Master Builder list.");
return true;
} }
return true;
} }
case "remove": case "remove":
{ {
@ -173,10 +155,6 @@ public class Command_mbconfig extends FreedomCommand
FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true); FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
data.setMasterBuilder(false); data.setMasterBuilder(false);
if (data.getDiscordID() == null)
{
data.setVerification(false);
}
plugin.pl.save(data); plugin.pl.save(data);
if (player != null) if (player != null)
{ {

View File

@ -1,158 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
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.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Manage your verification", usage = "/<command> <enable | disable | clearips | clearip <ip> | status | genbackupcodes>", aliases = "playerverify,pv")
public class Command_playerverification extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
PlayerData target = plugin.pl.getData(playerSender);
boolean verificationEnabled = ConfigEntry.DISCORD_VERIFICATION.getBoolean();
List<String> ips = new ArrayList<>(target.getIps());
if (verificationEnabled)
{
if (args.length == 1)
{
if (args[0].equalsIgnoreCase("clearips"))
{
int cleared = 0;
for (String ip : ips)
{
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;
}
else if (args[0].equalsIgnoreCase("clearip"))
{
return false;
}
}
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.", ChatColor.RED);
}
return true;
}
default:
return false;
}
}
else
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
}
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1)
{
return Arrays.asList("enable", "disable", "status", "clearips", "genbackupcodes");
}
return Collections.emptyList();
}
}

View File

@ -187,12 +187,6 @@ public class Command_saconfig extends FreedomCommand
} }
} }
if (plugin.pl.isPlayerImpostor(player))
{
msg("This player was labeled as a Player impostor and is not an admin, therefore they cannot be added to the admin list.", ChatColor.RED);
return true;
}
if (admin == null) // New admin if (admin == null) // New admin
{ {
@ -209,11 +203,6 @@ public class Command_saconfig extends FreedomCommand
admin.setActive(true); admin.setActive(true);
admin.setLastLogin(new Date()); admin.setLastLogin(new Date());
if (plugin.al.isVerifiedAdmin(player))
{
plugin.al.verifiedNoAdmin.remove(player.getName());
}
plugin.al.save(admin); plugin.al.save(admin);
plugin.al.updateTables(); plugin.al.updateTables();
plugin.rm.updateDisplay(player); plugin.rm.updateDisplay(player);

View File

@ -17,7 +17,7 @@ public class Command_unlinkdiscord extends FreedomCommand
{ {
if (!plugin.dc.enabled) if (!plugin.dc.enabled)
{ {
msg("The Discord verification system is currently disabled.", ChatColor.RED); msg("The Discord integration system is currently disabled.", ChatColor.RED);
return true; return true;
} }
@ -31,7 +31,7 @@ public class Command_unlinkdiscord extends FreedomCommand
} }
playerData.setDiscordID(null); playerData.setDiscordID(null);
msg("Unlinked " + args[0] + "'s discord account.", ChatColor.GREEN); msg("Unlinked " + args[0] + "'s Discord account.", ChatColor.GREEN);
return true; return true;
} }
@ -42,7 +42,6 @@ public class Command_unlinkdiscord extends FreedomCommand
return true; return true;
} }
data.setDiscordID(null); data.setDiscordID(null);
data.setVerification(false);
plugin.pl.save(data); plugin.pl.save(data);
msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN); msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN);
return true; return true;

View File

@ -1,101 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
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 = "/<command> <code | <playername>>")
public class Command_verify extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
boolean verificationEnabled = ConfigEntry.DISCORD_VERIFICATION.getBoolean();
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
if (!verificationEnabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
return true;
}
if (senderIsConsole)
{
msg("/manuallyverify <playername>", ChatColor.WHITE);
return true;
}
if (!plugin.pl.IsImpostor(playerSender))
{
msg("You are not an impostor, therefore you do not need to verify.", ChatColor.RED);
return true;
}
PlayerData playerData = plugin.pl.getData(playerSender);
String discordId = playerData.getDiscordID();
if (playerData.getDiscordID() == null)
{
msg("You do not have a Discord account linked to your Minecraft account, please verify the manual way.", ChatColor.RED);
return true;
}
if (args.length == 0)
{
String code = plugin.dc.generateCode(10);
plugin.dc.addVerificationCode(code, playerData);
plugin.dc.getUser(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + FUtil.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN);
return true;
}
String code = args[0];
String backupCode = null;
if (plugin.pl.IsImpostor(playerSender))
{
PlayerData mapPlayer = plugin.dc.getVerificationCodes().get(code);
if (mapPlayer == null)
{
if (!playerData.getBackupCodes().contains(Discord.getMD5(code)))
{
msg("You have entered an invalid verification code", ChatColor.RED);
return true;
}
else
{
backupCode = Discord.getMD5(code);
}
}
else
{
plugin.dc.removeVerificationCode(code);
}
final FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
if (fPlayer.getFreezeData().isFrozen())
{
fPlayer.getFreezeData().setFrozen(false);
msg("You have been unfrozen.");
}
FUtil.bcastMsg(playerSender.getName() + " has verified!", ChatColor.GOLD);
playerSender.setOp(true);
plugin.pl.verify(playerSender, backupCode);
return true;
}
return true;
}
}

View File

@ -1,92 +0,0 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
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 = "Verify an admin without giving them admin permissions.", usage = "/<command> <player>", aliases = "vns,verifynostaff,vna")
public class Command_verifynoadmin extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
Player player = getPlayer(args[0]);
if (player == null)
{
msg(PLAYER_NOT_FOUND);
return true;
}
if (plugin.al.isAdminImpostor(player))
{
String ip = FUtil.getIp(player);
if (!plugin.al.verifiedNoAdmin.containsKey(player.getName()))
{
List<String> ips = new ArrayList<>();
ips.add(ip);
plugin.al.verifiedNoAdmin.put(player.getName(), ips);
}
else
{
List<String> ips = plugin.al.verifiedNoAdmin.get(player.getName());
if (!ips.contains(ip))
{
ips.add(ip);
plugin.al.verifiedNoAdmin.remove(player.getName());
plugin.al.verifiedNoAdmin.put(player.getName(), ips);
}
}
plugin.rm.updateDisplay(player);
FUtil.adminAction(sender.getName(), "Verified " + player.getName() + ", without admin permissions.", true);
player.setOp(true);
msg(player, YOU_ARE_OP);
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen())
{
fPlayer.getFreezeData().setFrozen(false);
msg(player, "You have been unfrozen.");
}
msg("Verified " + player.getName() + " but didn't give them admin permissions", ChatColor.GREEN);
}
else
{
msg(player.getName() + " is not an admin imposter.", ChatColor.RED);
}
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1)
{
List<String> adminImposters = new ArrayList<>();
for (Player player : server.getOnlinePlayers())
{
if (plugin.al.isAdminImpostor(player))
{
adminImposters.add(player.getName());
}
}
return adminImposters;
}
return Collections.emptyList();
}
}

View File

@ -73,7 +73,6 @@ public enum ConfigEntry
SERVER_WHITELIST_MOTD(String.class, "server.motds.whitelist"), SERVER_WHITELIST_MOTD(String.class, "server.motds.whitelist"),
SERVER_FULL_MOTD(String.class, "server.motds.full"), SERVER_FULL_MOTD(String.class, "server.motds.full"),
// //
DISCORD_VERIFICATION(Boolean.class, "discord.verification"),
DISCORD_TOKEN(String.class, "discord.token"), DISCORD_TOKEN(String.class, "discord.token"),
DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"), DISCORD_REPORT_CHANNEL_ID(String.class, "discord.report_channel_id"),
DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"), DISCORD_CHAT_CHANNEL_ID(String.class, "discord.chat_channel_id"),

View File

@ -1,9 +1,6 @@
package me.totalfreedom.totalfreedommod.discord; package me.totalfreedom.totalfreedommod.discord;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -22,7 +19,6 @@ 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.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
@ -41,7 +37,6 @@ import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.ChunkingFilter; import net.dv8tion.jda.api.utils.ChunkingFilter;
import net.dv8tion.jda.api.utils.MemberCachePolicy; import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory; import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils; import org.apache.commons.lang.WordUtils;
import org.bukkit.GameRule; import org.bukkit.GameRule;
@ -57,18 +52,12 @@ public class Discord extends FreedomService
{ {
public static HashMap<String, PlayerData> LINK_CODES = new HashMap<>(); public static HashMap<String, PlayerData> LINK_CODES = new HashMap<>();
public static HashMap<String, PlayerData> VERIFICATION_CODES = new HashMap<>();
public static JDA bot = null; public static JDA bot = null;
public ScheduledThreadPoolExecutor RATELIMIT_EXECUTOR; public ScheduledThreadPoolExecutor RATELIMIT_EXECUTOR;
public List<CompletableFuture<Message>> sentMessages = new ArrayList<>(); public List<CompletableFuture<Message>> sentMessages = new ArrayList<>();
public Boolean enabled = false; public Boolean enabled = false;
private final Pattern DISCORD_MENTION_PATTERN = Pattern.compile("(<@!?([0-9]{16,20})>)"); private final Pattern DISCORD_MENTION_PATTERN = Pattern.compile("(<@!?([0-9]{16,20})>)");
public static String getMD5(String string)
{
return DigestUtils.md5Hex(string);
}
public static String getCode(PlayerData playerData) public static String getCode(PlayerData playerData)
{ {
for (String code : LINK_CODES.keySet()) for (String code : LINK_CODES.keySet())
@ -157,12 +146,6 @@ public class Discord extends FreedomService
public void startBot() public void startBot()
{ {
boolean verificationEnabled = ConfigEntry.DISCORD_VERIFICATION.getBoolean();
if (!verificationEnabled)
{
FLog.info("Discord Verification has been manually disabled.");
}
enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString()); enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString());
if (!enabled) if (!enabled)
{ {
@ -199,15 +182,15 @@ public class Discord extends FreedomService
.setMemberCachePolicy(MemberCachePolicy.ALL) .setMemberCachePolicy(MemberCachePolicy.ALL)
.enableIntents(GatewayIntent.GUILD_MEMBERS) .enableIntents(GatewayIntent.GUILD_MEMBERS)
.build(); .build();
FLog.info("Discord verification bot has successfully enabled!"); FLog.info("Discord integration has successfully enabled!");
} }
catch (LoginException e) catch (LoginException e)
{ {
FLog.warning("An invalid token for the discord verification bot, the bot will not enable."); FLog.warning("An invalid token for Discord integration was provided, the bot will not enable.");
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
{ {
FLog.warning("Discord verification bot failed to start."); FLog.warning("Discord integration failed to start.");
} }
catch (NoClassDefFoundError e) catch (NoClassDefFoundError e)
{ {
@ -261,35 +244,6 @@ public class Discord extends FreedomService
return member.getUser(); return member.getUser();
} }
public boolean sendBackupCodes(PlayerData playerData)
{
List<String> codes = generateBackupCodes();
List<String> encryptedCodes = generateEncryptedBackupCodes(codes);
User user = getUser(playerData.getDiscordID());
File file = generateBackupCodesFile(playerData.getName(), codes);
if (file == null)
{
return false;
}
PrivateChannel privateChannel = user.openPrivateChannel().complete();
privateChannel.sendMessage("Do not share these codes with anyone as they can be used to impose as you.").addFile(file).complete();
playerData.setBackupCodes(encryptedCodes);
plugin.pl.save(playerData);
//noinspection ResultOfMethodCallIgnored
file.delete();
return true;
}
public List<String> generateBackupCodes()
{
List<String> codes = new ArrayList<>();
for (int i = 0; i < 10; i++)
{
codes.add(FUtil.randomAlphanumericString(10));
}
return codes;
}
public String generateCode(int size) public String generateCode(int size)
{ {
StringBuilder code = new StringBuilder(); StringBuilder code = new StringBuilder();
@ -301,58 +255,6 @@ public class Discord extends FreedomService
return code.toString(); return code.toString();
} }
public List<String> generateEncryptedBackupCodes(List<String> codes)
{
List<String> encryptedCodes = new ArrayList<>();
for (String code : codes)
{
encryptedCodes.add(getMD5(code));
}
return encryptedCodes;
}
public File generateBackupCodesFile(String name, List<String> codes)
{
StringBuilder text = new StringBuilder();
text.append("Below are your backup codes for use on TotalFreedom in the event you lose access to your discord account.\n")
.append("Simply pick a code, and run /verify <code> on the server. Each code is one use, so be sure to cross it off once you use it.\n")
.append("To generate new codes, simply run /generatebackupcodes\n\n");
for (String code : codes)
{
text.append(code).append("\n");
}
String fileUrl = plugin.getDataFolder().getAbsolutePath() + "/TF-Backup-Codes-" + name + ".txt";
try
{
FileWriter fileWriter = new FileWriter(fileUrl);
fileWriter.write(text.toString());
fileWriter.close();
}
catch (IOException e)
{
FLog.severe("Failed to generate backup codes file: " + e.toString());
return null;
}
return new File(fileUrl);
}
public void addVerificationCode(String code, PlayerData playerData)
{
VERIFICATION_CODES.put(code, playerData);
}
public void removeVerificationCode(String code)
{
VERIFICATION_CODES.remove(code);
}
public HashMap<String, PlayerData> getVerificationCodes()
{
return VERIFICATION_CODES;
}
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event) public void onPlayerDeath(PlayerDeathEvent event)
{ {
@ -475,7 +377,7 @@ public class Discord extends FreedomService
messageChatChannel("**Server has stopped**"); messageChatChannel("**Server has stopped**");
} }
FLog.info("Discord verification bot has successfully shutdown."); FLog.info("Discord integration has successfully shutdown.");
} }
public String deformat(String input) public String deformat(String input)

View File

@ -22,7 +22,6 @@ public class PrivateMessageListener extends ListenerAdapter
PlayerData player = Discord.LINK_CODES.get(code); PlayerData player = Discord.LINK_CODES.get(code);
name = player.getName(); name = player.getName();
player.setDiscordID(event.getMessage().getAuthor().getId()); player.setDiscordID(event.getMessage().getAuthor().getId());
player.setVerification(true);
Admin admin = TotalFreedomMod.getPlugin().al.getEntryByUuid(player.getUuid()); Admin admin = TotalFreedomMod.getPlugin().al.getEntryByUuid(player.getUuid());
if (admin != null) if (admin != null)
@ -37,8 +36,7 @@ public class PrivateMessageListener extends ListenerAdapter
{ {
return; return;
} }
event.getChannel().sendMessage("Link successful. Now this Discord account is linked with your Minecraft account **" + name + "**.\n" event.getChannel().sendMessage("Link successful. Now this Discord account is linked with your Minecraft account **" + name + "**.").complete();
+ "Now when you are an impostor on the server, you may use `/verify` to verify.").complete();
} }
} }
} }

View File

@ -60,13 +60,10 @@ public class FreezeData
{ {
@Override @Override
public void run() public void run()
{
if (!Objects.requireNonNull(plugin()).al.isAdminImpostor(player) && Objects.requireNonNull(plugin()).pl.isPlayerImpostor(player))
{ {
FUtil.adminAction("TotalFreedom", "Unfreezing " + player.getName(), false); FUtil.adminAction("TotalFreedom", "Unfreezing " + player.getName(), false);
setFrozen(false); setFrozen(false);
} }
}
}.runTaskLater(Objects.requireNonNull(plugin()), AUTO_PURGE_TICKS); }.runTaskLater(Objects.requireNonNull(plugin()), AUTO_PURGE_TICKS);
} }

View File

@ -34,7 +34,6 @@ public class Module_list extends HTTPDModule
final JSONArray admins = new JSONArray(); final JSONArray admins = new JSONArray();
final JSONArray masterbuilders = new JSONArray(); final JSONArray masterbuilders = new JSONArray();
final JSONArray operators = new JSONArray(); final JSONArray operators = new JSONArray();
final JSONArray imposters = new JSONArray();
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
@ -43,11 +42,6 @@ public class Module_list extends HTTPDModule
continue; continue;
} }
if (isImposter(player))
{
imposters.add(player.getName());
}
if (plugin.pl.getData(player).isMasterBuilder()) if (plugin.pl.getData(player).isMasterBuilder())
{ {
masterbuilders.add(player.getName()); masterbuilders.add(player.getName());
@ -105,7 +99,6 @@ public class Module_list extends HTTPDModule
responseObject.put("admins", admins); responseObject.put("admins", admins);
responseObject.put("master_builders", masterbuilders); responseObject.put("master_builders", masterbuilders);
responseObject.put("operators", operators); responseObject.put("operators", operators);
responseObject.put("imposters", imposters);
responseObject.put("online", FUtil.getFakePlayerCount()); responseObject.put("online", FUtil.getFakePlayerCount());
responseObject.put("max", server.getMaxPlayers()); responseObject.put("max", server.getMaxPlayers());
@ -141,11 +134,6 @@ public class Module_list extends HTTPDModule
} }
} }
public boolean isImposter(Player player)
{
return plugin.al.isAdminImpostor(player) || plugin.pl.isPlayerImpostor(player);
}
public boolean hasSpecialTitle(Player player) public boolean hasSpecialTitle(Player player)
{ {
return !FUtil.DEVELOPERS.contains(player.getUniqueId().toString()) && !ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && !ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()); return !FUtil.DEVELOPERS.contains(player.getUniqueId().toString()) && !ConfigEntry.SERVER_EXECUTIVES.getList().contains(player.getName()) && !ConfigEntry.SERVER_OWNERS.getList().contains(player.getName());

View File

@ -37,7 +37,7 @@ public class Module_players extends HTTPDModule
if (!plugin.al.isVanished(player.getName())) if (!plugin.al.isVanished(player.getName()))
{ {
players.add(player.getName()); players.add(player.getName());
if (plugin.al.isAdmin(player) && !plugin.al.isAdminImpostor(player)) if (plugin.al.isAdmin(player))
{ {
onlineadmins.add(player.getName()); onlineadmins.add(player.getName());
} }

View File

@ -54,9 +54,6 @@ public class FPlayer
private String lastMessage = ""; private String lastMessage = "";
private boolean inAdminchat = false; private boolean inAdminchat = false;
private boolean allCommandsBlocked = false; private boolean allCommandsBlocked = false;
private boolean superadminIdVerified = false;
private String lastCommand = ""; private String lastCommand = "";
private boolean cmdspyEnabled = false; private boolean cmdspyEnabled = false;
private String tag = null; private String tag = null;
@ -648,16 +645,6 @@ public class FPlayer
this.allCommandsBlocked = allCommandsBlocked; this.allCommandsBlocked = allCommandsBlocked;
} }
public boolean isSuperadminIdVerified()
{
return superadminIdVerified;
}
public void setSuperadminIdVerified(boolean superadminIdVerified)
{
this.superadminIdVerified = superadminIdVerified;
}
public boolean isCmdspyEnabled() public boolean isCmdspyEnabled()
{ {
return cmdspyEnabled; return cmdspyEnabled;

View File

@ -5,7 +5,6 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.*;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.shop.ShopItem; import me.totalfreedom.totalfreedommod.shop.ShopItem;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
@ -19,13 +18,10 @@ public class PlayerData
private UUID uuid; private UUID uuid;
private final List<String> ips = Lists.newArrayList(); private final List<String> ips = Lists.newArrayList();
private final List<String> notes = Lists.newArrayList(); private final List<String> notes = Lists.newArrayList();
private final List<String> backupCodes = Lists.newArrayList();
private String tag = null; private String tag = null;
private String discordID = null; private String discordID = null;
private Boolean masterBuilder = false; private Boolean masterBuilder = false;
private Boolean verification = false;
private String rideMode = "ask"; private String rideMode = "ask";
@ -54,10 +50,7 @@ public class PlayerData
notes.addAll(FUtil.stringToList(resultSet.getString("notes"))); notes.addAll(FUtil.stringToList(resultSet.getString("notes")));
tag = resultSet.getString("tag"); tag = resultSet.getString("tag");
discordID = resultSet.getString("discord_id"); discordID = resultSet.getString("discord_id");
backupCodes.clear();
backupCodes.addAll(FUtil.stringToList(resultSet.getString("backup_codes")));
masterBuilder = resultSet.getBoolean("master_builder"); masterBuilder = resultSet.getBoolean("master_builder");
verification = resultSet.getBoolean("verification");
rideMode = resultSet.getString("ride_mode"); rideMode = resultSet.getString("ride_mode");
coins = resultSet.getInt("coins"); coins = resultSet.getInt("coins");
items.clear(); items.clear();
@ -71,18 +64,6 @@ public class PlayerData
{ {
FLog.severe("Failed to load player: " + e.getMessage()); FLog.severe("Failed to load player: " + e.getMessage());
} }
// Force verification for Master Builders
if (masterBuilder && !verification)
{
verification = true;
TotalFreedomMod.getPlugin().pl.save(this);
}
else if (!masterBuilder && discordID == null && verification)
{
this.verification = false;
TotalFreedomMod.getPlugin().pl.save(this);
}
} }
public PlayerData(Player player) public PlayerData(Player player)
@ -97,13 +78,11 @@ public class PlayerData
"- IPs: " + StringUtils.join(ips, ", ") + "\n" + "- IPs: " + StringUtils.join(ips, ", ") + "\n" +
"- Discord ID: " + discordID + "\n" + "- Discord ID: " + discordID + "\n" +
"- Master Builder: " + masterBuilder + "\n" + "- Master Builder: " + masterBuilder + "\n" +
"- Has Verification: " + verification + "\n" +
"- Coins: " + coins + "\n" + "- Coins: " + coins + "\n" +
"- Total Votes: " + totalVotes + "\n" + "- Total Votes: " + totalVotes + "\n" +
"- Display Discord: " + displayDiscord + "\n" + "- Display Discord: " + displayDiscord + "\n" +
"- Tag: " + FUtil.colorize(tag) + ChatColor.GRAY + "\n" + "- Tag: " + FUtil.colorize(tag) + ChatColor.GRAY + "\n" +
"- Ride Mode: " + rideMode + "\n" + "- Ride Mode: " + rideMode + "\n" +
"- Backup Codes: " + backupCodes.size() + "/10" + "\n" +
"- Login Message: " + loginMessage; "- Login Message: " + loginMessage;
} }
@ -152,22 +131,6 @@ public class PlayerData
notes.clear(); notes.clear();
} }
public List<String> getBackupCodes()
{
return Collections.unmodifiableList(backupCodes);
}
public void setBackupCodes(List<String> codes)
{
backupCodes.clear();
backupCodes.addAll(codes);
}
public void removeBackupCode(String code)
{
backupCodes.remove(code);
}
public void addNote(String note) public void addNote(String note)
{ {
notes.add(note); notes.add(note);
@ -211,11 +174,6 @@ public class PlayerData
items.remove(item.getDataName()); items.remove(item.getDataName());
} }
public boolean hasVerification()
{
return verification;
}
public boolean isMasterBuilder() public boolean isMasterBuilder()
{ {
return masterBuilder; return masterBuilder;
@ -235,9 +193,7 @@ public class PlayerData
put("notes", FUtil.listToString(notes)); put("notes", FUtil.listToString(notes));
put("tag", tag); put("tag", tag);
put("discord_id", discordID); put("discord_id", discordID);
put("backup_codes", FUtil.listToString(backupCodes));
put("master_builder", masterBuilder); put("master_builder", masterBuilder);
put("verification", verification);
put("ride_mode", rideMode); put("ride_mode", rideMode);
put("coins", coins); put("coins", coins);
put("items", FUtil.listToString(items)); put("items", FUtil.listToString(items));
@ -293,16 +249,6 @@ public class PlayerData
this.masterBuilder = masterBuilder; this.masterBuilder = masterBuilder;
} }
public Boolean getVerification()
{
return verification;
}
public void setVerification(Boolean verification)
{
this.verification = verification;
}
public String getRideMode() public String getRideMode()
{ {
return rideMode; return rideMode;

View File

@ -138,43 +138,6 @@ public class PlayerList extends FreedomService
return new PlayerData(resultSet); return new PlayerData(resultSet);
} }
public Boolean isPlayerImpostor(Player player)
{
PlayerData playerData = getData(player);
return plugin.dc.enabled
&& !plugin.al.isAdmin(player)
&& (playerData.hasVerification())
&& !playerData.getIps().contains(FUtil.getIp(player));
}
public boolean IsImpostor(Player player)
{
return isPlayerImpostor(player) || plugin.al.isAdminImpostor(player);
}
public void verify(Player player, String backupCode)
{
PlayerData playerData = getData(player);
if (backupCode != null)
{
playerData.removeBackupCode(backupCode);
}
playerData.addIp(FUtil.getIp(player));
save(playerData);
if (plugin.al.isAdminImpostor(player))
{
Admin admin = plugin.al.getEntryByUuid(player.getUniqueId());
admin.setLastLogin(new Date());
admin.addIp(FUtil.getIp(player));
plugin.al.updateTables();
plugin.al.save(admin);
}
plugin.rm.updateDisplay(player);
}
public void syncIps(Admin admin) public void syncIps(Admin admin)
{ {
PlayerData playerData = getData(admin.getName()); PlayerData playerData = getData(admin.getName());
@ -183,20 +146,6 @@ public class PlayerList extends FreedomService
plugin.pl.save(playerData); plugin.pl.save(playerData);
} }
public void syncIps(PlayerData playerData)
{
Admin admin = plugin.al.getEntryByUuid(playerData.getUuid());
if (admin != null && admin.isActive())
{
admin.clearIPs();
admin.addIps(playerData.getIps());
plugin.al.updateTables();
plugin.al.save(admin);
}
}
public void save(PlayerData player) public void save(PlayerData player)
{ {
try try

View File

@ -4,7 +4,6 @@ import net.md_5.bungee.api.ChatColor;
public enum Rank implements Displayable public enum Rank implements Displayable
{ {
IMPOSTOR("an", "Impostor", Type.PLAYER, "Imp", ChatColor.YELLOW, null, false, false),
NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false, false), NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.WHITE, null, false, false),
OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false, false), OP("an", "Operator", Type.PLAYER, "OP", ChatColor.GREEN, null, false, false),
ADMIN("an", "Admin", Type.ADMIN, "Admin", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true, true), ADMIN("an", "Admin", Type.ADMIN, "Admin", ChatColor.DARK_GREEN, org.bukkit.ChatColor.DARK_GREEN, true, true),

View File

@ -39,12 +39,6 @@ public class RankManager extends FreedomService
final Player player = (Player)sender; final Player player = (Player)sender;
// Display impostors
if (plugin.al.isAdminImpostor(player))
{
return Rank.IMPOSTOR;
}
// If the player's an owner, display that // If the player's an owner, display that
if (ConfigEntry.SERVER_OWNERS.getList().contains(player.getName())) if (ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
{ {
@ -67,11 +61,6 @@ public class RankManager extends FreedomService
return Title.ASSTEXEC; return Title.ASSTEXEC;
} }
if (plugin.al.isVerifiedAdmin(player))
{
return Title.VERIFIED_ADMIN;
}
// Master builders show up if they are not an admin // Master builders show up if they are not an admin
if (plugin.pl.getData(player).isMasterBuilder() && !plugin.al.isAdmin(player)) if (plugin.pl.getData(player).isMasterBuilder() && !plugin.al.isAdmin(player))
{ {
@ -137,11 +126,6 @@ public class RankManager extends FreedomService
public Rank getRank(Player player) public Rank getRank(Player player)
{ {
if (plugin.al.isAdminImpostor(player) || plugin.pl.isPlayerImpostor(player))
{
return Rank.IMPOSTOR;
}
final Admin entry = plugin.al.getAdmin(player); final Admin entry = plugin.al.getAdmin(player);
if (entry != null) if (entry != null)
{ {
@ -193,53 +177,15 @@ public class RankManager extends FreedomService
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final FPlayer fPlayer = plugin.pl.getPlayer(player);
PlayerData target = plugin.pl.getData(player); PlayerData target = plugin.pl.getData(player);
// Unban admins
boolean isAdmin = plugin.al.isAdmin(player); boolean isAdmin = plugin.al.isAdmin(player);
// Updates last login time
if (isAdmin) if (isAdmin)
{ {
// Verify strict IP match
if (!plugin.al.isIdentityMatched(player))
{
FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED);
fPlayer.setSuperadminIdVerified(false);
}
else
{
fPlayer.setSuperadminIdVerified(true);
plugin.al.updateLastLogin(player); plugin.al.updateLastLogin(player);
} }
}
if (plugin.al.isVerifiedAdmin(player))
{
FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but does not have any admin permissions.", ChatColor.RED);
}
// Handle impostors
boolean isImpostor = plugin.al.isAdminImpostor(player) || plugin.pl.isPlayerImpostor(player);
if (isImpostor)
{
FUtil.bcastMsg(ChatColor.AQUA + player.getName() + " is " + Rank.IMPOSTOR.getColoredLoginMessage());
if (plugin.al.isAdminImpostor(player))
{
FUtil.bcastMsg("Warning: " + player.getName() + " has been flagged as an admin impostor and has been frozen!", ChatColor.RED);
}
else if (plugin.pl.isPlayerImpostor(player))
{
FUtil.bcastMsg("Warning: " + player.getName() + " has been flagged as a player impostor and has been frozen!", ChatColor.RED);
}
String displayName = Rank.IMPOSTOR.getColor() + player.getName();
player.setPlayerListName(StringUtils.substring(displayName, 0, 16));
player.getInventory().clear();
player.setOp(false);
player.setGameMode(GameMode.SURVIVAL);
plugin.pl.getPlayer(player).getFreezeData().setFrozen(true);
player.sendMessage(ChatColor.RED + "You are marked as an impostor, please verify yourself!");
return;
}
// Broadcast login message // Broadcast login message
if (isAdmin || FUtil.isDeveloper(player) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).hasLoginMessage()) if (isAdmin || FUtil.isDeveloper(player) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).hasLoginMessage())
@ -253,14 +199,11 @@ public class RankManager extends FreedomService
// Set display // Set display
updateDisplay(player); updateDisplay(player);
if (!plugin.pl.isPlayerImpostor(player) && target.hasVerification())
{
if (target.getTag() != null) if (target.getTag() != null)
{ {
plugin.pl.getData(player).setTag(FUtil.colorize(target.getTag())); plugin.pl.getData(player).setTag(FUtil.colorize(target.getTag()));
} }
} }
}
public String craftLoginMessage(Player player, String message) public String craftLoginMessage(Player player, String message)
{ {

View File

@ -6,7 +6,6 @@ public enum Title implements Displayable
{ {
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true), MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true, true),
VERIFIED_ADMIN("a", "Verified Admin", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VA", false, true),
EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true), EXECUTIVE("an", "Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Exec", true, true),
ASSTEXEC("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true), ASSTEXEC("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true, true),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true), DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true),

View File

@ -95,7 +95,7 @@ public class SQLite extends FreedomService
{ {
try try
{ {
connection.createStatement().execute("CREATE TABLE `players` (`uuid` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `backup_codes` VARCHAR, `master_builder` BOOLEAN NOT NULL,`verification` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT, `items` VARCHAR, `total_votes` INT NOT NULL, `display_discord` BOOLEAN NOT NULL, `login_message` VARCHAR, `inspect` BOOLEAN NOT NULL);"); connection.createStatement().execute("CREATE TABLE `players` (`uuid` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `master_builder` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT, `items` VARCHAR, `total_votes` INT NOT NULL, `display_discord` BOOLEAN NOT NULL, `login_message` VARCHAR, `inspect` BOOLEAN NOT NULL);");
} }
catch (SQLException e) catch (SQLException e)
{ {
@ -242,22 +242,20 @@ public class SQLite extends FreedomService
{ {
try try
{ {
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.setString(1, player.getUuid().toString()); statement.setString(1, player.getUuid().toString());
statement.setString(2, FUtil.listToString(player.getIps())); statement.setString(2, FUtil.listToString(player.getIps()));
statement.setString(3, FUtil.listToString(player.getNotes())); statement.setString(3, FUtil.listToString(player.getNotes()));
statement.setString(4, player.getTag()); statement.setString(4, player.getTag());
statement.setString(5, player.getDiscordID()); statement.setString(5, player.getDiscordID());
statement.setString(6, FUtil.listToString(player.getBackupCodes())); statement.setBoolean(6, player.isMasterBuilder());
statement.setBoolean(7, player.isMasterBuilder()); statement.setString(7, player.getRideMode());
statement.setBoolean(8, player.hasVerification()); statement.setInt(8, player.getCoins());
statement.setString(9, player.getRideMode()); statement.setString(9, FUtil.listToString(player.getItems()));
statement.setInt(10, player.getCoins()); statement.setInt(10, player.getTotalVotes());
statement.setString(11, FUtil.listToString(player.getItems())); statement.setBoolean(11, player.doesDisplayDiscord());
statement.setInt(12, player.getTotalVotes()); statement.setString(12, player.getLoginMessage());
statement.setBoolean(13, player.doesDisplayDiscord()); statement.setBoolean(13, player.hasInspection());
statement.setString(14, player.getLoginMessage());
statement.setBoolean(15, player.hasInspection());
statement.executeUpdate(); statement.executeUpdate();
} }
catch (SQLException e) catch (SQLException e)

View File

@ -56,8 +56,6 @@ server:
# Discord # Discord
discord: discord:
# Do you want to enable the Discord verification system? (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 # If you do not have a token, make a bot account and get one at https://discordapp.com/developers/applications/me
token: '' token: ''
# The official discord server's ID for this server # The official discord server's ID for this server