2024-12-11 22:26:55 +01:00
|
|
|
--- a/net/minecraft/server/PlayerAdvancements.java
|
|
|
|
+++ b/net/minecraft/server/PlayerAdvancements.java
|
2017-06-09 08:29:31 +02:00
|
|
|
@@ -162,6 +162,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
public void save() {
|
|
|
|
+ if (org.spigotmc.SpigotConfig.disableAdvancementSaving) return; // Spigot
|
|
|
|
JsonElement jsonelement = (JsonElement) this.codec.encodeStart(JsonOps.INSTANCE, this.asData()).getOrThrow();
|
|
|
|
|
|
|
|
try {
|
|
|
|
@@ -196,6 +197,7 @@
|
2024-12-11 22:26:55 +01:00
|
|
|
AdvancementHolder advancementholder = loader.get(minecraftkey);
|
|
|
|
|
|
|
|
if (advancementholder == null) {
|
|
|
|
+ if (!minecraftkey.getNamespace().equals("minecraft")) return; // CraftBukkit
|
|
|
|
PlayerAdvancements.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
|
|
|
|
} else {
|
|
|
|
this.startProgress(advancementholder, advancementprogress);
|
2018-01-19 15:15:29 +01:00
|
|
|
@@ -223,10 +225,17 @@
|
|
|
|
boolean flag1 = advancementprogress.isDone();
|
|
|
|
|
|
|
|
if (advancementprogress.grantProgress(criterionName)) {
|
|
|
|
+ // Paper start - Add PlayerAdvancementCriterionGrantEvent
|
|
|
|
+ if (!new com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent(this.player.getBukkitEntity(), advancement.toBukkit(), criterionName).callEvent()) {
|
|
|
|
+ advancementprogress.revokeProgress(criterionName);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ // Paper end - Add PlayerAdvancementCriterionGrantEvent
|
|
|
|
this.unregisterListeners(advancement);
|
2024-12-11 22:26:55 +01:00
|
|
|
this.progressChanged.add(advancement);
|
|
|
|
flag = true;
|
|
|
|
if (!flag1 && advancementprogress.isDone()) {
|
|
|
|
+ this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit())); // CraftBukkit
|
|
|
|
advancement.value().rewards().grant(this.player);
|
|
|
|
advancement.value().display().ifPresent((advancementdisplay) -> {
|
|
|
|
if (advancementdisplay.shouldAnnounceChat() && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|