mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
[Bleeding] Prepared TFM_UserList for UUID switchover
This commit is contained in:
parent
a3a484dc58
commit
d087dc1148
@ -30,7 +30,7 @@ public class Command_findip extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance(TotalFreedomMod.plugin).getEntry(player).getIpAddresses(), ", "));
|
||||
playerMsg("Player IPs: " + StringUtils.join(TFM_UserList.getInstance().getEntry(player).getIpAddresses(), ", "));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class Command_glist extends TFM_Command
|
||||
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
|
||||
if (TFM_SuperadminList.isSeniorAdmin(sender))
|
||||
{
|
||||
TFM_UserList.getInstance(plugin).purge();
|
||||
TFM_UserList.getInstance().purge();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -58,7 +58,7 @@ public class Command_glist extends TFM_Command
|
||||
}
|
||||
catch (PlayerNotFoundException ex)
|
||||
{
|
||||
TFM_UserListEntry entry = TFM_UserList.getInstance(plugin).getEntry(args[1]);
|
||||
TFM_UserListEntry entry = TFM_UserList.getInstance().getEntry(args[1]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ public class Command_rollback extends TFM_Command
|
||||
|
||||
if (playerName == null)
|
||||
{
|
||||
playerName = TFM_UserList.getInstance(plugin).searchByPartialName(playerNameInput);
|
||||
playerName = TFM_UserList.getInstance().searchByPartialName(playerNameInput);
|
||||
}
|
||||
|
||||
return playerName;
|
||||
|
@ -692,10 +692,9 @@ public class TFM_PlayerListener implements Listener
|
||||
playerdata.setSuperadminIdVerified(null);
|
||||
final String IP = player.getAddress().getAddress().getHostAddress().trim();
|
||||
|
||||
// Log join message, as 1.7 doesn't log it anymore
|
||||
TFM_Log.info("[JOIN] " + player.getName() + " joined the game with IP address: " + IP, true);
|
||||
TFM_Log.info("[JOIN] " + player.getName() + " (" + player.getUniqueId() + ") joined the game with IP address: " + IP, true);
|
||||
|
||||
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(player);
|
||||
TFM_UserList.getInstance().addUser(player);
|
||||
|
||||
final boolean impostor = TFM_SuperadminList.isSuperadminImpostor(player);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.StevenLawson.TotalFreedomMod;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
@ -71,7 +72,7 @@ public class TFM_Superadmin
|
||||
|
||||
public List<String> getIps()
|
||||
{
|
||||
return ips;
|
||||
return Collections.unmodifiableList(ips);
|
||||
}
|
||||
|
||||
public Date getLastLogin()
|
||||
|
@ -3,6 +3,7 @@ package me.StevenLawson.TotalFreedomMod;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -35,22 +36,22 @@ public class TFM_SuperadminList
|
||||
|
||||
public static List<String> getSuperadminIPs()
|
||||
{
|
||||
return superadminIPs;
|
||||
return Collections.unmodifiableList(superadminIPs);
|
||||
}
|
||||
|
||||
public static List<String> getSuperadminNames()
|
||||
{
|
||||
return superadminNames;
|
||||
return Collections.unmodifiableList(superadminNames);
|
||||
}
|
||||
|
||||
public static List<String> getTelnetadminNames()
|
||||
{
|
||||
return telnetadminNames;
|
||||
return Collections.unmodifiableList(telnetadminNames);
|
||||
}
|
||||
|
||||
public static List<String> getSenioradminNames()
|
||||
{
|
||||
return senioradminNames;
|
||||
return Collections.unmodifiableList(senioradminNames);
|
||||
}
|
||||
|
||||
public static void loadSuperadminList()
|
||||
|
@ -8,31 +8,28 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TFM_UserList
|
||||
{
|
||||
private static final TFM_UserList INSTANCE = new TFM_UserList();
|
||||
private static final String USERLIST_FILENAME = "userlist.yml";
|
||||
private static TFM_UserList instance = null;
|
||||
private Map<String, TFM_UserListEntry> userlist = new HashMap<String, TFM_UserListEntry>();
|
||||
private final TotalFreedomMod plugin;
|
||||
|
||||
protected TFM_UserList(TotalFreedomMod plugin)
|
||||
private TFM_UserList()
|
||||
{
|
||||
this.plugin = plugin;
|
||||
|
||||
primeList();
|
||||
}
|
||||
|
||||
private void primeList()
|
||||
protected void primeList()
|
||||
{
|
||||
try
|
||||
{
|
||||
userlist.clear();
|
||||
|
||||
FileConfiguration savedUserlist = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), USERLIST_FILENAME));
|
||||
FileConfiguration savedUserlist = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), USERLIST_FILENAME));
|
||||
|
||||
for (String username : savedUserlist.getKeys(false))
|
||||
{
|
||||
@ -40,7 +37,7 @@ public class TFM_UserList
|
||||
userlist.put(username, entry);
|
||||
}
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers())
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
addUser(player);
|
||||
}
|
||||
@ -56,7 +53,7 @@ public class TFM_UserList
|
||||
|
||||
private void exportList()
|
||||
{
|
||||
FileConfiguration newUserlist = new YamlConfiguration();
|
||||
final FileConfiguration newUserlist = new YamlConfiguration();
|
||||
|
||||
for (TFM_UserListEntry entry : userlist.values())
|
||||
{
|
||||
@ -65,7 +62,7 @@ public class TFM_UserList
|
||||
|
||||
try
|
||||
{
|
||||
newUserlist.save(new File(plugin.getDataFolder(), USERLIST_FILENAME));
|
||||
newUserlist.save(new File(TotalFreedomMod.plugin.getDataFolder(), USERLIST_FILENAME));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@ -73,13 +70,9 @@ public class TFM_UserList
|
||||
}
|
||||
}
|
||||
|
||||
public static TFM_UserList getInstance(TotalFreedomMod plugin)
|
||||
public static TFM_UserList getInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new TFM_UserList(plugin);
|
||||
}
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void addUser(Player player)
|
||||
@ -119,7 +112,7 @@ public class TFM_UserList
|
||||
{
|
||||
userlist.clear();
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers())
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
addUser(player);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
loadSuperadminConfig();
|
||||
loadPermbanConfig();
|
||||
|
||||
TFM_UserList.getInstance(plugin);
|
||||
TFM_UserList.getInstance().primeList();
|
||||
|
||||
registerEventHandlers();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user