VelocityVanish icon indicating copy to clipboard operation
VelocityVanish copied to clipboard

Vanish task fails on adding potion effect on folia

Open YouHaveTrouble opened this issue 3 months ago • 1 comments

Server backend version

git-Folia-"3a91a4a" (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT) (Git: 3a91a4a)

Server backend Java version

Temurin 17

Server Velocity version

Velocity 3.3.0-SNAPSHOT (git-8891faa5-b370)

Server Velocity Java version

Temurin 17

VelocityVanish version

VelocityVanish v3.27.3-build.60-901daad

Describe the bug

Plugin uses wrong scheduler. It should use region scheduler for the region player is in afaik.

[14:02:13 ERROR]: Thread Region Scheduler Thread #0 failed main thread check: Cannot add effects to entities asynchronously
java.lang.Throwable: null
        at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:78) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1154) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1149) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1140) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R3.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:513) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at org.bukkit.craftbukkit.v1_20_R3.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:507) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at ir.syrent.velocityvanish.spigot.core.VanishManager.addPotionEffects$lambda$6(VanishManager.kt:124) ~[VelocityVanish_3.27.3-build.60-901daad.jar:?]
        at ir.syrent.velocityvanish.spigot.ruom.Ruom.runSync$lambda$1(Ruom.kt:112) ~[VelocityVanish_3.27.3-build.60-901daad.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask.run(FoliaGlobalRegionScheduler.java:179) ~[folia-1.20.4.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler.tick(FoliaGlobalRegionScheduler.java:37) ~[folia-1.20.4.jar:?]
        at io.papermc.paper.threadedregions.RegionizedServer.globalTick(RegionizedServer.java:293) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.tickRegion(RegionizedServer.java:148) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:404) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
[14:02:13 WARN]: [VelocityVanish] Global task for VelocityVanish v3.27.3-build.60-901daad generated an exception
java.lang.IllegalStateException: Cannot add effects to entities asynchronously
        at io.papermc.paper.util.TickThread.ensureTickThread(TickThread.java:79) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1154) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1149) ~[?:?]
        at net.minecraft.world.entity.LivingEntity.addEffect(LivingEntity.java:1140) ~[?:?]
        at org.bukkit.craftbukkit.v1_20_R3.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:513) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at org.bukkit.craftbukkit.v1_20_R3.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:507) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at ir.syrent.velocityvanish.spigot.core.VanishManager.addPotionEffects$lambda$6(VanishManager.kt:124) ~[VelocityVanish_3.27.3-build.60-901daad.jar:?]
        at ir.syrent.velocityvanish.spigot.ruom.Ruom.runSync$lambda$1(Ruom.kt:112) ~[VelocityVanish_3.27.3-build.60-901daad.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask.run(FoliaGlobalRegionScheduler.java:179) ~[folia-1.20.4.jar:?]
        at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler.tick(FoliaGlobalRegionScheduler.java:37) ~[folia-1.20.4.jar:?]
        at io.papermc.paper.threadedregions.RegionizedServer.globalTick(RegionizedServer.java:293) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at io.papermc.paper.threadedregions.RegionizedServer$GlobalTickTickHandle.tickRegion(RegionizedServer.java:148) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at io.papermc.paper.threadedregions.TickRegionScheduler$RegionScheduleHandle.runTick(TickRegionScheduler.java:404) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at ca.spottedleaf.concurrentutil.scheduler.SchedulerThreadPool$TickThreadRunner.run(SchedulerThreadPool.java:525) ~[folia-1.20.4.jar:git-Folia-"3a91a4a"]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]

Expected behavior

Plugin not throwing an exception due to usage of wrong scheduler

Steps to reproduce

Step 1: Setup folia server under velocity Step 2: Install plugin on both backend and proxy Step 3: Execute /v to vanish

LuckPerms webview link

No response

VelocityVanish's configuration file

# Full wiki is available at https://github.com/Syrent/VelocityVanish/wiki
config_version: 9
default_language: en_US
show_dependency_suggestions: true

# IMPORTANT: Legacy code support is strongly discouraged. It adversely affects performance and lacks new Minecraft chat features.
support_legacy_color_codes: false

# If you're the first player to join the server, Vanish data may not synchronize correctly,
# and you may not enter vanish mode. With this option enabled, you can still enter vanish mode
# if you have operator privileges or the "velocityvanish.action.vanish.force" permission.
# If you weren't previously in vanish mode, you'll be unvanished after a few seconds.
force_vanish_if_first: true

bstats: true
# Leave sounds blank to disable them
# Example: command: ""
sounds:
  command: ENTITY_EXPERIENCE_ORB_PICKUP
  vanish: ENTITY_EXPERIENCE_ORB_PICKUP
  unvanish: ENTITY_EXPERIENCE_ORB_PICKUP
vanish:
  # Show players an actionbar when they are vanished
  actionbar: true
  # Remember vanish data after switching servers?
  # Note: Requires Velocity as a proxy server
  remember: true
  # Should we change player type to spectator in tablist for players who have permission to see vanished players?
  # Note: Requires ProtocolLib in versions lower than 1.19
  see_as_spectator: true
  # Should vanished players be protected from all damage sources?
  invincible: true
  # You can also achieve this by setting the fake join/leave message to blank in the language file
  fake_join_leave_message: true
  silent_open_container: true
  # Might cause incompatibility with some plugins like TAB and eGlow
  disable_collision: false
  prevent:
    pickup: true
    block_break: false
    block_place: false
    interact: false
    # Only works on PaperMC servers (Paper, Purpur, Pufferfish, etc...)
    advancement: true
hooks:
  essentials:
    enabled: false
    force_prevent_private_messages: false
  sunlight:
    enabled: false
  placeholderapi:
    enabled: true
  protocollib:
    enabled: true
  squaremap:
    enabled: true
  discordsrv:
    enabled: true
  cmi:
    enabled: false

Plugins

VelocityVanish

Additional info

No response

Checklist

  • [X] I have read the wiki to make sure it's not an issue with configuration
  • [X] I am running the latest version of the plugin on both Velocity and Spigot
  • [X] I tried the plugin on a fresh server and it didn't work (Or it worked but I know exactly which plugin it's incompatible with)
  • [ ] I ticked all of the boxes without actually reading them

YouHaveTrouble avatar Apr 03 '24 14:04 YouHaveTrouble