[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -16,6 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
@@ -26,14 +27,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final FailReason failReason;
+ private boolean allowed;
+ private boolean logWarning;
+ private final Location from;
+ private final Location to;
+ private boolean allowed;
+ private boolean logWarning;
+
+ public PlayerFailMoveEvent(@NotNull Player who, @NotNull FailReason failReason, boolean allowed,
+ @ApiStatus.Internal
+ public PlayerFailMoveEvent(@NotNull Player player, @NotNull FailReason failReason, boolean allowed,
+ boolean logWarning, @NotNull Location from, @NotNull Location to) {
+ super(who);
+ super(player);
+ this.failReason = failReason;
+ this.allowed = allowed;
+ this.logWarning = logWarning;
@@ -43,41 +45,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * Gets the reason this movement was prevented by the server
+ *
+ * @return The reason the movement was prevented
+ */
+ @NotNull
+ public FailReason getFailReason() {
+ return failReason;
+ return this.failReason;
+ }
+
+ /**
+ * Gets the location this player moved from
+ *
+ * @return Location the player moved from
+ */
+ @NotNull
+ public Location getFrom() {
+ return from.clone();
+ return this.from.clone();
+ }
+
+ /**
+ * Gets the location this player tried to move to
+ *
+ * @return Location the player tried to move to
+ */
+ @NotNull
+ public Location getTo() {
+ return to.clone();
+ return this.to.clone();
+ }
+
+ /**
+ * Gets if the check should be bypassed, allowing the movement
+ *
+ * @return whether to bypass the check
+ */
+ public boolean isAllowed() {
+ return allowed;
+ return this.allowed;
+ }
+
+ /**
+ * Set if the check should be bypassed and the movement should be allowed
+ *
+ * @param allowed whether to bypass the check
+ */
+ public void setAllowed(boolean allowed) {
@@ -85,15 +92,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ /**
+ * Gets if warnings will be printed to console. eg. "Player123 moved too quickly!"
+ * Gets if warnings will be printed to console. e.g. "Player123 moved too quickly!"
+ *
+ * @return whether to log warnings
+ */
+ public boolean getLogWarning() {
+ return logWarning;
+ return this.logWarning;
+ }
+
+ /**
+ * Set if a warning is printed to console. eg. "Player123 moved too quickly!"
+ * Set if a warning is printed to console. e.g. "Player123 moved too quickly!"
+ *
+ * @param logWarning whether to log warnings
+ */
+ public void setLogWarning(boolean logWarning) {