diff --git a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapController.java b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapController.java
index c2c038b..11a71cd 100644
--- a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapController.java
+++ b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapController.java
@@ -1,6 +1,6 @@
/*
* This file is part of MapReflectionAPI.
- * Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
+ * Copyright (c) 2022-2023 inventivetalent / SBDevelopment - All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,12 +27,6 @@ import org.bukkit.entity.Player;
* A {@link MapController} controls one {@link MapWrapper}.
*/
public interface MapController extends IMapController {
- /**
- * @deprecated Please use {@link MapWrapper#getContent()}
- */
- @Deprecated(since = "1.3", forRemoval = true)
- ArrayImage getContent();
-
/**
* Get the map ID for a player
*
diff --git a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapWrapper.java b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapWrapper.java
index d3c6ad8..08fe46b 100644
--- a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapWrapper.java
+++ b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MapWrapper.java
@@ -125,11 +125,6 @@ public class MapWrapper extends AbstractMapWrapper {
}
}
- @Override
- public ArrayImage getContent() {
- return MapWrapper.this.getContent();
- }
-
@Override
public void sendContent(Player player) {
sendContent(player, false);
diff --git a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapController.java b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapController.java
index e364c72..df07c10 100644
--- a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapController.java
+++ b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapController.java
@@ -1,6 +1,6 @@
/*
* This file is part of MapReflectionAPI.
- * Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
+ * Copyright (c) 2022-2023 inventivetalent / SBDevelopment - All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -89,7 +89,7 @@ public interface MultiMapController extends IMapController {
* @param entityIdMatrix 2D-Array of entity-IDs of the {@link ItemFrame}s (int[width][height]
)
* @see MapController#showInFrame(Player, int)
*/
- void showInFrames(Player player, int[][] entityIdMatrix);
+ void showInFrames(Player player, Integer[][] entityIdMatrix);
/**
* Show this {@link MultiMapController} in {@link ItemFrame}s
@@ -99,7 +99,7 @@ public interface MultiMapController extends IMapController {
* @param callable {@link DebugCallable} which will be called to display debug information, or null
* @see MapController#showInFrame(Player, int, String)
*/
- void showInFrames(Player player, int[][] entityIdMatrix, DebugCallable callable);
+ void showInFrames(Player player, Integer[][] entityIdMatrix, DebugCallable callable);
/**
* Show this {@link MultiMapController} in {@link ItemFrame}s
@@ -126,7 +126,7 @@ public interface MultiMapController extends IMapController {
* @param player {@link Player} that will be able to see the cleared frames
* @param entityIdMatrix 2D-Array of entity-IDs of the {@link ItemFrame}s (int[width][height]
)
*/
- void clearFrames(Player player, int[][] entityIdMatrix);
+ void clearFrames(Player player, Integer[][] entityIdMatrix);
/**
* Clear the frames
diff --git a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapWrapper.java b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapWrapper.java
index c8009df..7d22541 100644
--- a/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapWrapper.java
+++ b/src/main/java/tech/sbdevelopment/mapreflectionapi/api/MultiMapWrapper.java
@@ -1,6 +1,6 @@
/*
* This file is part of MapReflectionAPI.
- * Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
+ * Copyright (c) 2022-2023 inventivetalent / SBDevelopment - All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
+import static tech.sbdevelopment.mapreflectionapi.utils.MainUtil.validateArrayDimensions;
+
/**
* A {@link MultiMapWrapper} wraps one image split in pieces.
*/
@@ -147,7 +149,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
}
@Override
- public void showInFrames(Player player, int[][] entityIdMatrix) {
+ public void showInFrames(Player player, Integer[][] entityIdMatrix) {
+ validateArrayDimensions(wrapperMatrix, entityIdMatrix);
+
for (int x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().showInFrame(player, entityIdMatrix[x][wrapperMatrix.length - 1 - y]);
@@ -156,7 +160,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
}
@Override
- public void showInFrames(Player player, int[][] entityIdMatrix, DebugCallable callable) {
+ public void showInFrames(Player player, Integer[][] entityIdMatrix, DebugCallable callable) {
+ validateArrayDimensions(wrapperMatrix, entityIdMatrix);
+
for (int x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().showInFrame(player, entityIdMatrix[x][wrapperMatrix.length - 1 - y], callable.call(wrapperMatrix[y][x].getController(), x, y));
@@ -166,6 +172,8 @@ public class MultiMapWrapper extends AbstractMapWrapper {
@Override
public void showInFrames(Player player, ItemFrame[][] itemFrameMatrix, boolean force) {
+ validateArrayDimensions(wrapperMatrix, itemFrameMatrix);
+
for (int x = 0; x < itemFrameMatrix.length; x++) {
for (int y = 0; y < itemFrameMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().showInFrame(player, itemFrameMatrix[x][wrapperMatrix.length - 1 - y], force);
@@ -179,7 +187,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
}
@Override
- public void clearFrames(Player player, int[][] entityIdMatrix) {
+ public void clearFrames(Player player, Integer[][] entityIdMatrix) {
+ validateArrayDimensions(wrapperMatrix, entityIdMatrix);
+
for (int x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().clearFrame(player, entityIdMatrix[x][y]);
@@ -189,6 +199,8 @@ public class MultiMapWrapper extends AbstractMapWrapper {
@Override
public void clearFrames(Player player, ItemFrame[][] itemFrameMatrix) {
+ validateArrayDimensions(wrapperMatrix, itemFrameMatrix);
+
for (int x = 0; x < itemFrameMatrix.length; x++) {
for (int y = 0; y < itemFrameMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().clearFrame(player, itemFrameMatrix[x][y]);
diff --git a/src/main/java/tech/sbdevelopment/mapreflectionapi/utils/MainUtil.java b/src/main/java/tech/sbdevelopment/mapreflectionapi/utils/MainUtil.java
index c5f3fdb..5556e0e 100644
--- a/src/main/java/tech/sbdevelopment/mapreflectionapi/utils/MainUtil.java
+++ b/src/main/java/tech/sbdevelopment/mapreflectionapi/utils/MainUtil.java
@@ -1,6 +1,6 @@
/*
* This file is part of MapReflectionAPI.
- * Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
+ * Copyright (c) 2022-2023 inventivetalent / SBDevelopment - All Rights Reserved
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,4 +35,10 @@ public class MainUtil {
return true;
}
}
+
+ public static void validateArrayDimensions(A[][] arrayOne, B[][] arrayTwo) {
+ if (arrayOne.length != arrayTwo.length || arrayOne[0].length != arrayTwo[0].length) {
+ throw new IllegalArgumentException("The dimensions of two provided arrays (" + arrayOne.getClass().getName() + ", " + arrayTwo.getClass().getName() + ") do not match!");
+ }
+ }
}