mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-30 13:27:37 +00:00
couldnt give it a better name
This commit is contained in:
parent
fb0bfb847f
commit
dffd9f8c3c
@ -112,7 +112,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
public Monitors mo;
|
||||
public MovementValidator mv;
|
||||
public EntityWiper ew;
|
||||
public FrontDoor fd;
|
||||
public ServerPing sp;
|
||||
public CurseListener cul;
|
||||
public ItemFun it;
|
||||
@ -229,7 +228,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
|
||||
mv = services.registerService(MovementValidator.class);
|
||||
ew = services.registerService(EntityWiper.class);
|
||||
fd = services.registerService(FrontDoor.class);
|
||||
sp = services.registerService(ServerPing.class);
|
||||
pv = services.registerService(PlayerVerification.class);
|
||||
|
||||
|
@ -36,6 +36,8 @@ public class AdminList extends FreedomService
|
||||
private final Set<Admin> activeAdmins = Sets.newHashSet();
|
||||
private final Map<String, Admin> nameTable = Maps.newHashMap();
|
||||
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
||||
public final List<String> verifiedNoAdmins = new ArrayList<>();
|
||||
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
||||
//
|
||||
private final YamlConfig config;
|
||||
|
||||
@ -255,7 +257,12 @@ public class AdminList extends FreedomService
|
||||
|
||||
public boolean isAdminImpostor(Player player)
|
||||
{
|
||||
return getEntryByName(player.getName()) != null && !isAdmin(player);
|
||||
return getEntryByName(player.getName()) != null && !isAdmin(player) && !isVerifiedAdmin(player);
|
||||
}
|
||||
|
||||
public boolean isVerifiedAdmin(Player player)
|
||||
{
|
||||
return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(Ips.getIp(player));
|
||||
}
|
||||
|
||||
public boolean isIdentityMatched(Player player)
|
||||
|
@ -285,6 +285,12 @@ public class Command_saconfig extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.al.isVerifiedAdmin(player))
|
||||
{
|
||||
plugin.al.verifiedNoAdmins.remove(player.getName());
|
||||
plugin.al.verifiedNoAdminIps.remove(player.getName());
|
||||
}
|
||||
|
||||
plugin.al.save();
|
||||
plugin.al.updateTables();
|
||||
if (player != null)
|
||||
|
@ -0,0 +1,78 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.Ips;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Warns a player.", usage = "/<command> <player>", aliases = "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))
|
||||
{
|
||||
if (!plugin.al.verifiedNoAdmins.contains(player.getName()))
|
||||
{
|
||||
plugin.al.verifiedNoAdmins.add(player.getName());
|
||||
}
|
||||
String ip = Ips.getIp(player);
|
||||
if (!plugin.al.verifiedNoAdminIps.containsKey(player.getName()))
|
||||
{
|
||||
List<String> ips = new ArrayList<>();
|
||||
ips.add(ip);
|
||||
plugin.al.verifiedNoAdminIps.put(player.getName(), ips);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> ips = plugin.al.verifiedNoAdminIps.get(player.getName());
|
||||
if (!ips.contains(ip))
|
||||
{
|
||||
ips.add(ip);
|
||||
plugin.al.verifiedNoAdmins.remove(player.getName());
|
||||
plugin.al.verifiedNoAdminIps.put(player.getName(), ips);
|
||||
|
||||
}
|
||||
}
|
||||
plugin.rm.updateDisplay(player);
|
||||
FUtil.adminAction(sender.getName(), "Verified " + player.getName() + ", but didn't give them admin permissions", true);
|
||||
player.setOp(true);
|
||||
player.sendMessage(YOU_ARE_OP);
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
if (fPlayer.getFreezeData().isFrozen())
|
||||
{
|
||||
fPlayer.getFreezeData().setFrozen(false);
|
||||
player.sendMessage(ChatColor.GRAY + "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;
|
||||
}
|
||||
}
|
@ -67,6 +67,11 @@ public class RankManager extends FreedomService
|
||||
return Title.EXECUTIVE;
|
||||
}
|
||||
|
||||
if (plugin.al.isVerifiedAdmin(player))
|
||||
{
|
||||
return Title.VERIFIED_ADMIN;
|
||||
}
|
||||
|
||||
// Master builders show up if they are not admins
|
||||
if (plugin.mbl.isMasterBuilder(player) && !plugin.al.isAdmin(player))
|
||||
{
|
||||
@ -170,6 +175,11 @@ public class RankManager extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
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.pv.isPlayerImpostor(player) || plugin.mbl.isMasterBuilderImpostor(player);
|
||||
if (isImpostor)
|
||||
|
@ -7,6 +7,7 @@ public enum Title implements Displayable
|
||||
{
|
||||
|
||||
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "MB"),
|
||||
VERIFIED_ADMIN("a", "Verified Admin", ChatColor.LIGHT_PURPLE, "VA"),
|
||||
EXECUTIVE("an", "Executive", ChatColor.RED, "Exec"),
|
||||
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"),
|
||||
OWNER("the", "Owner", ChatColor.DARK_RED, "Owner");
|
||||
|
Loading…
Reference in New Issue
Block a user