mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
merge /verifyplayer into /verify (#113)
* Spelling error and addition of forgotten checks * Fix tag nyan * this is what happens when you don't sleep for 2 days * d * Merge /verifyplayer into /verify
This commit is contained in:
parent
533e7892cc
commit
f3baf37279
2
pom.xml
2
pom.xml
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -15,22 +15,53 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code.", usage = "/<command> [code]")
|
||||
@CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Sends a verification code to the player, or the player can input the sent code.", 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)
|
||||
{
|
||||
|
||||
if (!plugin.dc.enabled)
|
||||
{
|
||||
msg("The Discord verification system is currently disabled", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdminImpostor(playerSender) && !plugin.pv.isPlayerImpostor(playerSender))
|
||||
|
||||
if (args.length == 1 && plugin.al.isAdmin(playerSender))
|
||||
{
|
||||
final Player player = getPlayer(args[0]);
|
||||
if (player == null && playerSender == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (!plugin.pv.isPlayerImpostor(player))
|
||||
{
|
||||
msg("That player is not an impostor.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), true);
|
||||
player.setOp(true);
|
||||
player.sendMessage(YOU_ARE_OP);
|
||||
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
|
||||
{
|
||||
plugin.pl.getPlayer(player).getFreezeData().setFrozen(false);
|
||||
msg("You have been unfrozen.");
|
||||
}
|
||||
plugin.pv.verifyPlayer(player);
|
||||
plugin.rm.updateDisplay(player);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("/verify <playername>", ChatColor.WHITE);
|
||||
return true;
|
||||
}
|
||||
if (!plugin.pv.isPlayerImpostor(playerSender) && !plugin.al.isAdminImpostor(playerSender))
|
||||
{
|
||||
msg("You are not an impostor, therefore you do not need to verify.", ChatColor.RED);
|
||||
return true;
|
||||
@ -48,8 +79,7 @@ public class Command_verify extends FreedomCommand
|
||||
}
|
||||
discordId = admin.getDiscordID();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (plugin.pv.isPlayerImpostor(playerSender))
|
||||
{
|
||||
if (plugin.pv.getVerificationPlayer(playerSender).getDiscordId() == null)
|
||||
@ -59,7 +89,6 @@ public class Command_verify extends FreedomCommand
|
||||
}
|
||||
discordId = plugin.pv.getVerificationPlayer(playerSender).getDiscordId();
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length < 1)
|
||||
{
|
||||
@ -81,19 +110,16 @@ public class Command_verify extends FreedomCommand
|
||||
msg("You have entered an invalid verification code", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (plugin.al.isAdminImpostor(playerSender))
|
||||
{
|
||||
Admin admin = plugin.al.getEntryByName(playerSender.getName());
|
||||
Discord.VERIFY_CODES.remove(code);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified!", ChatColor.GOLD);
|
||||
FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Readding " + admin.getName() + " to the admin list", true);
|
||||
if (playerSender != null)
|
||||
{
|
||||
|
||||
admin.setName(playerSender.getName());
|
||||
admin.addIp(Ips.getIp(playerSender));
|
||||
}
|
||||
|
||||
if (!plugin.mbl.isMasterBuilder(playerSender))
|
||||
{
|
||||
@ -108,12 +134,9 @@ public class Command_verify extends FreedomCommand
|
||||
}
|
||||
|
||||
if (masterBuilder != null)
|
||||
{
|
||||
if (playerSender != null)
|
||||
{
|
||||
masterBuilder.setName(playerSender.getName());
|
||||
masterBuilder.addIp(Ips.getIp(playerSender));
|
||||
}
|
||||
|
||||
masterBuilder.setLastLogin(new Date());
|
||||
|
||||
@ -127,10 +150,6 @@ public class Command_verify extends FreedomCommand
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
if (playerSender != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
}
|
||||
playerSender.setOp(true);
|
||||
msg(YOU_ARE_OP);
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
||||
@ -139,15 +158,14 @@ public class Command_verify extends FreedomCommand
|
||||
fPlayer.getFreezeData().setFrozen(false);
|
||||
msg("You have been unfrozen.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
if (plugin.pv.isPlayerImpostor(playerSender))
|
||||
{
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
|
||||
FUtil.bcastMsg(playerSender.getName() + " has verified!", ChatColor.GOLD);
|
||||
if (playerSender != null)
|
||||
{
|
||||
plugin.rm.updateDisplay(playerSender);
|
||||
}
|
||||
playerSender.setOp(true);
|
||||
msg(YOU_ARE_OP);
|
||||
if (fPlayer.getFreezeData().isFrozen())
|
||||
@ -156,10 +174,10 @@ public class Command_verify extends FreedomCommand
|
||||
msg("You have been unfrozen.");
|
||||
}
|
||||
plugin.pv.verifyPlayer(playerSender);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
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.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Manually verifies a player", usage = "/<command> <partialname>")
|
||||
public class Command_verifyplayer extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
if (!plugin.pv.isPlayerImpostor(player))
|
||||
{
|
||||
msg("That player is not an impostor.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), true);
|
||||
plugin.pv.verifyPlayer(player);
|
||||
plugin.rm.updateDisplay(player);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user