mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
I think I have a better solution to #109
This commit is contained in:
parent
b702c1cec5
commit
12f023196a
@ -4,6 +4,9 @@ import java.util.regex.Pattern;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
||||||
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
|
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import me.totalfreedom.totalfreedommod.command.Command_vanish;
|
import me.totalfreedom.totalfreedommod.command.Command_vanish;
|
||||||
@ -183,10 +186,34 @@ public class LoginProcess 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);
|
||||||
|
|
||||||
for (Player p : Command_vanish.VANISHED)
|
for (Player p : Command_vanish.VANISHED)
|
||||||
{
|
{
|
||||||
player.hidePlayer(p);
|
if (!plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
player.hidePlayer(plugin, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
if (plugin.mbl.isMasterBuilder(player))
|
||||||
|
{
|
||||||
|
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(player);
|
||||||
|
if (masterBuilder.getTag() != null)
|
||||||
|
{
|
||||||
|
fPlayer.setTag(FUtil.colorize(masterBuilder.getTag()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
|
||||||
|
if (vPlayer.getEnabled() && vPlayer.getTag() != null)
|
||||||
|
{
|
||||||
|
fPlayer.setTag(FUtil.colorize(vPlayer.getTag()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag | setacformat <format> | clearacformat> | oldtags | logstick>")
|
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setacformat <format> | clearacformat> | oldtags | logstick>")
|
||||||
public class Command_myadmin extends FreedomCommand
|
public class Command_myadmin extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -162,21 +162,13 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
|
|
||||||
case "settag":
|
case "settag":
|
||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Setting personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
msg("Please use /tag set to set your tag.", ChatColor.RED);
|
||||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
|
||||||
target.setTag(tag);
|
|
||||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " default tag is now: " + FUtil.colorize(target.getTag()));
|
|
||||||
plugin.al.save();
|
|
||||||
plugin.al.updateTables();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "cleartag":
|
case "cleartag":
|
||||||
{
|
{
|
||||||
FUtil.adminAction(sender.getName(), "Clearing personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
msg("Please use /tag off to remove your tag.", ChatColor.RED);
|
||||||
target.setTag(null);
|
|
||||||
plugin.al.save();
|
|
||||||
plugin.al.updateTables();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "setacformat":
|
case "setacformat":
|
||||||
|
@ -2,16 +2,14 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import net.pravian.aero.util.Ips;
|
import net.pravian.aero.util.Ips;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Manage your verification", usage = "/<command> <<enable | disable | clearips | status> <discord | forum> | settag <tag> | cleartag>", aliases = "playerverification,pv")
|
@CommandParameters(description = "Manage your verification", usage = "/<command> <<enable | disable | clearips | status>", aliases = "playerverification,pv")
|
||||||
public class Command_playerverify extends FreedomCommand
|
public class Command_playerverify extends FreedomCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -51,96 +49,43 @@ public class Command_playerverify extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (args[0])
|
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
||||||
{
|
|
||||||
case "cleartag":
|
|
||||||
{
|
|
||||||
msg("Cleared personal default tag");
|
|
||||||
target.setTag(null);
|
|
||||||
plugin.pv.saveVerificationData(target);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length < 2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (args[0].toLowerCase())
|
switch (args[0].toLowerCase())
|
||||||
{
|
{
|
||||||
case "enable":
|
case "enable":
|
||||||
switch (args[1].toLowerCase())
|
if (!plugin.dc.enabled)
|
||||||
{
|
{
|
||||||
case "discord":
|
msg("The Discord verification system is currently disabled.", ChatColor.RED);
|
||||||
if (!plugin.dc.enabled)
|
return true;
|
||||||
{
|
|
||||||
msg("The Discord verification system is currently disabled.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
|
||||||
if (data.getDiscordEnabled())
|
|
||||||
{
|
|
||||||
msg("Discord verification is already enabled for you.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
data.setDiscordEnabled(true);
|
|
||||||
plugin.pv.saveVerificationData(data);
|
|
||||||
msg("Enabled Discord verification. Please type /linkdiscord to link a Discord account.", ChatColor.GREEN);
|
|
||||||
return true;
|
|
||||||
case "forum":
|
|
||||||
msg("TODO. This will be enabled in a later update. Please use Discord verification instead.");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
if (data.getEnabled())
|
||||||
|
{
|
||||||
|
msg("Discord verification is already enabled for you.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
data.setEnabled(true);
|
||||||
|
plugin.pv.saveVerificationData(data);
|
||||||
|
msg("Enabled Discord verification. Please type /linkdiscord to link a Discord account.", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
|
||||||
case "disable":
|
case "disable":
|
||||||
switch (args[1].toLowerCase())
|
if (!data.getEnabled())
|
||||||
{
|
{
|
||||||
case "discord":
|
msg("Discord verification is already disabled for you.", ChatColor.RED);
|
||||||
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
|
return true;
|
||||||
if (!data.getDiscordEnabled())
|
|
||||||
{
|
|
||||||
msg("Discord verification is already disabled for you.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
data.setDiscordEnabled(false);
|
|
||||||
plugin.pv.saveVerificationData(data);
|
|
||||||
msg("Disabled Discord verification.", ChatColor.GREEN);
|
|
||||||
return true;
|
|
||||||
case "forum":
|
|
||||||
msg("TODO. Forum verification will be enabled in a later update.");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
data.setEnabled(false);
|
||||||
|
plugin.pv.saveVerificationData(data);
|
||||||
|
msg("Disabled Discord verification.", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
|
||||||
case "status":
|
case "status":
|
||||||
switch (args[1].toLowerCase())
|
boolean enabled = target.getEnabled();
|
||||||
{
|
boolean specified = target.getDiscordId() != null;
|
||||||
case "discord":
|
msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false"));
|
||||||
boolean enabled = target.getDiscordEnabled();
|
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordId() : ChatColor.RED + "not set"));
|
||||||
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"));
|
|
||||||
return true;
|
|
||||||
case "forum":
|
|
||||||
msg("TODO. Forum verification will be enabled in a later update.");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "settag":
|
|
||||||
{
|
|
||||||
String tag = StringUtils.join(args, " ", 1, args.length);
|
|
||||||
target.setTag(tag);
|
|
||||||
msg("Your default tag is now: " + FUtil.colorize(target.getTag()));
|
|
||||||
plugin.pv.saveVerificationData(target);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@ package me.totalfreedom.totalfreedommod.command;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
|
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
|
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -16,10 +20,8 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_tag extends FreedomCommand
|
public class Command_tag extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[]
|
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(
|
||||||
{
|
"admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "tca", "sta", "sa");
|
||||||
"admin", "owner", "moderator", "developer", "console", "SRA", "TCA", "SA"
|
|
||||||
});
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
@ -75,6 +77,7 @@ public class Command_tag extends FreedomCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugin.pl.getPlayer(playerSender).setTag(null);
|
plugin.pl.getPlayer(playerSender).setTag(null);
|
||||||
|
save(playerSender, null);
|
||||||
msg("Your tag has been removed.");
|
msg("Your tag has been removed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +107,7 @@ public class Command_tag extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.pl.getPlayer(player).setTag(null);
|
plugin.pl.getPlayer(player).setTag(null);
|
||||||
|
save(player, null);
|
||||||
msg("Removed " + player.getName() + "'s tag.");
|
msg("Removed " + player.getName() + "'s tag.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -111,7 +115,7 @@ public class Command_tag extends FreedomCommand
|
|||||||
else if ("set".equalsIgnoreCase(args[0]))
|
else if ("set".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
final String inputTag = StringUtils.join(args, " ", 1, args.length);
|
final String inputTag = StringUtils.join(args, " ", 1, args.length);
|
||||||
final String outputTag = FUtil.colorize(StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"" + ChatColor.COLOR_CHAR, "&k"
|
"" + ChatColor.COLOR_CHAR, "&k"
|
||||||
@ -119,7 +123,8 @@ public class Command_tag extends FreedomCommand
|
|||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"", ""
|
"", ""
|
||||||
})) + ChatColor.RESET;
|
});
|
||||||
|
final String outputTag = FUtil.colorize(strippedTag);
|
||||||
|
|
||||||
if (!plugin.al.isAdmin(sender))
|
if (!plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
@ -142,7 +147,8 @@ public class Command_tag extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.pl.getPlayer(playerSender).setTag(outputTag);
|
plugin.pl.getPlayer(playerSender).setTag(outputTag);
|
||||||
msg("Tag set to '" + outputTag + "'.");
|
save(playerSender, strippedTag);
|
||||||
|
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -156,4 +162,28 @@ public class Command_tag extends FreedomCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void save(Player player, String tag)
|
||||||
|
{
|
||||||
|
if (plugin.al.isAdmin(playerSender))
|
||||||
|
{
|
||||||
|
Admin admin = plugin.al.getAdmin(player);
|
||||||
|
admin.setTag(tag);
|
||||||
|
plugin.al.save();
|
||||||
|
plugin.al.updateTables();
|
||||||
|
}
|
||||||
|
else if (plugin.mbl.isMasterBuilder(playerSender))
|
||||||
|
{
|
||||||
|
MasterBuilder masterBuilder = plugin.mbl.getMasterBuilder(player);
|
||||||
|
masterBuilder.setTag(tag);
|
||||||
|
plugin.mbl.save();
|
||||||
|
plugin.mbl.updateTables();
|
||||||
|
}
|
||||||
|
else if (plugin.pv.getVerificationPlayer(player).getEnabled())
|
||||||
|
{
|
||||||
|
VPlayer vPlayer = plugin.pv.getVerificationPlayer(player);
|
||||||
|
vPlayer.setTag(tag);
|
||||||
|
plugin.pv.saveVerificationData(vPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class Command_unlinkdiscord extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
data.setDiscordId(null);
|
data.setDiscordId(null);
|
||||||
data.setDiscordEnabled(false);
|
data.setEnabled(false);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class Command_vanish extends FreedomCommand
|
|||||||
FLog.info(playerSender.getName() + " is no longer vanished.");
|
FLog.info(playerSender.getName() + " is no longer vanished.");
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player.showPlayer(playerSender);
|
player.showPlayer(plugin, playerSender);
|
||||||
}
|
}
|
||||||
plugin.esb.setVanished(playerSender.getName(), false);
|
plugin.esb.setVanished(playerSender.getName(), false);
|
||||||
playerSender.removePotionEffect(PotionEffectType.INVISIBILITY);
|
playerSender.removePotionEffect(PotionEffectType.INVISIBILITY);
|
||||||
@ -74,7 +74,10 @@ public class Command_vanish extends FreedomCommand
|
|||||||
FLog.info(playerSender.getName() + " is now vanished.");
|
FLog.info(playerSender.getName() + " is now vanished.");
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player.hidePlayer(playerSender);
|
if (!plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
player.hidePlayer(plugin, playerSender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
plugin.esb.setVanished(playerSender.getName(), true);
|
plugin.esb.setVanished(playerSender.getName(), true);
|
||||||
playerSender.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000, 1, false, true));
|
playerSender.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 1000000, 1, false, true));
|
||||||
|
@ -31,6 +31,9 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private String discordID = null;
|
private String discordID = null;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String tag = null;
|
||||||
|
|
||||||
public static final String CONFIG_FILENAME = "masterbuilders.yml";
|
public static final String CONFIG_FILENAME = "masterbuilders.yml";
|
||||||
|
|
||||||
@ -53,8 +56,9 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
|
|
||||||
output.append("MasterBuilder: ").append(name).append("\n")
|
output.append("MasterBuilder: ").append(name).append("\n")
|
||||||
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
|
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
|
||||||
.append("- Last Login: ").append(FUtil.dateToString(lastLogin)).append("\n");
|
.append("- Last Login: ").append(FUtil.dateToString(lastLogin)).append("\n")
|
||||||
//.append("- Discord ID: ").append(discordID).append("\n"); (Reserved for future usage)
|
.append("- Discord ID: ").append(discordID).append("\n")
|
||||||
|
.append("- Tag: ").append(tag).append("\n");
|
||||||
|
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
@ -75,6 +79,7 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
ips.addAll(cs.getStringList("ips"));
|
ips.addAll(cs.getStringList("ips"));
|
||||||
lastLogin = FUtil.stringToDate(cs.getString("last_login"));
|
lastLogin = FUtil.stringToDate(cs.getString("last_login"));
|
||||||
discordID = cs.getString("discord_id", null);
|
discordID = cs.getString("discord_id", null);
|
||||||
|
tag = cs.getString("tag", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,6 +90,7 @@ public class MasterBuilder implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
cs.set("ips", Lists.newArrayList(ips));
|
cs.set("ips", Lists.newArrayList(ips));
|
||||||
cs.set("last_login", FUtil.dateToString(lastLogin));
|
cs.set("last_login", FUtil.dateToString(lastLogin));
|
||||||
cs.set("discord_id", discordID);
|
cs.set("discord_id", discordID);
|
||||||
|
cs.set("tag", tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addIp(String ip)
|
public void addIp(String ip)
|
||||||
|
@ -14,6 +14,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PlayerVerification extends FreedomService
|
public class PlayerVerification extends FreedomService
|
||||||
@ -47,7 +48,7 @@ public class PlayerVerification extends FreedomService
|
|||||||
{
|
{
|
||||||
VPlayer vPlayer = getVerificationPlayer(player);
|
VPlayer vPlayer = getVerificationPlayer(player);
|
||||||
return !plugin.al.isAdmin(player)
|
return !plugin.al.isAdmin(player)
|
||||||
&& (vPlayer.getForumEnabled() || vPlayer.getDiscordEnabled())
|
&& (vPlayer.getEnabled())
|
||||||
&& !vPlayer.getIps().contains(Ips.getIp(player));
|
&& !vPlayer.getIps().contains(Ips.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,6 +177,23 @@ public class PlayerVerification extends FreedomService
|
|||||||
{
|
{
|
||||||
final YamlConfig config = new YamlConfig(plugin, getConfigFile(player.getName().toLowerCase()), false);
|
final YamlConfig config = new YamlConfig(plugin, getConfigFile(player.getName().toLowerCase()), false);
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
|
// Convert discordEnabled to enabled, and remove forumEnabled.
|
||||||
|
if (config.get("discordEnabled") != null)
|
||||||
|
{
|
||||||
|
config.set("enabled", config.getBoolean("discordEnabled"));
|
||||||
|
config.set("discordEnabled", null);
|
||||||
|
config.set("forumEnabled", null);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
config.save(getConfigFile(player.getName().toLowerCase()));
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FLog.warning("Failed to convert Player Verification entry for " + player.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
private String forumUsername = null;
|
private String forumUsername = null;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private Boolean discordEnabled = false;
|
private Boolean enabled = false;
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private Boolean forumEnabled = false;
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private String tag = null;
|
private String tag = null;
|
||||||
@ -53,9 +50,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
ips.clear();
|
ips.clear();
|
||||||
ips.addAll(cs.getStringList("ips"));
|
ips.addAll(cs.getStringList("ips"));
|
||||||
discordId = cs.getString("discordId", null);
|
discordId = cs.getString("discordId", null);
|
||||||
forumUsername = cs.getString("forumUsername", null);
|
enabled = cs.getBoolean("enabled", false);
|
||||||
discordEnabled = cs.getBoolean("discordEnabled", false);
|
|
||||||
forumEnabled = cs.getBoolean("forumEnabled", false);
|
|
||||||
tag = cs.getString("tag", null);
|
tag = cs.getString("tag", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +60,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
Validate.isTrue(isValid(), "Could not save player verification entry: " + name + ". Entry not valid!");
|
Validate.isTrue(isValid(), "Could not save player verification entry: " + name + ". Entry not valid!");
|
||||||
cs.set("name", name);
|
cs.set("name", name);
|
||||||
cs.set("discordId", discordId);
|
cs.set("discordId", discordId);
|
||||||
cs.set("forumUsername", forumUsername);
|
cs.set("enabled", enabled);
|
||||||
cs.set("discordEnabled", discordEnabled);
|
|
||||||
cs.set("forumEnabled", forumEnabled);
|
|
||||||
cs.set("tag", tag);
|
cs.set("tag", tag);
|
||||||
cs.set("ips", Lists.newArrayList(ips));
|
cs.set("ips", Lists.newArrayList(ips));
|
||||||
}
|
}
|
||||||
@ -79,7 +72,7 @@ public class VPlayer implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
|
|
||||||
public boolean addIp(String ip)
|
public boolean addIp(String ip)
|
||||||
{
|
{
|
||||||
return ips.contains(ip) ? false : ips.add(ip);
|
return !ips.contains(ip) && ips.add(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeIp(String ip)
|
public boolean removeIp(String ip)
|
||||||
|
@ -233,7 +233,7 @@ public class RankManager extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.pv.isPlayerImpostor(player) && target.getDiscordEnabled())
|
if (!plugin.pv.isPlayerImpostor(player) && target.getEnabled())
|
||||||
{
|
{
|
||||||
if (target.getTag() != null)
|
if (target.getTag() != null)
|
||||||
{
|
{
|
||||||
|
@ -142,9 +142,8 @@ blocked_commands:
|
|||||||
- 'n:b:/function:_'
|
- 'n:b:/function:_'
|
||||||
- 'n:b:/data:_'
|
- 'n:b:/data:_'
|
||||||
- 'n:b:/datapack:_'
|
- 'n:b:/datapack:_'
|
||||||
- 'n:b:/tag:_'
|
|
||||||
|
|
||||||
# Superadmin commands
|
# Admin commands
|
||||||
- 's:b:/save-all:_'
|
- 's:b:/save-all:_'
|
||||||
- 's:b:/kick:_'
|
- 's:b:/kick:_'
|
||||||
- 's:b:/socialspy:_'
|
- 's:b:/socialspy:_'
|
||||||
@ -184,10 +183,6 @@ blocked_commands:
|
|||||||
- 's:b:/team:_'
|
- 's:b:/team:_'
|
||||||
- 'n:b:/bossbar:_'
|
- 'n:b:/bossbar:_'
|
||||||
|
|
||||||
# Superadmin commands - Auto-eject
|
|
||||||
- 's:a:/stop:_'
|
|
||||||
- 's:a:/restart:_'
|
|
||||||
|
|
||||||
# Automatically wipe dropped objects
|
# Automatically wipe dropped objects
|
||||||
auto_wipe: true
|
auto_wipe: true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user