Document advancement listener versions

This commit is contained in:
Vankka 2023-11-15 23:35:32 +02:00
parent 273f3d9a19
commit b74f557359
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
2 changed files with 5 additions and 5 deletions

View File

@ -33,11 +33,11 @@ import java.util.Arrays;
/** /**
* Used for Spigot and Paper in versions before they added advancement apis. * Used for Spigot and Paper in versions before they added advancement apis.
*/ */
public class BukkitAdvancementListener extends AbstractBukkitAwardListener { public class BukkitLegacyAdvancementListener extends AbstractBukkitAwardListener {
private final NMS nms; private final NMS nms;
public BukkitAdvancementListener(DiscordSRV discordSRV, IBukkitAwardForwarder forwarder) { public BukkitLegacyAdvancementListener(DiscordSRV discordSRV, IBukkitAwardForwarder forwarder) {
super(discordSRV, forwarder); super(discordSRV, forwarder);
String version = Bukkit.getServer().getBukkitVersion().split("-", 2)[0]; String version = Bukkit.getServer().getBukkitVersion().split("-", 2)[0];

View File

@ -34,14 +34,14 @@ public class BukkitAwardForwarder implements IBukkitAwardForwarder {
if (exists("org.bukkit.event.player.PlayerAdvancementDoneEvent")) { if (exists("org.bukkit.event.player.PlayerAdvancementDoneEvent")) {
// Advancement // Advancement
if (exists("io.papermc.paper.advancement.AdvancementDisplay")) { if (exists("io.papermc.paper.advancement.AdvancementDisplay")) {
// Paper // Paper (Since 1.17.1)
return new PaperModernAdvancementListener(discordSRV, forwarder); return new PaperModernAdvancementListener(discordSRV, forwarder);
} else if (exists("org.bukkit.advancement.AdvancementDisplay")) { } else if (exists("org.bukkit.advancement.AdvancementDisplay")) {
// Spigot // Spigot (Since 1.19)
return new SpigotModernAdvancementListener(discordSRV, forwarder); return new SpigotModernAdvancementListener(discordSRV, forwarder);
} else { } else {
// Generic // Generic
return new BukkitAdvancementListener(discordSRV, forwarder); return new BukkitLegacyAdvancementListener(discordSRV, forwarder);
} }
} else { } else {
// Achievement // Achievement