2020-05-02 00:03:47 +02:00
|
|
|
From 34cad9effb5ade48de65055b9afa0eb5aae8848c Mon Sep 17 00:00:00 2001
|
2018-01-21 19:23:34 +01:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Fri, 19 Jan 2018 08:15:14 -0600
|
|
|
|
Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
|
|
|
new file mode 100644
|
2020-04-02 23:07:06 +02:00
|
|
|
index 000000000..bb8d7c959
|
2018-01-21 19:23:34 +01:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,63 @@
|
2018-01-21 19:23:34 +01:00
|
|
|
+package com.destroystokyo.paper.event.player;
|
|
|
|
+
|
|
|
|
+import org.bukkit.advancement.Advancement;
|
|
|
|
+import org.bukkit.entity.Player;
|
|
|
|
+import org.bukkit.event.Cancellable;
|
|
|
|
+import org.bukkit.event.HandlerList;
|
|
|
|
+import org.bukkit.event.player.PlayerEvent;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2018-01-21 19:23:34 +01:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Called when a player is granted a criteria in an advancement.
|
|
|
|
+ */
|
|
|
|
+public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable {
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull private final Advancement advancement;
|
|
|
|
+ @NotNull private final String criterion;
|
2018-01-21 19:23:34 +01:00
|
|
|
+ private boolean cancel = false;
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public PlayerAdvancementCriterionGrantEvent(@NotNull Player who, @NotNull Advancement advancement, @NotNull String criterion) {
|
2018-01-21 19:23:34 +01:00
|
|
|
+ super(who);
|
|
|
|
+ this.advancement = advancement;
|
|
|
|
+ this.criterion = criterion;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the advancement which has been affected.
|
|
|
|
+ *
|
|
|
|
+ * @return affected advancement
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-01-21 19:23:34 +01:00
|
|
|
+ public Advancement getAdvancement() {
|
|
|
|
+ return advancement;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the criterion which has been granted.
|
|
|
|
+ *
|
|
|
|
+ * @return granted criterion
|
|
|
|
+ */
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-01-21 19:23:34 +01:00
|
|
|
+ public String getCriterion() {
|
|
|
|
+ return criterion;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return cancel;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ this.cancel = cancel;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-01-21 19:23:34 +01:00
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-01-21 19:23:34 +01:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
--
|
2020-05-02 00:03:47 +02:00
|
|
|
2.26.2
|
2018-01-21 19:23:34 +01:00
|
|
|
|