Don't write spoofed UUIDs to cache

This commit is contained in:
Jerom van der Sar 2014-08-30 16:24:35 +02:00
parent d1b73592af
commit 8cae042857
5 changed files with 26 additions and 9 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Wed Aug 27 13:29:32 CEST 2014 #Sat Aug 30 16:14:15 CEST 2014
build.number=948 build.number=949

View File

@ -168,12 +168,12 @@ public class Command_saconfig extends TFM_Command
if (player.isOnline()) if (player.isOnline())
{ {
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData((Player) player); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player.getPlayer());
if (playerdata.isFrozen()) if (playerdata.isFrozen())
{ {
playerdata.setFrozen(false); playerdata.setFrozen(false);
playerMsg((Player) player, "You have been unfrozen."); playerMsg(player.getPlayer(), "You have been unfrozen.");
} }
} }

View File

@ -562,11 +562,16 @@ public class TFM_AdminList
final TFM_Admin superadmin = adminList.get(uuid); final TFM_Admin superadmin = adminList.get(uuid);
superadmin.setActivated(true); superadmin.setActivated(true);
if (player instanceof Player) if (player.isOnline())
{ {
superadmin.setLastLogin(new Date()); superadmin.setLastLogin(new Date());
if (ip != null)
{
superadmin.addIp(ip); superadmin.addIp(ip);
} }
}
saveAll(); saveAll();
updateIndexLists(); updateIndexLists();
return; return;
@ -579,6 +584,7 @@ public class TFM_AdminList
return; return;
} }
final TFM_Admin superadmin = new TFM_Admin( final TFM_Admin superadmin = new TFM_Admin(
uuid, uuid,
player.getName(), player.getName(),

View File

@ -151,7 +151,7 @@ public class TFM_Util
public static String getIp(OfflinePlayer player) public static String getIp(OfflinePlayer player)
{ {
if (player instanceof Player) if (player.isOnline())
{ {
return player.getPlayer().getAddress().getAddress().getHostAddress().trim(); return player.getPlayer().getAddress().getAddress().getHostAddress().trim();
} }

View File

@ -9,7 +9,6 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import me.StevenLawson.TotalFreedomMod.Config.TFM_Config; import me.StevenLawson.TotalFreedomMod.Config.TFM_Config;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
public class TFM_UuidManager public class TFM_UuidManager
{ {
@ -52,6 +51,11 @@ public class TFM_UuidManager
continue; continue;
} }
if (uuidString.startsWith("deadbeef"))
{
continue;
}
UUID_CACHE.put(playerName.toLowerCase(), UUID.fromString(uuidString)); UUID_CACHE.put(playerName.toLowerCase(), UUID.fromString(uuidString));
} }
@ -67,7 +71,14 @@ public class TFM_UuidManager
for (String playerName : UUID_CACHE.keySet()) for (String playerName : UUID_CACHE.keySet())
{ {
uuids.add(playerName + ":" + UUID_CACHE.get(playerName)); final UUID uuid = UUID_CACHE.get(playerName);
if (uuid.toString().startsWith("deadbeef"))
{
continue;
}
uuids.add(playerName + ":" + uuid);
} }
config.set("cache", uuids); config.set("cache", uuids);