Add clean command
This commit is contained in:
@@ -159,8 +159,12 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
|
||||
// Removes orphaned foreign keys
|
||||
@Override
|
||||
public void clean()
|
||||
public int clean()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!FactionColl.get().isActive()) return ret;
|
||||
|
||||
for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
|
||||
{
|
||||
TerritoryAccess territoryAccess = entry.getValue();
|
||||
@@ -171,8 +175,12 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
PS ps = entry.getKey();
|
||||
this.removeAt(ps);
|
||||
|
||||
ret += 0;
|
||||
|
||||
Factions.get().log("Board cleaner removed "+factionId+" from "+ps);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// CHUNKS
|
||||
|
@@ -118,12 +118,16 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clean()
|
||||
public int clean()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for (Board board : this.getAll())
|
||||
{
|
||||
board.clean();
|
||||
ret += board.clean();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// CHUNKS
|
||||
|
@@ -21,7 +21,7 @@ public interface BoardInterface
|
||||
// REMOVE
|
||||
void removeAt(PS ps);
|
||||
void removeAll(Faction faction);
|
||||
void clean();
|
||||
int clean();
|
||||
|
||||
// CHUNKS
|
||||
Set<PS> getChunks(Faction faction);
|
||||
|
@@ -82,8 +82,12 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
||||
// EXTRAS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void clean()
|
||||
public int clean()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!FactionColl.get().isActive()) return ret;
|
||||
|
||||
// For each player ...
|
||||
for (MPlayer mplayer : this.getAll())
|
||||
{
|
||||
@@ -93,11 +97,14 @@ public class MPlayerColl extends SenderColl<MPlayer>
|
||||
|
||||
// ... reset their faction data ...
|
||||
mplayer.resetFactionData();
|
||||
ret += 1;
|
||||
|
||||
// ... and log.
|
||||
String message = Txt.parse("<i>Reset data for <h>%s <i>. Unknown factionId <h>%s", mplayer.getDisplayName(IdUtil.getConsole()), factionId);
|
||||
Factions.get().log(message);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void considerRemovePlayerMillis()
|
||||
|
Reference in New Issue
Block a user