Skip to content

Commit cfc0803

Browse files
committed
Changed Paper Position to BlockifyPosition
1 parent e274510 commit cfc0803

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/main/java/codes/kooper/blockify/events/BlockifyBreakEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import codes.kooper.blockify.models.Stage;
44
import codes.kooper.blockify.models.View;
5-
import io.papermc.paper.math.Position;
5+
import codes.kooper.blockify.types.BlockifyPosition;
66
import lombok.Getter;
77
import org.bukkit.block.data.BlockData;
88
import org.bukkit.entity.Player;
@@ -16,7 +16,7 @@ public class BlockifyBreakEvent extends Event implements Cancellable {
1616
private static final HandlerList HANDLERS = new HandlerList();
1717
private boolean cancelled = false;
1818
private final Player player;
19-
private final Position position;
19+
private final BlockifyPosition position;
2020
private final BlockData blockData;
2121
private final View view;
2222
private final Stage stage;
@@ -30,7 +30,7 @@ public class BlockifyBreakEvent extends Event implements Cancellable {
3030
* @param view The view that the player is in.
3131
* @param stage The stage that the player is in.
3232
*/
33-
public BlockifyBreakEvent(Player player, Position position, BlockData blockData, View view, Stage stage) {
33+
public BlockifyBreakEvent(Player player, BlockifyPosition position, BlockData blockData, View view, Stage stage) {
3434
this.player = player;
3535
this.position = position;
3636
this.blockData = blockData;

src/main/java/codes/kooper/blockify/events/BlockifyInteractEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import codes.kooper.blockify.models.Stage;
44
import codes.kooper.blockify.models.View;
5-
import io.papermc.paper.math.Position;
5+
import codes.kooper.blockify.types.BlockifyPosition;
66
import lombok.Getter;
77
import org.bukkit.block.data.BlockData;
88
import org.bukkit.entity.Player;
@@ -16,7 +16,7 @@ public class BlockifyInteractEvent extends Event implements Cancellable {
1616
private static final HandlerList HANDLERS = new HandlerList();
1717
private boolean cancelled = false;
1818
private final Player player;
19-
private final Position position;
19+
private final BlockifyPosition position;
2020
private final BlockData blockData;
2121
private final View view;
2222
private final Stage stage;
@@ -30,7 +30,7 @@ public class BlockifyInteractEvent extends Event implements Cancellable {
3030
* @param view The view that the player is currently in.
3131
* @param stage The stage that the player is currently in.
3232
*/
33-
public BlockifyInteractEvent(Player player, Position position, BlockData blockData, View view, Stage stage) {
33+
public BlockifyInteractEvent(Player player, BlockifyPosition position, BlockData blockData, View view, Stage stage) {
3434
this.player = player;
3535
this.position = position;
3636
this.blockData = blockData;

src/main/java/codes/kooper/blockify/events/BlockifyPlaceEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import codes.kooper.blockify.models.Stage;
44
import codes.kooper.blockify.models.View;
5-
import io.papermc.paper.math.Position;
5+
import codes.kooper.blockify.types.BlockifyPosition;
66
import lombok.Getter;
77
import org.bukkit.entity.Player;
88
import org.bukkit.event.Event;
@@ -13,7 +13,7 @@
1313
public class BlockifyPlaceEvent extends Event {
1414
private static final HandlerList HANDLERS = new HandlerList();
1515
private final Player player;
16-
private final Position position;
16+
private final BlockifyPosition position;
1717
private final View view;
1818
private final Stage stage;
1919

@@ -25,7 +25,7 @@ public class BlockifyPlaceEvent extends Event {
2525
* @param view The view that the player is currently in.
2626
* @param stage The stage that the player is currently in.
2727
*/
28-
public BlockifyPlaceEvent(Player player, Position position, View view, Stage stage) {
28+
public BlockifyPlaceEvent(Player player, BlockifyPosition position, View view, Stage stage) {
2929
this.player = player;
3030
this.position = position;
3131
this.view = view;

src/main/java/codes/kooper/blockify/protocol/BlockDigAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
4747
BlockData blockData = view.getBlock(position);
4848

4949
// Call BlockifyInteractEvent to handle custom interaction
50-
Bukkit.getScheduler().runTask(Blockify.getInstance(), () -> new BlockifyInteractEvent(player, position.toPosition(), blockData, view, view.getStage()).callEvent());
50+
Bukkit.getScheduler().runTask(Blockify.getInstance(), () -> new BlockifyInteractEvent(player, position, blockData, view, view.getStage()).callEvent());
5151

5252
// Check if block is breakable, if not, send block change packet to cancel the break
5353
if (!view.isBreakable()) {
@@ -59,7 +59,7 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
5959
if (actionType == DiggingAction.FINISHED_DIGGING || canInstantBreak(player, blockData)) {
6060
Bukkit.getScheduler().runTask(Blockify.getInstance(), () -> {
6161
// Call BlockifyBreakEvent
62-
BlockifyBreakEvent blockifyBreakEvent = new BlockifyBreakEvent(player, position.toPosition(), blockData, view, view.getStage());
62+
BlockifyBreakEvent blockifyBreakEvent = new BlockifyBreakEvent(player, position, blockData, view, view.getStage());
6363
blockifyBreakEvent.callEvent();
6464
// If block is not cancelled, break the block, otherwise, revert the block
6565
if (!blockifyBreakEvent.isCancelled()) {

src/main/java/codes/kooper/blockify/protocol/BlockPlaceAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
3838
for (View view : stage.getViews()) {
3939
if (view.hasBlock(position)) {
4040
// Call the event and cancel the placement
41-
Bukkit.getScheduler().runTask(Blockify.getInstance(), () -> new BlockifyPlaceEvent(player, position.toPosition(), view, stage).callEvent());
41+
Bukkit.getScheduler().runTask(Blockify.getInstance(), () -> new BlockifyPlaceEvent(player, position, view, stage).callEvent());
4242
event.setCancelled(true);
4343
return;
4444
}

0 commit comments

Comments
 (0)