From 8cae0428573ce15ef33783593f8ee0c539f27935 Mon Sep 17 00:00:00 2001 From: Jerom van der Sar Date: Sat, 30 Aug 2014 16:24:35 +0200 Subject: [PATCH] Don't write spoofed UUIDs to cache --- buildnumber.properties | 4 ++-- .../Commands/Command_saconfig.java | 4 ++-- .../TotalFreedomMod/TFM_AdminList.java | 10 ++++++++-- src/me/StevenLawson/TotalFreedomMod/TFM_Util.java | 2 +- .../TotalFreedomMod/TFM_UuidManager.java | 15 +++++++++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/buildnumber.properties b/buildnumber.properties index 0b3c695..ff32cd2 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed Aug 27 13:29:32 CEST 2014 -build.number=948 +#Sat Aug 30 16:14:15 CEST 2014 +build.number=949 diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java index 429baea..95fe139 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_saconfig.java @@ -168,12 +168,12 @@ public class Command_saconfig extends TFM_Command if (player.isOnline()) { - final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData((Player) player); + final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player.getPlayer()); if (playerdata.isFrozen()) { playerdata.setFrozen(false); - playerMsg((Player) player, "You have been unfrozen."); + playerMsg(player.getPlayer(), "You have been unfrozen."); } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java index 3fc0abf..5b82444 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java @@ -562,11 +562,16 @@ public class TFM_AdminList final TFM_Admin superadmin = adminList.get(uuid); superadmin.setActivated(true); - if (player instanceof Player) + if (player.isOnline()) { superadmin.setLastLogin(new Date()); - superadmin.addIp(ip); + + if (ip != null) + { + superadmin.addIp(ip); + } } + saveAll(); updateIndexLists(); return; @@ -579,6 +584,7 @@ public class TFM_AdminList return; } + final TFM_Admin superadmin = new TFM_Admin( uuid, player.getName(), diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index cae0a2a..451e937 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -151,7 +151,7 @@ public class TFM_Util public static String getIp(OfflinePlayer player) { - if (player instanceof Player) + if (player.isOnline()) { return player.getPlayer().getAddress().getAddress().getHostAddress().trim(); } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_UuidManager.java b/src/me/StevenLawson/TotalFreedomMod/TFM_UuidManager.java index 5f1435c..1d66586 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_UuidManager.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_UuidManager.java @@ -9,7 +9,6 @@ import java.util.Map; import java.util.UUID; import me.StevenLawson.TotalFreedomMod.Config.TFM_Config; import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; public class TFM_UuidManager { @@ -52,6 +51,11 @@ public class TFM_UuidManager continue; } + if (uuidString.startsWith("deadbeef")) + { + continue; + } + UUID_CACHE.put(playerName.toLowerCase(), UUID.fromString(uuidString)); } @@ -67,7 +71,14 @@ public class TFM_UuidManager 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);