1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Fixed a mistake introduced in one of the first versions of the 2.0

This commit is contained in:
Tim203
2021-01-15 23:10:51 +01:00
parent 9b0cbd5cdd
commit 4cf92c6551

View File

@@ -49,17 +49,17 @@ public class SimpleFloodgateApi implements FloodgateApi {
@Override
public FloodgatePlayer getPlayer(UUID uuid) {
FloodgatePlayer player = players.get(uuid);
FloodgatePlayer selfPlayer = players.get(uuid);
// bedrock players are always stored by their xuid,
// so we return the instance if we know that the given uuid is a Floodgate uuid
if (player != null || isFloodgateId(uuid)) {
return player;
if (selfPlayer != null || isFloodgateId(uuid)) {
return selfPlayer;
}
// make it possible to find player by Java id (linked players)
for (FloodgatePlayer player1 : players.values()) {
if (player1.getCorrectUniqueId().equals(uuid)) {
return player1;
for (FloodgatePlayer player : players.values()) {
if (player.getCorrectUniqueId().equals(uuid)) {
return player;
}
}
return null;
@@ -109,7 +109,7 @@ public class SimpleFloodgateApi implements FloodgateApi {
}
// removeLogin logic
if (!shouldRemove(selfPlayer, removeLogin)) {
if (!canRemove(selfPlayer, removeLogin)) {
return null;
}
@@ -121,17 +121,15 @@ public class SimpleFloodgateApi implements FloodgateApi {
// we still want to be able to remove a linked-player by his linked java uuid
for (FloodgatePlayer player : players.values()) {
if (shouldRemove(player, removeLogin) && player.getCorrectUniqueId().equals(onlineId)) {
continue;
if (canRemove(player, removeLogin) && player.getCorrectUniqueId().equals(onlineId)) {
players.remove(player.getJavaUniqueId());
return player;
}
players.remove(player.getJavaUniqueId());
return player;
}
return null;
}
protected boolean shouldRemove(FloodgatePlayer player, boolean removeLogin) {
protected boolean canRemove(FloodgatePlayer player, boolean removeLogin) {
FloodgatePlayerImpl impl = player.as(FloodgatePlayerImpl.class);
return impl.isLogin() && removeLogin || !impl.isLogin() && !removeLogin;
}