fix: advancement messages being improperly canceled

feat/data-edit-commands
William 7 months ago
parent e9ab0909ce
commit a3b50a0bf5
No known key found for this signature in database

@ -29,7 +29,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.server.MapInitializeEvent;
import org.bukkit.event.world.WorldSaveEvent;
@ -103,10 +102,6 @@ public class BukkitEventListener extends EventListener implements BukkitJoinEven
super.saveOnPlayerDeath(user, BukkitData.Items.ItemArray.adapt(event.getDrops()));
}
// Handle advancement grant events (empty on Spigot due to missing message API)
protected void handleLockedAdvancementGrant(@NotNull @SuppressWarnings("unused") PlayerAdvancementDoneEvent event) {
}
@EventHandler(ignoreCancelled = true)
public void onWorldSave(@NotNull WorldSaveEvent event) {
if (!plugin.getSettings().getSynchronization().isSaveOnWorldSave()) {
@ -126,13 +121,6 @@ public class BukkitEventListener extends EventListener implements BukkitJoinEven
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerAdvancementDone(@NotNull PlayerAdvancementDoneEvent event) {
if (lockedHandler.cancelPlayerEvent(event.getPlayer().getUniqueId())) {
handleLockedAdvancementGrant(event);
}
}
// We handle commands here to allow specific command handling on ProtocolLib servers
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onCommandProcessed(@NotNull PlayerCommandPreprocessEvent event) {

@ -24,6 +24,8 @@ import net.william278.husksync.BukkitHuskSync;
import net.william278.husksync.data.BukkitData;
import net.william278.husksync.user.BukkitUser;
import net.william278.husksync.user.OnlineUser;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.bukkit.inventory.ItemStack;
@ -69,10 +71,11 @@ public class PaperEventListener extends BukkitEventListener {
super.saveOnPlayerDeath(user, BukkitData.Items.ItemArray.adapt(itemsToSave));
}
@Override
protected void handleLockedAdvancementGrant(@NotNull PlayerAdvancementDoneEvent event) {
// Disable advancement chat messages
event.message(null);
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerAdvancementDone(@NotNull PlayerAdvancementDoneEvent event) {
if (lockedHandler.cancelPlayerEvent(event.getPlayer().getUniqueId())) {
event.message(null);
}
}
@NotNull

Loading…
Cancel
Save