Pyrbu / ZNPCsPlus

A Spigot plugin for creating interactable fake entities
https://www.spigotmc.org/resources/znpcsplus.109380/
GNU General Public License v3.0
110 stars 27 forks source link

[Folia] Dispatch Command error #54

Closed Aitooor closed 1 year ago

Aitooor commented 1 year ago

Branch: 2.0.0 Commit used: https://github.com/Pyrbu/ZNPCsPlus/commit/5ae5ca200d3a01d2d0261a0b3b975d19305230c8

Error lines: https://paste.md-5.net/awuvequqiv.bash

You need to use Global Region for dispatch commands in Folia Server#dispatchCommand

Example:

plugin.getServer().getGlobalRegionScheduler().run(plugin, scheduledTask ->
    plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command)
);
D3v1s0m commented 1 year ago

@Aitooor , is that the correct commit ?

Pyrbu commented 1 year ago

We are already doing that, console commands work perfectly fine the issue is with player commands. I have no clue which scheduler to use for those, any ideas?

Pyrbu commented 1 year ago

Never mind, found it.

Commands for entities/players are called on the region which owns the entity/player. Console commands are executed on the global region.

Aitooor commented 1 year ago

Sorry, I was out of my house.