Update to fit a more secure processing system

This commit is contained in:
Paul Reilly 2023-03-08 10:33:16 -06:00
parent d4b46996c1
commit 755ca70523
20 changed files with 199 additions and 120 deletions

View File

@ -1,17 +1,6 @@
Q
java:S1066!"/Merge this if statement with the enclosing one.(À<>·Ïþÿÿÿÿ8Õçþë0
U
java:S1118":Add a private constructor to hide the implicit public one.(¹‹ó¿ýÿÿÿÿ
t
java:S3776"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(¼³”Íùÿÿÿÿ8Ûëþë0
C
java:S1659"!Declare "col" on a separate line.(žÏ¤šýÿÿÿÿ8Þëþë0
?
java:S1659""Declare "dCol" on a separate line.(õÀ©…8Þëþë0
f
java:S3358*"DExtract this nested ternary operation into an independent statement.(±·‹Šúÿÿÿÿ8ãëþë0
f
java:S3358*"DExtract this nested ternary operation into an independent statement.(±·‹Šúÿÿÿÿ8ãëþë0
O
java:S1128"-Remove this unused import 'java.util.Arrays'.(î–˜Éüÿÿÿÿ¸åýë0
r java:S117O"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(—©¼›ÿÿÿÿÿ8“ÏÐ<C38F>ì0
<
java:S1659"!Declare "col" on a separate line.(žÏ¤šýÿÿÿÿ
8
java:S1659 ""Declare "dCol" on a separate line.(õÀ©…

View File

@ -1,5 +1,5 @@
c java:S116"NRename this field "INV" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÖóŸÕ
g java:S116"RRename this field "ACTIONS" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(»¬Þõ
c java:S116"NRename this field "INV" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÖóŸÕ
g java:S116"RRename this field "ACTIONS" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(»¬Þõ
I
java:S1611K"3Remove the parentheses around the "tuple" parameter(œÓ–ô
java:S1611R"3Remove the parentheses around the "tuple" parameter(œÓ–ô

View File

@ -7,39 +7,41 @@ m
=src/main/java/io/github/simplexdevelopment/api/GUIAction.java,3\0\30ddeaabb5082f9cf52c55066a39e20a1f7e4cde
l
<src/main/java/io/github/simplexdevelopment/util/Context.java,0\a\0a12643b5926514dc78595dd0de298f57c214da6
l
<src/main/java/io/github/simplexdevelopment/util/Utility.java,0\a\0a6146f64cde5935027cec3f5011843917c695cc
o
?src/main/java/io/github/simplexdevelopment/mob/AxolotlType.java,e\9\e9f15dd068513a64c53a24b0daa25119adfcc9ec
k
;src/main/java/io/github/simplexdevelopment/mob/CatType.java,4\8\4853b7b764faca92eb34eb45c9c8ae8753e8c104
k
;src/main/java/io/github/simplexdevelopment/mob/FoxType.java,1\2\12461258daee2839e766d082ea2e514d5578731c
m
=src/main/java/io/github/simplexdevelopment/mob/LlamaType.java,c\0\c073e6b63a4ab557c6e151977d8a00190061ea34
l
<src/main/java/io/github/simplexdevelopment/mob/FrogType.java,1\1\114d1a559c312d068b50b6a948d509cbdc315e2b
m
=src/main/java/io/github/simplexdevelopment/mob/HorseType.java,1\7\172cbc3e89142dd502a2aa74ee25933e1e1dca0e
n
>src/main/java/io/github/simplexdevelopment/mob/ParrotType.java,c\1\c17017a8e659f282bdd6ebfdaf9293f034645a9c
m
=src/main/java/io/github/simplexdevelopment/mob/SheepType.java,f\7\f7a91356545d95e994ebce6af582f1824b8ba782
n
>src/main/java/io/github/simplexdevelopment/mob/RabbitType.java,b\6\b6a6baf26fa767cc0299e356d0466810eb110166
m
=src/main/java/io/github/simplexdevelopment/mob/PandaType.java,6\d\6d697c45549525f848d3b9bc2eb4094069cf0043
t
Dsrc/main/java/io/github/simplexdevelopment/mob/TropicalFishType.java,f\b\fb9f8bc5d1d91117468f0312d09333f5af318753
p
@src/main/java/io/github/simplexdevelopment/mob/VillagerType.java,0\f\0f39357e2b7952a9117fcd9387b5a91735f600f5
x
Hsrc/main/java/io/github/simplexdevelopment/util/DisplayableSlotEnum.java,b\3\b3eafc205cf9dae5d1a7b77b5dbb74e37277308b
o
?src/main/java/io/github/simplexdevelopment/inv/AbstractGUI.java,3\f\3f45a40dab9ff1ac3dfeb0b1447c92d3fcca7e1d
m
=src/main/java/io/github/simplexdevelopment/api/GUIWindow.java,a\5\a5bbb1ae03235febbc6078171e3310884077d032
l
<src/main/java/io/github/simplexdevelopment/TypeListener.java,9\9\999d23e2cf89fb28de6ae4c8b025a7d0a7c4820d
l
<src/main/java/io/github/simplexdevelopment/TypeSelector.java,6\7\675f1b97b89a93527cff306e60abfb39c17a0c8d
<src/main/java/io/github/simplexdevelopment/TypeSelector.java,6\7\675f1b97b89a93527cff306e60abfb39c17a0c8d
l
<src/main/java/io/github/simplexdevelopment/util/Utility.java,0\a\0a6146f64cde5935027cec3f5011843917c695cc
o
?src/main/java/io/github/simplexdevelopment/inv/AbstractGUI.java,3\f\3f45a40dab9ff1ac3dfeb0b1447c92d3fcca7e1d
m
=src/main/java/io/github/simplexdevelopment/util/Selector.java,c\9\c98e1ff7e9323b7e41003c6492e15a73f9ff4250
m
=src/main/java/io/github/simplexdevelopment/mob/LlamaType.java,c\0\c073e6b63a4ab557c6e151977d8a00190061ea34
m
=src/main/java/io/github/simplexdevelopment/mob/HorseType.java,1\7\172cbc3e89142dd502a2aa74ee25933e1e1dca0e
l
<src/main/java/io/github/simplexdevelopment/mob/FrogType.java,1\1\114d1a559c312d068b50b6a948d509cbdc315e2b
k
;src/main/java/io/github/simplexdevelopment/mob/FoxType.java,1\2\12461258daee2839e766d082ea2e514d5578731c
k
;src/main/java/io/github/simplexdevelopment/mob/CatType.java,4\8\4853b7b764faca92eb34eb45c9c8ae8753e8c104
o
?src/main/java/io/github/simplexdevelopment/mob/AxolotlType.java,e\9\e9f15dd068513a64c53a24b0daa25119adfcc9ec
m
=src/main/java/io/github/simplexdevelopment/mob/PandaType.java,6\d\6d697c45549525f848d3b9bc2eb4094069cf0043
n
>src/main/java/io/github/simplexdevelopment/mob/ParrotType.java,c\1\c17017a8e659f282bdd6ebfdaf9293f034645a9c
n
>src/main/java/io/github/simplexdevelopment/mob/RabbitType.java,b\6\b6a6baf26fa767cc0299e356d0466810eb110166
m
=src/main/java/io/github/simplexdevelopment/mob/SheepType.java,f\7\f7a91356545d95e994ebce6af582f1824b8ba782
t
Dsrc/main/java/io/github/simplexdevelopment/mob/TropicalFishType.java,f\b\fb9f8bc5d1d91117468f0312d09333f5af318753
p
@src/main/java/io/github/simplexdevelopment/mob/VillagerType.java,0\f\0f39357e2b7952a9117fcd9387b5a91735f600f5

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -3,6 +3,7 @@ package io.github.simplexdevelopment.inv;
import io.github.simplexdevelopment.api.GUIAction;
import io.github.simplexdevelopment.api.GUIWindow;
import io.github.simplexdevelopment.util.DisplayableSlotEnum;
import io.github.simplexdevelopment.util.Selector;
import io.github.simplexdevelopment.util.Tuple;
import io.github.simplexdevelopment.util.Utility;
import net.kyori.adventure.text.Component;
@ -23,11 +24,13 @@ public abstract class AbstractGUI implements GUIWindow {
private final int[] slots = Utility.range(0, 44);
private final Map<Integer, Material> slotMap = DisplayableSlotEnum.getSlotMaterialMap();
private final Set<Tuple<Integer, String, GUIAction>> tupleList = new HashSet<>();
private final Selector selector;
protected AbstractGUI(String name) {
this.uuid = UUID.randomUUID();
this.INV = Bukkit.createInventory(null, 45, Component.text(name));
this.ACTIONS = new HashMap<>();
this.selector = new Selector(22, 5, 9);
GUIWindow.getInvByUUID().put(getUUID(), this);
}
@ -65,6 +68,10 @@ public abstract class AbstractGUI implements GUIWindow {
openInventories.put(p.getUniqueId(), getUUID());
}
public Selector getSelector() {
return selector;
}
public void createInjection(int slot, String name, GUIAction action) {
tupleList.add(new Tuple<>(slot, name, action));
}

View File

@ -1,6 +1,7 @@
package io.github.simplexdevelopment.mob;
import io.github.simplexdevelopment.inv.AbstractGUI;
import io.github.simplexdevelopment.util.Selector;
import io.github.simplexdevelopment.util.Utility;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Player;
@ -17,13 +18,13 @@ public class AxolotlType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Axolotl.Variant.values(), variant -> {
this.createInjection(x[0], variant.name(), action -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), variant.name(), action -> {
axolotl.setVariant(variant);
action.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class CatType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Cat.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), type.name(), p -> {
cat.setCatType(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class FoxType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Fox.Type.values(), type -> {
this.createInjection(x[0], type.name(), s -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), type.name(), s -> {
fox.setFoxType(type);
s.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class FrogType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Frog.Variant.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), type.name(), p -> {
frog.setVariant(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -19,13 +19,15 @@ public class HorseType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {0};
Utility.forEach(Horse.Color.values(), color -> {
this.createInjection(x[0], color.name(), p -> {
if (this.getSelector().noMoreSlots()) {
return;
}
this.createInjection(this.getSelector().getSlot(), color.name(), p -> {
horse.setColor(color);
horseStyle.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
@ -44,13 +46,13 @@ public class HorseType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Horse.Style.values(), style -> {
this.createInjection(x[0], style.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), style.name(), p -> {
horse.setStyle(style);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class LlamaType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Llama.Color.values(), color -> {
this.createInjection(x[0], color.name(), p-> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), color.name(), p-> {
llama.setColor(color);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -19,13 +19,13 @@ public class PandaType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Panda.Gene.values(), gene -> {
this.createInjection(x[0], gene.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), gene.name(), p -> {
panda.setMainGene(gene);
diminutive.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
@ -42,13 +42,13 @@ public class PandaType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Panda.Gene.values(), gene -> {
this.createInjection(x[0], gene.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), gene.name(), p -> {
panda.setHiddenGene(gene);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class ParrotType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Parrot.Variant.values(), variant -> {
this.createInjection(x[0], variant.name(), action -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), variant.name(), action -> {
parrot.setVariant(variant);
action.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -17,13 +17,13 @@ public class RabbitType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Rabbit.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), type.name(), p -> {
rabbit.setRabbitType(type);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -18,13 +18,13 @@ public class SheepType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), color -> {
this.createInjection(x[0], color.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), color.name(), p -> {
sheep.setColor(color);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -22,13 +22,13 @@ public class TropicalFishType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(TropicalFish.Pattern.values(), pattern -> {
this.createInjection(x[0], pattern.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), pattern.name(), p -> {
fish.setPattern(pattern);
bodyColor.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
@ -45,13 +45,13 @@ public class TropicalFishType extends AbstractGUI {
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), dyeColor -> {
this.createInjection(x[0], dyeColor.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), dyeColor.name(), p -> {
fish.setBodyColor(dyeColor);
patternColor.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
@ -69,13 +69,13 @@ public class TropicalFishType extends AbstractGUI {
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(DyeColor.values(), dyeColor -> {
this.createInjection(x[0], dyeColor.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), dyeColor.name(), p -> {
fish.setPatternColor(dyeColor);
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -20,13 +20,13 @@ public class VillagerType extends AbstractGUI {
@Override
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Villager.Type.values(), type -> {
this.createInjection(x[0], type.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), type.name(), p -> {
villager.setVillagerType(type);
villagerProfession.openMenu();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);
@ -43,14 +43,14 @@ public class VillagerType extends AbstractGUI {
}
public void openMenu() {
int[] x = {Utility.getNextEmptySlot(22)};
Utility.forEach(Villager.Profession.values(), profession -> {
this.createInjection(x[0], profession.name(), p -> {
if (this.getSelector().noMoreSlots()) return;
this.createInjection(this.getSelector().getSlot(), profession.name(), p -> {
villager.setProfession(profession);
villager.setVillagerExperience(1); // This prevents loss of profession.
p.closeInventory();
});
x[0] = Utility.getNextEmptySlot(x[0]);
this.getSelector().nextSlot();
});
this.dynamicSlotAssignment(this.getTupleList());
this.open(player);

View File

@ -0,0 +1,36 @@
package io.github.simplexdevelopment.util;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class Selector {
private int slot;
private ItemStack[][] slots;
public Selector(int slot, int length, int width) {
this.slot = slot;
this.slots = Utility.new2dItemArray(length, width);
}
public int getSlot() {
return slot;
}
public void nextSlot() {
dropSlot();
this.slot = Utility.getNextEmptySlot(this.slot, this.slots);
}
public boolean noMoreSlots() {
return this.slot == -1;
}
public void dropSlot() {
int xPos = slot / slots.length;
int yPos = slot / slots[xPos].length;
if (Utility.isOutOfBounds(xPos, yPos, slots) || !Utility.isCurrentSlotEmpty(slots, xPos, yPos)) {
return;
}
slots[xPos][yPos] = new ItemStack(Material.BARRIER, 1); // Since we only use this for logic purposes, this can be any block other than air.
}
}

View File

@ -1,11 +1,15 @@
package io.github.simplexdevelopment.util;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.function.Consumer;
public class Utility {
private Utility() {
throw new AssertionError();
}
public static int[] range(int start, int end) {
int[] range = new int[end - start];
for (int i = 0; i < range.length; i++) {
@ -20,33 +24,65 @@ public class Utility {
}
}
public static int getNextEmptySlot(int x) {
int[][] grid = new int[5][9]; // initialize the grid
int row = 0, col = 0;
int dRow = 0, dCol = 1;
public static int getNextEmptySlot(int x, ItemStack[][] grid) {
// initialize the grid
int[] dr = {0, 1, 0, -1};
int[] dc = {1, 0, -1, 0};
int row = 0, col = 0;
int dRow = 0, dCol = 1;
for (int i = 0; i < 5 * 9; i++) {
if (grid[row][col] == 0) {
if (i == x) {
return row * 9 + col;
}
}
row += dRow;
col += dCol;
if (row < 0 || row >= 5 || col < 0 || col >= 9 || grid[row][col] != 0) {
row -= dRow;
col -= dCol;
int dir = (dRow == 0) ? (dCol == 1 ? 1 : 3) : (dRow == 1 ? 2 : 0);
dRow = dr[dir];
dCol = dc[dir];
row += dRow;
col += dCol;
if (isCurrentSlotEmpty(grid, row, col) && i == x) {
return row * 9 + col;
}
int[] nextSlot = getNextSlot(grid, row, col, dRow, dCol, dr, dc);
row = nextSlot[0];
col = nextSlot[1];
dRow = nextSlot[2];
dCol = nextSlot[3];
}
return -1; // no empty slot found
}
public static boolean isCurrentSlotEmpty(ItemStack[][] grid, int row, int col) {
return grid[row][col].getType().equals(Material.AIR);
}
public static int[] getNextSlot(ItemStack[][] grid, int row, int col, int dRow, int dCol, int[] dr, int[] dc) {
int nextRow = row + dRow;
int nextCol = col + dCol;
int dir = getDirection(dRow, dCol);
if (isOutOfBounds(nextRow, nextCol, grid) || !isCurrentSlotEmpty(grid, nextRow, nextCol)) {
dir = (dir + 1) % 4;
}
return new int[]{row + dr[dir], col + dc[dir], dr[dir], dc[dir]};
}
public static int getDirection(int dRow, int dCol) {
if (dRow == 0) {
return dCol == 1 ? 1 : 3;
} else {
return dRow == 1 ? 2 : 0;
}
}
public static boolean isOutOfBounds(int row, int col, ItemStack[][] grid) {
return row < 0 || row >= grid.length - 1 || col < 0 || col >= grid[row].length - 1;
}
public static ItemStack[][] new2dItemArray(int length, int width) {
ItemStack[][] range = new ItemStack[length][width];
ItemStack BASE = new ItemStack(Material.AIR, 1);
for (int i = 0; i < length - 1; i++) {
for (int j = 0; j < width - 1; j++) {
range[i][j] = BASE;
}
}
return range;
}
}