mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 11:46:40 +00:00
Stage 3 of IP -> UUID migration: completely removing the verification system
This commit is contained in:
@ -18,7 +18,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
}
|
||||
|
||||
playerData.setDiscordID(args[1]);
|
||||
msg("Linked " + args[0] + "'s discord account.", ChatColor.GREEN);
|
||||
msg("Linked " + args[0] + "'s Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -i | -f | -v]", aliases = "who,lsit")
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-s | -f | -v]", aliases = "who,lsit")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -63,11 +63,6 @@ public class Command_list extends FreedomCommand
|
||||
listFilter = ListFilter.TELNET_SESSIONS;
|
||||
break;
|
||||
}
|
||||
case "-i":
|
||||
{
|
||||
listFilter = ListFilter.IMPOSTORS;
|
||||
break;
|
||||
}
|
||||
case "-f":
|
||||
{
|
||||
listFilter = ListFilter.FAMOUS_PLAYERS;
|
||||
@ -122,10 +117,6 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.FAMOUS_PLAYERS && !ConfigEntry.FAMOUS_PLAYERS.getList().contains(p.getName().toLowerCase()))
|
||||
{
|
||||
continue;
|
||||
@ -164,7 +155,6 @@ public class Command_list extends FreedomCommand
|
||||
ADMINS,
|
||||
VANISHED_ADMINS,
|
||||
TELNET_SESSIONS,
|
||||
FAMOUS_PLAYERS,
|
||||
IMPOSTORS
|
||||
FAMOUS_PLAYERS
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -116,39 +116,21 @@ public class Command_mbconfig extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player))
|
||||
{
|
||||
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())
|
||||
if (!data.isMasterBuilder())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
|
||||
data.setMasterBuilder(true);
|
||||
data.setVerification(true);
|
||||
plugin.pl.save(data);
|
||||
if (player != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That player is already on the Master Builder list.");
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
data.setMasterBuilder(false);
|
||||
if (data.getDiscordID() == null)
|
||||
{
|
||||
data.setVerification(false);
|
||||
}
|
||||
plugin.pl.save(data);
|
||||
if (player != null)
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
|
||||
@ -209,11 +203,6 @@ public class Command_saconfig extends FreedomCommand
|
||||
admin.setActive(true);
|
||||
admin.setLastLogin(new Date());
|
||||
|
||||
if (plugin.al.isVerifiedAdmin(player))
|
||||
{
|
||||
plugin.al.verifiedNoAdmin.remove(player.getName());
|
||||
}
|
||||
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(player);
|
||||
|
@ -17,7 +17,7 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
}
|
||||
|
||||
playerData.setDiscordID(null);
|
||||
msg("Unlinked " + args[0] + "'s discord account.", ChatColor.GREEN);
|
||||
msg("Unlinked " + args[0] + "'s Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,7 +42,6 @@ public class Command_unlinkdiscord extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
data.setDiscordID(null);
|
||||
data.setVerification(false);
|
||||
plugin.pl.save(data);
|
||||
msg("Your Minecraft account has been successfully unlinked from the Discord account.", ChatColor.GREEN);
|
||||
return true;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user