-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add block break and place events, move to folder
- Loading branch information
Showing
7 changed files
with
119 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/gtnewhorizons/mutecore/api/event/BlockBreakEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.gtnewhorizons.mutecore.api.event; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import dev.dominion.ecs.api.Entity; | ||
|
||
public class BlockBreakEvent implements Comparable<BlockBreakEvent>{ | ||
|
||
private int priority; | ||
private BlockBreak interaction; | ||
|
||
public BlockBreakEvent(int priority, @Nonnull BlockBreak interaction) { | ||
this.priority = priority; | ||
this.interaction = interaction; | ||
} | ||
|
||
public final @Nonnull void call(Entity entity) { | ||
interaction.executeEvent(entity); | ||
} | ||
|
||
@FunctionalInterface | ||
public static interface BlockBreak { | ||
|
||
@Nonnull | ||
void executeEvent(@Nonnull Entity entity); | ||
} | ||
|
||
@Override | ||
public int compareTo(@Nonnull BlockBreakEvent other) { | ||
return Integer.compare(priority, other.priority); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/gtnewhorizons/mutecore/api/event/BlockPlaceEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.gtnewhorizons.mutecore.api.event; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import dev.dominion.ecs.api.Entity; | ||
|
||
public class BlockPlaceEvent implements Comparable<BlockPlaceEvent>{ | ||
|
||
private int priority; | ||
private BlockPlace interaction; | ||
|
||
public BlockPlaceEvent(int priority, @Nonnull BlockPlace interaction) { | ||
this.priority = priority; | ||
this.interaction = interaction; | ||
} | ||
|
||
public final @Nonnull void call(Entity entity) { | ||
interaction.executeEvent(entity); | ||
} | ||
|
||
@FunctionalInterface | ||
public static interface BlockPlace { | ||
|
||
@Nonnull | ||
void executeEvent(@Nonnull Entity entity); | ||
} | ||
|
||
@Override | ||
public int compareTo(@Nonnull BlockPlaceEvent other) { | ||
return Integer.compare(priority, other.priority); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../api/registry/PlayerInteractionEvent.java → ...ore/api/event/PlayerInteractionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters