DiscordSRV

DiscordSRV

86.8k Downloads

plugin staffplusplus cancel achievement on staffmode but discordsrv still sending them

kingakis2 opened this issue ยท 3 comments

commented

Expected behavior

it should not send achievement at all when a player is on staffmode

Actual behavior

it sends the achievement anyways and spams it multiple times

Steps to reproduce

first, activate staffmode from staffplusplus and go somewhere like a trial chamber to get the achievement, you ain't going to get it on the game but, discordsrv will spam as if you get it multiple times whenever you got it configured to send it

Server software and version

Pufferfish version 1.21.1-19-8abd47b (MC: 1.21.1) (Implementing API version 1.21.1-R0.1-SNAPSHOT)

Checks

  • I am not using an outdated version of DiscordSRV.
  • I asked in DiscordSRV's Discord server to see whether this issue is in fact a bug that needs to be fixed.

Ticket number or message link to where you asked in DiscordSRV's Discord server about this

19480

Anything else

image
image
https://bin.scarsz.me/d2cdc655-77f3-44ab-9bbb-9ce97da362fc#nFofMexGiX6LMeMHwkQS07EK60dJazQp

commented

Staff++ changes the gamerule to "hide advancements", https://github.com/garagepoort/StaffPlusPlus/blob/f1358596e9f3837d82da87ced3e33aceedbd4e1c/src/main/java/net/shortninja/staffplus/core/domain/staff/mode/listeners/ModeAdvancementListener.java#L34-L44

Doesn't currently work as DiscordSRV checks the gamerule off thread,

SchedulerUtil.runTaskAsynchronously(DiscordSRV.getPlugin(), () -> runAsync(event));
}
private void runAsync(PlayerAdvancementDoneEvent event) {
Player player = event.getPlayer();
Advancement advancement = event.getAdvancement();
if (advancementIsHiddenInChat(advancement, player.getWorld())) return;

commented

Developer of staff++ here (who commited that piece of code).

Are we hiding the advancements wrong on our side, or is this an issue with DiscordSRV?

Also, is there going to be a change, or should we simply hook into the DiscordSRV api, and disable the send event?

commented

Are we hiding the advancements wrong on our side, or is this an issue with DiscordSRV?

It isn't necessarily wrong, but that code also has the side effect of forcing the announce advancement gamerule on (if it is disabled manually and somebody gets a advancement in staff mode).
This should probably be fixed on DiscordSRV's side, as Advancement API looks to be so lacking in Spigot that, that truly is the only way to generically flag to other plugins the message should not be posted

Also, is there going to be a change, or should we simply hook into the DiscordSRV api, and disable the send event?

Yes, I'm not sure when, though