mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Whitelist now working 100%.
This commit is contained in:
parent
d786e4e389
commit
779bf9152b
@ -70,7 +70,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
// on
|
// on
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Turning the whitelist on", false);
|
TFM_Util.adminAction(sender.getName(), "Turning the whitelist on.", true);
|
||||||
server.setWhitelist(true);
|
server.setWhitelist(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
// off
|
// off
|
||||||
if (args[0].equalsIgnoreCase("off"))
|
if (args[0].equalsIgnoreCase("off"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Turning the whitelist off", false);
|
TFM_Util.adminAction(sender.getName(), "Turning the whitelist off.", true);
|
||||||
server.setWhitelist(false);
|
server.setWhitelist(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -91,26 +91,19 @@ public class Command_whitelist extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String search_name = args[1].trim().toLowerCase();
|
||||||
|
|
||||||
OfflinePlayer p;
|
OfflinePlayer p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p = getPlayer(args[1]);
|
p = getPlayer(search_name);
|
||||||
}
|
}
|
||||||
catch (CantFindPlayerException ex)
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
if (!senderIsConsole)
|
p = server.getOfflinePlayer(search_name);
|
||||||
{
|
|
||||||
sender.sendMessage(ex.getMessage());
|
|
||||||
sender.sendMessage(ChatColor.YELLOW + "You don't have permissions to whitelist offline players");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p = server.getOfflinePlayer(args[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Adding " + p.getName() + " to the whitelist", false);
|
TFM_Util.adminAction(sender.getName(), "Adding " + p.getName() + " to the whitelist.", false);
|
||||||
p.setWhitelisted(true);
|
p.setWhitelisted(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -123,19 +116,21 @@ public class Command_whitelist extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String search_name = args[1].trim().toLowerCase();
|
||||||
|
|
||||||
OfflinePlayer p;
|
OfflinePlayer p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
p = getPlayer(args[1]);
|
p = getPlayer(search_name);
|
||||||
}
|
}
|
||||||
catch (CantFindPlayerException ex)
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
p = server.getOfflinePlayer(args[0]);
|
p = server.getOfflinePlayer(search_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.isWhitelisted())
|
if (p.isWhitelisted())
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing " + p.getName() + "from the whitelist", false);
|
TFM_Util.adminAction(sender.getName(), "Removing " + p.getName() + " from the whitelist.", false);
|
||||||
p.setWhitelisted(false);
|
p.setWhitelisted(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -150,7 +145,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
// addall
|
// addall
|
||||||
if (args[0].equalsIgnoreCase("addall"))
|
if (args[0].equalsIgnoreCase("addall"))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Adding all online players to the whitelist", false);
|
TFM_Util.adminAction(sender.getName(), "Adding all online players to the whitelist.", false);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
@ -176,7 +171,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
Set whitelisted = MinecraftServer.getServer().getServerConfigurationManager().getWhitelisted();
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist", true);
|
TFM_Util.adminAction(sender.getName(), "Removing all players from the whitelist.", false);
|
||||||
TFM_Util.playerMsg(sender, "Removed " + whitelisted.size() + " players from the whitelist.");
|
TFM_Util.playerMsg(sender, "Removed " + whitelisted.size() + " players from the whitelist.");
|
||||||
whitelisted.clear();
|
whitelisted.clear();
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
if (scm.hasWhitelist)
|
if (scm.hasWhitelist)
|
||||||
{
|
{
|
||||||
if (!scm.getWhitelisted().contains(player_name))
|
if (!scm.getWhitelisted().contains(player_name.toLowerCase()))
|
||||||
{
|
{
|
||||||
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.");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user