Removed deprecated function from API

This commit is contained in:
Stijn Bannink 2023-06-08 19:26:11 +02:00
parent 833ce898ff
commit 5ad5269b97
5 changed files with 28 additions and 21 deletions

View file

@ -1,6 +1,6 @@
/* /*
* This file is part of MapReflectionAPI. * 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 * 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 * 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}. * A {@link MapController} controls one {@link MapWrapper}.
*/ */
public interface MapController extends IMapController { 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 * Get the map ID for a player
* *

View file

@ -125,11 +125,6 @@ public class MapWrapper extends AbstractMapWrapper {
} }
} }
@Override
public ArrayImage getContent() {
return MapWrapper.this.getContent();
}
@Override @Override
public void sendContent(Player player) { public void sendContent(Player player) {
sendContent(player, false); sendContent(player, false);

View file

@ -1,6 +1,6 @@
/* /*
* This file is part of MapReflectionAPI. * 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 * 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 * 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 (<code>int[width][height]</code>) * @param entityIdMatrix 2D-Array of entity-IDs of the {@link ItemFrame}s (<code>int[width][height]</code>)
* @see MapController#showInFrame(Player, int) * @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 * 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 <code>null</code> * @param callable {@link DebugCallable} which will be called to display debug information, or <code>null</code>
* @see MapController#showInFrame(Player, int, String) * @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 * 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 player {@link Player} that will be able to see the cleared frames
* @param entityIdMatrix 2D-Array of entity-IDs of the {@link ItemFrame}s (<code>int[width][height]</code>) * @param entityIdMatrix 2D-Array of entity-IDs of the {@link ItemFrame}s (<code>int[width][height]</code>)
*/ */
void clearFrames(Player player, int[][] entityIdMatrix); void clearFrames(Player player, Integer[][] entityIdMatrix);
/** /**
* Clear the frames * Clear the frames

View file

@ -1,6 +1,6 @@
/* /*
* This file is part of MapReflectionAPI. * 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 * 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 * 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.Set;
import java.util.UUID; import java.util.UUID;
import static tech.sbdevelopment.mapreflectionapi.utils.MainUtil.validateArrayDimensions;
/** /**
* A {@link MultiMapWrapper} wraps one image split in pieces. * A {@link MultiMapWrapper} wraps one image split in pieces.
*/ */
@ -147,7 +149,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
} }
@Override @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 x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) { for (int y = 0; y < entityIdMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().showInFrame(player, entityIdMatrix[x][wrapperMatrix.length - 1 - y]); wrapperMatrix[y][x].getController().showInFrame(player, entityIdMatrix[x][wrapperMatrix.length - 1 - y]);
@ -156,7 +160,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
} }
@Override @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 x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) { 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)); 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 @Override
public void showInFrames(Player player, ItemFrame[][] itemFrameMatrix, boolean force) { public void showInFrames(Player player, ItemFrame[][] itemFrameMatrix, boolean force) {
validateArrayDimensions(wrapperMatrix, itemFrameMatrix);
for (int x = 0; x < itemFrameMatrix.length; x++) { for (int x = 0; x < itemFrameMatrix.length; x++) {
for (int y = 0; y < itemFrameMatrix[x].length; y++) { for (int y = 0; y < itemFrameMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().showInFrame(player, itemFrameMatrix[x][wrapperMatrix.length - 1 - y], force); wrapperMatrix[y][x].getController().showInFrame(player, itemFrameMatrix[x][wrapperMatrix.length - 1 - y], force);
@ -179,7 +187,9 @@ public class MultiMapWrapper extends AbstractMapWrapper {
} }
@Override @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 x = 0; x < entityIdMatrix.length; x++) {
for (int y = 0; y < entityIdMatrix[x].length; y++) { for (int y = 0; y < entityIdMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().clearFrame(player, entityIdMatrix[x][y]); wrapperMatrix[y][x].getController().clearFrame(player, entityIdMatrix[x][y]);
@ -189,6 +199,8 @@ public class MultiMapWrapper extends AbstractMapWrapper {
@Override @Override
public void clearFrames(Player player, ItemFrame[][] itemFrameMatrix) { public void clearFrames(Player player, ItemFrame[][] itemFrameMatrix) {
validateArrayDimensions(wrapperMatrix, itemFrameMatrix);
for (int x = 0; x < itemFrameMatrix.length; x++) { for (int x = 0; x < itemFrameMatrix.length; x++) {
for (int y = 0; y < itemFrameMatrix[x].length; y++) { for (int y = 0; y < itemFrameMatrix[x].length; y++) {
wrapperMatrix[y][x].getController().clearFrame(player, itemFrameMatrix[x][y]); wrapperMatrix[y][x].getController().clearFrame(player, itemFrameMatrix[x][y]);

View file

@ -1,6 +1,6 @@
/* /*
* This file is part of MapReflectionAPI. * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -35,4 +35,10 @@ public class MainUtil {
return true; return true;
} }
} }
public static <A, B> 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!");
}
}
} }