[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

@@ -27,10 +27,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Called when an anvil is damaged from being used
+ */
+public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private boolean cancel;
+ private DamageState damageState;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @Nullable BlockData blockData) {
@@ -51,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public DamageState getDamageState() {
+ return damageState;
+ return this.damageState;
+ }
+
+ /**
@@ -66,31 +67,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Gets if anvil is breaking on this use
+ *
+ * @return True if breaking
+ * @return {@code true} if breaking
+ */
+ public boolean isBreaking() {
+ return damageState == DamageState.BROKEN;
+ return this.damageState == DamageState.BROKEN;
+ }
+
+ /**
+ * Sets if anvil is breaking on this use
+ *
+ * @param breaking True if breaking
+ * @param breaking {@code true} if breaking
+ */
+ public void setBreaking(boolean breaking) {
+ if (breaking) {
+ damageState = DamageState.BROKEN;
+ } else if (damageState == DamageState.BROKEN) {
+ damageState = DamageState.DAMAGED;
+ this.damageState = DamageState.BROKEN;
+ } else if (this.damageState == DamageState.BROKEN) {
+ this.damageState = DamageState.DAMAGED;
+ }
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ this.cancelled = cancel;
+ }
+
+ @NotNull
@@ -125,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public Material getMaterial() {
+ return material;
+ return this.material;
+ }
+
+ /**
@@ -153,7 +156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return BROKEN;
+ }
+ for (DamageState state : values()) {
+ if (state.material == material) {
+ if (state.getMaterial() == material) {
+ return state;
+ }
+ }