From a01196f3457d15aa85d82898b2a5279f939313ed Mon Sep 17 00:00:00 2001 From: TechnicallyCoded Date: Mon, 9 Oct 2023 10:34:11 +0200 Subject: [PATCH] Cleanup TODO comments --- .../nossr50/commands/party/teleport/PtpAcceptCommand.java | 4 ++-- .../gmail/nossr50/commands/party/teleport/PtpCommand.java | 6 +++--- .../nossr50/runnables/player/PlayerProfileLoadingTask.java | 3 ++- src/main/java/com/gmail/nossr50/util/EventUtils.java | 5 ++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpAcceptCommand.java b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpAcceptCommand.java index 370318545..93b0b2f6b 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpAcceptCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpAcceptCommand.java @@ -49,7 +49,7 @@ public class PtpAcceptCommand implements CommandExecutor { } if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) { - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe World targetWorld = target.getWorld(); World playerWorld = player.getWorld(); @@ -65,7 +65,7 @@ public class PtpAcceptCommand implements CommandExecutor { } } - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe PtpCommand.handleTeleportWarmup(target, player); return true; } diff --git a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java index fea76961c..d108f970a 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java @@ -228,8 +228,8 @@ public class PtpCommand implements TabExecutor { return true; } - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) { + // TODO FOLIA - target is not on the same thread as sender/player - unsafe if(UserManager.getPlayer(targetPlayer) == null) { targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); @@ -251,11 +251,11 @@ public class PtpCommand implements TabExecutor { if (warmup > 0) { teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup)); - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(teleportingPlayer, new TeleportationWarmup(mcMMOPlayer, mcMMOTarget), 20 * warmup); } else { - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java index f34639e1e..be565c69a 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerProfileLoadingTask.java @@ -37,7 +37,8 @@ public class PlayerProfileLoadingTask extends CancellableRunnable { } // Quit if they logged out - if (!player.isOnline()) { // TODO TECH CHECK - is thread safe? We are running this async + // TODO FOLIA - player may not be accessed from the right thread - unsafe + if (!player.isOnline()) { LogUtils.debug(mcMMO.p.getLogger(), "Aborting profile loading recovery for " + player.getName() + " - player logged out"); return; } diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index 333335e45..f6a2bf441 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -354,14 +354,13 @@ public final class EventUtils { return !damageEvent.isCancelled() && !fakeBlockBreakEvent.isCancelled(); } - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) { McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer); if(mcMMOPlayer == null) return; - // TODO TECH CHECK - running operations on teleporting player and target player without the proper thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName()); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -369,7 +368,7 @@ public final class EventUtils { return; } - // TODO TECH CHECK - getting location of target from another thread + // TODO FOLIA - target is not on the same thread as sender/player - unsafe mcMMO.p.getFoliaLib().getImpl().teleportAsync(teleportingPlayer, targetPlayer.getLocation()); teleportingPlayer.sendMessage(LocaleLoader.getString("Party.Teleport.Player", targetPlayer.getName()));