Skip to content

Commit

Permalink
Added more debug messages to replacing players (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Dec 23, 2022
1 parent abff691 commit b56a787
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -1425,7 +1425,7 @@ public void replacePlayers(SuperiorPlayer originalPlayer, SuperiorPlayer newPlay
Preconditions.checkNotNull(originalPlayer, "originalPlayer parameter cannot be null.");
Preconditions.checkNotNull(newPlayer, "newPlayer parameter cannot be null.");

Log.debug(Debug.REPLACE_PLAYER, owner.getName(), originalPlayer.getName(), newPlayer.getName());
Log.debug(Debug.REPLACE_PLAYER, owner, originalPlayer, newPlayer);

if (owner.equals(originalPlayer)) {
Log.debugResult(Debug.REPLACE_PLAYER, "Action", "Replace Owner");
Expand Down
Expand Up @@ -136,14 +136,17 @@ public List<SuperiorPlayer> matchAllPlayers(Predicate<? super SuperiorPlayer> pr
}

public void replacePlayers(SuperiorPlayer originPlayer, SuperiorPlayer newPlayer) {
Log.debug(Debug.REPLACE_PLAYER, originPlayer.getName(), newPlayer.getName());
Log.debug(Debug.REPLACE_PLAYER, originPlayer, newPlayer);

newPlayer.merge(originPlayer);

// We first want to replace the player for his own island
Island playerIsland = originPlayer.getIsland();
if (playerIsland != null)
if (playerIsland != null) {
playerIsland.replacePlayers(originPlayer, newPlayer);
if (playerIsland.getOwner() != newPlayer)
Log.debugResult(Debug.REPLACE_PLAYER, "Owner was not replaced", "Curr owner: " + playerIsland.getOwner().getUniqueId());
}

for (Island island : plugin.getGrid().getIslands()) {
if (island != playerIsland)
Expand Down

0 comments on commit b56a787

Please sign in to comment.