Skip to content

Commit

Permalink
Checks player by reference in future logic
Browse files Browse the repository at this point in the history
  • Loading branch information
anjoismysign committed Aug 13, 2024
1 parent 5aec95c commit 7ed800f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void initAnimations(JavaPlugin plugin) {
private void initLogic(JavaPlugin plugin) {
logicTask = Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, () -> {
Player owner = findOwner();
if (owner == null || !owner.isOnline()) {
if (owner == null) {
destroy();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected void initLogic(JavaPlugin plugin) {
EntityAnimationsCarrier animationsCarrier = settings.animationsCarrier();
logicTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
Player owner = findOwner();
if (owner == null || !owner.isOnline()) {
if (owner == null) {
destroy();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void initLogic(JavaPlugin plugin) {
EntityAnimationsCarrier animationsCarrier = settings.animationsCarrier();
logicTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
Player owner = findOwner();
if (owner == null || !owner.isOnline()) {
if (owner == null) {
destroy();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ public static BlobChatListener smart(Player owner, long timeout, Consumer<String
messages.forEach(message -> timerMessages.add(
message.modify(s -> s.replace("%world%", owner.getWorld().getName()))
));
UUID uuid = owner.getUniqueId();
return new BlobChatListener(owner.getName(), timeout,
inputListener -> {
String input = inputListener.getInput();
chatManager.removeChatListener(owner);
Bukkit.getScheduler().runTask(main, () -> {
if (owner == null || !owner.isOnline()) {
if (owner != Bukkit.getPlayer(uuid))
return;
}
consumer.accept(input);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public static BlobDropListener smart(Player owner, Consumer<ItemStack> consumer,
DropListenerManager dropManager = main.getDropListenerManager();
Optional<BlobMessage> timerMessage = Optional.ofNullable(BlobLibMessageAPI.getInstance().getMessage(timerMessageKey, owner));
List<BlobMessage> messages = timerMessage.map(Collections::singletonList).orElse(Collections.emptyList());
UUID uuid = owner.getUniqueId();
return new BlobDropListener(owner.getName(), listener -> {
ItemStack input = listener.getInput();
dropManager.removeDropListener(owner);
Bukkit.getScheduler().runTask(main, () -> {
if (owner == null || !owner.isOnline()) {
if (owner != Bukkit.getPlayer(uuid))
return;
}
consumer.accept(input);
});
}, messages);
Expand Down

0 comments on commit 7ed800f

Please sign in to comment.