From 324455cdde6e14021a71b5c5e1ffc6f8693f6978 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 7 Jan 2012 15:56:17 -0600 Subject: [PATCH 1/2] fix for potential infinite loop when cleaning data As reported: at com.massivecraft.factions.Factions.get(Factions.java:99) at com.massivecraft.factions.FPlayer.getFaction(FPlayer.java:43) at com.massivecraft.factions.integration.SpoutFeatures.updateSingle(SpoutFeatures.java:218) at com.massivecraft.factions.integration.SpoutFeatures.updateAppearances(SpoutFeatures.java:154) at com.massivecraft.factions.FPlayer.resetFactionData(FPlayer.java:188) at com.massivecraft.factions.FPlayer.resetFactionData(FPlayer.java:194) at com.massivecraft.factions.FPlayers.clean(FPlayers.java:45) --- src/com/massivecraft/factions/FPlayers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/FPlayers.java b/src/com/massivecraft/factions/FPlayers.java index d2148861..9da3aaeb 100644 --- a/src/com/massivecraft/factions/FPlayers.java +++ b/src/com/massivecraft/factions/FPlayers.java @@ -43,7 +43,7 @@ public class FPlayers extends PlayerEntityCollection if ( ! Factions.i.exists(fplayer.getFactionId())) { p.log("Reset faction data (invalid faction) for player "+fplayer.getName()); - fplayer.resetFactionData(); + fplayer.resetFactionData(false); } } } From 65f16b74bd91511b9a49af0080090cfc651f2b00 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 9 Jan 2012 21:37:16 -0600 Subject: [PATCH 2/2] Players auto-removed due to inactivity or due to being banned now have their data deleted immediately; this should fix the log spam of the same players repeatedly being marked for deletion --- src/com/massivecraft/factions/FPlayers.java | 7 +++---- .../factions/listeners/FactionsPlayerListener.java | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayers.java b/src/com/massivecraft/factions/FPlayers.java index eb0f8db8..08952141 100644 --- a/src/com/massivecraft/factions/FPlayers.java +++ b/src/com/massivecraft/factions/FPlayers.java @@ -62,16 +62,15 @@ public class FPlayers extends PlayerEntityCollection { if (now - fplayer.getLastLoginTime() > toleranceMillis) { - // TODO: This stops the memory leak crashes but does not solve the issue: MEMBERS ARE NOT KICKED!!! - // TODO: DO SOMETHING ABOUT THIS - /*if (Conf.logFactionLeave || Conf.logFactionKick) - P.p.log("Player "+fplayer.getName()+" was auto-removed due to inactivity.");*/ + if (Conf.logFactionLeave || Conf.logFactionKick) + P.p.log("Player "+fplayer.getName()+" was auto-removed due to inactivity."); // if player is faction leader, sort out the faction since he's going away if (fplayer.getRole() == Rel.LEADER) fplayer.getFaction().promoteNewLeader(); fplayer.leave(false); + fplayer.detach(); } } } diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index ebd1dcc1..0c223a43 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -420,6 +420,7 @@ public class FactionsPlayerListener extends PlayerListener if (badGuy.getRole() == Rel.LEADER) badGuy.getFaction().promoteNewLeader(); badGuy.leave(false); + badGuy.detach(); } } }