From 459174b81737d248482f2bebf6c51dc86ab4e6f5 Mon Sep 17 00:00:00 2001 From: Slqmy <90862990+Slqmy@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:47:28 +0100 Subject: [PATCH] Add class to represent a block location --- .../util/types/BlockLocation.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/net/slqmy/template_paper_plugin/util/types/BlockLocation.java diff --git a/src/main/java/net/slqmy/template_paper_plugin/util/types/BlockLocation.java b/src/main/java/net/slqmy/template_paper_plugin/util/types/BlockLocation.java new file mode 100644 index 00000000..6523e50b --- /dev/null +++ b/src/main/java/net/slqmy/template_paper_plugin/util/types/BlockLocation.java @@ -0,0 +1,28 @@ +package net.slqmy.template_paper_plugin.util.types; + +import org.bukkit.Location; +import org.bukkit.block.Block; + +public class BlockLocation { + + private String worldName; + + private int x; + private int y; + private int z; + + public BlockLocation(String worldName, int x, int y, int z) { + this.worldName = worldName; + this.x = x; + this.y = y; + this.z = z; + } + + public BlockLocation(Location location) { + this(location.getWorld().getName(), (int) location.getX(), (int) location.getY(), (int) location.getZ()); + } + + public BlockLocation(Block block) { + this(block.getLocation()); + } +}